1 #!/bin/sh |
|
2 |
|
3 # create temporary directory |
|
4 TEMP_DIR=".tmp-`uname -n`" |
|
5 rm -Rf "$TEMP_DIR" |
|
6 if mkdir -p "$TEMP_DIR"; then |
|
7 : |
|
8 else |
|
9 echo "Cannot create tmp dir $TEMP_DIR" |
|
10 echo "Abort" |
|
11 exit 1 |
|
12 fi |
|
13 touch "$TEMP_DIR/options" |
|
14 touch "$TEMP_DIR/features" |
|
15 |
|
16 # define standard variables |
|
17 PREFIX=/usr |
|
18 EPREFIX= |
|
19 BINDIR= |
|
20 SBINDIR= |
|
21 LIBDIR= |
|
22 LIBEXECDIR= |
|
23 DATADIR= |
|
24 SYSCONFDIR= |
|
25 SHAREDSTATEDIR= |
|
26 LOCALSTATEDIR= |
|
27 INCLUDEDIR= |
|
28 INFODIR= |
|
29 MANDIR= |
|
30 |
|
31 # custom variables |
|
32 |
|
33 # features |
|
34 FEATURE_DB=auto |
|
35 |
|
36 # clean abort |
|
37 abort_configure() |
|
38 { |
|
39 rm -Rf "$TEMP_DIR" |
|
40 exit 1 |
|
41 } |
|
42 |
|
43 # help text |
|
44 printhelp() |
|
45 { |
|
46 echo "Usage: $0 [OPTIONS]..." |
|
47 cat << __EOF__ |
|
48 Installation directories: |
|
49 --prefix=PREFIX path prefix for architecture-independent files |
|
50 [/usr] |
|
51 --exec-prefix=EPREFIX path prefix for architecture-dependent files |
|
52 [PREFIX] |
|
53 |
|
54 --bindir=DIR user executables [EPREFIX/bin] |
|
55 --sbindir=DIR system admin executables [EPREFIX/sbin] |
|
56 --libexecdir=DIR program executables [EPREFIX/libexec] |
|
57 --sysconfdir=DIR system configuration files [PREFIX/etc] |
|
58 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] |
|
59 --localstatedir=DIR modifiable single-machine data [PREFIX/var] |
|
60 --libdir=DIR object code libraries [EPREFIX/lib] |
|
61 --includedir=DIR C header files [PREFIX/include] |
|
62 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] |
|
63 --datadir=DIR read-only architecture-independent data [DATAROOTDIR] |
|
64 --infodir=DIR info documentation [DATAROOTDIR/info] |
|
65 --mandir=DIR man documentation [DATAROOTDIR/man] |
|
66 |
|
67 Options: |
|
68 --debug add extra compile flags for debug builds |
|
69 --release add extra compile flags for release builds |
|
70 --toolkit=(gtk3|cli|gtk2|wpf) |
|
71 |
|
72 Optional Features: |
|
73 --disable-db |
|
74 --enable-gui |
|
75 |
|
76 __EOF__ |
|
77 } |
|
78 |
|
79 # |
|
80 # parse arguments |
|
81 # |
|
82 BUILD_TYPE="default" |
|
83 for ARG in "$@" |
|
84 do |
|
85 case "$ARG" in |
|
86 "--prefix="*) PREFIX=${ARG#--prefix=} ;; |
|
87 "--exec-prefix="*) EPREFIX=${ARG#--exec-prefix=} ;; |
|
88 "--bindir="*) BINDIR=${ARG#----bindir=} ;; |
|
89 "--sbindir="*) SBINDIR=${ARG#--sbindir=} ;; |
|
90 "--libdir="*) LIBDIR=${ARG#--libdir=} ;; |
|
91 "--libexecdir="*) LIBEXECDIR=${ARG#--libexecdir=} ;; |
|
92 "--datadir="*) DATADIR=${ARG#--datadir=} ;; |
|
93 "--sysconfdir="*) SYSCONFDIR=${ARG#--sysconfdir=} ;; |
|
94 "--sharedstatedir="*) SHAREDSTATEDIR=${ARG#--sharedstatedir=} ;; |
|
95 "--localstatedir="*) LOCALSTATEDIR=${ARG#--localstatedir=} ;; |
|
96 "--includedir="*) INCLUDEDIR=${ARG#--includedir=} ;; |
|
97 "--infodir="*) INFODIR=${ARG#--infodir=} ;; |
|
98 "--mandir"*) MANDIR=${ARG#--mandir} ;; |
|
99 "--help"*) printhelp; abort_configure ;; |
|
100 "--debug") BUILD_TYPE="debug" ;; |
|
101 "--release") BUILD_TYPE="release" ;; |
|
102 "--toolkit="*) OPT_TOOLKIT=${ARG#--toolkit=} ;; |
|
103 "--enable-db") FEATURE_DB=on ;; |
|
104 "--disable-db") unset FEATURE_DB ;; |
|
105 "--enable-gui") FEATURE_GUI=on ;; |
|
106 "--disable-gui") unset FEATURE_GUI ;; |
|
107 "-"*) echo "unknown option: $ARG"; abort_configure ;; |
|
108 esac |
|
109 done |
|
110 |
|
111 |
|
112 # set dir variables |
|
113 : ${EPREFIX:="$PREFIX"} |
|
114 : ${BINDIR:="$EPREFIX/bin"} |
|
115 : ${SBINDIR:="$EPREFIX/sbin"} |
|
116 : ${LIBDIR:="$EPREFIX/lib"} |
|
117 : ${LIBEXECDIR:="$EPREFIX/libexec"} |
|
118 : ${DATADIR:="$PREFIX/share"} |
|
119 : ${SYSCONFDIR:="$PREFIX/etc"} |
|
120 : ${SHAREDSTATEDIR:="$PREFIX/com"} |
|
121 : ${LOCALSTATEDIR:="$PREFIX/var"} |
|
122 : ${INCLUDEDIR:="$PREFIX/include"} |
|
123 : ${INFODIR:="$PREFIX/info"} |
|
124 : ${MANDIR:="$PREFIX/man"} |
|
125 |
|
126 # Test for availability of pkg-config |
|
127 PKG_CONFIG=`command -v pkg-config` |
|
128 : ${PKG_CONFIG:="false"} |
|
129 |
|
130 # Simple uname based platform detection |
|
131 # $PLATFORM is used for platform dependent dependency selection |
|
132 OS=`uname -s` |
|
133 OS_VERSION=`uname -r` |
|
134 printf "detect platform... " |
|
135 if [ "$OS" = "SunOS" ]; then |
|
136 PLATFORM="solaris sunos unix svr4" |
|
137 fi |
|
138 if [ "$OS" = "Linux" ]; then |
|
139 PLATFORM="linux unix" |
|
140 fi |
|
141 if [ "$OS" = "FreeBSD" ]; then |
|
142 PLATFORM="freebsd bsd unix" |
|
143 fi |
|
144 if [ "$OS" = "Darwin" ]; then |
|
145 PLATFORM="macos osx bsd unix" |
|
146 fi |
|
147 if echo "$OS" | grep -i "MINGW" > /dev/null; then |
|
148 PLATFORM="windows mingw" |
|
149 fi |
|
150 : ${PLATFORM:="unix"} |
|
151 |
|
152 PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -` |
|
153 echo "$PLATFORM_NAME" |
|
154 |
|
155 isplatform() |
|
156 { |
|
157 for p in $PLATFORM |
|
158 do |
|
159 if [ "$p" = "$1" ]; then |
|
160 return 0 |
|
161 fi |
|
162 done |
|
163 return 1 |
|
164 } |
|
165 notisplatform() |
|
166 { |
|
167 for p in $PLATFORM |
|
168 do |
|
169 if [ "$p" = "$1" ]; then |
|
170 return 1 |
|
171 fi |
|
172 done |
|
173 return 0 |
|
174 } |
|
175 |
|
176 |
|
177 # generate vars.mk |
|
178 cat > "$TEMP_DIR/vars.mk" << __EOF__ |
|
179 PREFIX="$PREFIX" |
|
180 EPREFIX="$EPREFIX" |
|
181 BINDIR="$BINDIR" |
|
182 SBINDIR="$SBINDIR" |
|
183 LIBDIR="$LIBDIR" |
|
184 LIBEXECDIR="$LIBEXECDIR" |
|
185 DATADIR="$DATADIR" |
|
186 SYSCONFDIR="$SYSCONFDIR" |
|
187 SHAREDSTATEDIR="$SHAREDSTATEDIR" |
|
188 LOCALSTATEDIR="$LOCALSTATEDIR" |
|
189 INCLUDEDIR="$INCLUDEDIR" |
|
190 INFODIR="$INFODIR" |
|
191 MANDIR="$MANDIR" |
|
192 __EOF__ |
|
193 sort -u -o "$TEMP_DIR/vars.mk" "$TEMP_DIR/vars.mk" |
|
194 |
|
195 |
|
196 # toolchain detection utilities |
|
197 . make/toolchain.sh |
|
198 |
|
199 # |
|
200 # DEPENDENCIES |
|
201 # |
|
202 |
|
203 # check languages |
|
204 lang_c= |
|
205 lang_cpp= |
|
206 if detect_c_compiler ; then |
|
207 lang_c=1 |
|
208 fi |
|
209 |
|
210 # create buffer for make variables required by dependencies |
|
211 echo > "$TEMP_DIR/make.mk" |
|
212 |
|
213 test_pkg_config() |
|
214 { |
|
215 if "$PKG_CONFIG" --exists "$1" ; then : |
|
216 else return 1 ; fi |
|
217 if [ -z "$2" ] || "$PKG_CONFIG" --atleast-version="$2" "$1" ; then : |
|
218 else return 1 ; fi |
|
219 if [ -z "$3" ] || "$PKG_CONFIG" --exact-version="$3" "$1" ; then : |
|
220 else return 1 ; fi |
|
221 if [ -z "$4" ] || "$PKG_CONFIG" --max-version="$4" "$1" ; then : |
|
222 else return 1 ; fi |
|
223 return 0 |
|
224 } |
|
225 |
|
226 dependency_error_qt4() |
|
227 { |
|
228 printf "checking for qt4... " |
|
229 # dependency qt4 |
|
230 while true |
|
231 do |
|
232 if which qmake-qt4 > /dev/null ; then |
|
233 : |
|
234 else |
|
235 break |
|
236 fi |
|
237 echo yes |
|
238 return 1 |
|
239 done |
|
240 |
|
241 echo no |
|
242 return 0 |
|
243 } |
|
244 dependency_error_curl() |
|
245 { |
|
246 printf "checking for curl... " |
|
247 # dependency curl platform="windows" |
|
248 while true |
|
249 do |
|
250 if notisplatform "windows"; then |
|
251 break |
|
252 fi |
|
253 TEMP_CFLAGS="$TEMP_CFLAGS -I/mingw/include" |
|
254 TEMP_LDFLAGS="$TEMP_LDFLAGS -lcurl" |
|
255 echo yes |
|
256 return 1 |
|
257 done |
|
258 |
|
259 # dependency curl platform="macos" |
|
260 while true |
|
261 do |
|
262 if notisplatform "macos"; then |
|
263 break |
|
264 fi |
|
265 if tmp_flags=`curl-config --cflags` ; then |
|
266 TEMP_CFLAGS="$TEMP_CFLAGS $tmp_flags" |
|
267 else |
|
268 break |
|
269 fi |
|
270 if tmp_flags=`curl-config --ldflags` ; then |
|
271 TEMP_LDFLAGS="$TEMP_LDFLAGS $tmp_flags" |
|
272 else |
|
273 break |
|
274 fi |
|
275 echo yes |
|
276 return 1 |
|
277 done |
|
278 |
|
279 # dependency curl |
|
280 while true |
|
281 do |
|
282 if [ -z "$PKG_CONFIG" ]; then |
|
283 break |
|
284 fi |
|
285 if test_pkg_config "libcurl" "" "" "" ; then |
|
286 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libcurl`" |
|
287 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libcurl`" |
|
288 else |
|
289 break |
|
290 fi |
|
291 echo yes |
|
292 return 1 |
|
293 done |
|
294 |
|
295 echo no |
|
296 return 0 |
|
297 } |
|
298 dependency_error_gtk2() |
|
299 { |
|
300 printf "checking for gtk2... " |
|
301 # dependency gtk2 |
|
302 while true |
|
303 do |
|
304 if [ -z "$PKG_CONFIG" ]; then |
|
305 break |
|
306 fi |
|
307 if test_pkg_config "gtk+-2.0" "" "" "" ; then |
|
308 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags gtk+-2.0`" |
|
309 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs gtk+-2.0`" |
|
310 else |
|
311 break |
|
312 fi |
|
313 echo yes |
|
314 return 1 |
|
315 done |
|
316 |
|
317 echo no |
|
318 return 0 |
|
319 } |
|
320 dependency_error_sqlite() |
|
321 { |
|
322 printf "checking for sqlite... " |
|
323 # dependency sqlite |
|
324 while true |
|
325 do |
|
326 if [ -z "$PKG_CONFIG" ]; then |
|
327 break |
|
328 fi |
|
329 if test_pkg_config "sqlite3" "" "" "" ; then |
|
330 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags sqlite3`" |
|
331 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs sqlite3`" |
|
332 else |
|
333 break |
|
334 fi |
|
335 echo yes |
|
336 return 1 |
|
337 done |
|
338 |
|
339 echo no |
|
340 return 0 |
|
341 } |
|
342 dependency_error_test() |
|
343 { |
|
344 printf "checking for test... " |
|
345 # dependency test platform="bsd" |
|
346 while true |
|
347 do |
|
348 if notisplatform "bsd"; then |
|
349 break |
|
350 fi |
|
351 if isplatform "macos"; then |
|
352 break |
|
353 fi |
|
354 TEMP_CFLAGS="$TEMP_CFLAGS -DBSD" |
|
355 echo yes |
|
356 return 1 |
|
357 done |
|
358 |
|
359 # dependency test |
|
360 while true |
|
361 do |
|
362 TEMP_CFLAGS="$TEMP_CFLAGS -DTEST" |
|
363 echo yes |
|
364 return 1 |
|
365 done |
|
366 |
|
367 echo no |
|
368 return 0 |
|
369 } |
|
370 dependency_error_gtk3() |
|
371 { |
|
372 printf "checking for gtk3... " |
|
373 # dependency gtk3 |
|
374 while true |
|
375 do |
|
376 if [ -z "$PKG_CONFIG" ]; then |
|
377 break |
|
378 fi |
|
379 if test_pkg_config "gtk+-5.0" "" "" "" ; then |
|
380 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags gtk+-5.0`" |
|
381 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs gtk+-5.0`" |
|
382 else |
|
383 break |
|
384 fi |
|
385 echo yes |
|
386 return 1 |
|
387 done |
|
388 |
|
389 echo no |
|
390 return 0 |
|
391 } |
|
392 dependency_error_deptest() |
|
393 { |
|
394 printf "checking for deptest... " |
|
395 # dependency deptest |
|
396 while true |
|
397 do |
|
398 TEMP_CFLAGS="$TEMP_CFLAGS -DDEPTEST" |
|
399 echo yes |
|
400 return 1 |
|
401 done |
|
402 |
|
403 echo no |
|
404 return 0 |
|
405 } |
|
406 dependency_error_libxml2() |
|
407 { |
|
408 printf "checking for libxml2... " |
|
409 # dependency libxml2 |
|
410 while true |
|
411 do |
|
412 if [ -z "$PKG_CONFIG" ]; then |
|
413 break |
|
414 fi |
|
415 if test_pkg_config "libxml-2.0" "2.8" "" "" ; then |
|
416 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libxml-2.0`" |
|
417 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libxml-2.0`" |
|
418 else |
|
419 break |
|
420 fi |
|
421 cat >> $TEMP_DIR/make.mk << __EOF__ |
|
422 # Dependency: libxml2 |
|
423 xml = libxml2 |
|
424 |
|
425 __EOF__ |
|
426 echo yes |
|
427 return 1 |
|
428 done |
|
429 |
|
430 echo no |
|
431 return 0 |
|
432 } |
|
433 |
|
434 |
|
435 |
|
436 |
|
437 # start collecting dependency information |
|
438 echo > "$TEMP_DIR/flags.mk" |
|
439 |
|
440 DEPENDENCIES_FAILED= |
|
441 ERROR=0 |
|
442 # unnamed dependencies |
|
443 TEMP_CFLAGS= |
|
444 TEMP_CXXFLAGS= |
|
445 TEMP_LDFLAGS= |
|
446 while true |
|
447 do |
|
448 while true |
|
449 do |
|
450 if [ -z "$lang_c" ] ; then |
|
451 ERROR=1 |
|
452 break |
|
453 fi |
|
454 |
|
455 cat >> "$TEMP_DIR/make.mk" << __EOF__ |
|
456 MVAR = 123 |
|
457 MVAR += 123 |
|
458 |
|
459 __EOF__ |
|
460 break |
|
461 done |
|
462 break |
|
463 done |
|
464 |
|
465 # add general dependency flags to flags.mk |
|
466 echo "# general flags" >> "$TEMP_DIR/flags.mk" |
|
467 if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then |
|
468 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" |
|
469 fi |
|
470 if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then |
|
471 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" |
|
472 fi |
|
473 if [ -n "${TEMP_LDFLAGS}" ]; then |
|
474 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" |
|
475 fi |
|
476 |
|
477 # |
|
478 # OPTION VALUES |
|
479 # |
|
480 checkopt_toolkit_gtk3() |
|
481 { |
|
482 VERR=0 |
|
483 if dependency_error_gtk3 ; then |
|
484 VERR=1 |
|
485 fi |
|
486 if [ $VERR -ne 0 ]; then |
|
487 return 1 |
|
488 fi |
|
489 TEMP_CFLAGS="$TEMP_CFLAGS -Da=b" |
|
490 TEMP_CXXFLAGS="$TEMP_CXXFLAGS -Da=b" |
|
491 cat >> "$TEMP_DIR/make.mk" << __EOF__ |
|
492 UIOBJ += graphics_cairo.o |
|
493 |
|
494 __EOF__ |
|
495 return 0 |
|
496 } |
|
497 checkopt_toolkit_cli() |
|
498 { |
|
499 VERR=0 |
|
500 if dependency_error_curl ; then |
|
501 VERR=1 |
|
502 fi |
|
503 if dependency_error_test ; then |
|
504 VERR=1 |
|
505 fi |
|
506 if [ $VERR -ne 0 ]; then |
|
507 return 1 |
|
508 fi |
|
509 return 0 |
|
510 } |
|
511 checkopt_toolkit_gtk2() |
|
512 { |
|
513 VERR=0 |
|
514 if dependency_error_gtk2 ; then |
|
515 VERR=1 |
|
516 fi |
|
517 if [ $VERR -ne 0 ]; then |
|
518 return 1 |
|
519 fi |
|
520 return 0 |
|
521 } |
|
522 checkopt_toolkit_wpf() |
|
523 { |
|
524 VERR=0 |
|
525 if dependency_error_test ; then |
|
526 VERR=1 |
|
527 fi |
|
528 if [ $VERR -ne 0 ]; then |
|
529 return 1 |
|
530 fi |
|
531 return 0 |
|
532 } |
|
533 |
|
534 # |
|
535 # TARGETS |
|
536 # |
|
537 |
|
538 echo >> "$TEMP_DIR/flags.mk" |
|
539 echo "configuring target: dav" |
|
540 echo "# flags for target dav" >> "$TEMP_DIR/flags.mk" |
|
541 TEMP_CFLAGS= |
|
542 TEMP_CXXFLAGS= |
|
543 TEMP_LDFLAGS= |
|
544 |
|
545 if dependency_error_curl; then |
|
546 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED curl " |
|
547 ERROR=1 |
|
548 fi |
|
549 if dependency_error_libxml2; then |
|
550 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 " |
|
551 ERROR=1 |
|
552 fi |
|
553 if dependency_error_test; then |
|
554 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED test " |
|
555 ERROR=1 |
|
556 fi |
|
557 |
|
558 # Features |
|
559 if [ -n "$FEATURE_DB" ]; then |
|
560 # check dependency |
|
561 if dependency_error_sqlite ; then |
|
562 # "auto" features can fail and are just disabled in this case |
|
563 if [ "$FEATURE_DB" = "auto" ]; then |
|
564 DISABLE_FEATURE_DB=1 |
|
565 else |
|
566 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED sqlite " |
|
567 ERROR=1 |
|
568 fi |
|
569 fi |
|
570 if [ -n "$DISABLE_FEATURE_DB" ]; then |
|
571 unset FEATURE_DB |
|
572 fi |
|
573 fi |
|
574 if [ -n "$FEATURE_GUI" ]; then |
|
575 # check dependency |
|
576 if dependency_error_gtk3 ; then |
|
577 # "auto" features can fail and are just disabled in this case |
|
578 if [ "$FEATURE_GUI" = "auto" ]; then |
|
579 DISABLE_FEATURE_GUI=1 |
|
580 else |
|
581 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED gtk3 " |
|
582 ERROR=1 |
|
583 fi |
|
584 fi |
|
585 if [ -n "$DISABLE_FEATURE_GUI" ]; then |
|
586 unset FEATURE_GUI |
|
587 fi |
|
588 fi |
|
589 |
|
590 # Option: --toolkit |
|
591 if [ -z "$OPT_TOOLKIT" ]; then |
|
592 echo "auto-detecting option 'toolkit'" |
|
593 SAVED_ERROR="$ERROR" |
|
594 SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED" |
|
595 ERROR=1 |
|
596 while true |
|
597 do |
|
598 if isplatform "windows"; then |
|
599 if checkopt_toolkit_wpf ; then |
|
600 echo " toolkit: wpf" >> "$TEMP_DIR/options" |
|
601 ERROR=0 |
|
602 break |
|
603 fi |
|
604 fi |
|
605 if checkopt_toolkit_gtk3 ; then |
|
606 echo " toolkit: gtk3" >> "$TEMP_DIR/options" |
|
607 ERROR=0 |
|
608 break |
|
609 fi |
|
610 if checkopt_toolkit_gtk2 ; then |
|
611 echo " toolkit: gtk2" >> "$TEMP_DIR/options" |
|
612 ERROR=0 |
|
613 break |
|
614 fi |
|
615 break |
|
616 done |
|
617 if [ $ERROR -ne 0 ]; then |
|
618 SAVED_ERROR=1 |
|
619 SAVED_DEPENDENCIES_FAILED="option 'toolkit' $SAVED_DEPENDENCIES_FAILED" |
|
620 fi |
|
621 ERROR="$SAVED_ERROR" |
|
622 DEPENDENCIES_FAILED="$SAVED_DEPENDENCIES_FAILED" |
|
623 else |
|
624 echo "checking option toolkit = $OPT_TOOLKIT" |
|
625 if false; then |
|
626 false |
|
627 elif [ "$OPT_TOOLKIT" = "gtk3" ]; then |
|
628 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options |
|
629 if checkopt_toolkit_gtk3 ; then |
|
630 : |
|
631 else |
|
632 ERROR=1 |
|
633 DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED" |
|
634 fi |
|
635 elif [ "$OPT_TOOLKIT" = "cli" ]; then |
|
636 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options |
|
637 if checkopt_toolkit_cli ; then |
|
638 : |
|
639 else |
|
640 ERROR=1 |
|
641 DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED" |
|
642 fi |
|
643 elif [ "$OPT_TOOLKIT" = "gtk2" ]; then |
|
644 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options |
|
645 if checkopt_toolkit_gtk2 ; then |
|
646 : |
|
647 else |
|
648 ERROR=1 |
|
649 DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED" |
|
650 fi |
|
651 elif [ "$OPT_TOOLKIT" = "wpf" ]; then |
|
652 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options |
|
653 if checkopt_toolkit_wpf ; then |
|
654 : |
|
655 else |
|
656 ERROR=1 |
|
657 DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED" |
|
658 fi |
|
659 fi |
|
660 fi |
|
661 |
|
662 if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then |
|
663 echo "DAV_CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" |
|
664 fi |
|
665 if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then |
|
666 echo "DAV_CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" |
|
667 fi |
|
668 if [ "$BUILD_TYPE" = "debug" ]; then |
|
669 if [ -n "$lang_c" ]; then |
|
670 echo 'DAV_CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" |
|
671 fi |
|
672 if [ -n "$lang_cpp" ]; then |
|
673 echo 'DAV_CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" |
|
674 fi |
|
675 fi |
|
676 if [ "$BUILD_TYPE" = "release" ]; then |
|
677 if [ -n "$lang_c" ]; then |
|
678 echo 'DAV_CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" |
|
679 fi |
|
680 if [ -n "$lang_cpp" ]; then |
|
681 echo 'DAV_CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" |
|
682 fi |
|
683 fi |
|
684 if [ -n "${TEMP_LDFLAGS}" ]; then |
|
685 echo "DAV_LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" |
|
686 fi |
|
687 |
|
688 echo >> "$TEMP_DIR/flags.mk" |
|
689 echo "configuring global target" |
|
690 echo "# flags for unnamed target" >> "$TEMP_DIR/flags.mk" |
|
691 TEMP_CFLAGS= |
|
692 TEMP_CXXFLAGS= |
|
693 TEMP_LDFLAGS= |
|
694 |
|
695 if dependency_error_deptest; then |
|
696 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED deptest " |
|
697 ERROR=1 |
|
698 fi |
|
699 |
|
700 # Features |
|
701 |
|
702 |
|
703 if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then |
|
704 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" |
|
705 fi |
|
706 if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then |
|
707 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" |
|
708 fi |
|
709 if [ "$BUILD_TYPE" = "debug" ]; then |
|
710 if [ -n "$lang_c" ]; then |
|
711 echo 'CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" |
|
712 fi |
|
713 if [ -n "$lang_cpp" ]; then |
|
714 echo 'CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" |
|
715 fi |
|
716 fi |
|
717 if [ "$BUILD_TYPE" = "release" ]; then |
|
718 if [ -n "$lang_c" ]; then |
|
719 echo 'CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" |
|
720 fi |
|
721 if [ -n "$lang_cpp" ]; then |
|
722 echo 'CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" |
|
723 fi |
|
724 fi |
|
725 if [ -n "${TEMP_LDFLAGS}" ]; then |
|
726 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" |
|
727 fi |
|
728 |
|
729 |
|
730 # final result |
|
731 if [ $ERROR -ne 0 ]; then |
|
732 echo |
|
733 echo "Error: Unresolved dependencies" |
|
734 echo "$DEPENDENCIES_FAILED" |
|
735 abort_configure |
|
736 fi |
|
737 |
|
738 echo "configure finished" |
|
739 echo |
|
740 echo "Build Config:" |
|
741 echo " PREFIX: $PREFIX" |
|
742 echo " TOOLCHAIN: $TOOLCHAIN_NAME" |
|
743 echo "Options:" |
|
744 cat "$TEMP_DIR/options" |
|
745 echo "Features:" |
|
746 if [ -n "$FEATURE_DB" ]; then |
|
747 echo " db: on" |
|
748 else |
|
749 echo " db: off" |
|
750 fi |
|
751 if [ -n "$FEATURE_GUI" ]; then |
|
752 echo " gui: on" |
|
753 else |
|
754 echo " gui: off" |
|
755 fi |
|
756 echo |
|
757 |
|
758 # generate the config.mk file |
|
759 cat > "$TEMP_DIR/config.mk" << __EOF__ |
|
760 # |
|
761 # config.mk generated by configure |
|
762 # |
|
763 |
|
764 __EOF__ |
|
765 write_toolchain_defaults "$TEMP_DIR/toolchain.mk" |
|
766 cat "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk |
|
767 rm -Rf "$TEMP_DIR" |
|
768 |
|
769 |
|