Commit 274a49f3598c36e5ee65d039275c368686665bab

Authored by Perry Werneck
1 parent a6437767
Exists in develop

Refactoring runtime builder script.

gitsync.sh
@@ -1,35 +0,0 @@ @@ -1,35 +0,0 @@
1 -#!/bin/bash  
2 -#  
3 -# https://help.github.com/articles/syncing-a-fork/  
4 -#  
5 -# https://help.github.com/articles/configuring-a-remote-for-a-fork/  
6 -#  
7 -# https://www.opentechguides.com/how-to/article/git/177/git-sync-repos.html  
8 -#  
9 -# Setup:  
10 -#  
11 -# git remote add github https://github.com/PerryWerneck/lib3270.git  
12 -#  
13 -#  
14 -  
15 -git push  
16 -  
17 -git fetch origin  
18 -git merge  
19 -  
20 -BRANCH=$(git symbolic-ref --short HEAD)  
21 -REPOS=$(git remote -v | grep -v origin | grep "(push)" | awk '{print $1}')  
22 -  
23 -for repo in ${REPOS}  
24 -do  
25 - echo "Getting updates to branch ${BRANCH} from ${repo} ..."  
26 - git fetch "${repo}" "${BRANCH}"  
27 -# git merge 2>&1 > /dev/null  
28 -done  
29 -  
30 -for repo in ${REPOS}  
31 -do  
32 - echo "Updating ${repo} ..."  
33 - git push ${repo}  
34 -done  
35 -  
pushtag.sh
@@ -1,32 +0,0 @@ @@ -1,32 +0,0 @@
1 -#!/bin/bash  
2 -#  
3 -# https://help.github.com/articles/syncing-a-fork/  
4 -#  
5 -# https://help.github.com/articles/configuring-a-remote-for-a-fork/  
6 -#  
7 -# https://www.opentechguides.com/how-to/article/git/177/git-sync-repos.html  
8 -#  
9 -# Setup:  
10 -#  
11 -# git remote add github https://github.com/PerryWerneck/lib3270.git  
12 -#  
13 -#  
14 -  
15 -if [ -z ${1} ]; then  
16 - echo "Inform target tag"  
17 - exit -1  
18 -fi  
19 -  
20 -git push  
21 -  
22 -git fetch origin  
23 -  
24 -git tag -f ${1}  
25 -git push -f --tags  
26 -  
27 -for repo in $(git remote -v | grep -v origin | grep "(push)" | awk '{print $1}')  
28 -do  
29 - echo "Updating ${repo} ..."  
30 - git push ${repo} -f --tags  
31 -done  
32 -  
update.sh
@@ -1,7 +0,0 @@ @@ -1,7 +0,0 @@
1 -#!/bin/bash  
2 -  
3 -git pull  
4 -git fetch origin  
5 -  
6 -git submodule update --remote --recursive  
7 -  
win/makeruntime.sh.in
1 #!/bin/bash 1 #!/bin/bash
2 # 2 #
3 -# "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270  
4 -# (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a  
5 -# aplicativos mainframe. Registro no INPI sob o nome G3270. 3 +# SPDX-License-Identifier: LGPL-3.0-or-later
6 # 4 #
7 -# Copyright (C) <2008> <Banco do Brasil S.A.> 5 +# Copyright (C) 2021 Perry Werneck <perry.werneck@gmail.com>
8 # 6 #
9 -# Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob  
10 -# os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela  
11 -# Free Software Foundation. 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.
12 # 11 #
13 -# Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER  
14 -# GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO  
15 -# A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para  
16 -# obter mais detalhes. 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.
17 # 16 #
18 -# Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este  
19 -# programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple  
20 -# Place, Suite 330, Boston, MA, 02111-1307, USA  
21 -#  
22 -# Contatos:  
23 -#  
24 -# perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)  
25 -# erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça) 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/>.
26 # 19 #
27 20
28 # 21 #
@@ -32,39 +25,26 @@ @@ -32,39 +25,26 @@
32 # http://drup.org/gtk-warning-error-loading-icon-couldnt-recognize-image-file-format 25 # http://drup.org/gtk-warning-error-loading-icon-couldnt-recognize-image-file-format
33 # 26 #
34 27
35 -# Get myDIR  
36 -myDIR=$(dirname $(readlink -f "${0}"))  
37 -  
38 -# Disable i18n  
39 -export LANG=C  
40 - 28 +# Setup default paths
  29 +srcdir="$(dirname $(dirname $(readlink -f "${0}")))"
41 prefix="@prefix@" 30 prefix="@prefix@"
42 -PKG_CONFIG="@PKG_CONFIG@"  
43 -GTK_VERSION="gtk+-@GTK_VERSION@"  
44 31
45 -GTK_PREFIX=$($PKG_CONFIG --variable=prefix ${GTK_VERSION})  
46 -GDK_LOADERS=$(${PKG_CONFIG} --variable=gdk_pixbuf_binarydir gdk-pixbuf-2.0 | sed -e "s@${prefix}@@g") 32 +imgdir=.build
  33 +bindir="${imgdir}/bin"
47 34
48 -TARGET="@BUILDDIR@/.bin/runtime"  
49 -BINDIR="@BUILDDIR@/.bin/Release/"  
50 -SCHEMADIR="@BUILDDIR@/schemas/"  
51 -  
52 -# Change to bin path  
53 -mkdir -p ${TARGET}  
54 -rm -fr ${TARGET}/* 35 +export LANG=C
55 36
56 -copy_dll() { 37 +install_bin() {
57 38
58 AGAIN=1 39 AGAIN=1
59 - until [ $AGAIN = 0 ]; do 40 + until [ $AGAIN = 0 ]; do
60 41
61 SOURCES=$(mktemp) 42 SOURCES=$(mktemp)
62 REQUIRES=$(mktemp) 43 REQUIRES=$(mktemp)
63 44
64 - find "${BINDIR}" -iname "*.dll" > ${SOURCES}  
65 - find "${BINDIR}" -iname "*.exe" >> ${SOURCES}  
66 - find "${TARGET}" -iname *.dll >> ${SOURCES}  
67 - 45 + find "${imgdir}" -iname "*.dll" > ${SOURCES}
  46 + find "${imgdir}" -iname "*.exe" >> ${SOURCES}
  47 +
68 while read FILENAME 48 while read FILENAME
69 do 49 do
70 objdump -p ${FILENAME} | grep "DLL Name:" | cut -d: -f2 | tr "[:upper:]" "[:lower:]" >> ${REQUIRES} 50 objdump -p ${FILENAME} | grep "DLL Name:" | cut -d: -f2 | tr "[:upper:]" "[:lower:]" >> ${REQUIRES}
@@ -124,227 +104,54 @@ copy_dll() { @@ -124,227 +104,54 @@ copy_dll() {
124 winhttp 104 winhttp
125 " 105 "
126 106
127 - # Excluo DLLs do sistema 107 + # Remove system DLLs from list
128 for i in $libs_to_exclude; do 108 for i in $libs_to_exclude; do
129 sed -i -e "/${i}/d" ${REQUIRES} 109 sed -i -e "/${i}/d" ${REQUIRES}
130 done 110 done
131 111
132 - # Procuro pelas DLLs que faltam  
133 AGAIN=0 112 AGAIN=0
134 while read FILENAME 113 while read FILENAME
135 do 114 do
136 - if [ ! -e "${TARGET}/${FILENAME}" ]; then  
137 -  
138 - COUNT=$(find "${BINDIR}" -iname ${FILENAME} | wc --lines)  
139 - if [ "${COUNT}" == "0" ]; then  
140 115
141 - echo ${FILENAME} 116 + if [ ! -e "${bindir}/${FILENAME}" ]; then
142 117
143 - if [ -e ${prefix}/bin/${FILENAME} ]; then 118 + if [ -e ${prefix}/bin/${FILENAME} ]; then
144 119
145 - echo "Copiando $(basename ${FILENAME})..." 120 + echo "${prefix}/bin/${FILENAME}"
146 121
147 - AGAIN=1  
148 - cp -v "${prefix}/bin/${FILENAME}" "${TARGET}/${FILENAME}"  
149 - if [ "$?" != "0" ]; then  
150 - exit -1  
151 - fi  
152 -  
153 - elif [ -e ${prefix}/lib/${FILENAME} ]; then  
154 -  
155 - echo "Copiando $(basename ${FILENAME})..." 122 + AGAIN=1
  123 + cp -v "${prefix}/bin/${FILENAME}" "${bindir}/${FILENAME}"
  124 + if [ "$?" != "0" ]; then
  125 + exit -1
  126 + fi
156 127
157 - AGAIN=1  
158 - cp -v "${prefix}/lib/${FILENAME}" "${TARGET}/${FILENAME}"  
159 - if [ "$?" != "0" ]; then  
160 - exit -1  
161 - fi 128 + elif [ -e ${prefix}/lib/${FILENAME} ]; then
162 129
163 - else 130 + echo "${prefix}/lib/${FILENAME}"
164 131
165 - echo "Can't find ${FILENAME}" 132 + AGAIN=1
  133 + cp -v "${prefix}/lib/${FILENAME}" "${bindir}/${FILENAME}"
  134 + if [ "$?" != "0" ]; then
166 exit -1 135 exit -1
167 -  
168 fi 136 fi
169 137
170 - fi 138 + else
171 139
  140 + echo "Can't find ${FILENAME}"
  141 + exit -1
172 142
  143 + fi
  144 +
173 fi 145 fi
174 - 146 +
175 done < ${REQUIRES} 147 done < ${REQUIRES}
176 148
177 rm -f ${SOURCES} 149 rm -f ${SOURCES}
178 rm -f ${REQUIRES} 150 rm -f ${REQUIRES}
179 -  
180 - done  
181 -  
182 -}  
183 -  
184 -copy_locale() {  
185 -  
186 - rm -fr ${TARGET}/share/locale/pt_BR/LC_MESSAGES  
187 - mkdir -p ${TARGET}/share/locale/pt_BR/LC_MESSAGES  
188 -  
189 - locales="  
190 - gettext-runtime.mo  
191 - gettext-tools.mo  
192 - glib20.mo  
193 - gtk30.mo  
194 - gtk30-properties.mo  
195 - "  
196 -  
197 - for i in $locales; do  
198 - if [ -e "${GTK_PREFIX}/share/locale/pt_BR/LC_MESSAGES/${i}" ]; then  
199 - echo "${GTK_PREFIX}/share/locale/pt_BR/LC_MESSAGES/${i} ..."  
200 - cp "${GTK_PREFIX}/share/locale/pt_BR/LC_MESSAGES/${i}" "${TARGET}/share/locale/pt_BR/LC_MESSAGES"  
201 - if [ "$?" != "0" ]; then  
202 - exit -1  
203 - fi  
204 - fi 151 +
205 done 152 done
206 153
207 } 154 }
208 155
209 -copy_loaders() {  
210 -  
211 - mkdir -p "${TARGET}/${GDK_LOADERS}"  
212 - cp -rv "${prefix}/${GDK_LOADERS}/loaders" "${TARGET}/${GDK_LOADERS}"  
213 - if [ "$?" != "0" ]; then  
214 - exit -1  
215 - fi  
216 -  
217 -}  
218 -  
219 -copy_schemes() {  
220 -  
221 - mkdir -p "${TARGET}/share/glib-2.0/schemas"  
222 -  
223 - cp -v \  
224 - ${SCHEMADIR}/windows/*.xml \  
225 - "${TARGET}/share/glib-2.0/schemas"  
226 -  
227 - if [ "$?" != "0" ]; then  
228 - exit -1  
229 - fi  
230 -  
231 - cp -rv \  
232 - "${prefix}/share/glib-2.0/schemas/org.gtk.Settings.FileChooser.gschema.xml" \  
233 - "${TARGET}/share/glib-2.0/schemas"  
234 -  
235 - if [ "$?" != "0" ]; then  
236 - exit -1  
237 - fi  
238 -  
239 - cp -rv \  
240 - "${prefix}/share/glib-2.0/schemas/gschema.dtd" \  
241 - "${TARGET}/share/glib-2.0/schemas"  
242 -  
243 - if [ "$?" != "0" ]; then  
244 - exit -1  
245 - fi  
246 -  
247 - glib-compile-schemas \  
248 - --targetdir="${TARGET}/share/glib-2.0/schemas" \  
249 - "${TARGET}/share/glib-2.0/schemas"  
250 -  
251 - if [ "$?" != "0" ]; then  
252 - exit -1  
253 - fi  
254 -}  
255 -  
256 -  
257 -copy_theme() {  
258 -  
259 - mkdir -p "${TARGET}/etc"  
260 - cp -rv "${prefix}/etc/gtk-3.0" "${TARGET}/etc"  
261 -  
262 - # https://stackoverflow.com/questions/37035936/how-to-get-native-windows-decorations-on-gtk3-on-windows-7-and-msys2  
263 - mkdir -p ${TARGET}/etc/gtk-3.0  
264 - rm -f ${TARGET}/etc/gtk-3.0/settings.ini  
265 - rm -f ${TARGET}/etc/gtk-3.0/gtkrc  
266 -  
267 - mkdir -p ${TARGET}/share/icons  
268 - if [ "$?" != 0 ]; then  
269 - echo "Can´t create icons folder"  
270 - exit -1  
271 - fi  
272 -  
273 - cp -rv /usr/share/icons/${1} ${TARGET}/share/icons  
274 - if [ "$?" != 0 ]; then  
275 - echo "Can´t copy ${1} icons"  
276 - exit -1  
277 - fi  
278 -  
279 - mkdir -p ${TARGET}/share/themes  
280 - if [ "$?" != 0 ]; then  
281 - echo "Can´t create themes folder"  
282 - exit -1  
283 - fi  
284 -  
285 -# cp -rv /usr/share/themes/${1} ${TARGET}/share/themes  
286 -# if [ "$?" != 0 ]; then  
287 -# echo "Can´t copy ${1} theme"  
288 -# exit -1  
289 -# fi  
290 -  
291 - echo "${myDIR}/gtk.css"  
292 - if [ -e "${myDIR}/gtk.css" ]; then  
293 - cp "${myDIR}/gtk.css" "${TARGET}/share/themes/${1}/gtk-3.0/gtk.css"  
294 - fi  
295 -  
296 -}  
297 -  
298 -#  
299 -# Check command line parameters  
300 -#  
301 -until [ -z "$1" ]  
302 -do  
303 - if [ ${1:0:2} = '--' ]; then  
304 - tmp=${1:2}  
305 - parameter=${tmp%%=*}  
306 - parameter=$(echo $parameter | tr "[:lower:]" "[:upper:]")  
307 - value=${tmp##*=}  
308 -  
309 - case "$parameter" in  
310 - OUTPUT-DIR)  
311 - TARGET=$value  
312 - ;;  
313 -  
314 - BINDIR)  
315 - BINDIR=$value  
316 - ;;  
317 -  
318 - HELP)  
319 - echo "${0} [options]"  
320 - echo ""  
321 - echo "Options:"  
322 - echo ""  
323 - echo " --path Set runtime instalation path (default is $TARGET)"  
324 - echo " --bindir Set binaries source path (default is $BINDIR)"  
325 - echo ""  
326 - exit 0  
327 -  
328 - ;;  
329 -  
330 - esac  
331 - fi  
332 -  
333 - shift  
334 -  
335 -done  
336 -  
337 -#  
338 -# Make runtime  
339 -#  
340 -copy_dll  
341 -copy_locale  
342 -copy_loaders  
343 -copy_schemes  
344 -copy_theme "Adwaita"  
345 -  
346 -# Otimiza todos os pngs  
347 -#echo "Optimizing..."  
348 -#find ${TARGET} -iname *.png -exec optipng -o7 -quiet {} \; 2>&1 > /dev/null 156 +install_bin
349 157
350 -echo "Runtime ok"