1 #!/bin/bash |
1 #!/bin/sh |
2 # |
2 |
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
3 PREFIX=/usr |
4 # |
4 EPREFIX=$PREFIX |
5 # Copyright 2011 Olaf Wintermann. All rights reserved. |
5 |
6 # |
6 BINDIR= |
7 # Redistribution and use in source and binary forms, with or without |
7 SBINDIR= |
8 # modification, are permitted provided that the following conditions are met: |
8 LIBDIR= |
9 # |
9 LIBEXECDIR= |
10 # 1. Redistributions of source code must retain the above copyright notice, |
10 DATADIR= |
11 # this list of conditions and the following disclaimer. |
11 SYSCONFDIR= |
12 # |
12 SHAREDSTATEDIR= |
13 # 2. Redistributions in binary form must reproduce the above copyright |
13 LOCALSTATEDIR= |
14 # notice, this list of conditions and the following disclaimer in the |
14 INCLUDEDIR= |
15 # documentation and/or other materials provided with the distribution. |
15 INFODIR= |
16 # |
16 MANDIR= |
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
|
18 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|
19 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
|
20 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
|
21 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
22 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
|
23 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
|
24 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
|
25 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
|
26 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
27 # POSSIBILITY OF SUCH DAMAGE. |
|
28 # |
|
29 |
17 |
30 OS=`uname -s` |
18 OS=`uname -s` |
31 OS_VERSION=`uname -r` |
19 OS_VERSION=`uname -r` |
32 PREFIX=/opt/toolkit |
20 |
33 |
21 TEMP_DIR=".tmp-`uname -n`" |
34 # |
22 mkdir -p $TEMP_DIR |
35 # parse arguments |
23 if [ $? -ne 0 ]; then |
|
24 echo "Cannot create tmp dir" |
|
25 echo "Abort" |
|
26 fi |
|
27 touch $TEMP_DIR/options |
|
28 touch $TEMP_DIR/features |
|
29 |
|
30 # features |
|
31 |
|
32 # help text |
|
33 printhelp() |
|
34 { |
|
35 echo "Usage: $0 [OPTIONS]..." |
|
36 cat << __EOF__ |
|
37 Installation directories: |
|
38 --prefix=PREFIX path prefix for architecture-independent files |
|
39 [/usr] |
|
40 --exec-prefix=EPREFIX path prefix for architecture-dependent files |
|
41 [PREFIX] |
|
42 |
|
43 --bindir=DIR user executables [EPREFIX/bin] |
|
44 --sbindir=DIR system admin executables [EPREFIX/sbin] |
|
45 --libexecdir=DIR program executables [EPREFIX/libexec] |
|
46 --sysconfdir=DIR system configuration files [PREFIX/etc] |
|
47 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] |
|
48 --localstatedir=DIR modifiable single-machine data [PREFIX/var] |
|
49 --libdir=DIR object code libraries [EPREFIX/lib] |
|
50 --includedir=DIR C header files [PREFIX/include] |
|
51 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] |
|
52 --datadir=DIR read-only architecture-independent data [DATAROOTDIR] |
|
53 --infodir=DIR info documentation [DATAROOTDIR/info] |
|
54 --mandir=DIR man documentation [DATAROOTDIR/man] |
|
55 |
|
56 Options: |
|
57 --toolkit=(gtk3|gtk2|gtk2legacy|qt5|qt4|motif) |
|
58 |
|
59 __EOF__ |
|
60 } |
|
61 |
|
62 # |
|
63 # parse arguments |
36 # |
64 # |
37 for ARG in $@ |
65 for ARG in $@ |
38 do |
66 do |
39 if [[ $ARG == --prefix=* ]]; then |
67 if [[ $ARG == --prefix=* ]]; then |
40 PREFIX=${ARG:9} |
68 PREFIX=${ARG:9} |
|
69 elif [[ $ARG = --exec-prefix=* ]]; then |
|
70 EPREFIX=${ARG:14} |
|
71 elif [[ $ARG = --bindir=* ]]; then |
|
72 BINDIR=${ARG:9} |
|
73 elif [[ $ARG = --sbindir=* ]]; then |
|
74 SBINDIR=${ARG:10} |
|
75 elif [[ $ARG = --libdir=* ]]; then |
|
76 LIBDIR=${ARG:9} |
|
77 elif [[ $ARG = --libexecdir=* ]]; then |
|
78 LIBEXECDIR=${ARG:13} |
|
79 elif [[ $ARG = --datadir=* ]]; then |
|
80 DATADIR=${ARG:10} |
|
81 elif [[ $ARG = --sysconfdir=* ]]; then |
|
82 SYSCONFDIR=${ARG:13} |
|
83 elif [[ $ARG = --sharedstatedir=* ]]; then |
|
84 SHAREDSTATEDIR=${ARG:17} |
|
85 elif [[ $ARG = --localstatedir=* ]]; then |
|
86 LOCALSTATEDIR=${ARG:16} |
|
87 elif [[ $ARG = --includedir=* ]]; then |
|
88 INCLUDEDIR=${ARG:12} |
|
89 elif [[ $ARG = --infodir=* ]]; then |
|
90 INFODIR=${ARG:10} |
|
91 elif [[ $ARG = --mandir=* ]]; then |
|
92 MANDIR=${ARG:9} |
|
93 elif [ $ARG = "--help" ]; then |
|
94 printhelp |
|
95 exit 0 |
41 elif [[ $ARG == --toolkit=* ]]; then |
96 elif [[ $ARG == --toolkit=* ]]; then |
42 # todo: check for invalid toolkit |
97 OPT_TOOLKIT=${ARG:10} |
43 TOOLKIT=${ARG:10} |
|
44 elif [ $ARG = "--help" ]; then |
|
45 # todo: print help text |
|
46 echo "no help yet" |
|
47 exit 0 |
|
48 fi |
98 fi |
49 done |
99 done |
50 |
100 |
51 # |
101 # set dir variables |
52 # check_pkgconfig_lib() |
102 if [ -z $BINDIR ]; then |
53 # |
103 BINDIR=$EPREFIX/bin |
54 # arg1: display package name |
104 fi |
55 # arg2: pkg-config package name |
105 if [ -z $SBINDIR ]; then |
56 # |
106 SBINDIR=$EPREFIX/sbin |
57 check_pkgconfig_lib() |
107 fi |
58 { |
108 if [ -z $LIBDIR ]; then |
59 printf "checking for " |
109 LIBDIRDIR=$EPREFIX/lib |
60 printf $1 |
110 fi |
61 printf "... " |
111 if [ -z $LIBEXEC ]; then |
62 pkg-config $2 |
112 LIBExECDIR=$EPREFIX/libexec |
63 RESULT=$? |
113 fi |
64 if [ $RESULT -eq 0 ]; then |
114 if [ -z $DATADIR ]; then |
65 echo "ok" |
115 DATADIR=$PREFIX/share |
66 else |
116 fi |
67 echo "not found" |
117 if [ -z $SYSCONFDIR]; then |
68 echo |
118 SYSCONFDIR=$PREFIX/etc |
69 echo "missing package" $1 |
119 fi |
70 exit -1 |
120 if [ -z $SHAREDSTATEDIR ]; then |
71 fi |
121 SHAREDSTATEDIR=$PREFIX/com |
72 } |
122 fi |
73 |
123 if [ -z $LOCALSTATEDIR ]; then |
74 |
124 LOCALSTATEDIR=$PREFIX/var |
75 # |
125 fi |
76 # check OS and libraries |
126 if [ -z $INCLUDEDIR ]; then |
77 # |
127 INCLUDEDIR=$PREFIX/include |
78 |
128 fi |
79 printf "checking for toolchain... " |
129 if [ -z $INFODIR ]; then |
|
130 INFODIR=$PREFIX/info |
|
131 fi |
|
132 if [ -z $MANDIR ]; then |
|
133 MANDIR=$PREFIX/man |
|
134 fi |
|
135 |
|
136 which pkg-config > /dev/null |
|
137 if [ $? -ne 0 ]; then |
|
138 PKG_CONFIG=pkg-config |
|
139 else |
|
140 PKG_CONFIG=false |
|
141 fi |
|
142 |
|
143 # Simple uname based platform detection |
|
144 # $PLATFORM is used for platform dependent dependency selection |
|
145 printf "detect platform... " |
80 if [ $OS = SunOS ]; then |
146 if [ $OS = SunOS ]; then |
81 BUILD_CONFIG=suncc |
147 PLATFORM="solaris sunos unix svr4" |
82 echo "suncc" |
148 fi |
83 fi |
|
84 |
|
85 if [ $OS = Linux ]; then |
149 if [ $OS = Linux ]; then |
86 BUILD_CONFIG=gcc |
150 PLATFORM="linux unix" |
87 echo "gcc" |
151 fi |
88 fi |
|
89 |
|
90 if [ $OS = FreeBSD ]; then |
152 if [ $OS = FreeBSD ]; then |
91 BUILD_CONFIG=clang |
153 PLATFORM="freebsd bsd unix" |
92 echo "clang" |
154 fi |
93 fi |
|
94 |
|
95 if [ $OS = Darwin ]; then |
155 if [ $OS = Darwin ]; then |
96 BUILD_CONFIG=osx |
156 PLATFORM="macos osx bsd unix" |
97 echo "gcc" |
157 fi |
98 fi |
158 echo $OS | grep "MINGW" > /dev/null |
99 |
|
100 echo $OS | grep -q "MINGW" |
|
101 if [ $? -eq 0 ]; then |
159 if [ $? -eq 0 ]; then |
102 BUILD_CONFIG=mingw |
160 PLATFORM="windows mingw" |
103 echo "mingw" |
161 fi |
104 fi |
162 |
105 |
163 if [ -z "$PLATFORM" ]; then |
106 if [ -z "BUILD_CONFIG" ]; then |
164 PLATFORM="unix" |
107 BUILD_CONFIG=gcc |
165 fi |
108 echo "gcc" |
166 |
109 fi |
167 for p in $PLATFORM |
110 |
168 do |
111 |
169 PLATFORM_NAME=$p |
112 #if [ $OS != Darwin ]; then |
170 break |
113 # check_pkgconfig_lib "libxml2" "libxml-2.0" |
171 done |
114 #fi |
172 echo $PLATFORM_NAME |
115 |
173 |
116 if [ -z $TOOLKIT ]; then |
174 isplatform() |
117 printf "checking for gui library... " |
175 { |
118 if [ $OS = SunOS ]; then |
176 for p in $PLATFORM |
119 if [ $OS_VERSION = 5.10 ]; then |
177 do |
120 TOOLKIT=gtk2legacy |
178 if [ $p = $1 ]; then |
|
179 return 0 |
|
180 fi |
|
181 done |
|
182 return 1 |
|
183 } |
|
184 |
|
185 # generate config.mk and config.h |
|
186 cat > $TEMP_DIR/config.mk << __EOF__ |
|
187 # |
|
188 # config.mk generated by configure |
|
189 # |
|
190 __EOF__ |
|
191 |
|
192 echo > $TEMP_DIR/make.mk |
|
193 |
|
194 ENV_CFLAGS=$CFLAGS |
|
195 ENV_LDFLAGS=$LDFLAGS |
|
196 ENV_CXXFLAGS=$CXXFLAGS |
|
197 |
|
198 # Toolchain detection |
|
199 # this will insert make vars to config.mk |
|
200 source make/toolchain.sh |
|
201 |
|
202 # add user specified flags to config.mk |
|
203 echo >> $TEMP_DIR/config.mk |
|
204 if [[ ! -z ${ENV_CFLAGS} ]]; then |
|
205 echo "CFLAGS += $ENV_CFLAGS" >> $TEMP_DIR/config.mk |
|
206 fi |
|
207 if [[ ! -z ${ENV_CXXFLAGS} ]]; then |
|
208 echo "CXXFLAGS += $ENV_CXXFLAGS" >> $TEMP_DIR/config.mk |
|
209 fi |
|
210 if [[ ! -z ${ENV_LDFLAGS} ]]; then |
|
211 echo "LDFLAGS += $ENV_LDFLAGS" >> $TEMP_DIR/config.mk |
|
212 fi |
|
213 |
|
214 # |
|
215 # DEPENDENCIES |
|
216 # |
|
217 |
|
218 dependency_qt4() |
|
219 { |
|
220 printf "checking for qt4... " |
|
221 # dependency qt4 |
|
222 while true |
|
223 do |
|
224 qmake-qt4 -o - /dev/null | grep DEFINES\ > /dev/null |
|
225 if [ $? -eq 0 ]; then |
|
226 CFLAGS+=" `qmake-qt4 -o - /dev/null | grep DEFINES\ `" |
121 else |
227 else |
122 TOOLKIT=gtk2 |
228 break |
123 fi |
229 fi |
124 echo "gtk2" |
230 qmake-qt4 -o - /dev/null | grep INCPATH\ > /dev/null |
125 elif [ $OS = Darwin ]; then |
231 if [ $? -eq 0 ]; then |
126 TOOLKIT=cocoa |
232 CFLAGS+=" `qmake-qt4 -o - /dev/null | grep INCPATH\ `" |
127 echo "Cocoa" |
|
128 else |
|
129 pkg-config gtk+-3.0 |
|
130 RESULT=$? |
|
131 if [ $RESULT -eq 0 ]; then |
|
132 TOOLKIT=gtk3 |
|
133 echo "gtk3" |
|
134 else |
233 else |
135 pkg-config gtk+-2.0 |
234 break |
136 RESULT=$? |
235 fi |
137 if [ $RESULT -eq 0 ]; then |
236 > /dev/null |
138 TOOLKIT=gtk2 |
237 if [ $? -eq 0 ]; then |
139 echo "gtk2" |
238 LDFLAGS+=" ``" |
140 else |
239 else |
141 which qmake-qt4 > /dev/null |
240 break |
142 RESULT=$? |
241 fi |
143 if [ $RESULT -eq 0 ]; then |
242 which qmake-qt4 > /dev/null |
144 TOOLKIT=qt4 |
243 if [ $? -ne 0 ]; then |
145 echo "qt4" |
244 break |
146 else |
245 fi |
147 echo "not found" |
246 echo yes |
148 exit 1 |
247 return 0 |
149 fi |
248 done |
150 fi |
249 |
151 fi |
250 echo no |
152 fi |
251 return 1 |
153 fi |
252 } |
154 |
253 dependency_gtk2legacy() |
155 |
254 { |
156 # generate config.mk |
255 printf "checking for gtk2legacy... " |
157 |
256 # dependency gtk2legacy |
158 cat > config.mk << __EOF__ |
257 while true |
159 # |
258 do |
160 # config.mk generated by configure |
259 if [ -z "PKG_CONFIG" ]; then |
161 # |
260 break |
162 |
261 fi |
163 PREFIX = ${PREFIX} |
262 if ! pkg-config gtk+-2.0 ; then |
164 |
263 break |
165 include \$(BUILD_ROOT)/make/${BUILD_CONFIG}.mk |
264 fi |
166 |
265 CFLAGS+=" `pkg-config --cflags gtk+-2.0`" |
167 __EOF__ |
266 LDFLAGS+=" `pkg-config --libs gtk+-2.0`" |
168 |
267 CFLAGS+="-DUI_GTK2 -DUI_GTK2LEGACY" |
169 # toolkit config |
268 LDFLAGS+="-lpthread" |
170 make/configure_${TOOLKIT}.sh |
269 echo yes |
171 |
270 return 0 |
|
271 done |
|
272 |
|
273 echo no |
|
274 return 1 |
|
275 } |
|
276 dependency_qt5() |
|
277 { |
|
278 printf "checking for qt5... " |
|
279 # dependency qt5 |
|
280 while true |
|
281 do |
|
282 qmake-qt5 -o - /dev/null | grep DEFINES\ > /dev/null |
|
283 if [ $? -eq 0 ]; then |
|
284 CFLAGS+=" `qmake-qt5 -o - /dev/null | grep DEFINES\ `" |
|
285 else |
|
286 break |
|
287 fi |
|
288 qmake-qt5 -o - /dev/null | grep INCPATH\ > /dev/null |
|
289 if [ $? -eq 0 ]; then |
|
290 CFLAGS+=" `qmake-qt5 -o - /dev/null | grep INCPATH\ `" |
|
291 else |
|
292 break |
|
293 fi |
|
294 > /dev/null |
|
295 if [ $? -eq 0 ]; then |
|
296 LDFLAGS+=" ``" |
|
297 else |
|
298 break |
|
299 fi |
|
300 which qmake-qt5 > /dev/null |
|
301 if [ $? -ne 0 ]; then |
|
302 break |
|
303 fi |
|
304 echo yes |
|
305 return 0 |
|
306 done |
|
307 |
|
308 echo no |
|
309 return 1 |
|
310 } |
|
311 dependency_gtk2() |
|
312 { |
|
313 printf "checking for gtk2... " |
|
314 # dependency gtk2 |
|
315 while true |
|
316 do |
|
317 if [ -z "PKG_CONFIG" ]; then |
|
318 break |
|
319 fi |
|
320 if ! pkg-config gtk+-2.0 ; then |
|
321 break |
|
322 fi |
|
323 CFLAGS+=" `pkg-config --cflags gtk+-2.0`" |
|
324 LDFLAGS+=" `pkg-config --libs gtk+-2.0`" |
|
325 CFLAGS+="-DUI_GTK2" |
|
326 LDFLAGS+="-lpthread" |
|
327 pkg-config --atleast-version=2.20 gtk+-2.0 > /dev/null |
|
328 if [ $? -ne 0 ]; then |
|
329 break |
|
330 fi |
|
331 echo yes |
|
332 return 0 |
|
333 done |
|
334 |
|
335 echo no |
|
336 return 1 |
|
337 } |
|
338 dependency_gtk3() |
|
339 { |
|
340 printf "checking for gtk3... " |
|
341 # dependency gtk3 |
|
342 while true |
|
343 do |
|
344 if [ -z "PKG_CONFIG" ]; then |
|
345 break |
|
346 fi |
|
347 if ! pkg-config gtk+-3.0 ; then |
|
348 break |
|
349 fi |
|
350 CFLAGS+=" `pkg-config --cflags gtk+-3.0`" |
|
351 LDFLAGS+=" `pkg-config --libs gtk+-3.0`" |
|
352 CFLAGS+="-DUI_GTK3" |
|
353 LDFLAGS+="-lpthread" |
|
354 echo yes |
|
355 return 0 |
|
356 done |
|
357 |
|
358 echo no |
|
359 return 1 |
|
360 } |
|
361 dependency_motif() |
|
362 { |
|
363 printf "checking for motif... " |
|
364 # dependency motif |
|
365 while true |
|
366 do |
|
367 CFLAGS+="-DUI_MOTIF" |
|
368 LDFLAGS+="-lXm -lXt -lX11 -lpthread" |
|
369 echo yes |
|
370 return 0 |
|
371 done |
|
372 |
|
373 echo no |
|
374 return 1 |
|
375 } |
|
376 dependency_wpf() |
|
377 { |
|
378 printf "checking for wpf... " |
|
379 # dependency wpf platform="windows" |
|
380 while true |
|
381 do |
|
382 if ! isplatform "windows"; then |
|
383 break |
|
384 fi |
|
385 CFLAGS+="-DUI_WPF" |
|
386 echo yes |
|
387 return 0 |
|
388 done |
|
389 |
|
390 echo no |
|
391 return 1 |
|
392 } |
|
393 dependency_cocoa() |
|
394 { |
|
395 printf "checking for cocoa... " |
|
396 # dependency cocoa platform="macos" |
|
397 while true |
|
398 do |
|
399 if ! isplatform "macos"; then |
|
400 break |
|
401 fi |
|
402 CFLAGS+="-DUI_COCOA" |
|
403 LDFLAGS+="-lobjc -framework Cocoa" |
|
404 echo yes |
|
405 return 0 |
|
406 done |
|
407 |
|
408 echo no |
|
409 return 1 |
|
410 } |
|
411 |
|
412 DEPENDENCIES_FAILED= |
|
413 ERROR=0 |
|
414 |
|
415 # |
|
416 # OPTION VALUES |
|
417 # |
|
418 checkopt_toolkit_gtk3() |
|
419 { |
|
420 VERR=0 |
|
421 dependency_gtk3 |
|
422 if [ $? -ne 0 ]; then |
|
423 VERR=1 |
|
424 fi |
|
425 if [ $VERR -ne 0 ]; then |
|
426 return 1 |
|
427 fi |
|
428 cat >> $TEMP_DIR/make.mk << __EOF__ |
|
429 TOOLKIT = gtk |
|
430 GTKOBJ = draw_cairo.o |
|
431 |
|
432 __EOF__ |
|
433 return 0 |
|
434 } |
|
435 checkopt_toolkit_gtk2() |
|
436 { |
|
437 VERR=0 |
|
438 dependency_gtk2 |
|
439 if [ $? -ne 0 ]; then |
|
440 VERR=1 |
|
441 fi |
|
442 if [ $VERR -ne 0 ]; then |
|
443 return 1 |
|
444 fi |
|
445 cat >> $TEMP_DIR/make.mk << __EOF__ |
|
446 TOOLKIT = gtk |
|
447 GTKOBJ = draw_cairo.o |
|
448 |
|
449 __EOF__ |
|
450 return 0 |
|
451 } |
|
452 checkopt_toolkit_gtk2legacy() |
|
453 { |
|
454 VERR=0 |
|
455 dependency_gtk2legacy |
|
456 if [ $? -ne 0 ]; then |
|
457 VERR=1 |
|
458 fi |
|
459 if [ $VERR -ne 0 ]; then |
|
460 return 1 |
|
461 fi |
|
462 cat >> $TEMP_DIR/make.mk << __EOF__ |
|
463 TOOLKIT = gtk |
|
464 GTKOBJ = draw_gdk.o |
|
465 |
|
466 __EOF__ |
|
467 return 0 |
|
468 } |
|
469 checkopt_toolkit_qt5() |
|
470 { |
|
471 VERR=0 |
|
472 dependency_qt5 |
|
473 if [ $? -ne 0 ]; then |
|
474 VERR=1 |
|
475 fi |
|
476 if [ $VERR -ne 0 ]; then |
|
477 return 1 |
|
478 fi |
|
479 cat >> $TEMP_DIR/make.mk << __EOF__ |
|
480 TOOLKIT = qt |
|
481 LD = $(CXX) |
|
482 |
|
483 __EOF__ |
|
484 return 0 |
|
485 } |
|
486 checkopt_toolkit_qt4() |
|
487 { |
|
488 VERR=0 |
|
489 dependency_qt4 |
|
490 if [ $? -ne 0 ]; then |
|
491 VERR=1 |
|
492 fi |
|
493 if [ $VERR -ne 0 ]; then |
|
494 return 1 |
|
495 fi |
|
496 cat >> $TEMP_DIR/make.mk << __EOF__ |
|
497 TOOLKIT = qt |
|
498 LD = $(CXX) |
|
499 |
|
500 __EOF__ |
|
501 return 0 |
|
502 } |
|
503 checkopt_toolkit_motif() |
|
504 { |
|
505 VERR=0 |
|
506 dependency_motif |
|
507 if [ $? -ne 0 ]; then |
|
508 VERR=1 |
|
509 fi |
|
510 if [ $VERR -ne 0 ]; then |
|
511 return 1 |
|
512 fi |
|
513 cat >> $TEMP_DIR/make.mk << __EOF__ |
|
514 TOOLKIT = motif |
|
515 |
|
516 __EOF__ |
|
517 return 0 |
|
518 } |
|
519 |
|
520 # |
|
521 # TARGETS |
|
522 # |
|
523 CFLAGS= |
|
524 CXXFLAGS= |
|
525 LDFLAGS= |
|
526 |
|
527 # Target: tk |
|
528 CFLAGS= |
|
529 LDFLAGS= |
|
530 CXXFLAGS= |
|
531 |
|
532 |
|
533 # Option: --toolkit |
|
534 if [ -z $OPT_TOOLKIT ]; then |
|
535 SAVED_ERROR=$ERROR |
|
536 SAVED_DEPENDENCIES_FAILED=$DEPENDENCIES_FAILED |
|
537 ERROR=0 |
|
538 while true |
|
539 do |
|
540 if isplatform "windows"; then |
|
541 checkopt_toolkit_wpf |
|
542 if [ $? -eq 0 ]; then |
|
543 echo " toolkit: wpf" >> $TEMP_DIR/options |
|
544 ERROR=0 |
|
545 break |
|
546 fi |
|
547 fi |
|
548 if isplatform "macos"; then |
|
549 checkopt_toolkit_cocoa |
|
550 if [ $? -eq 0 ]; then |
|
551 echo " toolkit: cocoa" >> $TEMP_DIR/options |
|
552 ERROR=0 |
|
553 break |
|
554 fi |
|
555 fi |
|
556 checkopt_toolkit_gtk3 |
|
557 if [ $? -eq 0 ]; then |
|
558 echo " toolkit: gtk3" >> $TEMP_DIR/options |
|
559 ERROR=0 |
|
560 break |
|
561 fi |
|
562 checkopt_toolkit_qt5 |
|
563 if [ $? -eq 0 ]; then |
|
564 echo " toolkit: qt5" >> $TEMP_DIR/options |
|
565 ERROR=0 |
|
566 break |
|
567 fi |
|
568 checkopt_toolkit_gtk2 |
|
569 if [ $? -eq 0 ]; then |
|
570 echo " toolkit: gtk2" >> $TEMP_DIR/options |
|
571 ERROR=0 |
|
572 break |
|
573 fi |
|
574 checkopt_toolkit_qt4 |
|
575 if [ $? -eq 0 ]; then |
|
576 echo " toolkit: qt4" >> $TEMP_DIR/options |
|
577 ERROR=0 |
|
578 break |
|
579 fi |
|
580 checkopt_toolkit_motif |
|
581 if [ $? -eq 0 ]; then |
|
582 echo " toolkit: motif" >> $TEMP_DIR/options |
|
583 ERROR=0 |
|
584 break |
|
585 fi |
|
586 break |
|
587 done |
|
588 if [ $ERROR -ne 0 ]; then |
|
589 SAVED_ERROR=1 |
|
590 fi |
|
591 ERROR=$SAVED_ERROR |
|
592 DEPENDENCIES_FAILED=$SAVED_DEPENDENCIES_FAILED= |
|
593 else |
|
594 if false; then |
|
595 false |
|
596 elif [ $OPT_TOOLKIT = "gtk3" ]; then |
|
597 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options |
|
598 checkopt_toolkit_gtk3 |
|
599 if [ $? -ne 0 ]; then |
|
600 ERROR=1 |
|
601 fi |
|
602 elif [ $OPT_TOOLKIT = "gtk2" ]; then |
|
603 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options |
|
604 checkopt_toolkit_gtk2 |
|
605 if [ $? -ne 0 ]; then |
|
606 ERROR=1 |
|
607 fi |
|
608 elif [ $OPT_TOOLKIT = "gtk2legacy" ]; then |
|
609 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options |
|
610 checkopt_toolkit_gtk2legacy |
|
611 if [ $? -ne 0 ]; then |
|
612 ERROR=1 |
|
613 fi |
|
614 elif [ $OPT_TOOLKIT = "qt5" ]; then |
|
615 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options |
|
616 checkopt_toolkit_qt5 |
|
617 if [ $? -ne 0 ]; then |
|
618 ERROR=1 |
|
619 fi |
|
620 elif [ $OPT_TOOLKIT = "qt4" ]; then |
|
621 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options |
|
622 checkopt_toolkit_qt4 |
|
623 if [ $? -ne 0 ]; then |
|
624 ERROR=1 |
|
625 fi |
|
626 elif [ $OPT_TOOLKIT = "motif" ]; then |
|
627 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options |
|
628 checkopt_toolkit_motif |
|
629 if [ $? -ne 0 ]; then |
|
630 ERROR=1 |
|
631 fi |
|
632 fi |
|
633 fi |
|
634 |
|
635 echo >> $TEMP_DIR/config.mk |
|
636 if [[ ! -z ${CFLAGS} ]]; then |
|
637 echo "TK_CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk |
|
638 fi |
|
639 if [[ ! -z ${CXXFLAGS} ]]; then |
|
640 echo "TK_CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk |
|
641 fi |
|
642 if [[ ! -z ${LDFLAGS} ]]; then |
|
643 echo "TK_LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk |
|
644 fi |
|
645 |
|
646 if [ $ERROR -ne 0 ]; then |
|
647 echo |
|
648 echo "Error: Unresolved dependencies" |
|
649 echo $DEPENCIES_FAILED |
|
650 rm -Rf $TEMP_DIR |
|
651 exit 1 |
|
652 fi |
172 |
653 |
173 echo "configure finished" |
654 echo "configure finished" |
174 echo |
655 echo |
175 echo " PREFIX: $PREFIX" |
656 echo "Build Config:" |
176 echo " BUILD_CONFIG: $BUILD_CONFIG" |
657 echo " PREFIX: $PREFIX" |
177 echo " TOOLKIT: $TOOLKIT" |
658 echo " TOOLCHAIN: $TOOLCHAIN_NAME" |
|
659 echo "Options:" |
|
660 cat $TEMP_DIR/options |
178 echo |
661 echo |
179 |
662 cat $TEMP_DIR/config.mk $TEMP_DIR/make.mk > config.mk |
|
663 rm -Rf $TEMP_DIR |
|
664 |
|
665 |