Commit 148093105654393bba504f03fb45593b8fc42570

Authored by Perry Werneck
1 parent 59c02e23
Exists in develop

Renaming old 'makeruntime' to 'bundle' since he now packs the entire

application.
Showing 3 changed files with 299 additions and 299 deletions   Show diff stats
configure.ac
... ... @@ -75,7 +75,7 @@ case "$host" in
75 75 AC_CONFIG_FILES(src/main/windows/app-manifest.xml)
76 76  
77 77 # Windows and linux doesn't use the same defaults.
78   - AC_CONFIG_FILES(win/makeruntime.sh)
  78 + AC_CONFIG_FILES(win/bundle)
79 79 AC_CONFIG_FILES(win/pw3270.nsi)
80 80  
81 81 if test "$host_cpu" = "x86_64"; then
... ...
win/bundle.in 0 → 100755
... ... @@ -0,0 +1,298 @@
  1 +#!/bin/bash
  2 +#
  3 +# SPDX-License-Identifier: LGPL-3.0-or-later
  4 +#
  5 +# Copyright (C) 2021 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 +# Referencias:
  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 +# Setup default paths
  29 +srcdir="$(dirname $(dirname $(readlink -f "${0}")))"
  30 +prefix="@prefix@"
  31 +
  32 +GTK_PREFIX=$(@PKG_CONFIG@ --variable=prefix gtk+-3.0)
  33 +GTK_BINARY_VERSION=$(@PKG_CONFIG@ --variable=gtk_binary_version gtk+-3.0)
  34 +GTK_LIBDIR=$(echo $(@PKG_CONFIG@ --variable=libdir gtk+-3.0) | sed "s@^C:/@/c/@g")
  35 +GDK_LOADERS=$(echo $(@PKG_CONFIG@ --variable=gdk_pixbuf_binarydir gdk-pixbuf-2.0) | sed -e "s@${GTK_PREFIX}@@g")
  36 +
  37 +buildroot=.build
  38 +bindir="${buildroot}${prefix}/bin"
  39 +
  40 +if [ -z "${WIN_ROOT}" ]; then
  41 + WIN_ROOT="/c/Windows"
  42 +fi
  43 +
  44 +export LANG=C
  45 +
  46 +install_bin() {
  47 +
  48 + mkdir -p "${bindir}"
  49 +
  50 + AGAIN=1
  51 + until [ $AGAIN = 0 ]; do
  52 +
  53 + SOURCES=$(mktemp)
  54 + REQUIRES=$(mktemp)
  55 +
  56 + find "${buildroot}${prefix}" -iname "*.dll" > ${SOURCES}
  57 + find "${buildroot}${prefix}" -iname "*.exe" >> ${SOURCES}
  58 +
  59 + while read FILENAME
  60 + do
  61 + objdump -p ${FILENAME} | grep "DLL Name:" | cut -d: -f2 | tr "[:upper:]" "[:lower:]" >> ${REQUIRES}
  62 + done < ${SOURCES}
  63 +
  64 + libs_to_exclude="
  65 + advapi32
  66 + cfgmgr32
  67 + comctl32
  68 + comdlg32
  69 + crypt32
  70 + d3d8
  71 + d3d9
  72 + ddraw
  73 + dnsapi
  74 + dsound
  75 + dwmapi
  76 + gdi32
  77 + gdiplus
  78 + glu32
  79 + glut32
  80 + imm32
  81 + iphlpapi
  82 + kernel32
  83 + ksuser
  84 + mpr
  85 + mscms
  86 + mscoree
  87 + msimg32
  88 + msvcr71
  89 + msvcr80
  90 + msvcr90
  91 + msvcrt
  92 + mswsock
  93 + netapi32
  94 + odbc32
  95 + ole32
  96 + oleacc
  97 + oleaut32
  98 + opengl32
  99 + psapi
  100 + rpcrt4
  101 + secur32
  102 + setupapi
  103 + shell32
  104 + shlwapi
  105 + user32
  106 + usp10
  107 + version
  108 + wininet
  109 + winmm
  110 + wldap32
  111 + ws2_32
  112 + wsock32
  113 + winspool.drv
  114 + ntdll
  115 + winhttp
  116 + hid
  117 + "
  118 +
  119 + # Remove system DLLs from list
  120 + for i in $libs_to_exclude; do
  121 + sed -i -e "/${i}/d" ${REQUIRES}
  122 + done
  123 +
  124 + AGAIN=0
  125 + while read FILENAME
  126 + do
  127 +
  128 + if [ ! -e "${bindir}/${FILENAME}" ]; then
  129 +
  130 + if [ -e ${prefix}/bin/${FILENAME} ]; then
  131 +
  132 + AGAIN=1
  133 + cp -v "${prefix}/bin/${FILENAME}" "${bindir}/${FILENAME}"
  134 + if [ "$?" != "0" ]; then
  135 + exit -1
  136 + fi
  137 +
  138 + elif [ -e ${prefix}/lib/${FILENAME} ]; then
  139 +
  140 + AGAIN=1
  141 + cp -v "${prefix}/lib/${FILENAME}" "${bindir}/${FILENAME}"
  142 + if [ "$?" != "0" ]; then
  143 + exit -1
  144 + fi
  145 +
  146 + elif [ -e "${WIN_ROOT}/System32/${FILENAME}" ]; then
  147 +
  148 + echo "Ignoring ${WIN_ROOT}/System32/${FILENAME}"
  149 +
  150 + else
  151 +
  152 + echo "Can't find ${prefix}/bin/${FILENAME} or ${WIN_ROOT}/System32/${FILENAME}"
  153 + find "${prefix}" -iname "${FILENAME}"
  154 + exit -1
  155 +
  156 + fi
  157 +
  158 + fi
  159 +
  160 + done < ${REQUIRES}
  161 +
  162 + rm -f ${SOURCES}
  163 + rm -f ${REQUIRES}
  164 +
  165 + done
  166 +
  167 +}
  168 +
  169 +install_locale() {
  170 +
  171 + mkdir -p ${buildroot}${prefix}/share/locale/pt_BR/LC_MESSAGES
  172 +
  173 + locales="
  174 + gettext-runtime.mo
  175 + gettext-tools.mo
  176 + glib20.mo
  177 + gtk30.mo
  178 + gtk30-properties.mo
  179 + "
  180 +
  181 + FILENAMES=$(mktemp)
  182 + for i in ${locales}
  183 + do
  184 + find "${prefix}/share/locale" -name ${i} >> ${FILENAMES}
  185 + done
  186 +
  187 + while read FILENAME
  188 + do
  189 + mkdir -p $(dirname "${buildroot}${FILENAME}")
  190 + cp -v "${FILENAME}" "${buildroot}${FILENAME}"
  191 + if [ "$?" != "0" ]; then
  192 + exit -1
  193 + fi
  194 + done < ${FILENAMES}
  195 + rm -f ${FILENAMES}
  196 +}
  197 +
  198 +install_schemas() {
  199 +
  200 + mkdir -p ${buildroot}${prefix}/share/glib-2.0/schemas
  201 +
  202 + schemas="
  203 + org.gtk.Settings.FileChooser.gschema.xml
  204 + gschema.dtd
  205 + "
  206 +
  207 + for schema in ${schemas}
  208 + do
  209 + cp -v "${prefix}/share/glib-2.0/schemas/${schema}" "${buildroot}${prefix}/share/glib-2.0/schemas"
  210 + if [ "$?" != "0" ]; then
  211 + exit -1
  212 + fi
  213 + done
  214 +
  215 + glib-compile-schemas \
  216 + --targetdir="${buildroot}${prefix}/share/glib-2.0/schemas" \
  217 + "${buildroot}${prefix}/share/glib-2.0/schemas"
  218 +
  219 + if [ "$?" != "0" ]; then
  220 + exit -1
  221 + fi
  222 +}
  223 +
  224 +install_theme() {
  225 +
  226 + mkdir -p "${buildroot}${prefix}/etc"
  227 + cp -rv "${prefix}/etc/gtk-3.0" "${buildroot}${prefix}/etc"
  228 + if [ "$?" != "0" ]; then
  229 + exit -1
  230 + fi
  231 +
  232 + # https://stackoverflow.com/questions/37035936/how-to-get-native-windows-decorations-on-gtk3-on-windows-7-and-msys2
  233 + mkdir -p ${buildroot}${prefix}/etc/gtk-3.0
  234 + rm -f ${buildroot}${prefix}/etc/gtk-3.0/settings.ini
  235 + rm -f ${buildroot}${prefix}/etc/gtk-3.0/gtkrc
  236 +
  237 + echo "[Settings]" > ${buildroot}${prefix}/etc/gtk-3.0/settings.ini
  238 + echo "gtk-theme-name=${1}" >> ${buildroot}${prefix}/etc/gtk-3.0/settings.ini
  239 +
  240 + if [ -e "${srcdir}/win/gtk.css" ]; then
  241 + mkdir -p "${buildroot}${prefix}/share/themes/Default/gtk-3.0"
  242 + cp "${srcdir}/win/gtk.css" "${buildroot}${prefix}/share/themes/Default/gtk-3.0/gtk.css"
  243 + fi
  244 +
  245 +}
  246 +
  247 +install_icons() {
  248 +
  249 + mkdir -p "${buildroot}${prefix}/share/icons"
  250 +
  251 + if [ -d "${prefix}/share/icons/${1}" ]; then
  252 +
  253 + cp -rv "${prefix}/share/icons/${1}" "${buildroot}${prefix}/share/icons"
  254 + if [ "$?" != 0 ]; then
  255 + echo "Can´t copy ${1} icons"
  256 + exit -1
  257 + fi
  258 +
  259 + elif [ -d "/usr/share/icons/${1}" ]; then
  260 +
  261 + cp -rv "/usr/share/icons/${1}" "${buildroot}${prefix}/share/icons"
  262 + if [ "$?" != 0 ]; then
  263 + echo "Can´t copy ${1} icons"
  264 + exit -1
  265 + fi
  266 +
  267 + else
  268 +
  269 + echo "Can´t find ${1} icons"
  270 + exit -1
  271 +
  272 + fi
  273 +
  274 +}
  275 +
  276 +install_loaders() {
  277 +
  278 + if [ -d "${prefix}${GDK_LOADERS}" ]; then
  279 + mkdir -p "${buildroot}/${prefix}${GDK_LOADERS}"
  280 + cp -rv ${prefix}${GDK_LOADERS}/* "${buildroot}/${prefix}${GDK_LOADERS}"
  281 + if [ "$?" != "0" ]; then
  282 + exit -1
  283 + fi
  284 +
  285 + find ${buildroot}/${prefix}${GDK_LOADERS} -iname "*.a" -exec rm -f {} \;
  286 +
  287 + fi
  288 +
  289 +}
  290 +
  291 +install_loaders
  292 +install_bin
  293 +install_locale
  294 +install_schemas
  295 +install_theme "Adwaita"
  296 +install_icons "Adwaita"
  297 +
  298 +
... ...
win/makeruntime.sh.in
... ... @@ -1,298 +0,0 @@
1   -#!/bin/bash
2   -#
3   -# SPDX-License-Identifier: LGPL-3.0-or-later
4   -#
5   -# Copyright (C) 2021 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   -# Referencias:
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   -# Setup default paths
29   -srcdir="$(dirname $(dirname $(readlink -f "${0}")))"
30   -prefix="@prefix@"
31   -
32   -GTK_PREFIX=$(@PKG_CONFIG@ --variable=prefix gtk+-3.0)
33   -GTK_BINARY_VERSION=$(@PKG_CONFIG@ --variable=gtk_binary_version gtk+-3.0)
34   -GTK_LIBDIR=$(echo $(@PKG_CONFIG@ --variable=libdir gtk+-3.0) | sed "s@^C:/@/c/@g")
35   -GDK_LOADERS=$(echo $(@PKG_CONFIG@ --variable=gdk_pixbuf_binarydir gdk-pixbuf-2.0) | sed -e "s@${GTK_PREFIX}@@g")
36   -
37   -buildroot=.build
38   -bindir="${buildroot}${prefix}/bin"
39   -
40   -if [ -z "${WIN_ROOT}" ]; then
41   - WIN_ROOT="/c/Windows"
42   -fi
43   -
44   -export LANG=C
45   -
46   -install_bin() {
47   -
48   - mkdir -p "${bindir}"
49   -
50   - AGAIN=1
51   - until [ $AGAIN = 0 ]; do
52   -
53   - SOURCES=$(mktemp)
54   - REQUIRES=$(mktemp)
55   -
56   - find "${buildroot}${prefix}" -iname "*.dll" > ${SOURCES}
57   - find "${buildroot}${prefix}" -iname "*.exe" >> ${SOURCES}
58   -
59   - while read FILENAME
60   - do
61   - objdump -p ${FILENAME} | grep "DLL Name:" | cut -d: -f2 | tr "[:upper:]" "[:lower:]" >> ${REQUIRES}
62   - done < ${SOURCES}
63   -
64   - libs_to_exclude="
65   - advapi32
66   - cfgmgr32
67   - comctl32
68   - comdlg32
69   - crypt32
70   - d3d8
71   - d3d9
72   - ddraw
73   - dnsapi
74   - dsound
75   - dwmapi
76   - gdi32
77   - gdiplus
78   - glu32
79   - glut32
80   - imm32
81   - iphlpapi
82   - kernel32
83   - ksuser
84   - mpr
85   - mscms
86   - mscoree
87   - msimg32
88   - msvcr71
89   - msvcr80
90   - msvcr90
91   - msvcrt
92   - mswsock
93   - netapi32
94   - odbc32
95   - ole32
96   - oleacc
97   - oleaut32
98   - opengl32
99   - psapi
100   - rpcrt4
101   - secur32
102   - setupapi
103   - shell32
104   - shlwapi
105   - user32
106   - usp10
107   - version
108   - wininet
109   - winmm
110   - wldap32
111   - ws2_32
112   - wsock32
113   - winspool.drv
114   - ntdll
115   - winhttp
116   - hid
117   - "
118   -
119   - # Remove system DLLs from list
120   - for i in $libs_to_exclude; do
121   - sed -i -e "/${i}/d" ${REQUIRES}
122   - done
123   -
124   - AGAIN=0
125   - while read FILENAME
126   - do
127   -
128   - if [ ! -e "${bindir}/${FILENAME}" ]; then
129   -
130   - if [ -e ${prefix}/bin/${FILENAME} ]; then
131   -
132   - AGAIN=1
133   - cp -v "${prefix}/bin/${FILENAME}" "${bindir}/${FILENAME}"
134   - if [ "$?" != "0" ]; then
135   - exit -1
136   - fi
137   -
138   - elif [ -e ${prefix}/lib/${FILENAME} ]; then
139   -
140   - AGAIN=1
141   - cp -v "${prefix}/lib/${FILENAME}" "${bindir}/${FILENAME}"
142   - if [ "$?" != "0" ]; then
143   - exit -1
144   - fi
145   -
146   - elif [ -e "${WIN_ROOT}/System32/${FILENAME}" ]; then
147   -
148   - echo "Ignoring ${WIN_ROOT}/System32/${FILENAME}"
149   -
150   - else
151   -
152   - echo "Can't find ${prefix}/bin/${FILENAME} or ${WIN_ROOT}/System32/${FILENAME}"
153   - find "${prefix}" -iname "${FILENAME}"
154   - exit -1
155   -
156   - fi
157   -
158   - fi
159   -
160   - done < ${REQUIRES}
161   -
162   - rm -f ${SOURCES}
163   - rm -f ${REQUIRES}
164   -
165   - done
166   -
167   -}
168   -
169   -install_locale() {
170   -
171   - mkdir -p ${buildroot}${prefix}/share/locale/pt_BR/LC_MESSAGES
172   -
173   - locales="
174   - gettext-runtime.mo
175   - gettext-tools.mo
176   - glib20.mo
177   - gtk30.mo
178   - gtk30-properties.mo
179   - "
180   -
181   - FILENAMES=$(mktemp)
182   - for i in ${locales}
183   - do
184   - find "${prefix}/share/locale" -name ${i} >> ${FILENAMES}
185   - done
186   -
187   - while read FILENAME
188   - do
189   - mkdir -p $(dirname "${buildroot}${FILENAME}")
190   - cp -v "${FILENAME}" "${buildroot}${FILENAME}"
191   - if [ "$?" != "0" ]; then
192   - exit -1
193   - fi
194   - done < ${FILENAMES}
195   - rm -f ${FILENAMES}
196   -}
197   -
198   -install_schemas() {
199   -
200   - mkdir -p ${buildroot}${prefix}/share/glib-2.0/schemas
201   -
202   - schemas="
203   - org.gtk.Settings.FileChooser.gschema.xml
204   - gschema.dtd
205   - "
206   -
207   - for schema in ${schemas}
208   - do
209   - cp -v "${prefix}/share/glib-2.0/schemas/${schema}" "${buildroot}${prefix}/share/glib-2.0/schemas"
210   - if [ "$?" != "0" ]; then
211   - exit -1
212   - fi
213   - done
214   -
215   - glib-compile-schemas \
216   - --targetdir="${buildroot}${prefix}/share/glib-2.0/schemas" \
217   - "${buildroot}${prefix}/share/glib-2.0/schemas"
218   -
219   - if [ "$?" != "0" ]; then
220   - exit -1
221   - fi
222   -}
223   -
224   -install_theme() {
225   -
226   - mkdir -p "${buildroot}${prefix}/etc"
227   - cp -rv "${prefix}/etc/gtk-3.0" "${buildroot}${prefix}/etc"
228   - if [ "$?" != "0" ]; then
229   - exit -1
230   - fi
231   -
232   - # https://stackoverflow.com/questions/37035936/how-to-get-native-windows-decorations-on-gtk3-on-windows-7-and-msys2
233   - mkdir -p ${buildroot}${prefix}/etc/gtk-3.0
234   - rm -f ${buildroot}${prefix}/etc/gtk-3.0/settings.ini
235   - rm -f ${buildroot}${prefix}/etc/gtk-3.0/gtkrc
236   -
237   - echo "[Settings]" > ${buildroot}${prefix}/etc/gtk-3.0/settings.ini
238   - echo "gtk-theme-name=${1}" >> ${buildroot}${prefix}/etc/gtk-3.0/settings.ini
239   -
240   - if [ -e "${srcdir}/win/gtk.css" ]; then
241   - mkdir -p "${buildroot}${prefix}/share/themes/Default/gtk-3.0"
242   - cp "${srcdir}/win/gtk.css" "${buildroot}${prefix}/share/themes/Default/gtk-3.0/gtk.css"
243   - fi
244   -
245   -}
246   -
247   -install_icons() {
248   -
249   - mkdir -p "${buildroot}${prefix}/share/icons"
250   -
251   - if [ -d "${prefix}/share/icons/${1}" ]; then
252   -
253   - cp -rv "${prefix}/share/icons/${1}" "${buildroot}${prefix}/share/icons"
254   - if [ "$?" != 0 ]; then
255   - echo "Can´t copy ${1} icons"
256   - exit -1
257   - fi
258   -
259   - elif [ -d "/usr/share/icons/${1}" ]; then
260   -
261   - cp -rv "/usr/share/icons/${1}" "${buildroot}${prefix}/share/icons"
262   - if [ "$?" != 0 ]; then
263   - echo "Can´t copy ${1} icons"
264   - exit -1
265   - fi
266   -
267   - else
268   -
269   - echo "Can´t find ${1} icons"
270   - exit -1
271   -
272   - fi
273   -
274   -}
275   -
276   -install_loaders() {
277   -
278   - if [ -d "${prefix}${GDK_LOADERS}" ]; then
279   - mkdir -p "${buildroot}/${prefix}${GDK_LOADERS}"
280   - cp -rv ${prefix}${GDK_LOADERS}/* "${buildroot}/${prefix}${GDK_LOADERS}"
281   - if [ "$?" != "0" ]; then
282   - exit -1
283   - fi
284   -
285   - find ${buildroot}/${prefix}${GDK_LOADERS} -iname "*.a" -exec rm -f {} \;
286   -
287   - fi
288   -
289   -}
290   -
291   -install_loaders
292   -install_bin
293   -install_locale
294   -install_schemas
295   -install_theme "Adwaita"
296   -install_icons "Adwaita"
297   -
298   -