src/test/resources/golden-sample/configure2

changeset 66
dc758dcd4645
parent 63
ac47c2fb2c4a
child 67
e43d30273f74
equal deleted inserted replaced
65:6db50c6df6e3 66:dc758dcd4645
171 done 171 done
172 return 0 172 return 0
173 } 173 }
174 174
175 175
176 # generate config.mk 176 # generate vars.mk
177 cat > "$TEMP_DIR/vars.mk" << __EOF__ 177 cat > "$TEMP_DIR/vars.mk" << __EOF__
178 PREFIX=$PREFIX 178 PREFIX=$PREFIX
179 EPREFIX=$EPREFIX 179 EPREFIX=$EPREFIX
180 BINDIR=$BINDIR 180 BINDIR=$BINDIR
181 SBINDIR=$SBINDIR 181 SBINDIR=$SBINDIR
187 LOCALSTATEDIR=$LOCALSTATEDIR 187 LOCALSTATEDIR=$LOCALSTATEDIR
188 INCLUDEDIR=$INCLUDEDIR 188 INCLUDEDIR=$INCLUDEDIR
189 INFODIR=$INFODIR 189 INFODIR=$INFODIR
190 MANDIR=$MANDIR 190 MANDIR=$MANDIR
191 __EOF__ 191 __EOF__
192 cat > "$TEMP_DIR/config.mk" << __EOF__ 192 sort -u -o "$TEMP_DIR/vars.mk" "$TEMP_DIR/vars.mk"
193 # 193
194 # config.mk generated by configure 194
195 # 195 # toolchain detection utilities
196 __EOF__
197 sort -u "$TEMP_DIR/vars.mk" >> "$TEMP_DIR/config.mk"
198
199
200 # toolchain detection
201 # this will insert make vars to config.mk
202 . make/toolchain.sh 196 . make/toolchain.sh
203 if [ -n "$TOOLCHAIN_ERROR" ]; then
204 echo "Toolchain error: $TOOLCHAIN_ERROR"
205 echo "Abort."
206 abort_configure
207 fi
208 197
209 # 198 #
210 # DEPENDENCIES 199 # DEPENDENCIES
211 # 200 #
212 201
215 204
216 test_pkg_config() 205 test_pkg_config()
217 { 206 {
218 if "$PKG_CONFIG" --exists "$1" ; then : 207 if "$PKG_CONFIG" --exists "$1" ; then :
219 else return 1 ; fi 208 else return 1 ; fi
220 if [ -n "$2" ] && "$PKG_CONFIG" --atleast-version="$2" "$1" ; then : 209 if [ -z "$2" ] || "$PKG_CONFIG" --atleast-version="$2" "$1" ; then :
221 else return 1 ; fi 210 else return 1 ; fi
222 if [ -n "$3" ] && "$PKG_CONFIG" --exact-version="$3" "$1" ; then : 211 if [ -z "$3" ] || "$PKG_CONFIG" --exact-version="$3" "$1" ; then :
223 else return 1 ; fi 212 else return 1 ; fi
224 if [ -n "$4" ] && "$PKG_CONFIG" --max-version="$4" "$1" ; then : 213 if [ -z "$4" ] || "$PKG_CONFIG" --max-version="$4" "$1" ; then :
225 else return 1 ; fi 214 else return 1 ; fi
226 return 0 215 return 0
227 } 216 }
228 217
229 dependency_error_qt4() 218 dependency_error_qt4()
431 done 420 done
432 421
433 echo no 422 echo no
434 return 0 423 return 0
435 } 424 }
425
426 # start collecting dependency information
427 echo > "$TEMP_DIR/flags.mk"
436 428
437 DEPENDENCIES_FAILED= 429 DEPENDENCIES_FAILED=
438 ERROR=0 430 ERROR=0
439 # unnamed dependencies 431 # unnamed dependencies
440 TEMP_CFLAGS= 432 TEMP_CFLAGS=
433 TEMP_CXXFLAGS=
441 TEMP_LDFLAGS= 434 TEMP_LDFLAGS=
442 while true 435 while true
443 do 436 do
444 while true 437 while true
445 do 438 do
439 if detect_c_compiler ; then
440 :
441 else
442 ERROR=1
443 break
444 fi
446 445
447 cat >> "$TEMP_DIR/make.mk" << __EOF__ 446 cat >> "$TEMP_DIR/make.mk" << __EOF__
448 MVAR = 123 447 MVAR = 123
449 MVAR += 123 448 MVAR += 123
450 449
452 break 451 break
453 done 452 done
454 break 453 break
455 done 454 done
456 455
457 # add unnamed dependency flags to config.mk 456 # add general dependency flags to flags.mk
458 echo >> "$TEMP_DIR/config.mk" 457 echo "# general flags" >> "$TEMP_DIR/flags.mk"
459 if [ -n "${TEMP_CFLAGS}" ]; then 458 if [ -n "${TEMP_CFLAGS}" ]; then
460 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/config.mk" 459 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
460 fi
461 if [ -n "${TEMP_CXXFLAGS}" ]; then
462 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
461 fi 463 fi
462 if [ -n "${TEMP_LDFLAGS}" ]; then 464 if [ -n "${TEMP_LDFLAGS}" ]; then
463 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk" 465 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
464 fi 466 fi
465 467
466 # 468 #
467 # OPTION VALUES 469 # OPTION VALUES
468 # 470 #
474 fi 476 fi
475 if [ $VERR -ne 0 ]; then 477 if [ $VERR -ne 0 ]; then
476 return 1 478 return 1
477 fi 479 fi
478 TEMP_CFLAGS="$TEMP_CFLAGS -Da=b" 480 TEMP_CFLAGS="$TEMP_CFLAGS -Da=b"
481 TEMP_CXXFLAGS="$TEMP_CXXFLAGS -Da=b"
479 cat >> "$TEMP_DIR/make.mk" << __EOF__ 482 cat >> "$TEMP_DIR/make.mk" << __EOF__
480 UIOBJ += graphics_cairo.o 483 UIOBJ += graphics_cairo.o
481 484
482 __EOF__ 485 __EOF__
483 return 0 486 return 0
521 524
522 # 525 #
523 # TARGETS 526 # TARGETS
524 # 527 #
525 528
529 echo >> "$TEMP_DIR/flags.mk"
526 # Target: dav 530 # Target: dav
531 echo "# flags for target dav" >> "$TEMP_DIR/flags.mk"
527 TEMP_CFLAGS= 532 TEMP_CFLAGS=
533 TEMP_CXXFLAGS=
528 TEMP_LDFLAGS= 534 TEMP_LDFLAGS=
529 535
530 if dependency_error_curl; then 536 if dependency_error_curl; then
531 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED curl " 537 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED curl "
532 ERROR=1 538 ERROR=1
629 ERROR=1 635 ERROR=1
630 fi 636 fi
631 fi 637 fi
632 fi 638 fi
633 639
634 echo >> "$TEMP_DIR/config.mk"
635 if [ -n "${TEMP_CFLAGS}" ]; then 640 if [ -n "${TEMP_CFLAGS}" ]; then
636 echo "DAV_CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/config.mk" 641 echo "DAV_CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
642 fi
643 if [ -n "${TEMP_CXXFLAGS}" ]; then
644 echo "DAV_CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
637 fi 645 fi
638 if [ "$BUILD_TYPE" = "debug" ]; then 646 if [ "$BUILD_TYPE" = "debug" ]; then
639 echo 'DAV_CFLAGS += ${DEBUG_FLAGS}' >> "$TEMP_DIR/config.mk" 647 echo 'DAV_CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
648 echo 'DAV_CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
640 fi 649 fi
641 if [ "$BUILD_TYPE" = "release" ]; then 650 if [ "$BUILD_TYPE" = "release" ]; then
642 echo 'DAV_CFLAGS += ${RELEASE_FLAGS}' >> "$TEMP_DIR/config.mk" 651 echo 'DAV_CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
652 echo 'DAV_CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
643 fi 653 fi
644 if [ -n "${TEMP_LDFLAGS}" ]; then 654 if [ -n "${TEMP_LDFLAGS}" ]; then
645 echo "DAV_LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk" 655 echo "DAV_LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
646 fi 656 fi
647 657
658 echo >> "$TEMP_DIR/flags.mk"
648 # Target 659 # Target
660 echo "# flags for unnamed target" >> "$TEMP_DIR/flags.mk"
649 TEMP_CFLAGS= 661 TEMP_CFLAGS=
662 TEMP_CXXFLAGS=
650 TEMP_LDFLAGS= 663 TEMP_LDFLAGS=
651 664
652 if dependency_error_deptest; then 665 if dependency_error_deptest; then
653 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED deptest " 666 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED deptest "
654 ERROR=1 667 ERROR=1
655 fi 668 fi
656 669
657 # Features 670 # Features
658 671
659 672
660 echo >> "$TEMP_DIR/config.mk"
661 if [ -n "${TEMP_CFLAGS}" ]; then 673 if [ -n "${TEMP_CFLAGS}" ]; then
662 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/config.mk" 674 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
675 fi
676 if [ -n "${TEMP_CXXFLAGS}" ]; then
677 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
663 fi 678 fi
664 if [ "$BUILD_TYPE" = "debug" ]; then 679 if [ "$BUILD_TYPE" = "debug" ]; then
665 echo 'CFLAGS += ${DEBUG_FLAGS}' >> "$TEMP_DIR/config.mk" 680 echo 'CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
681 echo 'CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
666 fi 682 fi
667 if [ "$BUILD_TYPE" = "release" ]; then 683 if [ "$BUILD_TYPE" = "release" ]; then
668 echo 'CFLAGS += ${RELEASE_FLAGS}' >> "$TEMP_DIR/config.mk" 684 echo 'CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
685 echo 'CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
669 fi 686 fi
670 if [ -n "${TEMP_LDFLAGS}" ]; then 687 if [ -n "${TEMP_LDFLAGS}" ]; then
671 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk" 688 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
672 fi 689 fi
673 690
691
692 # final result
674 if [ $ERROR -ne 0 ]; then 693 if [ $ERROR -ne 0 ]; then
675 echo 694 echo
676 echo "Error: Unresolved dependencies" 695 echo "Error: Unresolved dependencies"
677 echo "$DEPENDENCIES_FAILED" 696 echo "$DEPENDENCIES_FAILED"
678 abort_configure 697 abort_configure
695 echo " gui: on" 714 echo " gui: on"
696 else 715 else
697 echo " gui: off" 716 echo " gui: off"
698 fi 717 fi
699 echo 718 echo
700 cat "$TEMP_DIR/config.mk" "$TEMP_DIR/make.mk" > config.mk 719
720 # generate the config.mk file
721 cat > "$TEMP_DIR/config.mk" << __EOF__
722 #
723 # config.mk generated by configure
724 #
725
726 __EOF__
727 write_toolchain_defaults "$TEMP_DIR/config.mk"
728 cat "$TEMP_DIR/config.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk
701 rm -Rf "$TEMP_DIR" 729 rm -Rf "$TEMP_DIR"
702 730
703 731

mercurial