Browse code

Just various little things and checks that make life easier, especially if something goes wrong. Minions must be direct subdirectories of parent, and there can be no parent hierarchy. This is implicit ATM. Correct and simplify construction of CFLAGS, LDFLAGS and friends.

Nat! authored on 13-03-2017 11:34:20
Showing 16 changed files
... ...
@@ -122,9 +122,10 @@ EOF
122 122
    bootstrap     : does install and build recursively [default]
123 123
    build         : builds fetched repositories
124 124
    clean         : cleans mulle-bootstrap produced files.
125
+   defer         : join a master mulle-bootstrap project
126
+   emancipate    : emancipate from a master mulle-bootstrap project
127
+   flags         : produces CFLAGS for cc invocation and more
125 128
    init          : initializes a bootstrap project
126
-   install       : fetches required repositories recursively. Use it after
127
-                   updating the repositories and embedded_repositories files.
128 129
    update        : updates repositories (fetch).
129 130
    upgrade       : updates and checks out repositories (pull).
130 131
    show          : show repositories and brews
... ...
@@ -156,7 +157,7 @@ EOF
156 157
 
157 158
 ensure_consistency()
158 159
 {
159
-   if [ -f "${REPOS_DIR}/.bootstrap_fetch_started" ]
160
+   if dirty_harry
160 161
    then
161 162
       log_error "A previous fetch or update was incomplete.
162 163
 Suggested resolution (in $PWD):
... ...
@@ -755,7 +756,6 @@ bootstrap_main()
755 756
          expansion_main "$@" || exit 1
756 757
       ;;
757 758
 
758
-
759 759
       flags)
760 760
          . mulle-bootstrap-flags.sh
761 761
 
... ...
@@ -1068,7 +1068,7 @@ MULLE_EXECUTABLE_PID="$$"
1068 1068
 export MULLE_EXECUTABLE_PID
1069 1069
 
1070 1070
 
1071
-bootstrap_init
1071
+bootstrap_init "$@" # needs params
1072 1072
 
1073 1073
 main()
1074 1074
 {
... ...
@@ -105,6 +105,13 @@ _bootstrap_auto_copy()
105 105
             )
106 106
          ;;
107 107
 
108
+         minions)
109
+            if [ "${is_local}" = "YES" ]
110
+            then
111
+               exekutor cp -a ${COPYMOVEFLAGS} "${filepath}" "${dstfilepath}" >&2
112
+            fi
113
+         ;;
114
+
108 115
          *)
109 116
             #
110 117
             # root settings get the benefit of expansion
... ...
@@ -204,7 +211,6 @@ _bootstrap_merge_expanded_settings_in_front()
204 211
 }
205 212
 
206 213
 
207
-
208 214
 _bootstrap_merge_repository_files()
209 215
 {
210 216
    local srcfile="$1"
... ...
@@ -269,7 +275,7 @@ _bootstrap_auto_merge_root_settings()
269 275
       # "repositories" files gets special treatment
270 276
       # "embedded_repositories" is not merged though
271 277
       case "${settingname}" in
272
-         "embedded_repositories")
278
+         "embedded_repositories"|"minions")
273 279
             continue  # done by caller
274 280
          ;;
275 281
 
... ...
@@ -306,16 +312,17 @@ _bootstrap_auto_merge_root_settings()
306 312
 }
307 313
 
308 314
 
309
-_bootstrap_auto_embedded_copy()
315
+
316
+_bootstrap_auto_special_copy()
310 317
 {
318
+   local key="$1"; shift
319
+
311 320
    local name="$1"
312 321
    local directory="$2"
313 322
    local filepath="$3"
314 323
 
315 324
    local dst
316 325
 
317
-   log_debug ":_bootstrap_auto_embedded_copy:"
318
-
319 326
    dst="${BOOTSTRAP_DIR}.auto/.deep/${name}.d"
320 327
 
321 328
    rmdir_safer "${dst}"
... ...
@@ -327,7 +334,7 @@ _bootstrap_auto_embedded_copy()
327 334
    local clones
328 335
    local dstfilepath
329 336
 
330
-   dstfilepath="${dst}/embedded_repositories"
337
+   dstfilepath="${dst}/${key}"
331 338
 
332 339
    (
333 340
       STASHES_DEFAULT_DIR=""
... ...
@@ -337,6 +344,14 @@ _bootstrap_auto_embedded_copy()
337 344
 }
338 345
 
339 346
 
347
+_bootstrap_auto_embedded_copy()
348
+{
349
+   log_debug ":_bootstrap_auto_embedded_copy:"
350
+
351
+   _bootstrap_auto_special_copy "embedded_repositories" "$@"
352
+}
353
+
354
+
340 355
 bootstrap_auto_update()
341 356
 {
342 357
    local name="$1"
... ...
@@ -356,6 +371,8 @@ bootstrap_auto_update()
356 371
          _bootstrap_auto_embedded_copy "${name}" "${stashdir}" "${src}"
357 372
       fi
358 373
 
374
+      # don't copy minions
375
+
359 376
       src="${stashdir}/${BOOTSTRAP_DIR}/bin"
360 377
       if [ -d "${src}" ]
361 378
       then
... ...
@@ -500,12 +517,13 @@ bootstrap_auto_final()
500 517
    # add stuff from bootstrap folder
501 518
    # don't copy config if exists (it could be malicious)
502 519
    #
503
-   # __parse_expanded_clone
504 520
    local name
505 521
    local url
506 522
    local branch
507 523
    local scm
508 524
    local tag
525
+   local stashdir
526
+
509 527
    local clone
510 528
    local order
511 529
    local clones
... ...
@@ -554,6 +572,7 @@ repositories
554 572
 '
555 573
 
556 574
    NON_MERGABLE_SETTINGS='embedded_repositories
575
+minions
557 576
 version
558 577
 '
559 578
    [ -z "${MULLE_BOOTSTRAP_FUNCTIONS_SH}" ] && . mulle-bootstrap-functions.sh
... ...
@@ -333,7 +333,7 @@ determine_suffix()
333 333
    sdk="$2"
334 334
 
335 335
    [ ! -z "$configuration" ] || fail "configuration must not be empty"
336
-   [ ! -z "$sdk" ] || fail "sdk must not be empty"
336
+   [ ! -z "$sdk" ]           || fail "sdk must not be empty"
337 337
 
338 338
    suffix="${configuration}"
339 339
    if [ "${sdk}" != "Default" ]
... ...
@@ -634,54 +634,22 @@ tools_environment()
634 634
 }
635 635
 
636 636
 
637
-#
638
-# remove old builddir, create a new one
639
-# depending on configuration cmake with flags
640
-# build stuff into dependencies
641
-# TODO: cache commandline in a file $ and emit instead of rebuilding it every time
642
-#
643
-build_cmake()
637
+_build_flags()
644 638
 {
645
-   local configuration
646
-   local srcdir
647
-   local builddir
648
-   local name
649
-   local sdk
639
+   local configuration="$1"
640
+   local srcdir="$2"
641
+   local builddir="$3"
642
+   local name="$4"
643
+   local sdk="$5"
650 644
 
651
-   configuration="$1"
652
-   srcdir="$2"
653
-   builddir="$3"
654
-   name="$4"
655
-   sdk="$5"
656
-
657
-   enforce_build_sanity "${builddir}"
658
-
659
-   if [ -z "${CMAKE}" ]
660
-   then
661
-      fail "No cmake available"
662
-   fi
663
-   if [ -z "${MAKE}" ]
664
-   then
665
-      fail "No make available"
666
-   fi
667
-
668
-   log_info "Let ${C_RESET_BOLD}cmake${C_INFO} do a \
669
-${C_MAGENTA}${C_BOLD}${configuration}${C_INFO} build of \
670
-${C_MAGENTA}${C_BOLD}${name}${C_INFO} for SDK \
671
-${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
672
-
673
-   local sdkparameter
674
-   local suffix
675 645
    local mapped
676 646
    local fallback
677
-   local localcmakeflags
647
+   local suffix
678 648
 
679 649
    fallback="`echo "${OPTION_CONFIGURATIONS}" | tail -1`"
680 650
    fallback="`read_build_setting "${name}" "fallback-configuration" "${fallback}"`"
681 651
    mapped="`read_build_setting "${name}" "cmake-${configuration}.map" "${configuration}"`"
682
-   localcmakeflags="`read_build_setting "${name}" "CMAKEFLAGS"`"
683 652
    suffix="`determine_suffix "${configuration}" "${sdk}"`"
684
-   sdkparameter="`cmake_sdk_parameter "${sdk}"`"
685 653
 
686 654
    local mappedsubdir
687 655
    local fallbacksubdir
... ...
@@ -691,72 +659,24 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
691 659
    suffixsubdir="`determine_dependencies_subdir "${suffix}"`"
692 660
    fallbacksubdir="`determine_dependencies_subdir "${fallback}"`"
693 661
 
694
-   local c_compiler_line
695
-   local cxx_compiler_line
696
-
697
-   if [ ! -z "${C_COMPILER}" ]
698
-   then
699
-      c_compiler_line="-DCMAKE_C_COMPILER='${C_COMPILER}'"
700
-   fi
701
-   if [ ! -z "${CXX_COMPILER}" ]
702
-   then
703
-      cxx_compiler_line="-DCMAKE_CXX_COMPILER='${CXX_COMPILER}'"
704
-   fi
705
-
706
-   # linker="`read_build_setting "${name}" "LD"`"
707
-
662
+   local other_cppflags
708 663
    local other_cflags
709 664
    local other_cxxflags
710 665
    local other_ldflags
711 666
 
667
+   other_cppflags="`gcc_cppflags_value "${name}"`"
712 668
    other_cflags="`gcc_cflags_value "${name}"`"
713 669
    other_cxxflags="`gcc_cxxflags_value "${name}"`"
714 670
    other_ldflags="`gcc_ldflags_value "${name}"`"
715 671
 
716
-   local logfile1
717
-   local logfile2
718
-
719
-   mkdir_if_missing "${BUILDLOGS_DIR}"
720
-
721
-   logfile1="`build_log_name "cmake" "${name}" "${configuration}" "${sdk}"`"
722
-   logfile2="`build_log_name "make" "${name}" "${configuration}" "${sdk}"`"
723
-
724
-   local local_make_flags
725
-
726
-   if [ ! -z "${CORES}" ]
727
-   then
728
-      local_make_flags="-j ${CORES}"
729
-   fi
672
+   (
673
+      local nativewd
674
+      local owd
730 675
 
731
-   local owd
732
-   local nativewd
676
+      owd="${PWD}"
677
+      nativewd="`pwd ${BUILD_PWD_OPTIONS}`"
733 678
 
734
-   owd="${PWD}"
735
-   nativewd="`pwd ${BUILD_PWD_OPTIONS}`"
736
-
737
-#   cmake_keep_builddir="`read_build_setting "${name}" "cmake_keep_builddir" "YES"`"
738
-#   if [ "${cmake_keep_builddir}" != "YES" ]
739
-#   then
740
-#      rmdir_safer "${builddir}"
741
-#   fi
742
-   mkdir_if_missing "${builddir}"
743
-   exekutor cd "${builddir}" || fail "failed to enter ${builddir}"
744
-
745
-      # DONT READ CONFIG SETTING IN THIS INDENT
746
-      set -f
747
-
748
-      if [ "$MULLE_FLAG_VERBOSE_BUILD" = "YES" ]
749
-      then
750
-         logfile1="`tty`"
751
-         logfile2="$logfile1"
752
-      fi
753
-      if [ "$MULLE_FLAG_EXECUTOR_DRY_RUN" = "YES" ]
754
-      then
755
-         logfile1="/dev/null"
756
-         logfile2="/dev/null"
757
-      fi
758
-
759
-      log_verbose "Build logs will be in \"${logfile1}\" and \"${logfile2}\""
679
+      cd "${builddir}"
760 680
 
761 681
       local frameworklines
762 682
       local librarylines
... ...
@@ -768,55 +688,43 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
768 688
 
769 689
       if [ ! -z "${suffixsubdir}" ]
770 690
       then
771
-         frameworklines="`add_cmake_path_if_exists "${frameworklines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}${suffixsubdir}/${FRAMEWORK_DIR_NAME}"`"
772
-         librarylines="`add_cmake_path_if_exists "${librarylines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}${suffixsubdir}/${LIBRARY_DIR_NAME}"`"
691
+         frameworklines="`add_path_if_exists "${frameworklines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}${suffixsubdir}/${FRAMEWORK_DIR_NAME}"`"
692
+         librarylines="`add_path_if_exists "${librarylines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}${suffixsubdir}/${LIBRARY_DIR_NAME}"`"
773 693
       fi
774 694
 
775 695
       if [ ! -z "${mappedsubdir}" -a "${mappedsubdir}" != "${suffixsubdir}" ]
776 696
       then
777
-         frameworklines="`add_cmake_path_if_exists "${frameworklines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}${mappedsubdir}/${FRAMEWORK_DIR_NAME}"`"
778
-         librarylines="`add_cmake_path_if_exists "${librarylines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}${mappedsubdir}/${LIBRARY_DIR_NAME}"`"
697
+         frameworklines="`add_path_if_exists "${frameworklines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}${mappedsubdir}/${FRAMEWORK_DIR_NAME}"`"
698
+         librarylines="`add_path_if_exists "${librarylines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}${mappedsubdir}/${LIBRARY_DIR_NAME}"`"
779 699
       fi
780 700
 
781 701
       if [ ! -z "${fallbacksubdir}" -a "${fallbacksubdir}" != "${suffixsubdir}" -a "${fallbacksubdir}" != "${mappedsubdir}" ]
782 702
       then
783
-         frameworklines="`add_cmake_path_if_exists "${frameworklines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}${fallbacksubdir}/${FRAMEWORK_DIR_NAME}"`"
784
-         librarylines="`add_cmake_path_if_exists "${librarylines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}${fallbacksubdir}/${LIBRARY_DIR_NAME}"`"
703
+         frameworklines="`add_path_if_exists "${frameworklines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}${fallbacksubdir}/${FRAMEWORK_DIR_NAME}"`"
704
+         librarylines="`add_path_if_exists "${librarylines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}${fallbacksubdir}/${LIBRARY_DIR_NAME}"`"
785 705
       fi
786 706
 
787
-      includelines="`add_cmake_path_if_exists "${includelines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}/${HEADER_DIR_NAME}"`"
788
-      includelines="`add_cmake_path_if_exists "${includelines}" "${nativewd}/${REFERENCE_ADDICTIONS_DIR}/${HEADER_DIR_NAME}"`"
707
+      includelines="`add_path_if_exists "${includelines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}/${HEADER_DIR_NAME}"`"
708
+      includelines="`add_path_if_exists "${includelines}" "${nativewd}/${REFERENCE_ADDICTIONS_DIR}/${HEADER_DIR_NAME}"`"
789 709
 
790
-      librarylines="`add_cmake_path_if_exists "${librarylines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}/${LIBRARY_DIR_NAME}"`"
791
-      librarylines="`add_cmake_path_if_exists "${librarylines}" "${nativewd}/${REFERENCE_ADDICTIONS_DIR}/${LIBRARY_DIR_NAME}"`"
710
+      librarylines="`add_path_if_exists "${librarylines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}/${LIBRARY_DIR_NAME}"`"
711
+      librarylines="`add_path_if_exists "${librarylines}" "${nativewd}/${REFERENCE_ADDICTIONS_DIR}/${LIBRARY_DIR_NAME}"`"
792 712
 
793
-      frameworklines="`add_cmake_path_if_exists "${frameworklines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}/${FRAMEWORK_DIR_NAME}"`"
794
-      frameworklines="`add_cmake_path_if_exists "${frameworklines}" "${nativewd}/${REFERENCE_ADDICTIONS_DIR}/${FRAMEWORK_DIR_NAME}"`"
713
+      frameworklines="`add_path_if_exists "${frameworklines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}/${FRAMEWORK_DIR_NAME}"`"
714
+      frameworklines="`add_path_if_exists "${frameworklines}" "${nativewd}/${REFERENCE_ADDICTIONS_DIR}/${FRAMEWORK_DIR_NAME}"`"
795 715
 
796 716
       if [ "${OPTION_ADD_USR_LOCAL}" = "YES" ]
797 717
       then
798
-         includelines="`add_cmake_path_if_exists "${includelines}" "${USR_LOCAL_INCLUDE}"`"
799
-         librarylines="`add_cmake_path_if_exists "${librarylines}" "${USR_LOCAL_LIB}"`"
718
+         includelines="`add_path_if_exists "${includelines}" "${USR_LOCAL_INCLUDE}"`"
719
+         librarylines="`add_path_if_exists "${librarylines}" "${USR_LOCAL_LIB}"`"
800 720
       fi
801 721
 
802
-      local relative_srcdir
803
-      local prefixbuild
804
-      local dependenciesdir
805
-      local addictionsdir
806
-#      local cmakemodulepath
807
-
808
-      relative_srcdir="`relative_path_between "${owd}/${srcdir}" "${PWD}"`"
809
-
810
-      prefixbuild="`add_cmake_path "${prefixbuild}" "${nativewd}/${BUILD_DEPENDENCIES_DIR}"`"
811
-
812
-      dependenciesdir="`add_cmake_path_if_exists "${dependenciesdir}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}"`"
813
-      addictionsdir="`add_cmake_path_if_exists "${addictionsdir}" "${nativewd}/${REFERENCE_ADDICTIONS_DIR}"`"
814 722
 
815
-#      cmakemodulepath="\${CMAKE_MODULE_PATH}"
816
-#      if [ ! -z "${CMAKE_MODULE_PATH}" ]
817
-#      then
818
-#         cmakemodulepath="${CMAKE_MODULE_PATH}${PATH_SEPARATOR}${cmakemodulepath}"   # prepend
819
-#      fi
723
+   #      cmakemodulepath="\${CMAKE_MODULE_PATH}"
724
+   #      if [ ! -z "${CMAKE_MODULE_PATH}" ]
725
+   #      then
726
+   #         cmakemodulepath="${CMAKE_MODULE_PATH}${PATH_SEPARATOR}${cmakemodulepath}"   # prepend
727
+   #      fi
820 728
 
821 729
       local native_includelines
822 730
       local native_librarylines
... ...
@@ -840,7 +748,6 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
840 748
          ;;
841 749
 
842 750
          mingw)
843
-            relative_srcdir="`echo "${relative_srcdir}" | tr '/' '\\'  2> /dev/null`"
844 751
             native_includelines="`echo "${native_includelines}" | tr '/' '\\'  2> /dev/null`"
845 752
             native_librarylines="`echo "${native_librarylines}" | tr '/' '\\'  2> /dev/null`"
846 753
             libraryprefix="/LIBPATH:"
... ...
@@ -855,21 +762,17 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
855 762
          ;;
856 763
       esac
857 764
 
858
-      # assemble -I /I and -L /LIBPATH:
859
-
860
-
861 765
       # cmake separator
862 766
       [ -z "${DEFAULT_IFS}" ] && internal_fail "IFS fail"
863
-      IFS=";"
767
+      IFS="${PATH_SEPARATOR}"
864 768
       for path in ${native_includelines}
865 769
       do
866 770
          IFS="${DEFAULT_IFS}"
867 771
          path="$(sed 's/ /\\ /g' <<< "${path}")"
868
-         other_cflags="`concat "${other_cflags}" "${includeprefix}${path}"`"
869
-         other_cxxflags="`concat "${other_cxxflags}" "${includeprefix}${path}"`"
772
+         other_cppflags="`concat "${other_cflags}" "${includeprefix}${path}"`"
870 773
       done
871 774
 
872
-      IFS=";"
775
+      IFS="${PATH_SEPARATOR}"
873 776
       for path in ${native_librarylines}
874 777
       do
875 778
          IFS="${DEFAULT_IFS}"
... ...
@@ -877,25 +780,162 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
877 780
          other_ldflags="`concat "${other_ldflags}" "${libraryprefix}${path}"`"
878 781
       done
879 782
 
880
-      IFS=";"
783
+      IFS="${PATH_SEPARATOR}"
881 784
       for path in ${native_frameworklines}
882 785
       do
883 786
          IFS="${DEFAULT_IFS}"
884 787
          path="$(sed 's/ /\\ /g' <<< "${path}")"
885
-         other_cflags="`concat "${other_cflags}" "${frameworkprefix}${path}"`"
886
-         other_cxxflags="`concat "${other_cxxflags}" "${frameworkprefix}${path}"`"
788
+         other_cppflags="`concat "${other_cflags}" "${frameworkprefix}${path}"`"
887 789
          other_ldflags="`concat "${other_ldflags}" "${frameworkprefix}${path}"`"
888 790
       done
791
+      IFS="${DEFAULT_IFS}"
792
+
793
+      #
794
+      # the output one line each
795
+      #
796
+      echo "${other_cppflags}"
797
+      echo "${other_cflags}"
798
+      echo "${other_cxxflags}"
799
+      echo "${other_ldflags}"
800
+   )
801
+}
802
+
803
+
804
+build_unix_flags()
805
+{
806
+   _build_flags "$@"
807
+}
808
+
809
+
810
+build_cmake_flags()
811
+{
812
+   (
813
+      PATH_SEPARATOR=";"
814
+      _build_flags "$@"
815
+   )
816
+}
817
+
818
+#
819
+# remove old builddir, create a new one
820
+# depending on configuration cmake with flags
821
+# build stuff into dependencies
822
+# TODO: cache commandline in a file $ and emit instead of rebuilding it every time
823
+#
824
+build_cmake()
825
+{
826
+   local configuration="$1"
827
+   local srcdir="$2"
828
+   local builddir="$3"
829
+   local name="$4"
830
+   local sdk="$5"
831
+
832
+   enforce_build_sanity "${builddir}"
833
+
834
+   if [ -z "${CMAKE}" ]
835
+   then
836
+      fail "No cmake available"
837
+   fi
838
+   if [ -z "${MAKE}" ]
839
+   then
840
+      fail "No make available"
841
+   fi
842
+
843
+   log_info "Let ${C_RESET_BOLD}cmake${C_INFO} do a \
844
+${C_MAGENTA}${C_BOLD}${configuration}${C_INFO} build of \
845
+${C_MAGENTA}${C_BOLD}${name}${C_INFO} for SDK \
846
+${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
847
+
848
+   local sdkparameter
849
+   local local_cmake_flags
850
+   local local_make_flags
851
+
852
+   local_cmake_flags="`read_build_setting "${name}" "CMAKEFLAGS"`"
853
+   sdkparameter="`cmake_sdk_parameter "${sdk}"`"
854
+
855
+   if [ ! -z "${CORES}" ]
856
+   then
857
+      local_make_flags="-j ${CORES}"
858
+   fi
859
+
860
+   local c_compiler_line
861
+   local cxx_compiler_line
862
+
863
+   if [ ! -z "${C_COMPILER}" ]
864
+   then
865
+      c_compiler_line="-DCMAKE_C_COMPILER='${C_COMPILER}'"
866
+   fi
867
+   if [ ! -z "${CXX_COMPILER}" ]
868
+   then
869
+      cxx_compiler_line="-DCMAKE_CXX_COMPILER='${CXX_COMPILER}'"
870
+   fi
871
+
872
+   # linker="`read_build_setting "${name}" "LD"`"
873
+
874
+   # need this now
875
+   mkdir_if_missing "${builddir}"
876
+
877
+   local flaglines
878
+
879
+   flaglines="`build_cmake_flags "$@"`"
880
+
881
+   local other_cppflags
882
+   local other_cflags
883
+   local other_cxxflags
884
+   local other_ldflags
885
+
886
+   other_cppflags="`echo "${flaglines}" | sed -n '1p'`"
887
+   other_cflags="`echo "${flaglines}"   | sed -n '2p'`"
888
+   other_cxxflags="`echo "${flaglines}" | sed -n '3p'`"
889
+   other_ldflags="`echo "${flaglines}"  | sed -n '4p'`"
890
+
891
+   # CMAKE_CPP_FLAGS does not exist in cmake
892
+
893
+   other_cflags="`concat "${other_cppflags}" "${other_cflags}"`"
894
+   other_cxxflags="`concat "${other_cppflags}" "${other_cxxflags}"`"
895
+
896
+   local logfile1
897
+   local logfile2
898
+
899
+   mkdir_if_missing "${BUILDLOGS_DIR}"
900
+
901
+   logfile1="`build_log_name "cmake" "${name}" "${configuration}" "${sdk}"`"
902
+   logfile2="`build_log_name "make" "${name}" "${configuration}" "${sdk}"`"
903
+
904
+#   cmake_keep_builddir="`read_build_setting "${name}" "cmake_keep_builddir" "YES"`"
905
+#   if [ "${cmake_keep_builddir}" != "YES" ]
906
+#   then
907
+#      rmdir_safer "${builddir}"
908
+#   fi
909
+   (
910
+      local owd
911
+      local nativewd
912
+
913
+      owd="${PWD}"
914
+      nativewd="`pwd ${BUILD_PWD_OPTIONS}`"
915
+
916
+      exekutor cd "${builddir}" || fail "failed to enter ${builddir}"
917
+
918
+      # DONT READ CONFIG SETTING IN THIS INDENT
919
+      set -f
920
+
921
+      if [ "$MULLE_FLAG_VERBOSE_BUILD" = "YES" ]
922
+      then
923
+         logfile1="`tty`"
924
+         logfile2="$logfile1"
925
+      fi
926
+      if [ "$MULLE_FLAG_EXECUTOR_DRY_RUN" = "YES" ]
927
+      then
928
+         logfile1="/dev/null"
929
+         logfile2="/dev/null"
930
+      fi
931
+
932
+      log_verbose "Build logs will be in \"${logfile1}\" and \"${logfile2}\""
889 933
 
890
-      IFS=";"
891 934
       if [ "${MULLE_FLAG_VERBOSE_BUILD}" = "YES" ]
892 935
       then
893
-         IFS="${DEFAULT_IFS}"
894 936
          local_make_flags="${local_make_flags} VERBOSE=1"
895 937
       fi
896 938
 
897
-      IFS="${DEFAULT_IFS}"
898
-
899 939
       local oldpath
900 940
       local rval
901 941
 
... ...
@@ -904,6 +944,10 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
904 944
       oldpath="$PATH"
905 945
       PATH="${BUILDPATH}"
906 946
 
947
+      local prefixbuild
948
+
949
+      prefixbuild="`add_cmake_path "${prefixbuild}" "${nativewd}/${BUILD_DEPENDENCIES_DIR}"`"
950
+
907 951
       local cmake_flags
908 952
 
909 953
       cmake_flags="-DCMAKE_C_FLAGS='${other_cflags}' \
... ...
@@ -913,6 +957,12 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
913 957
 
914 958
       local cmake_dirs
915 959
 
960
+      local dependenciesdir
961
+      local addictionsdir
962
+
963
+      dependenciesdir="${nativewd}/${REFERENCE_DEPENDENCIES_DIR}"
964
+      addictionsdir="${nativewd}/${REFERENCE_ADDICTIONS_DIR}"
965
+
916 966
       if [ ! -z "${dependenciesdir}" ]
917 967
       then
918 968
          cmake_dirs="-DDEPENDENCIES_DIR='${dependenciesdir}'"
... ...
@@ -920,24 +970,32 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
920 970
 
921 971
       if [ ! -z "${addictionsdir}" ]
922 972
       then
923
-         cmake_dirs="`add_word "${cmake_dirs}" "-DADDICTIONS_DIR='${addictionsdir}'"`"
973
+         cmake_dirs="`concat "${cmake_dirs}" "-DADDICTIONS_DIR='${addictionsdir}'"`"
924 974
       fi
925 975
 
926 976
       if [ ! -z "${includelines}" ]
927 977
       then
928
-         cmake_dirs="`add_word "${cmake_dirs}" "-DCMAKE_INCLUDE_PATH='${includelines}'"`"
978
+         cmake_dirs="`concat "${cmake_dirs}" "-DCMAKE_INCLUDE_PATH='${includelines}'"`"
929 979
       fi
930 980
 
931 981
       if [ ! -z "${librarylines}" ]
932 982
       then
933
-         cmake_dirs="`add_word "${cmake_dirs}" "-DCMAKE_LIBRARY_PATH='${librarylines}'"`"
983
+         cmake_dirs="`concat "${cmake_dirs}" "-DCMAKE_LIBRARY_PATH='${librarylines}'"`"
934 984
       fi
935 985
 
936 986
       if [ ! -z "${frameworklines}" ]
937 987
       then
938
-         cmake_dirs="`add_word "${cmake_dirs}" "-DCMAKE_FRAMEWORK_PATH='${frameworklines}'"`"
988
+         cmake_dirs="`concat "${cmake_dirs}" "-DCMAKE_FRAMEWORK_PATH='${frameworklines}'"`"
939 989
       fi
940 990
 
991
+      local relative_srcdir
992
+
993
+      relative_srcdir="`relative_path_between "${owd}/${srcdir}" "${PWD}"`"
994
+      case "${UNAME}" in
995
+         mingw)
996
+            relative_srcdir="`echo "${relative_srcdir}" | tr '/' '\\'  2> /dev/null`"
997
+      esac
998
+
941 999
       logging_redirect_eval_exekutor "${logfile1}" "'${CMAKE}'" \
942 1000
 -G "'${CMAKE_GENERATOR}'" \
943 1001
 "-DMULLE_BOOTSTRAP_VERSION=${MULLE_BOOTSTRAP_VERSION}" \
... ...
@@ -948,7 +1006,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
948 1006
 "${sdkparameter}" \
949 1007
 "${c_compiler_line}" \
950 1008
 "${cxx_compiler_line}" \
951
-"${localcmakeflags}" \
1009
+"${local_cmake_flags}" \
952 1010
 "${CMAKE_FLAGS}" \
953 1011
 "'${relative_srcdir}'"
954 1012
       rval=$?
... ...
@@ -967,7 +1025,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
967 1025
 
968 1026
       set +f
969 1027
 
970
-   exekutor cd "${owd}"
1028
+   ) || exit 1
971 1029
 
972 1030
    local depend_subdir
973 1031
 
... ...
@@ -1008,40 +1066,50 @@ ${C_MAGENTA}${C_BOLD}${configuration}${C_INFO} build of \
1008 1066
 ${C_MAGENTA}${C_BOLD}${name}${C_INFO} for SDK \
1009 1067
 ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
1010 1068
 
1011
-   local sdkpath
1012
-   local fallback
1013
-   local mapped
1014
-   local suffix
1015
-   local fallback
1016 1069
    local configureflags
1017 1070
 
1018
-   fallback="`echo "${OPTION_CONFIGURATIONS}" | tail -1`"
1019
-   fallback="`read_build_setting "${name}" "fallback-configuration" "${fallback}"`"
1020
-
1021 1071
    configureflags="`read_build_setting "${name}" "configure_flags"`"
1022 1072
 
1023
-   mapped="`read_build_setting "${name}" "configure-${configuration}.map" "${configuration}"`"
1024
-   suffix="`determine_suffix "${configuration}" "${sdk}"`"
1025
-   sdkpath="`gcc_sdk_parameter "${sdk}"`"
1026
-   sdkpath="`echo "${sdkpath}" | sed -e 's/ /\\ /g'`"
1073
+#   create_dummy_dirs_against_warnings "${mapped}" "${suffix}"
1027 1074
 
1028
-   create_dummy_dirs_against_warnings "${mapped}" "${suffix}"
1075
+   local c_compiler_line
1076
+   local cxx_compiler_line
1029 1077
 
1030
-   local mappedsubdir
1031
-   local fallbacksubdir
1032
-   local suffixsubdir
1078
+   if [ ! -z "${C_COMPILER}" ]
1079
+   then
1080
+      c_compiler_line="CC='${C_COMPILER}'"
1081
+   fi
1082
+   if [ ! -z "${CXX_COMPILER}" ]
1083
+   then
1084
+      cxx_compiler_line="CXX='${CXX_COMPILER}'"
1085
+   fi
1033 1086
 
1034
-   mappedsubdir="`determine_dependencies_subdir "${mapped}"`"
1035
-   suffixsubdir="`determine_dependencies_subdir "${suffix}"`"
1036
-   fallbacksubdir="`determine_dependencies_subdir "${fallback}"`"
1087
+   mkdir_if_missing "${builddir}"
1037 1088
 
1089
+   local flags
1090
+
1091
+   flags="`build_unix_flags "$@"`"
1092
+
1093
+   local other_cppflags
1038 1094
    local other_cflags
1039 1095
    local other_cxxflags
1040 1096
    local other_ldflags
1041 1097
 
1042
-   other_cflags="`gcc_cflags_value "${name}"`"
1043
-   other_cxxflags="`gcc_cxxflags_value "${name}"`"
1044
-   other_ldflags="`gcc_ldflags_value "${name}"`"
1098
+   other_cppflags="`echo "${flags}" | sed -n '1p'`"
1099
+   other_cflags="`echo "${flags}"   | sed -n '2p'`"
1100
+   other_cxxflags="`echo "${flags}" | sed -n '3p'`"
1101
+   other_ldflags="`echo "${flags}"  | sed -n '4p'`"
1102
+
1103
+   local sdkpath
1104
+
1105
+   sdkpath="`gcc_sdk_parameter "${sdk}"`"
1106
+   sdkpath="`echo "${sdkpath}" | sed -e 's/ /\\ /g'`"
1107
+
1108
+   if [ ! -z "${sdkpath}" ]
1109
+   then
1110
+      other_cppflags="`concat "-isysroot ${sdkpath}" "${other_cppflags}"`"
1111
+      other_ldflags="`concat "-isysroot ${sdkpath}" "${other_ldflags}"`"
1112
+   fi
1045 1113
 
1046 1114
    local logfile1
1047 1115
    local logfile2
... ...
@@ -1051,20 +1119,17 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
1051 1119
    logfile1="`build_log_name "configure" "${name}" "${configuration}" "${sdk}"`"
1052 1120
    logfile2="`build_log_name "make" "${name}" "${configuration}" "${sdk}"`"
1053 1121
 
1054
-   local owd
1055
-   local nativewd
1122
+   (
1123
+      local owd
1124
+      local nativewd
1056 1125
 
1057
-   owd="${PWD}"
1058
-   nativewd="`pwd ${BUILD_PWD_OPTIONS}`"
1126
+      owd="${PWD}"
1127
+      nativewd="`pwd ${BUILD_PWD_OPTIONS}`"
1059 1128
 
1060
-   mkdir_if_missing "${builddir}"
1061
-   exekutor cd "${builddir}" || fail "failed to enter ${builddir}"
1129
+      exekutor cd "${builddir}" || fail "failed to enter ${builddir}"
1062 1130
 
1063 1131
       # DONT READ CONFIG SETTING IN THIS INDENT
1064
-       set -f
1065
-
1066
-      logfile1="${owd}/${logfile1}"
1067
-      logfile2="${owd}/${logfile2}"
1132
+      set -f
1068 1133
 
1069 1134
       if [ "$MULLE_FLAG_VERBOSE_BUILD" = "YES" ]
1070 1135
       then
... ...
@@ -1079,94 +1144,15 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
1079 1144
 
1080 1145
       log_verbose "Build logs will be in \"${logfile1}\" and \"${logfile2}\""
1081 1146
 
1082
-      local frameworklines
1083
-      local librarylines
1084
-      local includelines
1085
-
1086
-      frameworklines=
1087
-      librarylines=
1088
-      includelines=
1089
-
1090
-      if [ ! -z "${suffixsubdir}" ]
1091
-      then
1092
-         frameworklines="`add_path_if_exists "${frameworklines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}${suffixsubdir}/${FRAMEWORK_DIR_NAME}"`"
1093
-         librarylines="`add_path_if_exists "${librarylines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}${suffixsubdir}/${LIBRARY_DIR_NAME}"`"
1094
-      fi
1095
-
1096
-      if [ ! -z "${mappedsubdir}" -a "${mappedsubdir}" != "${suffixsubdir}" ]
1097
-      then
1098
-         frameworklines="`add_path_if_exists "${frameworklines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}${mappedsubdir}/${FRAMEWORK_DIR_NAME}"`"
1099
-         librarylines="`add_path_if_exists "${librarylines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}${mappedsubdir}/${LIBRARY_DIR_NAME}"`"
1100
-      fi
1101
-
1102
-      if [ ! -z "${fallbacksubdir}" -a "${fallbacksubdir}" != "${suffixsubdir}" -a "${fallbacksubdir}" != "${mappedsubdir}" ]
1103
-      then
1104
-         frameworklines="`add_path_if_exists "${frameworklines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}${fallbacksubdir}/${FRAMEWORK_DIR_NAME}"`"
1105
-         librarylines="`add_path_if_exists "${librarylines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}${fallbacksubdir}/${LIBRARY_DIR_NAME}"`"
1106
-      fi
1107
-
1108
-      includelines="`add_path_if_exists "${includelines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}/${HEADER_DIR_NAME}"`"
1109
-      includelines="`add_path_if_exists "${includelines}" "${nativewd}/${REFERENCE_ADDICTIONS_DIR}/${HEADER_DIR_NAME}"`"
1110
-
1111
-      librarylines="`add_path_if_exists "${librarylines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}/${LIBRARY_DIR_NAME}"`"
1112
-      librarylines="`add_path_if_exists "${librarylines}" "${nativewd}/${REFERENCE_ADDICTIONS_DIR}/${LIBRARY_DIR_NAME}"`"
1113
-
1114
-      frameworklines="`add_path_if_exists "${frameworklines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}/${FRAMEWORK_DIR_NAME}"`"
1115
-      frameworklines="`add_path_if_exists "${frameworklines}" "${nativewd}/${REFERENCE_ADDICTIONS_DIR}/${FRAMEWORK_DIR_NAME}"`"
1116
-
1117
-      if [ "${OPTION_ADD_USR_LOCAL}" = "YES" ]
1118
-      then
1119
-         includelines="`add_path_if_exists "${includelines}" "${USR_LOCAL_INCLUDE}"`"
1120
-         librarylines="`add_path_if_exists "${librarylines}" "${USR_LOCAL_LIB}"`"
1121
-      fi
1122
-
1123
-      local prefixbuild
1124 1147
       local dependenciesdir
1125 1148
       local addictionsdir
1126
-      #local linker
1127
-
1128
-      prefixbuild="`add_path "${prefixbuild}" "${nativewd}/${BUILD_DEPENDENCIES_DIR}"`"
1129
-      dependenciesdir="`add_path_if_exists "${dependenciesdir}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}"`"
1130
-      addictionsdir="`add_path_if_exists "${addictionsdir}" "${nativewd}/${REFERENCE_ADDICTIONS_DIR}"`"
1131
-
1132
-      case "${UNAME}" in
1133
-         darwin)
1134
-            other_cflags="`concat "${other_cflags}" "-isysroot ${sdkpath}"`"
1135
-            other_ldflags="`concat "${other_ldflags}" "-isysroot ${sdkpath}"`"
1136
-         ;;
1137 1149
 
1138
-         *)
1139
-            frameworklines=
1140
-         ;;
1141
-      esac
1142
-
1143
-      # assemble -I /I and -L /LIBPATH:
1144
-
1145
-
1146
-      IFS="${PATH_SEPARATOR}"
1147
-      for path in ${includelines}
1148
-      do
1149
-         IFS="${DEFAULT_IFS}"
1150
-         other_cflags="`concat "${other_cflags}" "${includeprefix}${path}"`"
1151
-      done
1152
-
1153
-      IFS="${PATH_SEPARATOR}"
1154
-      for path in ${librarylines}
1155
-      do
1156
-         IFS="${DEFAULT_IFS}"
1157
-         other_ldflags="`concat "${other_ldflags}" "${libraryprefix}${path}"`"
1158
-      done
1150
+      dependenciesdir="${nativewd}/${REFERENCE_DEPENDENCIES_DIR}"
1151
+      addictionsdir="${nativewd}/${REFERENCE_ADDICTIONS_DIR}"
1159 1152
 
1160
-      IFS="${PATH_SEPARATOR}"
1161
-      for path in ${frameworklines}
1162
-      do
1163
-         IFS="${DEFAULT_IFS}"
1164
-         other_cflags="`concat "${other_cflags}" "${frameworkprefix}${path}"`"
1165
-         other_ldflags="`concat "${other_ldflags}" "${frameworkprefix}${path}"`"
1166
-      done
1153
+      local prefixbuild
1167 1154
 
1168
-      other_cxxflags"`concat "${other_cflags}" "${other_cxxflags}"`"
1169
-      IFS="${DEFAULT_IFS}"
1155
+      prefixbuild="`add_path "${prefixbuild}" "${nativewd}/${BUILD_DEPENDENCIES_DIR}"`"
1170 1156
 
1171 1157
       local oldpath
1172 1158
       local rval
... ...
@@ -1174,18 +1160,35 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
1174 1160
       oldpath="$PATH"
1175 1161
       PATH="${BUILDPATH}"
1176 1162
 
1163
+      local tool_flags
1164
+
1165
+      if [ ! -z "${other_cppflags}" ]
1166
+      then
1167
+         tool_flags="`concat "${tool_flags}" "CPPFLAGS='${other_cppflags}'"`"
1168
+      fi
1169
+      if [ ! -z "${other_cflags}" ]
1170
+      then
1171
+         tool_flags="`concat "${tool_flags}" "CFLAGS='${other_cflags}'"`"
1172
+      fi
1173
+      if [ ! -z "${other_cxxflags}" ]
1174
+      then
1175
+         tool_flags="`concat "${tool_flags}" "CXXFLAGS='${other_cxxflags}'"`"
1176
+      fi
1177
+      if [ ! -z "${other_ldflags}" ]
1178
+      then
1179
+         tool_flags="`concat "${tool_flags}" "LDFLAGS='${other_ldflags}'"`"
1180
+      fi
1181
+
1177 1182
       # use absolute paths for configure, safer (and easier to read IMO)
1178
-      logging_eval_redirekt_exekutor "${logfile1}" \
1183
+      logging_redirect_eval_exekutor "${logfile1}" \
1179 1184
          DEPENDENCIES_DIR="'${dependenciesdir}'" \
1180 1185
          ADDICTIONS_DIR="'${addictionsdir}'" \
1181
-         CC="'${C_COMPILER:-${CC}}'" \
1182
-         CXX="'${CXX_COMPILER:-${CXX}}'" \
1183
-         CFLAGS="'${other_cflags}'" \
1184
-         CXXFLAGS="'${other_cxxflags}'" \
1185
-         LDFLAGS="'${other_ldflags}'" \
1186
+         "${c_compiler_line}" \
1187
+         "${cxx_compiler_line}" \
1188
+         "${tool_flags}" \
1186 1189
          "'${owd}/${srcdir}/configure'" \
1187
-            "${configureflags}" \
1188
-             --prefix "'${prefixbuild}'"
1190
+         "${configureflags}" \
1191
+         --prefix "'${prefixbuild}'"
1189 1192
       rval=$?
1190 1193
 
1191 1194
       if [ $rval -ne 0 ]
... ...
@@ -1203,7 +1206,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
1203 1206
       PATH="${oldpath}"
1204 1207
       set +f
1205 1208
 
1206
-   exekutor cd "${owd}"
1209
+   ) || exit 1
1207 1210
 
1208 1211
    local depend_subdir
1209 1212
 
... ...
@@ -1395,7 +1398,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO}${info} in \
1395 1398
       sdk=
1396 1399
    fi
1397 1400
 
1398
-   create_dummy_dirs_against_warnings "${mapped}" "${suffix}"
1401
+#   create_dummy_dirs_against_warnings "${mapped}" "${suffix}"
1399 1402
 
1400 1403
    local mappedsubdir
1401 1404
    local fallbacksubdir
... ...
@@ -2141,7 +2144,7 @@ build_stashes()
2141 2144
                log_info "${C_MAGENTA}${C_BOLD}${name}${C_INFO} is a system library, so not building it"
2142 2145
                :
2143 2146
             else
2144
-               fail "Unknown repo ${name}"
2147
+               fail "Unknown repo \"${name}\""
2145 2148
             fi
2146 2149
          fi
2147 2150
       done
... ...
@@ -2316,8 +2319,11 @@ build_main()
2316 2319
          rmdir_safer "${DEPENDENCIES_DIR}"
2317 2320
       fi
2318 2321
    else
2319
-      log_fluff "Unprotecting \"${DEPENDENCIES_DIR}\" (as this is a partial build)."
2320
-      exekutor chmod -R u+w "${DEPENDENCIES_DIR}"
2322
+      if [ -d "${DEPENDENCIES_DIR}" ]
2323
+      then
2324
+         log_fluff "Unprotecting \"${DEPENDENCIES_DIR}\" (as this is a partial build)."
2325
+         exekutor chmod -R u+w "${DEPENDENCIES_DIR}"
2326
+      fi
2321 2327
    fi
2322 2328
 
2323 2329
    # if present then we didnt't want to clean and we do nothing special
... ...
@@ -320,17 +320,29 @@ search_for_git_repository_in_caches()
320 320
 {
321 321
    local found
322 322
    local directory
323
+   local realdir
324
+   local curdir
323 325
 
326
+   curdir="`pwd -P`"
324 327
    IFS=":"
325 328
    for directory in ${CACHES_PATH}
326 329
    do
327 330
       IFS="${DEFAULT_IFS}"
328 331
 
329
-      found="`_search_for_git_repository_in_cache "${directory}" "$@"`" || exit 1
330
-      if [ ! -z "${found}" ]
332
+      realdir="`realpath "${directory}"`"
333
+      if [ ! -z "${realdir}" ]
331 334
       then
332
-         symlink_relpath "${found}" "${ROOT_DIR}"
333
-         return
335
+         if [ "${realdir}" = "${curdir}" ]
336
+         then
337
+            fail "config setting \"caches_path\" mistakenly contains \"${directory}\", which is the current directory"
338
+         fi
339
+
340
+         found="`_search_for_git_repository_in_cache "${realdir}" "$@"`" || exit 1
341
+         if [ ! -z "${found}" ]
342
+         then
343
+            symlink_relpath "${found}" "${ROOT_DIR}"
344
+            return
345
+         fi
334 346
       fi
335 347
    done
336 348
 
... ...
@@ -900,13 +912,6 @@ required_action_for_clone()
900 912
 
901 913
    parse_clone "${clone}"
902 914
 
903
-   if is_minion_bootstrap_project "${stashdir}"
904
-   then
905
-      log_fluff "\"${stashdir}\" is a minion. Ignoring possible differences."
906
-      echo "ignore"
907
-      return
908
-   fi
909
-
910 915
    log_debug "Change: \"${clone}\" -> \"${newclone}\""
911 916
 
912 917
    if [ "${scm}" != "${newscm}" ]
... ...
@@ -914,8 +919,14 @@ required_action_for_clone()
914 919
       if ! [ "${scm}" = "symlink" -a "${newscm}" = "git" ]
915 920
       then
916 921
          log_fluff "SCM has changed from \"${scm}\" to \"${newscm}\", need to refetch"
917
-         echo "remove
918
-clone"
922
+
923
+         if [ "${scm}" != "minion" ]
924
+         then
925
+            log_fluff "Not removing \"${stashdir}\" because it's a minion"
926
+            echo "remove"
927
+         fi
928
+
929
+         echo "clone"
919 930
          return
920 931
       fi
921 932
    fi
... ...
@@ -924,13 +935,13 @@ clone"
924 935
    then
925 936
       if [ -e "${newstashdir}" ]
926 937
       then
927
-         log_fluff "Destination already exists. Remove old."
938
+         log_fluff "Destination \"${newstashdir}\" already exists. Remove old."
928 939
          echo "remove"
929 940
 
930
-         # hacque ?
941
+         # detect unlucky hacque
931 942
          if is_minion_bootstrap_project "${newstashdir}"
932 943
          then
933
-            return
944
+            fail "\"${stashdir}\" was renamed to minion \"${newstashdir}\""
934 945
          fi
935 946
       else
936 947
          log_fluff "Destination has changed from \"${stashdir}\" to \"${newstashdir}\", need to move"
... ...
@@ -1021,6 +1032,36 @@ get_old_stashdir()
1021 1032
 }
1022 1033
 
1023 1034
 
1035
+work_minions()
1036
+{
1037
+   local minions="$1"
1038
+
1039
+   local minion
1040
+
1041
+   log_debug "Exploit \"${minions}\""
1042
+
1043
+   IFS="
1044
+"
1045
+   for minion in ${minions}
1046
+   do
1047
+      IFS="${DEFAULT_IFS}"
1048
+
1049
+      if [ -z "${minion}" ]
1050
+      then
1051
+         continue
1052
+      fi
1053
+
1054
+      log_debug "${C_INFO}Doing ${minion}..."
1055
+
1056
+      [ ! -d "${minion}" ] && fail "Minion \"${minion}\" is gone"
1057
+
1058
+      bootstrap_auto_update "${minion}" "${minion}"
1059
+   done
1060
+
1061
+   IFS="${DEFAULT_IFS}"
1062
+}
1063
+
1064
+
1024 1065
 work_clones()
1025 1066
 {
1026 1067
    local reposdir="$1"
... ...
@@ -1083,121 +1124,138 @@ work_clones()
1083 1124
       stashdir="${dstdir}"
1084 1125
       [ -z "${stashdir}" ] && internal_fail "empty stashdir"
1085 1126
 
1086
-      actionitems="`required_action_for_clone "${clone}" \
1087
-                                              "${reposdir}" \
1088
-                                              "${name}" \
1089
-                                              "${url}" \
1090
-                                              "${branch}" \
1091
-                                              "${scm}" \
1092
-                                              "${tag}" \
1093
-                                              "${stashdir}"`" || exit 1
1094
-
1095
-      log_debug "${C_INFO}Actions for \"${name}\": ${actionitems:-none}"
1127
+      case "${name}" in
1128
+         http:*|https:*)
1129
+            internal_fail "failed name: ${name}"
1130
+      esac
1096 1131
 
1097
-      IFS="
1098
-"
1099
-      for item in ${actionitems}
1100
-      do
1101
-         IFS="${DEFAULT_IFS}"
1132
+      case "${stashdir}" in
1133
+         http:*|https:*)
1134
+            internal_fail "failed stashdir: ${stashdir}"
1135
+      esac
1102 1136
 
1137
+      if is_minion_bootstrap_project "${name}"
1138
+      then
1139
+         log_fluff "Is a minion, ignoring possible changes"
1140
+         clone="`echo "${name};${name};${branch};minion;${tag}" | sed 's/;*$//'`"
1103 1141
          remember="YES"
1104
-
1105
-         case "${item}" in
1106
-            "checkout")
1107
-               checkout_repository "${reposdir}" \
1142
+      else
1143
+         actionitems="`required_action_for_clone "${clone}" \
1144
+                                                 "${reposdir}" \
1145
+                                                 "${name}" \
1146
+                                                 "${url}" \
1147
+                                                 "${branch}" \
1148
+                                                 "${scm}" \
1149
+                                                 "${tag}" \
1150
+                                                 "${stashdir}"`" || exit 1
1151
+
1152
+         log_debug "${C_INFO}Actions for \"${name}\": ${actionitems:-none}"
1153
+
1154
+         IFS="
1155
+"
1156
+         for item in ${actionitems}
1157
+         do
1158
+            IFS="${DEFAULT_IFS}"
1159
+
1160
+            remember="YES"
1161
+
1162
+            case "${item}" in
1163
+               "checkout")
1164
+                  checkout_repository "${reposdir}" \
1165
+                                      "${name}" \
1166
+                                      "${url}" \
1167
+                                      "${branch}" \
1168
+                                      "${scm}" \
1169
+                                      "${tag}" \
1170
+                                      "${stashdir}"
1171
+               ;;
1172
+
1173
+               "clone")
1174
+                  clone_repository "${reposdir}" \
1108 1175
                                    "${name}" \
1109 1176
                                    "${url}" \
1110 1177
                                    "${branch}" \
1111 1178
                                    "${scm}" \
1112 1179
                                    "${tag}" \
1113 1180
                                    "${stashdir}"
1114
-            ;;
1115 1181
 
1116
-            "clone")
1117
-               clone_repository "${reposdir}" \
1118
-                                "${name}" \
1119
-                                "${url}" \
1120
-                                "${branch}" \
1121
-                                "${scm}" \
1122
-                                "${tag}" \
1123
-                                "${stashdir}"
1124
-
1125
-               case "$?" in
1126
-                  1)
1127
-                     # skipped
1128
-                     continue
1129
-                  ;;
1130
-                  2)
1131
-                     # if we used a symlink, we want to memorize that
1132
-                     scm="symlink"
1133
-                  ;;
1134
-               esac
1135
-            ;;
1136
-
1137
-            "ignore")
1138
-               remember="NO"
1139
-            ;;
1140
-
1141
-            move*)
1142
-               oldstashdir="${item:5}"
1143
-
1144
-               log_info "Moving ${repotype}stash ${C_MAGENTA}${C_BOLD}${name}${C_INFO} from \"${oldstashdir}\" to \"${stashdir}\""
1145
-
1146
-               if ! exekutor mv ${COPYMOVEFLAGS} "${oldstashdir}" "${stashdir}"  >&2
1147
-               then
1148
-                  fail "Move failed!"
1149
-               fi
1150
-            ;;
1151
-
1152
-            "upgrade")
1153
-               upgrade_repository "${reposdir}" \
1154
-                                  "${name}" \
1155
-                                  "${url}" \
1156
-                                  "${branch}" \
1157
-                                  "${scm}" \
1158
-                                  "${tag}" \
1159
-                                  "${stashdir}" > /dev/null
1160
-            ;;
1161
-
1162
-            remove*)
1163
-               oldstashdir="${item:7}"
1164
-               if [ -z "${oldstashdir}" ]
1165
-               then
1166
-                  oldstashdir="`get_old_stashdir "${reposdir}" "${name}"`"
1167
-               fi
1168
-
1169
-               log_info "Removing old ${repotype}stash ${C_MAGENTA}${C_BOLD}${oldstashdir}${C_INFO}"
1170
-
1171
-               rmdir_safer "${oldstashdir}"
1172
-            ;;
1173
-
1174
-            "set-remote")
1175
-               log_info "Changing ${repotype}remote to \"${url}\""
1176
-
1177
-               local remote
1178
-
1179
-               remote="`git_get_default_remote "${stashdir}"`"
1180
-               if [ -z "${remote}" ]
1181
-               then
1182
-                  fail "Could not figure out a remote for \"$PWD/${stashdir}\""
1183
-               fi
1184
-               git_set_url "${stashdir}" "${remote}" "${url}"
1185
-            ;;
1186
-
1187
-            *)
1188
-               internal_fail "Unknown action item \"${item}\""
1189
-            ;;
1190
-         esac
1191
-      done
1182
+                  case "$?" in
1183
+                     1)
1184
+                        # skipped
1185
+                        continue
1186
+                     ;;
1187
+                     2)
1188
+                        # if we used a symlink, we want to memorize that
1189
+                        scm="symlink"
1190
+                     ;;
1191
+                  esac
1192
+               ;;
1193
+
1194
+               "ignore")
1195
+                  remember="NO"
1196
+               ;;
1197
+
1198
+               move*)
1199
+                  oldstashdir="${item:5}"
1200
+
1201
+                  log_info "Moving ${repotype}stash ${C_MAGENTA}${C_BOLD}${name}${C_INFO} from \"${oldstashdir}\" to \"${stashdir}\""
1202
+
1203
+                  if ! exekutor mv ${COPYMOVEFLAGS} "${oldstashdir}" "${stashdir}"  >&2
1204
+                  then
1205
+                     fail "Move failed!"
1206
+                  fi
1207
+               ;;
1208
+
1209
+               "upgrade")
1210
+                  upgrade_repository "${reposdir}" \
1211
+                                     "${name}" \
1212
+                                     "${url}" \
1213
+                                     "${branch}" \
1214
+                                     "${scm}" \
1215
+                                     "${tag}" \
1216
+                                     "${stashdir}" > /dev/null
1217
+               ;;
1218
+
1219
+               remove*)
1220
+                  oldstashdir="${item:7}"
1221
+                  if [ -z "${oldstashdir}" ]
1222
+                  then
1223
+                     oldstashdir="`get_old_stashdir "${reposdir}" "${name}"`"
1224
+                  fi
1225
+
1226
+                  log_info "Removing old ${repotype}stash ${C_MAGENTA}${C_BOLD}${oldstashdir}${C_INFO}"
1227
+
1228
+                  rmdir_safer "${oldstashdir}"
1229
+               ;;
1230
+
1231
+               "set-remote")
1232
+                  log_info "Changing ${repotype}remote to \"${url}\""
1233
+
1234
+                  local remote
1235
+
1236
+                  remote="`git_get_default_remote "${stashdir}"`"
1237
+                  if [ -z "${remote}" ]
1238
+                  then
1239
+                     fail "Could not figure out a remote for \"$PWD/${stashdir}\""
1240
+                  fi
1241
+                  git_set_url "${stashdir}" "${remote}" "${url}"
1242
+               ;;
1243
+
1244
+               *)
1245
+                  internal_fail "Unknown action item \"${item}\""
1246
+               ;;
1247
+            esac
1248
+         done
1249
+
1250
+         if [ "${autoupdate}" = "YES" ]
1251
+         then
1252
+            bootstrap_auto_update "${name}" "${stashdir}"
1253
+         fi
1192 1254
 
1193
-      if [ "${autoupdate}" = "YES" ]
1194
-      then
1195
-         bootstrap_auto_update "${name}" "${stashdir}"
1255
+         # create clone as it is now
1256
+         clone="`echo "${url};${dstdir};${branch};${scm};${tag}" | sed 's/;*$//'`"
1196 1257
       fi
1197 1258
 
1198
-      # create clone as it is now
1199
-      clone="`echo "${url};${dstdir};${branch};${scm};${tag}" | sed 's/;*$//'`"
1200
-
1201 1259
       #
1202 1260
       # always remember, what we have now (except if its a minion)
1203 1261
       #
... ...
@@ -1287,6 +1345,15 @@ fetch_once_deep_embedded_repositories()
1287 1345
 }
1288 1346
 
1289 1347
 
1348
+extract_minion_precis()
1349
+{
1350
+   local minions
1351
+
1352
+   minions="`read_root_setting minions`"
1353
+   work_minions "${minions}"
1354
+}
1355
+
1356
+
1290 1357
 fetch_loop_repositories()
1291 1358
 {
1292 1359
    local loops
... ...
@@ -1373,6 +1440,10 @@ fetch_loop()
1373 1440
 
1374 1441
    bootstrap_auto_create
1375 1442
 
1443
+   log_info "Extracting minions' precis..."
1444
+
1445
+   extract_minion_precis
1446
+
1376 1447
    log_info "Checking repositories..."
1377 1448
 
1378 1449
    fetch_once_embedded_repositories
... ...
@@ -48,8 +48,8 @@ usage:
48 48
       addictions     : output "addictions" path
49 49
       binpath        : output paths for binaries
50 50
       cflags         : output CFLAGS for gcc, clang and friends
51
-      cmake-flags    : output cmake flag definitions
52
-      cmake-paths    : output cmake paths definitions
51
+      cmakeflags     : output cmake flag definitions
52
+      cmakepaths     : output cmake paths definitions
53 53
       cxxflags       : output CXXFLAGS
54 54
       dependencies   : output "dependencies" path
55 55
       environment*   : output CFLAGS, CXXFLAGS, LDFLAGS (default)
... ...
@@ -639,11 +639,11 @@ flags_main()
639 639
             result="`add_line "${result}" "${values}"`"
640 640
          ;;
641 641
 
642
-         "cmake-flags")
642
+         "cmakeflags")
643 643
             result="`_flags_do_cmake_flags "${result}"`"
644 644
          ;;
645 645
 
646
-         "cmake-paths")
646
+         "cmakepaths")
647 647
             result="`_flags_do_cmake_paths "${result}"`"
648 648
          ;;
649 649
 
... ...
@@ -62,7 +62,7 @@ eval_exekutor()
62 62
 }
63 63
 
64 64
 
65
-redirect_append_eval_exekutor()
65
+_redirect_append_eval_exekutor()
66 66
 {
67 67
    local output="$1"; shift
68 68
 
... ...
@@ -87,8 +87,11 @@ logging_redirect_eval_exekutor()
87 87
 {
88 88
    local output="$1"; shift
89 89
 
90
-   echo "==>" "$@" > "${output}" # to stdout
91
-   redirect_append_eval_exekutor "${output}" "$@"
90
+   # overwrite
91
+   echo "==>" "$*" > "${output}" # to stdout
92
+
93
+   # append
94
+   _redirect_append_eval_exekutor "${output}" "$@"
92 95
 }
93 96
 
94 97
 
... ...
@@ -220,20 +223,6 @@ add_cmake_path()
220 223
 }
221 224
 
222 225
 
223
-add_word()
224
-{
225
-   local line="$1"
226
-   local word="$2"
227
-
228
-   if [ -z "${line}" ]
229
-   then
230
-      echo "${word}"
231
-   else
232
-      echo "${line} ${word}"
233
-   fi
234
-}
235
-
236
-
237 226
 add_line()
238 227
 {
239 228
    local lines="$1"
... ...
@@ -714,6 +703,7 @@ combined_escaped_search_path_if_exists()
714 703
    echo "${combinedpath}"
715 704
 }
716 705
 
706
+
717 707
 combined_escaped_search_path()
718 708
 {
719 709
    local i
... ...
@@ -1261,7 +1251,10 @@ find_xcodeproj()
1261 1251
    local match
1262 1252
    local new_depth
1263 1253
 
1264
-   for