Commit 59421629bfe7deaa8ae624915e2a2243578b1095
1 parent
6d3f2ca7
Exists in
master
and in
5 other branches
Refactoring windows build script.
Showing
1 changed file
with
221 additions
and
429 deletions
Show diff stats
win/pack.sh
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | +PROJECT_NAME="pw3270" | ||
4 | +LIBRARY_NAME="lib3270" | ||
5 | +CORE_LIBRARIES="lib3270 libv3270" | ||
6 | +PACKAGE_PLUGINS="ipc" | ||
7 | +PACKAGE_LANGUAGE_BINDINGS="hllapi" | ||
8 | +TARGET_ARCHS="x86_32" | ||
9 | +GIT_URL="https://github.com/PerryWerneck" | ||
10 | + | ||
3 | PROJECTDIR=$(dirname $(dirname $(readlink -f ${0}))) | 11 | PROJECTDIR=$(dirname $(dirname $(readlink -f ${0}))) |
4 | WORKDIR=$(mktemp -d) | 12 | WORKDIR=$(mktemp -d) |
5 | PUBLISH=0 | 13 | PUBLISH=0 |
14 | +GET_PREREQS=0 | ||
6 | 15 | ||
7 | if [ -e /etc/os-release ]; then | 16 | if [ -e /etc/os-release ]; then |
8 | . /etc/os-release | 17 | . /etc/os-release |
9 | fi | 18 | fi |
10 | 19 | ||
20 | +if [ -e ~/.config/pw3270.build.conf ]; then | ||
21 | + . ~/.config/pw3270.build.conf | ||
22 | +fi | ||
23 | + | ||
11 | # | 24 | # |
12 | # Limpa diretório temporário | 25 | # Limpa diretório temporário |
13 | # | 26 | # |
@@ -16,380 +29,232 @@ cleanup() | @@ -16,380 +29,232 @@ cleanup() | ||
16 | rm -fr ${WORKDIR} | 29 | rm -fr ${WORKDIR} |
17 | } | 30 | } |
18 | 31 | ||
19 | -# | ||
20 | -# Monta projeto no diretório corrente. | ||
21 | -# | ||
22 | -build() | 32 | +failed() |
23 | { | 33 | { |
24 | - make clean | ||
25 | - | ||
26 | - make all | ||
27 | - if [ "$?" != "0" ]; then | ||
28 | - cleanup | ||
29 | - exit -1 | ||
30 | - fi | ||
31 | - | ||
32 | - cp -rv .bin/Release/* ${WORKDIR}/build/bin | ||
33 | - if [ "$?" != "0" ]; then | ||
34 | - cleanup | ||
35 | - exit -1 | ||
36 | - fi | ||
37 | - | ||
38 | - make DESTDIR=${WORKDIR}/build install | ||
39 | - if [ "$?" != "0" ]; then | ||
40 | - cleanup | ||
41 | - exit -1 | ||
42 | - fi | ||
43 | - | 34 | + echo "$@" |
35 | + cleanup | ||
36 | + exit -1 | ||
44 | } | 37 | } |
45 | 38 | ||
46 | -build_plugin() | 39 | +# |
40 | +# Get pre requisites from spec | ||
41 | +# | ||
42 | +getBuildRequires() | ||
47 | { | 43 | { |
48 | - | ||
49 | - echo -e "\e]2;${2}-${1}\a" | ||
50 | - | ||
51 | - cd ${WORKDIR}/sources/pw3270-plugin-${2} | ||
52 | - if [ "$?" != "0" ]; then | ||
53 | - cleanup | ||
54 | - exit -1 | ||
55 | - fi | ||
56 | - | ||
57 | - export cache=${WORKDIR}/cache/pw3270-plugin-${2}.cache | ||
58 | - | ||
59 | - ./configure \ | ||
60 | - CFLAGS=${CFLAGS} \ | ||
61 | - LDFLAGS=${LDFLAGS} \ | ||
62 | - LIB3270_CFLAGS="${LIB3270_CFLAGS}" \ | ||
63 | - LIB3270_LIBS="${LIB3270_LIBS}" \ | ||
64 | - LIBV3270_CFLAGS="${LIBV3270_CFLAGS}" \ | ||
65 | - LIBV3270_LIBS="${LIBV3270_LIBS}" \ | ||
66 | - --host=${host} \ | ||
67 | - --prefix=${prefix} \ | ||
68 | - --libdir=${prefix}/lib | ||
69 | - | ||
70 | - if [ "$?" != "0" ]; then | ||
71 | - cleanup | ||
72 | - exit -1 | ||
73 | - fi | ||
74 | - | ||
75 | - make all | ||
76 | - if [ "$?" != "0" ]; then | ||
77 | - cleanup | ||
78 | - exit -1 | ||
79 | - fi | ||
80 | - | ||
81 | - cp -rv .bin/Release/* ${WORKDIR}/build/bin | ||
82 | - if [ "$?" != "0" ]; then | ||
83 | - cleanup | ||
84 | - exit -1 | ||
85 | - fi | 44 | + for required in $(grep -i buildrequires "${1}" | grep -v "%" | cut -d: -f2-) |
45 | + do | ||
46 | + echo "Installing ${required}" | ||
47 | + sudo zypper --non-interactive --quiet in "${required}" | ||
48 | + done | ||
86 | 49 | ||
87 | } | 50 | } |
88 | 51 | ||
89 | # | 52 | # |
90 | -# Monta binários | 53 | +# Get Sources from GIT |
91 | # | 54 | # |
92 | -# $1 = Arquitetura (x86_32/x86_64) | ||
93 | -# | ||
94 | -pack() | 55 | +getSource() |
95 | { | 56 | { |
57 | + echo -e "\e]2;Getting sources for ${1}\a" | ||
58 | + echo "Getting sources for ${1}" | ||
96 | 59 | ||
97 | - echo -e "\e]2;pw3270-${1}\a" | ||
98 | - | ||
99 | - case ${1} in | ||
100 | - x86_32) | ||
101 | - host=i686-w64-mingw32 | ||
102 | - host_cpu=i686 | ||
103 | - prefix=/usr/i686-w64-mingw32/sys-root/mingw | ||
104 | - tools=i686-w64-mingw32 | ||
105 | - pkg_config=/usr/bin/i686-w64-mingw32-pkg-config | ||
106 | - mingw_name=mingw32 | ||
107 | - ;; | ||
108 | - | ||
109 | - x86_64) | ||
110 | - host=x86_64-w64-mingw32 | ||
111 | - host_cpu=x86_64 | ||
112 | - prefix=/usr/x86_64-w64-mingw32/sys-root/mingw | ||
113 | - tools=x86_64-w64-mingw32 | ||
114 | - pkg_config=/usr/bin/x86_64-w64-mingw32-pkg-config | ||
115 | - mingw_name=mingw64 | ||
116 | - ;; | ||
117 | - | ||
118 | - *) | ||
119 | - failed "Arquitetura desconhecida: ${1}" | ||
120 | - | ||
121 | - esac | ||
122 | - | ||
123 | -# sudo zypper \ | ||
124 | -# --non-interactive \ | ||
125 | -# in \ | ||
126 | -# ${mingw_name}-libcurl-devel \ | ||
127 | -# ${mingw_name}-curl \ | ||
128 | -# ${mingw_name}-libopenssl-devel \ | ||
129 | -# ${mingw_name}-libintl-devel \ | ||
130 | -# ${mingw_name}-atk-devel \ | ||
131 | -# ${mingw_name}-pango-devel \ | ||
132 | -# ${mingw_name}-win_iconv-devel \ | ||
133 | -# ${mingw_name}-pixman-devel \ | ||
134 | -# ${mingw_name}-glib2-devel \ | ||
135 | -# ${mingw_name}-cairo-devel \ | ||
136 | -# ${mingw_name}-freetype-devel \ | ||
137 | -# ${mingw_name}-winpthreads-devel \ | ||
138 | -# ${mingw_name}-gtk3-devel \ | ||
139 | -# ${mingw_name}-cross-gcc-c++ \ | ||
140 | -# ${mingw_name}-cross-pkg-config \ | ||
141 | -# ${mingw_name}-cross-cpp \ | ||
142 | -# ${mingw_name}-cross-binutils \ | ||
143 | -# ${mingw_name}-cross-nsis | ||
144 | - | ||
145 | - if [ "$?" != "0" ]; then | ||
146 | - cleanup | ||
147 | - exit -1 | ||
148 | - fi | ||
149 | - | ||
150 | - export HOST_CC=/usr/bin/gcc | ||
151 | - | ||
152 | - rm -fr ${WORKDIR}/cache | ||
153 | - mkdir -p ${WORKDIR}/cache | ||
154 | - | ||
155 | - rm -fr ${WORKDIR}/build | ||
156 | - mkdir -p ${WORKDIR}/build/src/include | ||
157 | - mkdir -p ${WORKDIR}/build/.bin/Release | ||
158 | - | ||
159 | - # | ||
160 | - # Setup Target dir | ||
161 | - # | ||
162 | - mkdir -p ${WORKDIR}/build/bin | ||
163 | - | ||
164 | - export CFLAGS=-I${WORKDIR}/build/${prefix}/include -DWIN32 -D_WIN32 | ||
165 | - export LDFLAGS=-L${WORKDIR}/build/bin | ||
166 | - export PKG_CONFIG_PATH=${WORKDIR}/build/${prefix}/lib/pkgconfig | ||
167 | - | ||
168 | - # | ||
169 | - # Build lib3270 | ||
170 | - # | ||
171 | - echo -e "\e]2;lib3270-${1}\a" | ||
172 | - | ||
173 | - cd ${WORKDIR}/sources/lib3270 | ||
174 | - export cache=${WORKDIR}/cache/lib3270.cache | ||
175 | - | ||
176 | - ./configure \ | ||
177 | - --host=${host} \ | ||
178 | - --prefix=${prefix} \ | ||
179 | - --libdir=${prefix}/lib | ||
180 | - | ||
181 | - if [ "$?" != "0" ]; then | ||
182 | - cleanup | ||
183 | - exit -1 | ||
184 | - fi | ||
185 | - | ||
186 | - build | ||
187 | - | ||
188 | - export LIB3270_CFLAGS="-DLIB3270_NAME=3270" | ||
189 | - export LIB3270_LIBS="-l3270" | ||
190 | - | ||
191 | - # | ||
192 | - # Build libv3270 | ||
193 | - # | ||
194 | - echo -e "\e]2;libv3270-${1}\a" | ||
195 | - | ||
196 | - cd ${WORKDIR}/sources/libv3270 | ||
197 | - export cache=${WORKDIR}/cache/libv3270.cache | ||
198 | - | ||
199 | - ./configure \ | ||
200 | - CFLAGS=${CFLAGS} \ | ||
201 | - LDFLAGS=${LDFLAGS} \ | ||
202 | - LIB3270_CFLAGS="${LIB3270_CFLAGS}" \ | ||
203 | - LIB3270_LIBS="${LIB3270_LIBS}" \ | ||
204 | - --host=${host} \ | ||
205 | - --prefix=${prefix} \ | ||
206 | - --libdir=${prefix}/lib | 60 | + mkdir -p ${WORKDIR}/sources |
207 | 61 | ||
62 | + git clone ${GIT_URL}/${1}.git ${WORKDIR}/sources/${1} | ||
208 | if [ "$?" != "0" ]; then | 63 | if [ "$?" != "0" ]; then |
209 | - cleanup | ||
210 | - exit -1 | 64 | + faile "Can't get sources for ${1}" |
211 | fi | 65 | fi |
212 | 66 | ||
213 | - build | 67 | + if [ "${GET_PREREQS}" != "0" ]; then |
68 | + for ARCH in ${ARCHS} | ||
69 | + do | ||
214 | 70 | ||
215 | - export LIBV3270_CFLAGS="-DLIBV3270_MODE=3270" | ||
216 | - export LIBV3270_LIBS="-lv3270" | 71 | + if [ -d ${WORKDIR}/sources/${1}/win/${ARCH} ]; then |
217 | 72 | ||
218 | - # | ||
219 | - # Build main application | ||
220 | - # | ||
221 | - echo -e "\e]2;pw3270-${1}\a" | 73 | + for spec in $(find ${WORKDIR}/sources/${1}/win/${ARCH} -name "*.spec") |
74 | + do | ||
75 | + getBuildRequires "${spec}" | ||
76 | + done | ||
222 | 77 | ||
223 | - cd ${WORKDIR}/sources/pw3270 | ||
224 | - export cache=${WORKDIR}/cache/application.cache | 78 | + fi |
225 | 79 | ||
226 | - ./configure \ | ||
227 | - CFLAGS=${CFLAGS} \ | ||
228 | - LDFLAGS=${LDFLAGS} \ | ||
229 | - LIB3270_CFLAGS="${LIB3270_CFLAGS}" \ | ||
230 | - LIB3270_LIBS="${LIB3270_LIBS}" \ | ||
231 | - LIBV3270_CFLAGS="${LIBV3270_CFLAGS}" \ | ||
232 | - LIBV3270_LIBS="${LIBV3270_LIBS}" \ | ||
233 | - --host=${host} \ | ||
234 | - --prefix=${prefix} \ | ||
235 | - --libdir=${prefix}/lib \ | ||
236 | - --with-source-locales=${WORKDIR}/locale | ||
237 | 80 | ||
238 | - if [ "$?" != "0" ]; then | ||
239 | - cleanup | ||
240 | - exit -1 | 81 | + done |
241 | fi | 82 | fi |
242 | 83 | ||
243 | - mkdir -p ${WORKDIR}/locale | ||
244 | - | ||
245 | - cp ${WORKDIR}/sources/lib3270/.pot/*.pot ${WORKDIR}/locale | ||
246 | - if [ "$?" != "0" ]; then | ||
247 | - cleanup | ||
248 | - exit -1 | ||
249 | - fi | 84 | + cd ${WORKDIR}/sources/${1} |
250 | 85 | ||
251 | - cp ${WORKDIR}/sources/libv3270/.pot/*.pot ${WORKDIR}/locale | 86 | + NOCONFIGURE=1 ./autogen.sh |
252 | if [ "$?" != "0" ]; then | 87 | if [ "$?" != "0" ]; then |
253 | cleanup | 88 | cleanup |
254 | exit -1 | 89 | exit -1 |
255 | fi | 90 | fi |
256 | 91 | ||
257 | - build | ||
258 | - | ||
259 | - # | ||
260 | - # Build plugins | ||
261 | - # | ||
262 | - build_plugin ${1} hllapi | ||
263 | - | ||
264 | - # | ||
265 | - # Install data & icons | ||
266 | - # | ||
267 | - echo -e "\e]2;pw3270-icons-${1}\a" | ||
268 | - | ||
269 | - cd ${WORKDIR}/sources/pw3270 | ||
270 | 92 | ||
271 | - make -C ${WORKDIR}/sources/pw3270 locale | ||
272 | - if [ "$?" != "0" ]; then | ||
273 | - cleanup | ||
274 | - exit -1 | ||
275 | - fi | ||
276 | - | ||
277 | - cp -rv .bin/locale ${WORKDIR}/build | ||
278 | - if [ "$?" != "0" ]; then | ||
279 | - cleanup | ||
280 | - exit -1 | ||
281 | - fi | 93 | +} |
282 | 94 | ||
283 | - mkdir -p ${WORKDIR}/build/win | 95 | +# |
96 | +# Build library | ||
97 | +# | ||
98 | +buildLibrary() | ||
99 | +{ | ||
100 | + for ARCH in ${ARCHS} | ||
101 | + do | ||
102 | + | ||
103 | + echo -e "\e]2;Building ${1} for ${ARCH}\a" | ||
104 | + echo "Building ${1} for ${ARCH}" | ||
105 | + | ||
106 | + case ${ARCH} in | ||
107 | + x86_32) | ||
108 | + host=i686-w64-mingw32 | ||
109 | + host_cpu=i686 | ||
110 | + prefix=/usr/i686-w64-mingw32/sys-root/mingw | ||
111 | + tools=i686-w64-mingw32 | ||
112 | + pkg_config=/usr/bin/i686-w64-mingw32-pkg-config | ||
113 | + ;; | ||
284 | 114 | ||
285 | - mkdir -p ${WORKDIR}/sources/pw3270/.bin/Release | ||
286 | - cp -rv ${WORKDIR}/build/bin/* ${WORKDIR}/sources/pw3270/.bin/Release | 115 | + x86_64) |
116 | + host=x86_64-w64-mingw32 | ||
117 | + host_cpu=x86_64 | ||
118 | + prefix=/usr/x86_64-w64-mingw32/sys-root/mingw | ||
119 | + tools=x86_64-w64-mingw32 | ||
120 | + pkg_config=/usr/bin/x86_64-w64-mingw32-pkg-config | ||
121 | + ;; | ||
287 | 122 | ||
288 | - chmod +x ${WORKDIR}/sources/pw3270/win/makeruntime.sh | ||
289 | - ${WORKDIR}/sources/pw3270/win/makeruntime.sh | ||
290 | - if [ "$?" != "0" ]; then | ||
291 | - cleanup | ||
292 | - exit -1 | ||
293 | - fi | 123 | + *) |
124 | + failed "Arquitetura desconhecida: ${1}" | ||
294 | 125 | ||
295 | - mkdir -p ${WORKDIR}/build/bin | ||
296 | - cp -rv ${WORKDIR}/sources/pw3270/.bin/runtime ${WORKDIR}/build/bin | ||
297 | - if [ "$?" != "0" ]; then | ||
298 | - cleanup | ||
299 | - exit -1 | ||
300 | - fi | 126 | + esac |
301 | 127 | ||
302 | - # | ||
303 | - # Copy branding | ||
304 | - # | ||
305 | - cp ${WORKDIR}/branding/*.ico ${WORKDIR}/build | ||
306 | - if [ "$?" != "0" ]; then | ||
307 | - cleanup | ||
308 | - exit -1 | ||
309 | - fi | 128 | + export HOST_CC=/usr/bin/gcc |
129 | + | ||
130 | + mkdir -p ${WORKDIR}/build/${ARCH} | ||
131 | + mkdir -p ${WORKDIR}/cache/${ARCH} | ||
132 | + mkdir -p ${WORKDIR}/build/${ARCH}/bin | ||
133 | + mkdir -p ${WORKDIR}/build/${ARCH}/lib | ||
134 | + mkdir -p ${WORKDIR}/build/${ARCH}/locale | ||
135 | + mkdir -p ${WORKDIR}/build/${ARCH}/include | ||
136 | + mkdir -p ${WORKDIR}/build/${ARCH}/sysconfig | ||
137 | + mkdir -p ${WORKDIR}/build/${ARCH}/data | ||
138 | + | ||
139 | + export PKG_CONFIG_PATH=${WORKDIR}/build/${ARCH}/lib/pkgconfig | ||
140 | + export cache=${WORKDIR}/cache/${ARCH}/${1}.cache | ||
141 | + | ||
142 | + cd ${WORKDIR}/sources/${1} | ||
143 | + | ||
144 | + ./configure \ | ||
145 | + CFLAGS="-I${WORKDIR}/build/${ARCH}/include" \ | ||
146 | + LDFLAGS="-L${WORKDIR}/build/${ARCH}/lib" \ | ||
147 | + --host=${host} \ | ||
148 | + --prefix=${prefix} \ | ||
149 | + --bindir=${WORKDIR}/build/${ARCH}/bin \ | ||
150 | + --libdir=${WORKDIR}/build/${ARCH}/lib \ | ||
151 | + --localedir=${WORKDIR}/build/${ARCH}/locale \ | ||
152 | + --includedir=${WORKDIR}/build/${ARCH}/include \ | ||
153 | + --sysconfdir=${WORKDIR}/build/${ARCH}/sysconfig \ | ||
154 | + --datadir=${WORKDIR}/build/${ARCH}/data \ | ||
155 | + --datarootdir=${WORKDIR}/build/${ARCH}/data | ||
310 | 156 | ||
311 | - cp ${WORKDIR}/branding/*.png ${WORKDIR}/build | ||
312 | - if [ "$?" != "0" ]; then | ||
313 | - cleanup | ||
314 | - exit -1 | ||
315 | - fi | 157 | + if [ "$?" != "0" ]; then |
158 | + failed "Can't configure ${1}" | ||
159 | + fi | ||
316 | 160 | ||
317 | - cp ${WORKDIR}/branding/AUTHORS ${WORKDIR}/build | ||
318 | - if [ "$?" != "0" ]; then | ||
319 | - cleanup | ||
320 | - exit -1 | ||
321 | - fi | 161 | + make all |
162 | + if [ "$?" != "0" ]; then | ||
163 | + failed "Can't buid ${1}" | ||
164 | + fi | ||
322 | 165 | ||
323 | - cp ${WORKDIR}/branding/LICENSE ${WORKDIR}/build | ||
324 | - if [ "$?" != "0" ]; then | ||
325 | - cleanup | ||
326 | - exit -1 | ||
327 | - fi | 166 | + make install |
167 | + if [ "$?" != "0" ]; then | ||
168 | + failed "Can't install ${1}" | ||
169 | + fi | ||
328 | 170 | ||
329 | - cp -rv ${WORKDIR}/branding/ui ${WORKDIR}/build | ||
330 | - if [ "$?" != "0" ]; then | ||
331 | - cleanup | ||
332 | - exit -1 | ||
333 | - fi | 171 | + done |
334 | 172 | ||
335 | - cp -rv ${WORKDIR}/branding/*.conf ${WORKDIR}/build | ||
336 | - if [ "$?" != "0" ]; then | ||
337 | - cleanup | ||
338 | - exit -1 | ||
339 | - fi | 173 | +} |
340 | 174 | ||
341 | - cp -rv ${WORKDIR}/sources/pw3270/charsets/*.xml ${WORKDIR}/build | ||
342 | - if [ "$?" != "0" ]; then | ||
343 | - cleanup | ||
344 | - exit -1 | ||
345 | - fi | 175 | +# |
176 | +# Build main application | ||
177 | +# | ||
178 | +buildApplication() | ||
179 | +{ | ||
180 | + for ARCH in ${ARCHS} | ||
181 | + do | ||
182 | + | ||
183 | + echo -e "\e]2;Building ${1} for ${ARCH}\a" | ||
184 | + echo "Building ${1} for ${ARCH}" | ||
185 | + | ||
186 | + case ${ARCH} in | ||
187 | + x86_32) | ||
188 | + host=i686-w64-mingw32 | ||
189 | + host_cpu=i686 | ||
190 | + prefix=/usr/i686-w64-mingw32/sys-root/mingw | ||
191 | + tools=i686-w64-mingw32 | ||
192 | + pkg_config=/usr/bin/i686-w64-mingw32-pkg-config | ||
193 | + ;; | ||
346 | 194 | ||
347 | - # | ||
348 | - # Create installation package | ||
349 | - # | ||
350 | - echo -e "\e]2;pw3270-package-${1}\a" | 195 | + x86_64) |
196 | + host=x86_64-w64-mingw32 | ||
197 | + host_cpu=x86_64 | ||
198 | + prefix=/usr/x86_64-w64-mingw32/sys-root/mingw | ||
199 | + tools=x86_64-w64-mingw32 | ||
200 | + pkg_config=/usr/bin/x86_64-w64-mingw32-pkg-config | ||
201 | + ;; | ||
351 | 202 | ||
352 | - cd ${WORKDIR}/build | 203 | + *) |
204 | + failed "Arquitetura desconhecida: ${1}" | ||
353 | 205 | ||
354 | - cp ${WORKDIR}/sources/pw3270/win/pw3270.nsi ./pw3270.nsi | ||
355 | - if [ "$?" != "0" ]; then | ||
356 | - cleanup | ||
357 | - exit -1 | ||
358 | - fi | 206 | + esac |
359 | 207 | ||
360 | - makensis -DWITHGTK pw3270.nsi | ||
361 | - if [ "$?" != "0" ]; then | ||
362 | - cleanup | ||
363 | - exit -1 | ||
364 | - fi | 208 | + export HOST_CC=/usr/bin/gcc |
209 | + | ||
210 | + mkdir -p ${WORKDIR}/build/${ARCH} | ||
211 | + mkdir -p ${WORKDIR}/cache/${ARCH} | ||
212 | + mkdir -p ${WORKDIR}/build/${ARCH}/bin | ||
213 | + mkdir -p ${WORKDIR}/build/${ARCH}/lib | ||
214 | + mkdir -p ${WORKDIR}/build/${ARCH}/locale | ||
215 | + mkdir -p ${WORKDIR}/build/${ARCH}/include | ||
216 | + mkdir -p ${WORKDIR}/build/${ARCH}/sysconfig | ||
217 | + mkdir -p ${WORKDIR}/build/${ARCH}/data | ||
218 | + | ||
219 | + export PKG_CONFIG_PATH=${WORKDIR}/build/${ARCH}/lib/pkgconfig | ||
220 | + export cache=${WORKDIR}/cache/${ARCH}/${1}.cache | ||
221 | + | ||
222 | + cd ${WORKDIR}/sources/${1} | ||
223 | + | ||
224 | + ./configure \ | ||
225 | + CFLAGS="-I${WORKDIR}/build/${ARCH}/include" \ | ||
226 | + LDFLAGS="-L${WORKDIR}/build/${ARCH}/lib" \ | ||
227 | + --host=${host} \ | ||
228 | + --prefix=${prefix} \ | ||
229 | + --bindir=${WORKDIR}/build/${ARCH}/bin \ | ||
230 | + --libdir=${WORKDIR}/build/${ARCH}/lib \ | ||
231 | + --localedir=${WORKDIR}/build/${ARCH}/locale \ | ||
232 | + --includedir=${WORKDIR}/build/${ARCH}/include \ | ||
233 | + --sysconfdir=${WORKDIR}/build/${ARCH}/sysconfig \ | ||
234 | + --datadir=${WORKDIR}/build/${ARCH}/data \ | ||
235 | + --datarootdir=${WORKDIR}/build/${ARCH}/data | ||
365 | 236 | ||
366 | - cp -v *.exe ${PROJECTDIR} | ||
367 | - if [ "$?" != "0" ]; then | ||
368 | - cleanup | ||
369 | - exit -1 | ||
370 | - fi | 237 | + if [ "$?" != "0" ]; then |
238 | + failed "Can't configure ${1}" | ||
239 | + fi | ||
371 | 240 | ||
372 | - if [ -d ~/public_html/win/pw3270 ]; then | ||
373 | - mkdir -p ~/public_html/win/pw3270/${1} | ||
374 | - cp -v *.exe ~/public_html/win/pw3270/${1} | 241 | + make all |
375 | if [ "$?" != "0" ]; then | 242 | if [ "$?" != "0" ]; then |
376 | - cleanup | ||
377 | - exit -1 | 243 | + failed "Can't buid ${1}" |
378 | fi | 244 | fi |
379 | - fi | ||
380 | 245 | ||
381 | - if [ "${PUBLISH}" == "1" ] && [ ! -z ${WIN_PACKAGE_SERVER} ]; then | ||
382 | - scp *.exe ${WIN_PACKAGE_SERVER}/pw3270 | 246 | + make install |
383 | if [ "$?" != "0" ]; then | 247 | if [ "$?" != "0" ]; then |
384 | - cleanup | ||
385 | - exit -1 | 248 | + failed "Can't install ${1}" |
386 | fi | 249 | fi |
387 | - fi | 250 | + |
251 | + done | ||
252 | + | ||
388 | 253 | ||
389 | } | 254 | } |
390 | 255 | ||
391 | # | 256 | # |
392 | -# Setup options | 257 | +# Check command line parameters |
393 | # | 258 | # |
394 | until [ -z "$1" ] | 259 | until [ -z "$1" ] |
395 | do | 260 | do |
@@ -409,25 +274,25 @@ do | @@ -409,25 +274,25 @@ do | ||
409 | ;; | 274 | ;; |
410 | 275 | ||
411 | CLEAR) | 276 | CLEAR) |
412 | - if [ -d ~/public_html/win/pw3270 ]; then | ||
413 | - rm -fr ~/public_html/win/pw3270/{x86_32,x86_64} | 277 | + if [ -d ~/public_html/win/${PROJECT_NAME} ]; then |
278 | + rm -fr ~/public_html/win/${PROJECT_NAME}/{x86_32,x86_64} | ||
414 | fi | 279 | fi |
415 | - ;; | ||
416 | 280 | ||
281 | + ;; | ||
417 | HELP) | 282 | HELP) |
418 | - echo "${0} [OPTIONS]" | 283 | + echo "${0} [options]" |
419 | echo "" | 284 | echo "" |
420 | echo "Options:" | 285 | echo "Options:" |
421 | echo "" | 286 | echo "" |
422 | 287 | ||
423 | if [ ! -z ${WIN_PACKAGE_SERVER} ]; then | 288 | if [ ! -z ${WIN_PACKAGE_SERVER} ]; then |
424 | - echo " --nopublish Don't send packages to ${WIN_PACKAGE_SERVER}/pw3270" | ||
425 | - echo " --publish Send packages to ${WIN_PACKAGE_SERVER}/pw3270" | 289 | + echo " --nopublish Don't publish binaries in ${WIN_PACKAGE_SERVER}" |
290 | + echo " --publish Publish binaries in ${WIN_PACKAGE_SERVER}" | ||
426 | fi | 291 | fi |
427 | 292 | ||
428 | 293 | ||
429 | - if [ -d ~/public_html/win/pw3270 ]; then | ||
430 | - echo " --clear Remove directories ~/public_html/win/pw3270/{x86_32,x86_64}" | 294 | + if [ -d ~/public_html/win/${PROJECT_NAME} ]; then |
295 | + echo " --clear Remove ~/public_html/win/${PROJECT_NAME}/{x86_32,x86_64}" | ||
431 | fi | 296 | fi |
432 | 297 | ||
433 | echo "" | 298 | echo "" |
@@ -442,124 +307,51 @@ do | @@ -442,124 +307,51 @@ do | ||
442 | 307 | ||
443 | done | 308 | done |
444 | 309 | ||
445 | - | ||
446 | - | ||
447 | # | 310 | # |
448 | -# Get sources from GIT | 311 | +# Download sources |
449 | # | 312 | # |
450 | -mkdir -p ${WORKDIR}/sources | ||
451 | - | ||
452 | -for src in lib3270 libv3270 pw3270 pw3270-plugin-hllapi; do | ||
453 | - | ||
454 | - echo "Baixando ${src}..." | ||
455 | - echo -e "\e]2;Downloading ${src}\a" | ||
456 | - | ||
457 | - git clone https://github.com/PerryWerneck/${src}.git ${WORKDIR}/sources/${src} | ||
458 | - if [ "$?" != "0" ]; then | ||
459 | - cleanup | ||
460 | - exit -1 | ||
461 | - fi | ||
462 | - | ||
463 | - cd ${WORKDIR}/sources/${src} | 313 | +for src in ${CORE_LIBRARIES} |
314 | +do | ||
315 | + getSource ${src} | ||
316 | +done | ||
464 | 317 | ||
465 | - NOCONFIGURE=1 ./autogen.sh | ||
466 | - if [ "$?" != "0" ]; then | ||
467 | - cleanup | ||
468 | - exit -1 | ||
469 | - fi | 318 | +getSource pw3270 |
470 | 319 | ||
320 | +for src in ${PACKAGE_PLUGINS} | ||
321 | +do | ||
322 | + getSource pw3270-plugin-${src} | ||
323 | +done | ||
471 | 324 | ||
325 | +for src in ${PACKAGE_LANGUAGE_BINDINGS} | ||
326 | +do | ||
327 | + getSource lib3270-${src}-bindings | ||
472 | done | 328 | done |
473 | 329 | ||
474 | # | 330 | # |
475 | -# Setup branding | 331 | +# Build packages |
476 | # | 332 | # |
477 | -echo -e "\e]2;Branding\a" | ||
478 | - | ||
479 | -mkdir -p ${WORKDIR}/branding | ||
480 | - | ||
481 | -BRANDING_SOURCES=${WORKDIR}/sources/pw3270/branding | ||
482 | - | ||
483 | -cp -rv ${BRANDING_SOURCES}/* ${WORKDIR}/branding | ||
484 | -if [ "$?" != "0" ]; then | ||
485 | - cleanup | ||
486 | - exit -1 | ||
487 | -fi | ||
488 | - | ||
489 | -convert -density 384 -background transparent ${BRANDING_SOURCES}/pw3270.svg -define icon:auto-resize -colors 256 ${WORKDIR}/branding/pw3270.ico | ||
490 | -if [ "$?" != "0" ]; then | ||
491 | - cleanup | ||
492 | - exit -1 | ||
493 | -fi | ||
494 | - | ||
495 | -convert -background transparent ${BRANDING_SOURCES}/pw3270.svg ${WORKDIR}/branding/pw3270.png | ||
496 | -if [ "$?" != "0" ]; then | ||
497 | - cleanup | ||
498 | - exit -1 | ||
499 | -fi | ||
500 | - | ||
501 | -optipng -o7 ${WORKDIR}/branding/pw3270.png | ||
502 | -if [ "$?" != "0" ]; then | ||
503 | - cleanup | ||
504 | - exit -1 | ||
505 | -fi | ||
506 | - | ||
507 | -convert -background transparent ${BRANDING_SOURCES}/pw3270-logo.svg ${WORKDIR}/branding/pw3270-logo.png | ||
508 | -if [ "$?" != "0" ]; then | ||
509 | - cleanup | ||
510 | - exit -1 | ||
511 | -fi | ||
512 | - | ||
513 | -optipng -o7 ${WORKDIR}/branding/pw3270-logo.png | ||
514 | -if [ "$?" != "0" ]; then | ||
515 | - cleanup | ||
516 | - exit -1 | ||
517 | -fi | ||
518 | - | ||
519 | -cp ${WORKDIR}/sources/pw3270/AUTHORS ${WORKDIR}/branding | ||
520 | -if [ "$?" != "0" ]; then | ||
521 | - cleanup | ||
522 | - exit -1 | ||
523 | -fi | 333 | +for src in ${CORE_LIBRARIES} |
334 | +do | ||
335 | + buildLibrary ${src} | ||
336 | +done | ||
524 | 337 | ||
525 | -cp ${WORKDIR}/sources/pw3270/LICENSE ${WORKDIR}/branding | ||
526 | -if [ "$?" != "0" ]; then | ||
527 | - cleanup | ||
528 | - exit -1 | ||
529 | -fi | 338 | +buildApplication pw3270 |
530 | 339 | ||
531 | -cp ${WORKDIR}/sources/pw3270/conf/colors.conf ${WORKDIR}/branding | ||
532 | -if [ "$?" != "0" ]; then | ||
533 | - cleanup | ||
534 | - exit -1 | ||
535 | -fi | 340 | +for src in ${PACKAGE_PLUGINS} |
341 | +do | ||
342 | + buildLibrary pw3270-plugin-${src} | ||
343 | +done | ||
536 | 344 | ||
537 | -cp -rv ${WORKDIR}/sources/pw3270/ui ${WORKDIR}/branding | ||
538 | -if [ "$?" != "0" ]; then | ||
539 | - cleanup | ||
540 | - exit -1 | ||
541 | -fi | 345 | +for src in ${PACKAGE_LANGUAGE_BINDINGS} |
346 | +do | ||
347 | + buildLibrary lib3270-${src}-bindings | ||
348 | +done | ||
542 | 349 | ||
543 | -# | ||
544 | -# Create installers | ||
545 | -# | ||
546 | -pack x86_32 | ||
547 | -pack x86_64 | 350 | +cd ${WORKDIR}/build |
351 | +/bin/bash | ||
548 | 352 | ||
549 | cleanup | 353 | cleanup |
550 | 354 | ||
551 | 355 | ||
552 | 356 | ||
553 | 357 | ||
554 | - | ||
555 | - | ||
556 | - | ||
557 | - | ||
558 | - | ||
559 | - | ||
560 | - | ||
561 | - | ||
562 | - | ||
563 | - | ||
564 | - | ||
565 | - |