Commit 9fb71758163d6027398142884db14e7859897388

Authored by Perry Werneck
2 parents e814e0ce 5dac2434
Exists in develop

Merge branch 'develop' into macos

src/main/windows/tools.c
... ... @@ -35,8 +35,9 @@
35 35 return path;
36 36 }
37 37  
38   - g_free(path);
39 38 g_message("Cant find path for '%s'",path);
  39 + g_free(path);
  40 +
40 41 return NULL;
41 42  
42 43 }
... ...
src/objects/application/application.c
... ... @@ -278,9 +278,27 @@ static void pw3270Application_init(pw3270Application *app) {
278 278 g_settings_bind(app->settings, "ui-style", app, "ui-style", G_SETTINGS_BIND_DEFAULT);
279 279 }
280 280  
  281 + // Load plugin from default paths.
281 282 {
282   - lib3270_autoptr(char) plugin_path = lib3270_build_data_filename("plugins",NULL);
283   - pw3270_load_plugins_from_path(app, plugin_path);
  283 + const char *paths[] = {
  284 + "plugins",
  285 + G_STRINGIFY(PRODUCT_NAME) "-plugins",
  286 + "lib\\plugins",
  287 + "lib\\" G_STRINGIFY(PRODUCT_NAME) "-plugins",
  288 + };
  289 + size_t ix;
  290 +
  291 + g_autofree gchar * install = g_win32_get_package_installation_directory_of_module(NULL);
  292 +
  293 + for(ix = 0; ix < G_N_ELEMENTS(paths);ix++) {
  294 + g_autofree gchar * path = g_build_filename(install,paths[ix],NULL);
  295 + g_message("Checking '%s' for plugin files",path);
  296 + if(g_file_test(path,G_FILE_TEST_IS_DIR)) {
  297 + pw3270_load_plugins_from_path(app, path);
  298 + break;
  299 + }
  300 + }
  301 +
284 302 }
285 303  
286 304 #elif defined(__APPLE__)
... ...
src/objects/application/plugins.c
... ... @@ -65,6 +65,10 @@ void pw3270_load_plugins_from_path(pw3270Application *app, const char *path) {
65 65  
66 66 }
67 67  
  68 + } else {
  69 +
  70 + g_warning("Can't load plugins from %s: %s",path,"Invalid path");
  71 +
68 72 }
69 73  
70 74 }
... ...
src/objects/settings/gsettings.c
... ... @@ -100,13 +100,13 @@
100 100 schema_id,
101 101 TRUE);
102 102  
103   - g_message("Loading '%s'",names[ix]);
  103 +// g_message("Loading '%s'",names[ix]);
104 104 settings = g_settings_new_full(schema, NULL, NULL);
105 105  
106 106 g_settings_schema_source_unref(source);
107 107  
108 108 if(settings) {
109   - g_message("Got gsettings from %s",names[ix]);
  109 +// g_message("Got gsettings from %s",names[ix]);
110 110 return settings;
111 111 }
112 112  
... ... @@ -157,7 +157,7 @@
157 157  
158 158 GSettings * pw3270_application_settings_new() {
159 159 return settings_new(G_STRINGIFY(PRODUCT_ID));
160   - }
  160 + }
161 161  
162 162 GSettings * pw3270_application_window_settings_new() {
163 163 return settings_new(G_STRINGIFY(PRODUCT_ID) ".window");
... ...
win/bundle.common
... ... @@ -18,13 +18,6 @@
18 18 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19 19 #
20 20  
21   -#
22   -# References:
23   -#
24   -# https://www.gtk.org/docs/installations/windows/
25   -# http://drup.org/gtk-warning-error-loading-icon-couldnt-recognize-image-file-format
26   -#
27   -
28 21 # Check command-line arguments
29 22 argument() {
30 23  
... ... @@ -52,7 +45,10 @@ if [ &quot;$?&quot; == &quot;0&quot; ]; then
52 45 echo ""
53 46 echo " --help Help options (this screen)"
54 47 echo " --zip Build zipfile"
55   - echo " --nsi Build nsi installer"
  48 +
  49 + if [ -e "${srcdir}/win/${PACKAGE_NAME}.nsi" ]; then
  50 + echo " --nsi Build nsi installer"
  51 + fi
56 52 echo " --upload Upload bundle to github"
57 53 fi
58 54  
... ... @@ -90,11 +86,6 @@ if [ -z ${PACKAGE_VERSION} ]; then
90 86 exit -1
91 87 fi
92 88  
93   -GTK_PREFIX=$(${PKG_CONFIG} --variable=prefix gtk+-3.0)
94   -GTK_BINARY_VERSION=$(${PKG_CONFIG} --variable=gtk_binary_version gtk+-3.0)
95   -GTK_LIBDIR=$(echo $(${PKG_CONFIG} --variable=libdir gtk+-3.0) | sed "s@^C:/@/c/@g")
96   -GDK_LOADERS=$(echo $(${PKG_CONFIG} --variable=gdk_pixbuf_binarydir gdk-pixbuf-2.0) | sed -e "s@${GTK_PREFIX}@@g")
97   -
98 89 mkdir -p .bin/bundle
99 90 if [ "$?" != "0" ]; then
100 91 echo "Cant mkdir base buildroot"
... ... @@ -304,98 +295,6 @@ install_locale() {
304 295 rm -f ${FILENAMES}
305 296 }
306 297  
307   -install_schemas() {
308   -
309   - mkdir -p ${buildroot}${MINGW_PREFIX}/share/glib-2.0/schemas
310   -
311   - schemas="
312   - org.gtk.Settings.FileChooser.gschema.xml
313   - gschema.dtd
314   - "
315   -
316   - for schema in ${schemas}
317   - do
318   - cp -v "${MINGW_PREFIX}/share/glib-2.0/schemas/${schema}" "${buildroot}${MINGW_PREFIX}/share/glib-2.0/schemas"
319   - if [ "$?" != "0" ]; then
320   - exit -1
321   - fi
322   - done
323   -
324   - glib-compile-schemas \
325   - --targetdir="${buildroot}${MINGW_PREFIX}/share/glib-2.0/schemas" \
326   - "${buildroot}${MINGW_PREFIX}/share/glib-2.0/schemas"
327   -
328   - if [ "$?" != "0" ]; then
329   - exit -1
330   - fi
331   -}
332   -
333   -install_theme() {
334   -
335   - mkdir -p "${buildroot}${MINGW_PREFIX}/etc"
336   - cp -rv "${MINGW_PREFIX}/etc/gtk-3.0" "${buildroot}${MINGW_PREFIX}/etc"
337   - if [ "$?" != "0" ]; then
338   - exit -1
339   - fi
340   -
341   - # https://stackoverflow.com/questions/37035936/how-to-get-native-windows-decorations-on-gtk3-on-windows-7-and-msys2
342   - mkdir -p ${buildroot}${MINGW_PREFIX}/etc/gtk-3.0
343   - rm -f ${buildroot}${MINGW_PREFIX}/etc/gtk-3.0/settings.ini
344   - rm -f ${buildroot}${MINGW_PREFIX}/etc/gtk-3.0/gtkrc
345   -
346   - echo "[Settings]" > ${buildroot}${MINGW_PREFIX}/etc/gtk-3.0/settings.ini
347   - echo "gtk-theme-name=${1}" >> ${buildroot}${MINGW_PREFIX}/etc/gtk-3.0/settings.ini
348   -
349   - if [ -e "${srcdir}/win/gtk.css" ]; then
350   - mkdir -p "${buildroot}${MINGW_PREFIX}/share/themes/Default/gtk-3.0"
351   - cp "${srcdir}/win/gtk.css" "${buildroot}${MINGW_PREFIX}/share/themes/Default/gtk-3.0/gtk.css"
352   - fi
353   -
354   -}
355   -
356   -install_icons() {
357   -
358   - mkdir -p "${buildroot}${MINGW_PREFIX}/share/icons"
359   -
360   - if [ -d "${MINGW_PREFIX}/share/icons/${1}" ]; then
361   -
362   - cp -rv "${MINGW_PREFIX}/share/icons/${1}" "${buildroot}${MINGW_PREFIX}/share/icons"
363   - if [ "$?" != 0 ]; then
364   - echo "Can´t copy ${1} icons"
365   - exit -1
366   - fi
367   -
368   - elif [ -d "/usr/share/icons/${1}" ]; then
369   -
370   - cp -rv "/usr/share/icons/${1}" "${buildroot}${MINGW_PREFIX}/share/icons"
371   - if [ "$?" != 0 ]; then
372   - echo "Can´t copy ${1} icons"
373   - exit -1
374   - fi
375   -
376   - else
377   -
378   - echo "Can´t find ${1} icons"
379   - exit -1
380   -
381   - fi
382   -
383   -}
384   -
385   -install_loaders() {
386   -
387   - if [ -d "${MINGW_PREFIX}${GDK_LOADERS}" ]; then
388   - mkdir -p "${buildroot}/${MINGW_PREFIX}${GDK_LOADERS}"
389   - cp -rv ${MINGW_PREFIX}${GDK_LOADERS}/* "${buildroot}/${MINGW_PREFIX}${GDK_LOADERS}"
390   - if [ "$?" != "0" ]; then
391   - exit -1
392   - fi
393   -
394   - find ${buildroot}/${MINGW_PREFIX}${GDK_LOADERS} -iname "*.a" -exec rm -f {} \;
395   -
396   - fi
397   -
398   -}
399 298  
400 299 make_zip() {
401 300  
... ... @@ -433,6 +332,7 @@ make_nsis() {
433 332 -DWITHIPC \
434 333 -DWITHPLUGINS \
435 334 -DWITHSDK \
  335 + -DPKGDIR=${buildroot}${MINGW_PREFIX} \
436 336 ${buildroot}${MINGW_PREFIX}/${PACKAGE_NAME}.nsi
437 337 if [ "$?" != "0" ]; then
438 338 echo "Cant build nsis script"
... ... @@ -456,25 +356,47 @@ make_nsis() {
456 356 fi
457 357 }
458 358  
459   -install_runtime() {
  359 +install_license() {
  360 + mkdir -p "${buildroot}${MINGW_PREFIX}/usr/share/${PACKAGE_NAME}"
  361 + cp "${srcdir}/LICENSE" "${buildroot}${MINGW_PREFIX}/usr/share/${PACKAGE_NAME}"
  362 + if [ "$?" != "0" ]; then
  363 + echo "Cant copy LICENSE"
  364 + exit -1
  365 + fi
  366 +}
460 367  
461   - install_loaders
  368 +install_runtime() {
462 369 install_bin
463 370 install_locale
464   - install_schemas
465   - install_theme "Adwaita"
466   - install_icons "Adwaita"
467   -
468 371 }
469 372  
470   -make_packages() {
  373 +build_package() {
471 374  
472   - mkdir -p "${buildroot}${MINGW_PREFIX}/nsi"
473   - cp "${srcdir}/win/pw3270.nsi" "${buildroot}${MINGW_PREFIX}/${PACKAGE_NAME}.nsi"
  375 + # Build
  376 + make -C "${srcdir}" all
474 377 if [ "$?" != "0" ]; then
475   - echo "Cant copy nsis script"
476   - fi
  378 + echo "Build failed"
  379 + exit -1
  380 + fi
477 381  
  382 + make -C "${srcdir}" "DESTDIR=${buildroot}" install
  383 + if [ "$?" != "0" ]; then
  384 + echo "Install failed"
  385 + exit -1
  386 + fi
  387 +
  388 +}
  389 +
  390 +make_packages() {
  391 +
  392 + if [ -e "${srcdir}/win/${PACKAGE_NAME}.nsi" ]; then
  393 + mkdir -p "${buildroot}${MINGW_PREFIX}/nsi"
  394 + cp "${srcdir}/win/${PACKAGE_NAME}.nsi" "${buildroot}${MINGW_PREFIX}/${PACKAGE_NAME}.nsi"
  395 + if [ "$?" != "0" ]; then
  396 + echo "Cant copy nsis script"
  397 + fi
  398 + fi
  399 +
478 400 argument "zip" > /dev/null
479 401 if [ "$?" == "0" ]; then
480 402 make_zip
... ...
win/bundle.cross
... ... @@ -18,20 +18,13 @@
18 18 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19 19 #
20 20  
21   -#
22   -# References:
23   -#
24   -# https://www.gtk.org/docs/installations/windows/
25   -# http://drup.org/gtk-warning-error-loading-icon-couldnt-recognize-image-file-format
26   -#
27   -
28 21 MINGW_PREFIX="/usr/x86_64-w64-mingw32/sys-root/mingw"
29 22 PKG_CONFIG="/usr/bin/x86_64-w64-mingw32-pkg-config"
30 23 MINGW_PACKAGE_PREFIX="mingw64"
31 24 REPOSITORY_NAME="pw3270"
32 25  
33 26 # Load bundle functions
34   -. "$(dirname $(readlink -f "${0}"))/bundle.common"
  27 +. "$(dirname $(readlink -f "${0}"))/bundle.gtk3"
35 28  
36 29 argument "help" > /dev/null
37 30 if [ "$?" == "0" ]; then
... ... @@ -83,23 +76,6 @@ install_prereqs() {
83 76 done
84 77 }
85 78  
86   -build_package() {
87   -
88   - # Build
89   - make -C "${srcdir}" all
90   - if [ "$?" != "0" ]; then
91   - echo "Build failed"
92   - exit -1
93   - fi
94   -
95   - make -C "${srcdir}" "DESTDIR=${buildroot}" install
96   - if [ "$?" != "0" ]; then
97   - echo "Install failed"
98   - exit -1
99   - fi
100   -
101   -}
102   -
103 79 argument "install-requires" > /dev/null
104 80 if [ "$?" == "0" ]; then
105 81 install_prereqs
... ... @@ -193,18 +169,9 @@ unpack_rpm() {
193 169  
194 170 }
195 171  
196   -install_license() {
197   - mkdir -p "${buildroot}${MINGW_PREFIX}/usr/share/${PACKAGE_NAME}"
198   - cp "${srcdir}/LICENSE" "${buildroot}${MINGW_PREFIX}/share/${PACKAGE_NAME}"
199   - if [ "$?" != "0" ]; then
200   - echo "Cant copy LICENSE"
201   - exit -1
202   - fi
203   -}
204   -
205 172 unpack_rpm
206 173  
207   -install_runtime
  174 +install_gtk3_runtime
208 175 install_license
209 176  
210 177 make_packages
... ...
win/bundle.gtk3 0 → 100644
... ... @@ -0,0 +1,139 @@
  1 +#!/bin/bash
  2 +#
  3 +# SPDX-License-Identifier: LGPL-3.0-or-later
  4 +#
  5 +# Copyright (C) 2023 Perry Werneck <perry.werneck@gmail.com>
  6 +#
  7 +# This program is free software: you can redistribute it and/or modify
  8 +# it under the terms of the GNU Lesser General Public License as published
  9 +# by the Free Software Foundation, either version 3 of the License, or
  10 +# (at your option) any later version.
  11 +#
  12 +# This program is distributed in the hope that it will be useful,
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15 +# GNU General Public License for more details.
  16 +#
  17 +# You should have received a copy of the GNU Lesser General Public License
  18 +# along with this program. If not, see <https://www.gnu.org/licenses/>.
  19 +#
  20 +
  21 +#
  22 +# References:
  23 +#
  24 +# https://www.gtk.org/docs/installations/windows/
  25 +# http://drup.org/gtk-warning-error-loading-icon-couldnt-recognize-image-file-format
  26 +#
  27 +
  28 +# Load bundle functions
  29 +. "$(dirname $(readlink -f "${0}"))/bundle.common"
  30 +
  31 +GTK_PREFIX=$(${PKG_CONFIG} --variable=prefix gtk+-3.0)
  32 +GTK_BINARY_VERSION=$(${PKG_CONFIG} --variable=gtk_binary_version gtk+-3.0)
  33 +GTK_LIBDIR=$(echo $(${PKG_CONFIG} --variable=libdir gtk+-3.0) | sed "s@^C:/@/c/@g")
  34 +GDK_LOADERS=$(echo $(${PKG_CONFIG} --variable=gdk_pixbuf_binarydir gdk-pixbuf-2.0) | sed -e "s@${GTK_PREFIX}@@g")
  35 +
  36 +install_schemas() {
  37 +
  38 + mkdir -p ${buildroot}${MINGW_PREFIX}/share/glib-2.0/schemas
  39 +
  40 + schemas="
  41 + org.gtk.Settings.FileChooser.gschema.xml
  42 + gschema.dtd
  43 + "
  44 +
  45 + for schema in ${schemas}
  46 + do
  47 + cp -v "${MINGW_PREFIX}/share/glib-2.0/schemas/${schema}" "${buildroot}${MINGW_PREFIX}/share/glib-2.0/schemas"
  48 + if [ "$?" != "0" ]; then
  49 + exit -1
  50 + fi
  51 + done
  52 +
  53 + glib-compile-schemas \
  54 + --targetdir="${buildroot}${MINGW_PREFIX}/share/glib-2.0/schemas" \
  55 + "${buildroot}${MINGW_PREFIX}/share/glib-2.0/schemas"
  56 +
  57 + if [ "$?" != "0" ]; then
  58 + exit -1
  59 + fi
  60 +}
  61 +
  62 +install_theme() {
  63 +
  64 + mkdir -p "${buildroot}${MINGW_PREFIX}/etc"
  65 + cp -rv "${MINGW_PREFIX}/etc/gtk-3.0" "${buildroot}${MINGW_PREFIX}/etc"
  66 + if [ "$?" != "0" ]; then
  67 + exit -1
  68 + fi
  69 +
  70 + # https://stackoverflow.com/questions/37035936/how-to-get-native-windows-decorations-on-gtk3-on-windows-7-and-msys2
  71 + mkdir -p ${buildroot}${MINGW_PREFIX}/etc/gtk-3.0
  72 + rm -f ${buildroot}${MINGW_PREFIX}/etc/gtk-3.0/settings.ini
  73 + rm -f ${buildroot}${MINGW_PREFIX}/etc/gtk-3.0/gtkrc
  74 +
  75 + echo "[Settings]" > ${buildroot}${MINGW_PREFIX}/etc/gtk-3.0/settings.ini
  76 + echo "gtk-theme-name=${1}" >> ${buildroot}${MINGW_PREFIX}/etc/gtk-3.0/settings.ini
  77 +
  78 + if [ -e "${srcdir}/win/gtk.css" ]; then
  79 + mkdir -p "${buildroot}${MINGW_PREFIX}/share/themes/Default/gtk-3.0"
  80 + cp "${srcdir}/win/gtk.css" "${buildroot}${MINGW_PREFIX}/share/themes/Default/gtk-3.0/gtk.css"
  81 + fi
  82 +
  83 +}
  84 +
  85 +install_icons() {
  86 +
  87 + mkdir -p "${buildroot}${MINGW_PREFIX}/share/icons"
  88 +
  89 + if [ -d "${MINGW_PREFIX}/share/icons/${1}" ]; then
  90 +
  91 + cp -rv "${MINGW_PREFIX}/share/icons/${1}" "${buildroot}${MINGW_PREFIX}/share/icons"
  92 + if [ "$?" != 0 ]; then
  93 + echo "Can´t copy ${1} icons"
  94 + exit -1
  95 + fi
  96 +
  97 + elif [ -d "/usr/share/icons/${1}" ]; then
  98 +
  99 + cp -rv "/usr/share/icons/${1}" "${buildroot}${MINGW_PREFIX}/share/icons"
  100 + if [ "$?" != 0 ]; then
  101 + echo "Can´t copy ${1} icons"
  102 + exit -1
  103 + fi
  104 +
  105 + else
  106 +
  107 + echo "Can´t find ${1} icons"
  108 + exit -1
  109 +
  110 + fi
  111 +
  112 +}
  113 +
  114 +install_loaders() {
  115 +
  116 + if [ -d "${MINGW_PREFIX}${GDK_LOADERS}" ]; then
  117 + mkdir -p "${buildroot}/${MINGW_PREFIX}${GDK_LOADERS}"
  118 + cp -rv ${MINGW_PREFIX}${GDK_LOADERS}/* "${buildroot}/${MINGW_PREFIX}${GDK_LOADERS}"
  119 + if [ "$?" != "0" ]; then
  120 + exit -1
  121 + fi
  122 +
  123 + find ${buildroot}/${MINGW_PREFIX}${GDK_LOADERS} -iname "*.a" -exec rm -f {} \;
  124 +
  125 + fi
  126 +
  127 +}
  128 +
  129 +install_gtk3_runtime() {
  130 +
  131 + install_loaders
  132 + install_bin
  133 + install_locale
  134 + install_schemas
  135 + install_theme "Adwaita"
  136 + install_icons "Adwaita"
  137 +
  138 +}
  139 +
... ...
win/bundle.msys
... ... @@ -2,7 +2,7 @@
2 2 #
3 3 # SPDX-License-Identifier: LGPL-3.0-or-later
4 4 #
5   -# Copyright (C) 2021 Perry Werneck <perry.werneck@gmail.com>
  5 +# Copyright (C) 2023 Perry Werneck <perry.werneck@gmail.com>
6 6 #
7 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU Lesser General Public License as published
... ... @@ -18,15 +18,8 @@
18 18 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19 19 #
20 20  
21   -#
22   -# References:
23   -#
24   -# https://www.gtk.org/docs/installations/windows/
25   -# http://drup.org/gtk-warning-error-loading-icon-couldnt-recognize-image-file-format
26   -#
27   -
28 21 # Load bundle functions
29   -. "$(dirname $(readlink -f "${0}"))/bundle.common"
  22 +. "$(dirname $(readlink -f "${0}"))/bundle.gtk3"
30 23  
31 24 prepare
32 25  
... ... @@ -40,11 +33,6 @@ do
40 33 fi
41 34 done
42 35  
43   -install_loaders
44   -install_bin
45   -install_locale
46   -install_schemas
47   -install_theme "Adwaita"
48   -install_icons "Adwaita"
  36 +install_gtk3_runtime
49 37  
50 38  
... ...
win/ci-build.sh
... ... @@ -40,7 +40,7 @@ cd $(dirname $(dirname $(readlink -f ${0})))
40 40 # Install pre-reqs
41 41 #
42 42 echo "Installing pre-reqs..."
43   -pacman -U --noconfirm *.pkg.tar.zst || die "pacman failure"
  43 +pacman -U --noconfirm *.pkg.tar.zst || die "pre-reqs failure"
44 44  
45 45 #
46 46 # Build
... ...
win/pw3270.nsi.in
... ... @@ -222,6 +222,7 @@ SubSection &quot;@PRODUCT_NAME@&quot; SecMain
222 222 Section "Remote control" IPCPlugin
223 223  
224 224 ${DisableX64FSRedirection}
  225 +
225 226 CreateDirectory "$INSTDIR\lib\@PRODUCT_NAME@-plugins"
226 227 file "/oname=$INSTDIR\lib\@PRODUCT_NAME@-plugins\ipcserver.dll" "lib\@PRODUCT_NAME@-plugins\ipcserver.dll"
227 228  
... ...