Commit 9b421decb6ec2466926c0b83f3f72a8d88a96c8f

Authored by Perry Werneck
2 parents d83869d8 abc94626
Exists in develop

Merge branch 'master' into macos

Makefile.in
... ... @@ -301,7 +301,7 @@ install-macos-application: \
301 301 $(DESTDIR)$(bindir)/$(PRODUCT_NAME)@EXEEXT@
302 302  
303 303 install-windows-application: \
304   - branding/$(PRODUCT_NAME).png \
  304 + $(srcdir)/branding/$(PRODUCT_NAME).png \
305 305 strip
306 306  
307 307 @$(MKDIR) \
... ... @@ -315,11 +315,11 @@ install-windows-application: \
315 315 $(DESTDIR)$(datarootdir)/$(PRODUCT_NAME)
316 316  
317 317 @$(INSTALL_DATA) \
318   - branding/$(PRODUCT_NAME).png \
  318 + $(srcdir)/branding/$(PRODUCT_NAME).png \
319 319 $(DESTDIR)$(datarootdir)/$(PRODUCT_NAME)/$(PRODUCT_NAME).png
320 320  
321 321 @$(INSTALL_DATA) \
322   - CHANGELOG \
  322 + $(srcdir)/CHANGELOG \
323 323 $(DESTDIR)$(datarootdir)/$(PRODUCT_NAME)/$(PACKAGE_NAME).changes
324 324  
325 325 install-icons:
... ...
branding/Makefile.in
... ... @@ -24,9 +24,9 @@ APPLICATION_ID=@APPLICATION_ID@
24 24  
25 25 prefix=@prefix@
26 26 exec_prefix=@exec_prefix@
  27 +srcdir=@srcdir@
27 28 datarootdir=@datarootdir@
28 29 bindir=@bindir@
29   -srcdir=@srcdir@
30 30  
31 31 BUILDDIR=@BUILDDIR@
32 32 BINDIR=$(BUILDDIR)/.bin
... ... @@ -156,7 +156,7 @@ install-windows: \
156 156 @$(MKDIR) $(DESTDIR)$(bindir)
157 157  
158 158 @$(INSTALL_DATA) \
159   - $(PRODUCT_NAME).ico \
  159 + $(srcdir)/$(PRODUCT_NAME).ico \
160 160 $(DESTDIR)$(bindir)/$(PRODUCT_NAME).ico
161 161  
162 162  
... ...
macos/bundle 100755 → 100644
... ... @@ -5,7 +5,7 @@ set -Eeuo pipefail
5 5 check_dependencies() {
6 6 local unavailable=()
7 7 for dependency in "${@:-$(</dev/stdin)}"; do
8   - if [[ ! -x "$(command -v ${dependency})" ]]; then unavailable+=("${dependency}"); fi
  8 + if [[ ! -x "$(command -v "${dependency}")" ]]; then unavailable+=("${dependency}"); fi
9 9 done
10 10 if [[ ${#unavailable[@]} == 1 ]]; then
11 11 echo "Dependency '${unavailable[*]}' not found."
... ... @@ -18,7 +18,7 @@ check_dependencies() {
18 18  
19 19 find_lib() {
20 20 # https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/UsingDynamicLibraries.html
21   - local libs_path="${HOME}/lib /usr/local/lib /usr/lib"
  21 + local libs_path="${HOME}/lib $(brew --prefix)/lib /usr/lib"
22 22 for lib in "${@:-$(</dev/stdin)}"; do
23 23 local found=""
24 24 if [[ -f "${lib}" ]]; then
... ... @@ -73,17 +73,25 @@ bundle_cp() {
73 73 cp "${source}" "${target}"
74 74 chmod u+w "${target}"
75 75  
76   - if [[ "${id}" != "" ]]; then install_name_tool -id "${id}" "${target}"; fi
77   - install_name_tool -add_rpath "@executable_path/../Frameworks" "${target}"
  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 78  
79 79 for old_install_name in $(otool -L "${target}" | grep '^\t' | cut -c 2- | sed -n "s/\(.*\) (.*)/\1/p"); do
80 80 if [[ "${old_install_name}" == "${id}" ]]; then continue; fi
81   - local lib="$(find_lib "${old_install_name}")"
  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
82 88 local new_install_name="$(bundle_cp "${lib}")"
83 89 if [[ "${new_install_name}" != "" ]]; then
84   - install_name_tool -change "${old_install_name}" "${new_install_name}" "${target}"
  90 + install_name_tool -change "${old_install_name}" "${new_install_name}" "${target}" 2> /dev/null
85 91 fi
86 92 done
  93 + # https://stackoverflow.com/a/71753248/6910609
  94 + codesign --force -s - "${target}" 2> /dev/null
87 95 echo >&2 "${target}"
88 96 done
89 97 }
... ... @@ -113,9 +121,9 @@ bundle_cache() {
113 121 check_dependencies otool grep cut sed greadlink qlmanage sips iconutil
114 122  
115 123 # Creates temporary directory
116   -echo "Creating temporary directory"
  124 +echo "* Creating temporary directory"
117 125 tmp="$(mktemp -d)"
118   -trap 'echo "Removing temporary directory \"${tmp}\""; rm -rf "${tmp}"' EXIT
  126 +trap 'echo "* Removing temporary directory \"${tmp}\""; rm -rf "${tmp}"' EXIT
119 127  
120 128 bundle="pw3270.app"
121 129 bundle_path="${bundle}/Contents"
... ... @@ -129,17 +137,15 @@ mkdir -p &quot;${bundle_path}&quot;
129 137 cp "Info.plist" "${bundle_path}"
130 138  
131 139 mkdir -p "${res_path}"
132   -cp -r "../ui" "${res_path}"
  140 +cp -r "../ui/macos.ui.xml" "${res_path}/pw3270.ui.xml"
133 141 cp -r "$(brew --prefix)/share/pw3270/remap" "${res_path}"
134 142 cp "$(brew --prefix)/share/pw3270/colors.conf" "${res_path}"
135 143  
136 144 # Bundle GLib schemas
137   -echo "Bundling GLib schemas"
  145 +echo "* Bundling GLib schemas"
138 146 mkdir -p "${tmp}/schemas"
139   -
140   -cp "../schemas/*.gschema.xml" "${tmp}/schemas"
  147 +cp "../schemas/"*".gschema.xml" "${tmp}/schemas"
141 148 cp "$(pkg-config gtk+-3.0 --variable=prefix)/share/glib-2.0/schemas/org.gtk.Settings."*".gschema.xml" "${tmp}/schemas"
142   -
143 149 glib-compile-schemas --targetdir="${res_path}" "${tmp}/schemas"
144 150  
145 151 # Create the GTK settings file
... ... @@ -152,7 +158,7 @@ gtk-print-preview-command=&quot;open -b com.apple.Preview %f&quot;
152 158 EOF
153 159  
154 160 # Make icon bundle
155   -echo "Creating app icon bundle"
  161 +echo "* Creating app icon bundle"
156 162 iconset="${tmp}/pw3270.iconset"
157 163 rm -fr "${iconset}"
158 164 mkdir -p "${iconset}"
... ... @@ -168,34 +174,41 @@ iconutil -c icns -o &quot;${res_path}/pw3270.icns&quot; &quot;${iconset}&quot;
168 174  
169 175  
170 176 # Copy icons
  177 +echo "* Copying icons"
171 178 mkdir -p "${res_path}/icons"
172 179 cp -r "$(brew --prefix adwaita-icon-theme)/share/icons/" "${res_path}/icons"
173 180 cp -r "$(brew --prefix hicolor-icon-theme)/share/icons/" "${res_path}/icons"
174 181 mogrify -format png -path "${res_path}" -background transparent "../branding/*.svg"
175 182  
176 183 # Copy themes
  184 +echo "* Copying themes"
177 185 mkdir -p "${res_path}/themes"
178 186 cp -a "$(brew --prefix gtk+3)/share/themes/Mac" "${res_path}/themes"
179 187  
180 188 # Copy mime database
  189 +echo "* Copying mime database"
181 190 mkdir -p "${res_path}/mime"
182 191 cp "$(pkg-config shared-mime-info --variable=prefix)/share/mime/mime.cache" "${res_path}/mime"
183 192  
184 193 # Copy executables
  194 +echo "* Copying executables"
185 195 mkdir -p "${exe_path}"
186 196 bundle_cp "../.bin/Release/pw3270"
187 197 cp "launcher.sh" "${exe_path}"
188 198  
189 199 # Bundle GdkPixbuf Image Loader Modules
  200 +echo "* Bundling GdkPixbuf Image Loader Modules"
190 201 gdk-pixbuf-query-loaders | bundle_cache > "${res_path}/gdk-loaders.cache"
191 202  
192 203 # Bundle GTK+ Input Method Modules
  204 +echo "* Bundling GTK+ Input Method Modules"
193 205 gtk_prefix="$(pkg-config gtk+-3.0 --variable prefix)"
194 206 gtk-query-immodules-3.0 | bundle_cache \
195 207 | sed "s|${gtk_prefix}/share/locale|@executable_path/../Resources/locale|g" \
196 208 > "${res_path}/gtk.immodules"
197 209  
198 210 # Bundle print backends
  211 +echo "* Bundling print backends"
199 212 mkdir -p "${lib_path}/printbackends"
200 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
201 214 bundle_cp "${backend}"
... ... @@ -206,7 +219,8 @@ done
206 219 # TODO: gerar o Info.plist com a versão do macOS $(sw_vers -productVersion)
207 220  
208 221 # Bundle locale
  222 +echo "* Bundling locale"
209 223 mkdir -p "${res_path}/locale"
210 224 cp -r "../.bin/locale/" "${res_path}/locale"
211   -cp "$(brew --prefix)/share/locale/pt_BR/LC_MESSAGES/lib3270.mo" "${res_path}/locale/pt_BR/LC_MESSAGES"
212   -cp "$(brew --prefix)/share/locale/pt_BR/LC_MESSAGES/libv3270.mo" "${res_path}/locale/pt_BR/LC_MESSAGES"
  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"
... ...
src/include/config.h.in
... ... @@ -24,12 +24,12 @@
24 24 /* do we have malloc.h? */
25 25 #undef HAVE_MALLOC_H
26 26  
27   -/* Define to 1 if you have the <memory.h> header file. */
28   -#undef HAVE_MEMORY_H
29   -
30 27 /* Define to 1 if you have the <stdint.h> header file. */
31 28 #undef HAVE_STDINT_H
32 29  
  30 +/* Define to 1 if you have the <stdio.h> header file. */
  31 +#undef HAVE_STDIO_H
  32 +
33 33 /* Define to 1 if you have the <stdlib.h> header file. */
34 34 #undef HAVE_STDLIB_H
35 35  
... ... @@ -105,7 +105,9 @@
105 105 /* The schema path */
106 106 #undef PRODUCT_PATH
107 107  
108   -/* Define to 1 if you have the ANSI C header files. */
  108 +/* Define to 1 if all of the C90 standard headers exist (not just the ones
  109 + required in a freestanding environment). This macro is provided for
  110 + backward compatibility; new code need not use it. */
109 111 #undef STDC_HEADERS
110 112  
111 113 /* Version number of package */
... ...