Commit b5df356c09a07280124103914ca9e9c08afdff13

Authored by Perry Werneck
1 parent 3d70bc09
Exists in develop

Removing macos path due to conflicts with the branch with the same name.

mac/Info.plist 0 → 100644
@@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3 +<plist version="1.0">
  4 +<dict>
  5 + <key>CFBundleExecutable</key>
  6 + <string>launcher.sh</string>
  7 + <key>CFBundleName</key>
  8 + <string>pw3270</string>
  9 + <key>CFBundleDisplayName</key>
  10 + <string>pw3270</string>
  11 + <key>CFBundleIconFile</key>
  12 + <string>pw3270.icns</string>
  13 + <key>CFBundleIdentifier</key>
  14 + <string>br.app.pw3270</string>
  15 + <key>NSHighResolutionCapable</key>
  16 + <true/>
  17 + <key>LSMinimumSystemVersion</key>
  18 + <string>10.13.6</string>
  19 +</dict>
  20 +</plist>
mac/bundle 0 → 100755
@@ -0,0 +1,226 @@ @@ -0,0 +1,226 @@
  1 +#!/usr/bin/env bash
  2 +#@author André Breves <andre.breves@gmail.com>
  3 +set -Eeuo pipefail
  4 +
  5 +check_dependencies() {
  6 + local unavailable=()
  7 + for dependency in "${@:-$(</dev/stdin)}"; do
  8 + if [[ ! -x "$(command -v "${dependency}")" ]]; then unavailable+=("${dependency}"); fi
  9 + done
  10 + if [[ ${#unavailable[@]} == 1 ]]; then
  11 + echo "Dependency '${unavailable[*]}' not found."
  12 + exit 1
  13 + elif [[ ${#unavailable[@]} -gt 1 ]]; then
  14 + error "Dependencies '${unavailable[*]}' not found."
  15 + exit 1
  16 + fi
  17 +}
  18 +
  19 +find_lib() {
  20 + # https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/UsingDynamicLibraries.html
  21 + local libs_path="${HOME}/lib $(brew --prefix)/lib /usr/lib"
  22 + for lib in "${@:-$(</dev/stdin)}"; do
  23 + local found=""
  24 + if [[ -f "${lib}" ]]; then
  25 + found="$(greadlink -m "${lib}")"
  26 + else
  27 + for path in ${libs_path}; do
  28 + if [[ -f "${path}/${lib}" ]]; then
  29 + found="$(greadlink -m "${path}/${lib}")"
  30 + break
  31 + fi
  32 + done
  33 + fi
  34 + if [[ "${found}" != "" ]]; then
  35 + echo "${found}"
  36 + else
  37 + echo >&2 "Lib ${lib} not found"
  38 + exit 1
  39 + fi
  40 + done
  41 +}
  42 +
  43 +bundle_cp() {
  44 + local system_libs='^(/System/.*|/usr/lib/.*)$'
  45 +
  46 + for source in "${@:-$(</dev/stdin)}"; do
  47 + source="$(greadlink -m "${source}")"
  48 +
  49 + if [[ "${source}" =~ ${system_libs} ]]; then continue; fi
  50 +
  51 + if [[ ! -f "${source}" ]]; then
  52 + echo >&2 "File \"${source}\" not found"
  53 + exit 1
  54 + fi
  55 +
  56 + local id=""
  57 + local target=""
  58 + local file_type
  59 + file_type="$(file -b "${source}")"
  60 + case "${file_type}" in
  61 + *executable*)
  62 + target="$(greadlink -m "${exe_path}/$(basename "${source}")")";;
  63 + *)
  64 + id="@rpath/$(basename "${source}")"
  65 + target="$(greadlink -m "${lib_path}/$(basename "${source}")")";;
  66 + esac
  67 +
  68 + if [[ "${id}" != "" ]]; then echo "${id}"; fi
  69 +
  70 + if [[ -f "${target}" ]]; then continue; fi
  71 +
  72 + mkdir -p "$(dirname "${target}")"
  73 + cp "${source}" "${target}"
  74 + chmod u+w "${target}"
  75 +
  76 + if [[ "${id}" != "" ]]; then install_name_tool -id "${id}" "${target}" 2> /dev/null; fi
  77 + install_name_tool -add_rpath "@executable_path/../Frameworks" "${target}" 2> /dev/null
  78 +
  79 + for old_install_name in $(otool -L "${target}" | grep '^\t' | cut -c 2- | sed -n "s/\(.*\) (.*)/\1/p"); do
  80 + if [[ "${old_install_name}" == "${id}" ]]; then continue; fi
  81 + if [[ "${old_install_name}" =~ ${system_libs} ]]; then continue; fi
  82 + local lib
  83 + if [[ "${old_install_name}" =~ ^@loader_path.* ]]; then
  84 + lib="$(find_lib "$(dirname "${source}")/${old_install_name//@loader_path/}")"
  85 + else
  86 + lib="$(find_lib "${old_install_name}")"
  87 + fi
  88 + local new_install_name="$(bundle_cp "${lib}")"
  89 + if [[ "${new_install_name}" != "" ]]; then
  90 + install_name_tool -change "${old_install_name}" "${new_install_name}" "${target}" 2> /dev/null
  91 + fi
  92 + done
  93 + # https://stackoverflow.com/a/71753248/6910609
  94 + codesign --force -s - "${target}" 2> /dev/null
  95 + echo >&2 "${target}"
  96 + done
  97 +}
  98 +
  99 +bundle_cache() {
  100 + local awaiting_file=1;
  101 + while IFS= read -r line; do
  102 + if (( awaiting_file )); then
  103 + if [[ ! "${line}" =~ ^"#" && "${line}" != "" ]]; then
  104 + line="${line##\ }"
  105 + line="${line#\"}"
  106 + line="${line%%\ }"
  107 + line="${line%\"}"
  108 + line="\"$(bundle_cp "${line}")\""
  109 + awaiting_file=0
  110 + fi
  111 + else
  112 + if [[ "${line}" == "" ]]; then
  113 + awaiting_file=1
  114 + fi
  115 + fi
  116 + printf '%s\n' "${line}"
  117 + done
  118 +}
  119 +
  120 +# Check dependencies
  121 +check_dependencies otool grep cut sed greadlink qlmanage sips iconutil
  122 +
  123 +# Creates temporary directory
  124 +echo "* Creating temporary directory"
  125 +tmp="$(mktemp -d)"
  126 +trap 'echo "* Removing temporary directory \"${tmp}\""; rm -rf "${tmp}"' EXIT
  127 +
  128 +bundle="pw3270.app"
  129 +bundle_path="${bundle}/Contents"
  130 +exe_path="${bundle_path}/MacOS"
  131 +lib_path="${bundle_path}/Frameworks"
  132 +res_path="${bundle_path}/Resources"
  133 +
  134 +rm -fr "${bundle}"
  135 +
  136 +mkdir -p "${bundle_path}"
  137 +cp "Info.plist" "${bundle_path}"
  138 +
  139 +mkdir -p "${res_path}"
  140 +cp -r "../ui/macos.ui.xml" "${res_path}/pw3270.ui.xml"
  141 +cp -r "$(brew --prefix)/share/pw3270/remap" "${res_path}"
  142 +cp "$(brew --prefix)/share/pw3270/colors.conf" "${res_path}"
  143 +
  144 +# Bundle GLib schemas
  145 +echo "* Bundling GLib schemas"
  146 +mkdir -p "${tmp}/schemas"
  147 +cp "../schemas/"*".gschema.xml" "${tmp}/schemas"
  148 +cp "$(pkg-config gtk+-3.0 --variable=prefix)/share/glib-2.0/schemas/org.gtk.Settings."*".gschema.xml" "${tmp}/schemas"
  149 +glib-compile-schemas --targetdir="${res_path}" "${tmp}/schemas"
  150 +
  151 +# Create the GTK settings file
  152 +# https://developer.gnome.org/gtk3/stable/GtkSettings.html
  153 +mkdir -p "${res_path}/gtk-3.0"
  154 +cat > "${res_path}/gtk-3.0/settings.ini" << EOF
  155 +[Settings]
  156 +gtk-theme-name=Adwaita
  157 +gtk-print-preview-command="open -b com.apple.Preview %f"
  158 +EOF
  159 +
  160 +# Make icon bundle
  161 +echo "* Creating app icon bundle"
  162 +iconset="${tmp}/pw3270.iconset"
  163 +rm -fr "${iconset}"
  164 +mkdir -p "${iconset}"
  165 +icon_sizes=("16" "32" "64" "128" "256" "512" "1024")
  166 +for ((i=1; i < ${#icon_sizes[*]}; i++)); do
  167 + size=${icon_sizes[$((i - 1))]}
  168 + convert -density "${size}" -resize "${size}x" -background transparent "../branding/pw3270.svg" "${iconset}/icon_${size}x${size}.png"
  169 +
  170 + size2x=${icon_sizes[${i}]}
  171 + convert -density "${size2x}" -resize "${size2x}x" -background transparent "../branding/pw3270.svg" "${iconset}/icon_${size}x${size}@2x.png"
  172 +done
  173 +iconutil -c icns -o "${res_path}/pw3270.icns" "${iconset}"
  174 +
  175 +
  176 +# Copy icons
  177 +echo "* Copying icons"
  178 +mkdir -p "${res_path}/icons"
  179 +cp -r "$(brew --prefix adwaita-icon-theme)/share/icons/" "${res_path}/icons"
  180 +cp -r "$(brew --prefix hicolor-icon-theme)/share/icons/" "${res_path}/icons"
  181 +mogrify -format png -path "${res_path}" -background transparent "../branding/*.svg"
  182 +
  183 +# Copy themes
  184 +echo "* Copying themes"
  185 +mkdir -p "${res_path}/themes"
  186 +cp -a "$(brew --prefix gtk+3)/share/themes/Mac" "${res_path}/themes"
  187 +
  188 +# Copy mime database
  189 +echo "* Copying mime database"
  190 +mkdir -p "${res_path}/mime"
  191 +cp "$(pkg-config shared-mime-info --variable=prefix)/share/mime/mime.cache" "${res_path}/mime"
  192 +
  193 +# Copy executables
  194 +echo "* Copying executables"
  195 +mkdir -p "${exe_path}"
  196 +bundle_cp "../.bin/Release/pw3270"
  197 +cp "launcher.sh" "${exe_path}"
  198 +
  199 +# Bundle GdkPixbuf Image Loader Modules
  200 +echo "* Bundling GdkPixbuf Image Loader Modules"
  201 +gdk-pixbuf-query-loaders | bundle_cache > "${res_path}/gdk-loaders.cache"
  202 +
  203 +# Bundle GTK+ Input Method Modules
  204 +echo "* Bundling GTK+ Input Method Modules"
  205 +gtk_prefix="$(pkg-config gtk+-3.0 --variable prefix)"
  206 +gtk-query-immodules-3.0 | bundle_cache \
  207 + | sed "s|${gtk_prefix}/share/locale|@executable_path/../Resources/locale|g" \
  208 + > "${res_path}/gtk.immodules"
  209 +
  210 +# Bundle print backends
  211 +echo "* Bundling print backends"
  212 +mkdir -p "${lib_path}/printbackends"
  213 +for backend in "$(pkg-config gtk+-3.0 --variable=prefix)/lib/gtk-3.0/$(pkg-config gtk+-3.0 --variable=gtk_binary_version)/printbackends/"*.so; do
  214 + bundle_cp "${backend}"
  215 + # TODO: update bundle_cp to inform destiny dir
  216 + mv "${lib_path}/$(basename "${backend}")" "${lib_path}/printbackends"
  217 +done
  218 +
  219 +# TODO: gerar o Info.plist com a versão do macOS $(sw_vers -productVersion)
  220 +
  221 +# Bundle locale
  222 +echo "* Bundling locale"
  223 +mkdir -p "${res_path}/locale"
  224 +cp -r "../.bin/locale/" "${res_path}/locale"
  225 +cp "$(brew --prefix)/share/locale/pt_BR/LC_MESSAGES/lib3270"*".mo" "${res_path}/locale/pt_BR/LC_MESSAGES"
  226 +cp "$(brew --prefix)/share/locale/pt_BR/LC_MESSAGES/libv3270"*".mo" "${res_path}/locale/pt_BR/LC_MESSAGES"
mac/launcher.sh 0 → 100755
@@ -0,0 +1,65 @@ @@ -0,0 +1,65 @@
  1 +#!/usr/bin/env sh
  2 +#@author André Breves <andre.breves@gmail.com>
  3 +set -euo
  4 +
  5 +cd "${0%/*}"
  6 +executable_path="${PWD}"
  7 +cd ..
  8 +contents_path="${PWD}"
  9 +cd Resources
  10 +resource_path="${PWD}"
  11 +
  12 +info_plist="${contents_path}/Info.plist"
  13 +bundle_identifier=$(plutil -extract "CFBundleIdentifier" xml1 -o - "${info_plist}" | sed -n "s/.*<string>\(.*\)<\/string>.*/\1/p")
  14 +
  15 +# XDG Base Directory Specification
  16 +# https://specifications.freedesktop.org/basedir-spec/latest/ar01s03.html
  17 +
  18 +# Defines the base directory relative to which user specific configuration files should be stored
  19 +export XDG_CONFIG_HOME="${HOME}/Library/Application Support/${bundle_identifier}"
  20 +
  21 +# Defines the base directory relative to which user specific data files should be stored
  22 +export XDG_DATA_HOME="${HOME}/Library/Application Support/${bundle_identifier}"
  23 +
  24 +# Defines the preference-ordered set of base directories to search for data files in addition to the $XDG_DATA_HOME base directory
  25 +export XDG_DATA_DIRS="${resource_path}"
  26 +
  27 +# Defines the preference-ordered set of base directories to search for configuration files in addition to the $XDG_CONFIG_HOME base directory
  28 +export XDG_CONFIG_DIRS="${resource_path}"
  29 +
  30 +# Defines the base directory relative to which user specific non-essential data files should be stored
  31 +export XDG_CACHE_HOME="${HOME}/Library/Caches/${bundle_identifier}"
  32 +
  33 +
  34 +# Running GTK+ Applications
  35 +# https://developer.gnome.org/gtk3/stable/gtk-running.html
  36 +
  37 +# If set, makes GTK+ use $GTK_DATA_PREFIX instead of the prefix configured when GTK+ was compiled
  38 +export GTK_DATA_PREFIX="${resource_path}"
  39 +
  40 +# Specifies the file listing the Input Method modules to load
  41 +export GTK_IM_MODULE_FILE="${resource_path}/gtk.immodules"
  42 +
  43 +# Specifies the file listing the GdkPixbuf loader modules to load
  44 +export GDK_PIXBUF_MODULE_FILE="${resource_path}/gdk-loaders.cache"
  45 +
  46 +# Specifies a list of directories to search when GTK+ is looking for dynamically loaded objects such as the modules
  47 +# specified by GTK_MODULES, theme engines, input method modules, file system backends and print backends.
  48 +export GTK_PATH="${contents_path}/Frameworks"
  49 +
  50 +# Running GIO applications
  51 +# https://developer.gnome.org/gio/stable/running-gio-apps.html
  52 +
  53 +# This variable can be set to the names of directories to consider when looking for compiled schemas for GSettings
  54 +export GSETTINGS_SCHEMA_DIR="${resource_path}"
  55 +
  56 +# export LANG="pt_BR"
  57 +# export LC_MESSAGES="pt_BR"
  58 +# export LC_ALL="pt_BR"
  59 +
  60 +mkdir -p "${XDG_CONFIG_HOME}"
  61 +mkdir -p "${XDG_DATA_HOME}"
  62 +mkdir -p "${XDG_CACHE_HOME}"
  63 +
  64 +cd "${resource_path}"
  65 +exec "${executable_path}/pw3270"
macos/Info.plist
@@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
1 -<?xml version="1.0" encoding="UTF-8"?>  
2 -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">  
3 -<plist version="1.0">  
4 -<dict>  
5 - <key>CFBundleExecutable</key>  
6 - <string>launcher.sh</string>  
7 - <key>CFBundleName</key>  
8 - <string>pw3270</string>  
9 - <key>CFBundleDisplayName</key>  
10 - <string>pw3270</string>  
11 - <key>CFBundleIconFile</key>  
12 - <string>pw3270.icns</string>  
13 - <key>CFBundleIdentifier</key>  
14 - <string>br.app.pw3270</string>  
15 - <key>NSHighResolutionCapable</key>  
16 - <true/>  
17 - <key>LSMinimumSystemVersion</key>  
18 - <string>10.13.6</string>  
19 -</dict>  
20 -</plist>  
macos/bundle
@@ -1,226 +0,0 @@ @@ -1,226 +0,0 @@
1 -#!/usr/bin/env bash  
2 -#@author André Breves <andre.breves@gmail.com>  
3 -set -Eeuo pipefail  
4 -  
5 -check_dependencies() {  
6 - local unavailable=()  
7 - for dependency in "${@:-$(</dev/stdin)}"; do  
8 - if [[ ! -x "$(command -v "${dependency}")" ]]; then unavailable+=("${dependency}"); fi  
9 - done  
10 - if [[ ${#unavailable[@]} == 1 ]]; then  
11 - echo "Dependency '${unavailable[*]}' not found."  
12 - exit 1  
13 - elif [[ ${#unavailable[@]} -gt 1 ]]; then  
14 - error "Dependencies '${unavailable[*]}' not found."  
15 - exit 1  
16 - fi  
17 -}  
18 -  
19 -find_lib() {  
20 - # https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/UsingDynamicLibraries.html  
21 - local libs_path="${HOME}/lib $(brew --prefix)/lib /usr/lib"  
22 - for lib in "${@:-$(</dev/stdin)}"; do  
23 - local found=""  
24 - if [[ -f "${lib}" ]]; then  
25 - found="$(greadlink -m "${lib}")"  
26 - else  
27 - for path in ${libs_path}; do  
28 - if [[ -f "${path}/${lib}" ]]; then  
29 - found="$(greadlink -m "${path}/${lib}")"  
30 - break  
31 - fi  
32 - done  
33 - fi  
34 - if [[ "${found}" != "" ]]; then  
35 - echo "${found}"  
36 - else  
37 - echo >&2 "Lib ${lib} not found"  
38 - exit 1  
39 - fi  
40 - done  
41 -}  
42 -  
43 -bundle_cp() {  
44 - local system_libs='^(/System/.*|/usr/lib/.*)$'  
45 -  
46 - for source in "${@:-$(</dev/stdin)}"; do  
47 - source="$(greadlink -m "${source}")"  
48 -  
49 - if [[ "${source}" =~ ${system_libs} ]]; then continue; fi  
50 -  
51 - if [[ ! -f "${source}" ]]; then  
52 - echo >&2 "File \"${source}\" not found"  
53 - exit 1  
54 - fi  
55 -  
56 - local id=""  
57 - local target=""  
58 - local file_type  
59 - file_type="$(file -b "${source}")"  
60 - case "${file_type}" in  
61 - *executable*)  
62 - target="$(greadlink -m "${exe_path}/$(basename "${source}")")";;  
63 - *)  
64 - id="@rpath/$(basename "${source}")"  
65 - target="$(greadlink -m "${lib_path}/$(basename "${source}")")";;  
66 - esac  
67 -  
68 - if [[ "${id}" != "" ]]; then echo "${id}"; fi  
69 -  
70 - if [[ -f "${target}" ]]; then continue; fi  
71 -  
72 - mkdir -p "$(dirname "${target}")"  
73 - cp "${source}" "${target}"  
74 - chmod u+w "${target}"  
75 -  
76 - if [[ "${id}" != "" ]]; then install_name_tool -id "${id}" "${target}" 2> /dev/null; fi  
77 - install_name_tool -add_rpath "@executable_path/../Frameworks" "${target}" 2> /dev/null  
78 -  
79 - for old_install_name in $(otool -L "${target}" | grep '^\t' | cut -c 2- | sed -n "s/\(.*\) (.*)/\1/p"); do  
80 - if [[ "${old_install_name}" == "${id}" ]]; then continue; fi  
81 - if [[ "${old_install_name}" =~ ${system_libs} ]]; then continue; fi  
82 - local lib  
83 - if [[ "${old_install_name}" =~ ^@loader_path.* ]]; then  
84 - lib="$(find_lib "$(dirname "${source}")/${old_install_name//@loader_path/}")"  
85 - else  
86 - lib="$(find_lib "${old_install_name}")"  
87 - fi  
88 - local new_install_name="$(bundle_cp "${lib}")"  
89 - if [[ "${new_install_name}" != "" ]]; then  
90 - install_name_tool -change "${old_install_name}" "${new_install_name}" "${target}" 2> /dev/null  
91 - fi  
92 - done  
93 - # https://stackoverflow.com/a/71753248/6910609  
94 - codesign --force -s - "${target}" 2> /dev/null  
95 - echo >&2 "${target}"  
96 - done  
97 -}  
98 -  
99 -bundle_cache() {  
100 - local awaiting_file=1;  
101 - while IFS= read -r line; do  
102 - if (( awaiting_file )); then  
103 - if [[ ! "${line}" =~ ^"#" && "${line}" != "" ]]; then  
104 - line="${line##\ }"  
105 - line="${line#\"}"  
106 - line="${line%%\ }"  
107 - line="${line%\"}"  
108 - line="\"$(bundle_cp "${line}")\""  
109 - awaiting_file=0  
110 - fi  
111 - else  
112 - if [[ "${line}" == "" ]]; then  
113 - awaiting_file=1  
114 - fi  
115 - fi  
116 - printf '%s\n' "${line}"  
117 - done  
118 -}  
119 -  
120 -# Check dependencies  
121 -check_dependencies otool grep cut sed greadlink qlmanage sips iconutil  
122 -  
123 -# Creates temporary directory  
124 -echo "* Creating temporary directory"  
125 -tmp="$(mktemp -d)"  
126 -trap 'echo "* Removing temporary directory \"${tmp}\""; rm -rf "${tmp}"' EXIT  
127 -  
128 -bundle="pw3270.app"  
129 -bundle_path="${bundle}/Contents"  
130 -exe_path="${bundle_path}/MacOS"  
131 -lib_path="${bundle_path}/Frameworks"  
132 -res_path="${bundle_path}/Resources"  
133 -  
134 -rm -fr "${bundle}"  
135 -  
136 -mkdir -p "${bundle_path}"  
137 -cp "Info.plist" "${bundle_path}"  
138 -  
139 -mkdir -p "${res_path}"  
140 -cp -r "../ui/macos.ui.xml" "${res_path}/pw3270.ui.xml"  
141 -cp -r "$(brew --prefix)/share/pw3270/remap" "${res_path}"  
142 -cp "$(brew --prefix)/share/pw3270/colors.conf" "${res_path}"  
143 -  
144 -# Bundle GLib schemas  
145 -echo "* Bundling GLib schemas"  
146 -mkdir -p "${tmp}/schemas"  
147 -cp "../schemas/"*".gschema.xml" "${tmp}/schemas"  
148 -cp "$(pkg-config gtk+-3.0 --variable=prefix)/share/glib-2.0/schemas/org.gtk.Settings."*".gschema.xml" "${tmp}/schemas"  
149 -glib-compile-schemas --targetdir="${res_path}" "${tmp}/schemas"  
150 -  
151 -# Create the GTK settings file  
152 -# https://developer.gnome.org/gtk3/stable/GtkSettings.html  
153 -mkdir -p "${res_path}/gtk-3.0"  
154 -cat > "${res_path}/gtk-3.0/settings.ini" << EOF  
155 -[Settings]  
156 -gtk-theme-name=Adwaita  
157 -gtk-print-preview-command="open -b com.apple.Preview %f"  
158 -EOF  
159 -  
160 -# Make icon bundle  
161 -echo "* Creating app icon bundle"  
162 -iconset="${tmp}/pw3270.iconset"  
163 -rm -fr "${iconset}"  
164 -mkdir -p "${iconset}"  
165 -icon_sizes=("16" "32" "64" "128" "256" "512" "1024")  
166 -for ((i=1; i < ${#icon_sizes[*]}; i++)); do  
167 - size=${icon_sizes[$((i - 1))]}  
168 - convert -density "${size}" -resize "${size}x" -background transparent "../branding/pw3270.svg" "${iconset}/icon_${size}x${size}.png"  
169 -  
170 - size2x=${icon_sizes[${i}]}  
171 - convert -density "${size2x}" -resize "${size2x}x" -background transparent "../branding/pw3270.svg" "${iconset}/icon_${size}x${size}@2x.png"  
172 -done  
173 -iconutil -c icns -o "${res_path}/pw3270.icns" "${iconset}"  
174 -  
175 -  
176 -# Copy icons  
177 -echo "* Copying icons"  
178 -mkdir -p "${res_path}/icons"  
179 -cp -r "$(brew --prefix adwaita-icon-theme)/share/icons/" "${res_path}/icons"  
180 -cp -r "$(brew --prefix hicolor-icon-theme)/share/icons/" "${res_path}/icons"  
181 -mogrify -format png -path "${res_path}" -background transparent "../branding/*.svg"  
182 -  
183 -# Copy themes  
184 -echo "* Copying themes"  
185 -mkdir -p "${res_path}/themes"  
186 -cp -a "$(brew --prefix gtk+3)/share/themes/Mac" "${res_path}/themes"  
187 -  
188 -# Copy mime database  
189 -echo "* Copying mime database"  
190 -mkdir -p "${res_path}/mime"  
191 -cp "$(pkg-config shared-mime-info --variable=prefix)/share/mime/mime.cache" "${res_path}/mime"  
192 -  
193 -# Copy executables  
194 -echo "* Copying executables"  
195 -mkdir -p "${exe_path}"  
196 -bundle_cp "../.bin/Release/pw3270"  
197 -cp "launcher.sh" "${exe_path}"  
198 -  
199 -# Bundle GdkPixbuf Image Loader Modules  
200 -echo "* Bundling GdkPixbuf Image Loader Modules"  
201 -gdk-pixbuf-query-loaders | bundle_cache > "${res_path}/gdk-loaders.cache"  
202 -  
203 -# Bundle GTK+ Input Method Modules  
204 -echo "* Bundling GTK+ Input Method Modules"  
205 -gtk_prefix="$(pkg-config gtk+-3.0 --variable prefix)"  
206 -gtk-query-immodules-3.0 | bundle_cache \  
207 - | sed "s|${gtk_prefix}/share/locale|@executable_path/../Resources/locale|g" \  
208 - > "${res_path}/gtk.immodules"  
209 -  
210 -# Bundle print backends  
211 -echo "* Bundling print backends"  
212 -mkdir -p "${lib_path}/printbackends"  
213 -for backend in "$(pkg-config gtk+-3.0 --variable=prefix)/lib/gtk-3.0/$(pkg-config gtk+-3.0 --variable=gtk_binary_version)/printbackends/"*.so; do  
214 - bundle_cp "${backend}"  
215 - # TODO: update bundle_cp to inform destiny dir  
216 - mv "${lib_path}/$(basename "${backend}")" "${lib_path}/printbackends"  
217 -done  
218 -  
219 -# TODO: gerar o Info.plist com a versão do macOS $(sw_vers -productVersion)  
220 -  
221 -# Bundle locale  
222 -echo "* Bundling locale"  
223 -mkdir -p "${res_path}/locale"  
224 -cp -r "../.bin/locale/" "${res_path}/locale"  
225 -cp "$(brew --prefix)/share/locale/pt_BR/LC_MESSAGES/lib3270"*".mo" "${res_path}/locale/pt_BR/LC_MESSAGES"  
226 -cp "$(brew --prefix)/share/locale/pt_BR/LC_MESSAGES/libv3270"*".mo" "${res_path}/locale/pt_BR/LC_MESSAGES"  
macos/launcher.sh
@@ -1,65 +0,0 @@ @@ -1,65 +0,0 @@
1 -#!/usr/bin/env sh  
2 -#@author André Breves <andre.breves@gmail.com>  
3 -set -euo  
4 -  
5 -cd "${0%/*}"  
6 -executable_path="${PWD}"  
7 -cd ..  
8 -contents_path="${PWD}"  
9 -cd Resources  
10 -resource_path="${PWD}"  
11 -  
12 -info_plist="${contents_path}/Info.plist"  
13 -bundle_identifier=$(plutil -extract "CFBundleIdentifier" xml1 -o - "${info_plist}" | sed -n "s/.*<string>\(.*\)<\/string>.*/\1/p")  
14 -  
15 -# XDG Base Directory Specification  
16 -# https://specifications.freedesktop.org/basedir-spec/latest/ar01s03.html  
17 -  
18 -# Defines the base directory relative to which user specific configuration files should be stored  
19 -export XDG_CONFIG_HOME="${HOME}/Library/Application Support/${bundle_identifier}"  
20 -  
21 -# Defines the base directory relative to which user specific data files should be stored  
22 -export XDG_DATA_HOME="${HOME}/Library/Application Support/${bundle_identifier}"  
23 -  
24 -# Defines the preference-ordered set of base directories to search for data files in addition to the $XDG_DATA_HOME base directory  
25 -export XDG_DATA_DIRS="${resource_path}"  
26 -  
27 -# Defines the preference-ordered set of base directories to search for configuration files in addition to the $XDG_CONFIG_HOME base directory  
28 -export XDG_CONFIG_DIRS="${resource_path}"  
29 -  
30 -# Defines the base directory relative to which user specific non-essential data files should be stored  
31 -export XDG_CACHE_HOME="${HOME}/Library/Caches/${bundle_identifier}"  
32 -  
33 -  
34 -# Running GTK+ Applications  
35 -# https://developer.gnome.org/gtk3/stable/gtk-running.html  
36 -  
37 -# If set, makes GTK+ use $GTK_DATA_PREFIX instead of the prefix configured when GTK+ was compiled  
38 -export GTK_DATA_PREFIX="${resource_path}"  
39 -  
40 -# Specifies the file listing the Input Method modules to load  
41 -export GTK_IM_MODULE_FILE="${resource_path}/gtk.immodules"  
42 -  
43 -# Specifies the file listing the GdkPixbuf loader modules to load  
44 -export GDK_PIXBUF_MODULE_FILE="${resource_path}/gdk-loaders.cache"  
45 -  
46 -# Specifies a list of directories to search when GTK+ is looking for dynamically loaded objects such as the modules  
47 -# specified by GTK_MODULES, theme engines, input method modules, file system backends and print backends.  
48 -export GTK_PATH="${contents_path}/Frameworks"  
49 -  
50 -# Running GIO applications  
51 -# https://developer.gnome.org/gio/stable/running-gio-apps.html  
52 -  
53 -# This variable can be set to the names of directories to consider when looking for compiled schemas for GSettings  
54 -export GSETTINGS_SCHEMA_DIR="${resource_path}"  
55 -  
56 -# export LANG="pt_BR"  
57 -# export LC_MESSAGES="pt_BR"  
58 -# export LC_ALL="pt_BR"  
59 -  
60 -mkdir -p "${XDG_CONFIG_HOME}"  
61 -mkdir -p "${XDG_DATA_HOME}"  
62 -mkdir -p "${XDG_CACHE_HOME}"  
63 -  
64 -cd "${resource_path}"  
65 -exec "${executable_path}/pw3270"