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 156
 
157 157
 ensure_consistency()
158 158
 {
159
-   if [ -f "${REPOS_DIR}/.bootstrap_fetch_started" ]
159
+   if dirty_harry
160 160
    then
161 161
       log_error "A previous fetch or update was incomplete.
162 162
 Suggested resolution (in $PWD):
... ...
@@ -755,7 +756,6 @@ bootstrap_main()
755 755
          expansion_main "$@" || exit 1
756 756
       ;;
757 757
 
758
-
759 758
       flags)
760 759
          . mulle-bootstrap-flags.sh
761 760
 
... ...
@@ -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 204
 }
205 205
 
206 206
 
207
-
208 207
 _bootstrap_merge_repository_files()
209 208
 {
210 209
    local srcfile="$1"
... ...
@@ -269,7 +275,7 @@ _bootstrap_auto_merge_root_settings()
269 269
       # "repositories" files gets special treatment
270 270
       # "embedded_repositories" is not merged though
271 271
       case "${settingname}" in
272
-         "embedded_repositories")
272
+         "embedded_repositories"|"minions")
273 273
             continue  # done by caller
274 274
          ;;
275 275
 
... ...
@@ -306,16 +312,17 @@ _bootstrap_auto_merge_root_settings()
306 306
 }
307 307
 
308 308
 
309
-_bootstrap_auto_embedded_copy()
309
+
310
+_bootstrap_auto_special_copy()
310 311
 {
312
+   local key="$1"; shift
313
+
311 314
    local name="$1"
312 315
    local directory="$2"
313 316
    local filepath="$3"
314 317
 
315 318
    local dst
316 319
 
317
-   log_debug ":_bootstrap_auto_embedded_copy:"
318
-
319 320
    dst="${BOOTSTRAP_DIR}.auto/.deep/${name}.d"
320 321
 
321 322
    rmdir_safer "${dst}"
... ...
@@ -327,7 +334,7 @@ _bootstrap_auto_embedded_copy()
327 327
    local clones
328 328
    local dstfilepath
329 329
 
330
-   dstfilepath="${dst}/embedded_repositories"
330
+   dstfilepath="${dst}/${key}"
331 331
 
332 332
    (
333 333
       STASHES_DEFAULT_DIR=""
... ...
@@ -337,6 +344,14 @@ _bootstrap_auto_embedded_copy()
337 337
 }
338 338
 
339 339
 
340
+_bootstrap_auto_embedded_copy()
341
+{
342
+   log_debug ":_bootstrap_auto_embedded_copy:"
343
+
344
+   _bootstrap_auto_special_copy "embedded_repositories" "$@"
345
+}
346
+
347
+
340 348
 bootstrap_auto_update()
341 349
 {
342 350
    local name="$1"
... ...
@@ -356,6 +371,8 @@ bootstrap_auto_update()
356 356
          _bootstrap_auto_embedded_copy "${name}" "${stashdir}" "${src}"
357 357
       fi
358 358
 
359
+      # don't copy minions
360
+
359 361
       src="${stashdir}/${BOOTSTRAP_DIR}/bin"
360 362
       if [ -d "${src}" ]
361 363
       then
... ...
@@ -500,12 +517,13 @@ bootstrap_auto_final()
500 500
    # add stuff from bootstrap folder
501 501
    # don't copy config if exists (it could be malicious)
502 502
    #
503
-   # __parse_expanded_clone
504 503
    local name
505 504
    local url
506 505
    local branch
507 506
    local scm
508 507
    local tag
508
+   local stashdir
509
+
509 510
    local clone
510 511
    local order
511 512
    local clones
... ...
@@ -554,6 +572,7 @@ repositories
554 554
 '
555 555
 
556 556
    NON_MERGABLE_SETTINGS='embedded_repositories
557
+minions
557 558
 version
558 559
 '
559 560
    [ -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 691
    suffixsubdir="`determine_dependencies_subdir "${suffix}"`"
692 692
    fallbacksubdir="`determine_dependencies_subdir "${fallback}"`"
693 693
 
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
-
694
+   local other_cppflags
708 695
    local other_cflags
709 696
    local other_cxxflags
710 697
    local other_ldflags
711 698
 
699
+   other_cppflags="`gcc_cppflags_value "${name}"`"
712 700
    other_cflags="`gcc_cflags_value "${name}"`"
713 701
    other_cxxflags="`gcc_cxxflags_value "${name}"`"
714 702
    other_ldflags="`gcc_ldflags_value "${name}"`"
715 703
 
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
704
+   (
705
+      local nativewd
706
+      local owd
730 707
 
731
-   local owd
732
-   local nativewd
708
+      owd="${PWD}"
709
+      nativewd="`pwd ${BUILD_PWD_OPTIONS}`"
733 710
 
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}\""
711
+      cd "${builddir}"
760 712
 
761 713
       local frameworklines
762 714
       local librarylines
... ...
@@ -768,55 +688,43 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
768 768
 
769 769
       if [ ! -z "${suffixsubdir}" ]
770 770
       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}"`"
771
+         frameworklines="`add_path_if_exists "${frameworklines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}${suffixsubdir}/${FRAMEWORK_DIR_NAME}"`"
772
+         librarylines="`add_path_if_exists "${librarylines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}${suffixsubdir}/${LIBRARY_DIR_NAME}"`"
773 773
       fi
774 774
 
775 775
       if [ ! -z "${mappedsubdir}" -a "${mappedsubdir}" != "${suffixsubdir}" ]
776 776
       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}"`"
777
+         frameworklines="`add_path_if_exists "${frameworklines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}${mappedsubdir}/${FRAMEWORK_DIR_NAME}"`"
778
+         librarylines="`add_path_if_exists "${librarylines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}${mappedsubdir}/${LIBRARY_DIR_NAME}"`"
779 779
       fi
780 780
 
781 781
       if [ ! -z "${fallbacksubdir}" -a "${fallbacksubdir}" != "${suffixsubdir}" -a "${fallbacksubdir}" != "${mappedsubdir}" ]
782 782
       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}"`"
783
+         frameworklines="`add_path_if_exists "${frameworklines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}${fallbacksubdir}/${FRAMEWORK_DIR_NAME}"`"
784
+         librarylines="`add_path_if_exists "${librarylines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}${fallbacksubdir}/${LIBRARY_DIR_NAME}"`"
785 785
       fi
786 786
 
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}"`"
787
+      includelines="`add_path_if_exists "${includelines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}/${HEADER_DIR_NAME}"`"
788
+      includelines="`add_path_if_exists "${includelines}" "${nativewd}/${REFERENCE_ADDICTIONS_DIR}/${HEADER_DIR_NAME}"`"
789 789
 
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}"`"
790
+      librarylines="`add_path_if_exists "${librarylines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}/${LIBRARY_DIR_NAME}"`"
791
+      librarylines="`add_path_if_exists "${librarylines}" "${nativewd}/${REFERENCE_ADDICTIONS_DIR}/${LIBRARY_DIR_NAME}"`"
792 792
 
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}"`"
793
+      frameworklines="`add_path_if_exists "${frameworklines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}/${FRAMEWORK_DIR_NAME}"`"
794
+      frameworklines="`add_path_if_exists "${frameworklines}" "${nativewd}/${REFERENCE_ADDICTIONS_DIR}/${FRAMEWORK_DIR_NAME}"`"
795 795
 
796 796
       if [ "${OPTION_ADD_USR_LOCAL}" = "YES" ]
797 797
       then
798
-         includelines="`add_cmake_path_if_exists "${includelines}" "${USR_LOCAL_INCLUDE}"`"
799
-         librarylines="`add_cmake_path_if_exists "${librarylines}" "${USR_LOCAL_LIB}"`"
798
+         includelines="`add_path_if_exists "${includelines}" "${USR_LOCAL_INCLUDE}"`"
799
+         librarylines="`add_path_if_exists "${librarylines}" "${USR_LOCAL_LIB}"`"
800 800
       fi
801 801
 
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 802
 
815
-#      cmakemodulepath="\${CMAKE_MODULE_PATH}"
816
-#      if [ ! -z "${CMAKE_MODULE_PATH}" ]
817
-#      then
818
-#         cmakemodulepath="${CMAKE_MODULE_PATH}${PATH_SEPARATOR}${cmakemodulepath}"   # prepend
819
-#      fi
803
+   #      cmakemodulepath="\${CMAKE_MODULE_PATH}"
804
+   #      if [ ! -z "${CMAKE_MODULE_PATH}" ]
805
+   #      then
806
+   #         cmakemodulepath="${CMAKE_MODULE_PATH}${PATH_SEPARATOR}${cmakemodulepath}"   # prepend
807
+   #      fi
820 808
 
821 809
       local native_includelines
822 810
       local native_librarylines
... ...
@@ -840,7 +748,6 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
840 840
          ;;
841 841
 
842 842
          mingw)
843
-            relative_srcdir="`echo "${relative_srcdir}" | tr '/' '\\'  2> /dev/null`"
844 843
             native_includelines="`echo "${native_includelines}" | tr '/' '\\'  2> /dev/null`"
845 844
             native_librarylines="`echo "${native_librarylines}" | tr '/' '\\'  2> /dev/null`"
846 845
             libraryprefix="/LIBPATH:"
... ...
@@ -855,21 +762,17 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
855 855
          ;;
856 856
       esac
857 857
 
858
-      # assemble -I /I and -L /LIBPATH:
859
-
860
-
861 858
       # cmake separator
862 859
       [ -z "${DEFAULT_IFS}" ] && internal_fail "IFS fail"
863
-      IFS=";"
860
+      IFS="${PATH_SEPARATOR}"
864 861
       for path in ${native_includelines}
865 862
       do
866 863
          IFS="${DEFAULT_IFS}"
867 864
          path="$(sed 's/ /\\ /g' <<< "${path}")"
868
-         other_cflags="`concat "${other_cflags}" "${includeprefix}${path}"`"
869
-         other_cxxflags="`concat "${other_cxxflags}" "${includeprefix}${path}"`"
865
+         other_cppflags="`concat "${other_cflags}" "${includeprefix}${path}"`"
870 866
       done
871 867
 
872
-      IFS=";"
868
+      IFS="${PATH_SEPARATOR}"
873 869
       for path in ${native_librarylines}
874 870
       do
875 871
          IFS="${DEFAULT_IFS}"
... ...
@@ -877,25 +780,162 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
877 877
          other_ldflags="`concat "${other_ldflags}" "${libraryprefix}${path}"`"
878 878
       done
879 879
 
880
-      IFS=";"
880
+      IFS="${PATH_SEPARATOR}"
881 881
       for path in ${native_frameworklines}
882 882
       do
883 883
          IFS="${DEFAULT_IFS}"
884 884
          path="$(sed 's/ /\\ /g' <<< "${path}")"
885
-         other_cflags="`concat "${other_cflags}" "${frameworkprefix}${path}"`"
886
-         other_cxxflags="`concat "${other_cxxflags}" "${frameworkprefix}${path}"`"
885
+         other_cppflags="`concat "${other_cflags}" "${frameworkprefix}${path}"`"
887 886
          other_ldflags="`concat "${other_ldflags}" "${frameworkprefix}${path}"`"
888 887
       done
888
+      IFS="${DEFAULT_IFS}"
889
+
890
+      #
891
+      # the output one line each
892
+      #
893
+      echo "${other_cppflags}"
894
+      echo "${other_cflags}"
895
+      echo "${other_cxxflags}"
896
+      echo "${other_ldflags}"
897
+   )
898
+}
899
+
900
+
901
+build_unix_flags()
902
+{
903
+   _build_flags "$@"
904
+}
905
+
906
+
907
+build_cmake_flags()
908
+{
909
+   (
910
+      PATH_SEPARATOR=";"
911
+      _build_flags "$@"
912
+   )
913
+}
914
+
915
+#
916
+# remove old builddir, create a new one
917
+# depending on configuration cmake with flags
918
+# build stuff into dependencies
919
+# TODO: cache commandline in a file $ and emit instead of rebuilding it every time
920
+#
921
+build_cmake()
922
+{
923
+   local configuration="$1"
924
+   local srcdir="$2"
925
+   local builddir="$3"
926
+   local name="$4"
927
+   local sdk="$5"
928
+
929
+   enforce_build_sanity "${builddir}"
930
+
931
+   if [ -z "${CMAKE}" ]
932
+   then
933
+      fail "No cmake available"
934
+   fi
935
+   if [ -z "${MAKE}" ]
936
+   then
937
+      fail "No make available"
938
+   fi
939
+
940
+   log_info "Let ${C_RESET_BOLD}cmake${C_INFO} do a \
941
+${C_MAGENTA}${C_BOLD}${configuration}${C_INFO} build of \
942
+${C_MAGENTA}${C_BOLD}${name}${C_INFO} for SDK \
943
+${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
944
+
945
+   local sdkparameter
946
+   local local_cmake_flags
947
+   local local_make_flags
948
+
949
+   local_cmake_flags="`read_build_setting "${name}" "CMAKEFLAGS"`"
950
+   sdkparameter="`cmake_sdk_parameter "${sdk}"`"
951
+
952
+   if [ ! -z "${CORES}" ]
953
+   then
954
+      local_make_flags="-j ${CORES}"
955
+   fi
956
+
957
+   local c_compiler_line
958
+   local cxx_compiler_line
959
+
960
+   if [ ! -z "${C_COMPILER}" ]
961
+   then
962
+      c_compiler_line="-DCMAKE_C_COMPILER='${C_COMPILER}'"
963
+   fi
964
+   if [ ! -z "${CXX_COMPILER}" ]
965
+   then
966
+      cxx_compiler_line="-DCMAKE_CXX_COMPILER='${CXX_COMPILER}'"
967
+   fi
968
+
969
+   # linker="`read_build_setting "${name}" "LD"`"
970
+
971
+   # need this now
972
+   mkdir_if_missing "${builddir}"
973
+
974
+   local flaglines
975
+
976
+   flaglines="`build_cmake_flags "$@"`"
977
+
978
+   local other_cppflags
979
+   local other_cflags
980
+   local other_cxxflags
981
+   local other_ldflags
982
+
983
+   other_cppflags="`echo "${flaglines}" | sed -n '1p'`"
984
+   other_cflags="`echo "${flaglines}"   | sed -n '2p'`"
985
+   other_cxxflags="`echo "${flaglines}" | sed -n '3p'`"
986
+   other_ldflags="`echo "${flaglines}"  | sed -n '4p'`"
987
+
988
+   # CMAKE_CPP_FLAGS does not exist in cmake
989
+
990
+   other_cflags="`concat "${other_cppflags}" "${other_cflags}"`"
991
+   other_cxxflags="`concat "${other_cppflags}" "${other_cxxflags}"`"
992
+
993
+   local logfile1
994
+   local logfile2
995
+
996
+   mkdir_if_missing "${BUILDLOGS_DIR}"
997
+
998
+   logfile1="`build_log_name "cmake" "${name}" "${configuration}" "${sdk}"`"
999
+   logfile2="`build_log_name "make" "${name}" "${configuration}" "${sdk}"`"
1000
+
1001
+#   cmake_keep_builddir="`read_build_setting "${name}" "cmake_keep_builddir" "YES"`"
1002
+#   if [ "${cmake_keep_builddir}" != "YES" ]
1003
+#   then
1004
+#      rmdir_safer "${builddir}"
1005
+#   fi
1006
+   (
1007
+      local owd
1008
+      local nativewd
1009
+
1010
+      owd="${PWD}"
1011
+      nativewd="`pwd ${BUILD_PWD_OPTIONS}`"
1012
+
1013
+      exekutor cd "${builddir}" || fail "failed to enter ${builddir}"
1014
+
1015
+      # DONT READ CONFIG SETTING IN THIS INDENT
1016
+      set -f
1017
+
1018
+      if [ "$MULLE_FLAG_VERBOSE_BUILD" = "YES" ]
1019
+      then
1020
+         logfile1="`tty`"
1021
+         logfile2="$logfile1"
1022
+      fi
1023
+      if [ "$MULLE_FLAG_EXECUTOR_DRY_RUN" = "YES" ]
1024
+      then
1025
+         logfile1="/dev/null"
1026
+         logfile2="/dev/null"
1027
+      fi
1028
+
1029
+      log_verbose "Build logs will be in \"${logfile1}\" and \"${logfile2}\""
889 1030
 
890
-      IFS=";"
891 1031
       if [ "${MULLE_FLAG_VERBOSE_BUILD}" = "YES" ]
892 1032
       then
893
-         IFS="${DEFAULT_IFS}"
894 1033
          local_make_flags="${local_make_flags} VERBOSE=1"
895 1034
       fi
896 1035
 
897
-      IFS="${DEFAULT_IFS}"
898
-
899 1036
       local oldpath
900 1037
       local rval
901 1038
 
... ...
@@ -904,6 +944,10 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
904 904
       oldpath="$PATH"
905 905
       PATH="${BUILDPATH}"
906 906
 
907
+      local prefixbuild
908
+
909
+      prefixbuild="`add_cmake_path "${prefixbuild}" "${nativewd}/${BUILD_DEPENDENCIES_DIR}"`"
910
+
907 911
       local cmake_flags
908 912
 
909 913
       cmake_flags="-DCMAKE_C_FLAGS='${other_cflags}' \
... ...
@@ -913,6 +957,12 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
913 913
 
914 914
       local cmake_dirs
915 915
 
916
+      local dependenciesdir
917
+      local addictionsdir
918
+
919
+      dependenciesdir="${nativewd}/${REFERENCE_DEPENDENCIES_DIR}"
920
+      addictionsdir="${nativewd}/${REFERENCE_ADDICTIONS_DIR}"
921
+
916 922
       if [ ! -z "${dependenciesdir}" ]
917 923
       then
918 924
          cmake_dirs="-DDEPENDENCIES_DIR='${dependenciesdir}'"
... ...
@@ -920,24 +970,32 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
920 920
 
921 921
       if [ ! -z "${addictionsdir}" ]
922 922
       then
923
-         cmake_dirs="`add_word "${cmake_dirs}" "-DADDICTIONS_DIR='${addictionsdir}'"`"
923
+         cmake_dirs="`concat "${cmake_dirs}" "-DADDICTIONS_DIR='${addictionsdir}'"`"
924 924
       fi
925 925
 
926 926
       if [ ! -z "${includelines}" ]
927 927
       then
928
-         cmake_dirs="`add_word "${cmake_dirs}" "-DCMAKE_INCLUDE_PATH='${includelines}'"`"
928
+         cmake_dirs="`concat "${cmake_dirs}" "-DCMAKE_INCLUDE_PATH='${includelines}'"`"
929 929
       fi
930 930
 
931 931
       if [ ! -z "${librarylines}" ]
932 932
       then
933
-         cmake_dirs="`add_word "${cmake_dirs}" "-DCMAKE_LIBRARY_PATH='${librarylines}'"`"
933
+         cmake_dirs="`concat "${cmake_dirs}" "-DCMAKE_LIBRARY_PATH='${librarylines}'"`"
934 934
       fi
935 935
 
936 936
       if [ ! -z "${frameworklines}" ]
937 937
       then
938
-         cmake_dirs="`add_word "${cmake_dirs}" "-DCMAKE_FRAMEWORK_PATH='${frameworklines}'"`"
938
+         cmake_dirs="`concat "${cmake_dirs}" "-DCMAKE_FRAMEWORK_PATH='${frameworklines}'"`"
939 939
       fi
940 940
 
941
+      local relative_srcdir
942
+
943
+      relative_srcdir="`relative_path_between "${owd}/${srcdir}" "${PWD}"`"
944
+      case "${UNAME}" in
945
+         mingw)
946
+            relative_srcdir="`echo "${relative_srcdir}" | tr '/' '\\'  2> /dev/null`"
947
+      esac
948
+
941 949
       logging_redirect_eval_exekutor "${logfile1}" "'${CMAKE}'" \
942 950
 -G "'${CMAKE_GENERATOR}'" \
943 951
 "-DMULLE_BOOTSTRAP_VERSION=${MULLE_BOOTSTRAP_VERSION}" \
... ...
@@ -948,7 +1006,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
948 948
 "${sdkparameter}" \
949 949
 "${c_compiler_line}" \
950 950
 "${cxx_compiler_line}" \
951
-"${localcmakeflags}" \
951
+"${local_cmake_flags}" \
952 952
 "${CMAKE_FLAGS}" \
953 953
 "'${relative_srcdir}'"
954 954
       rval=$?
... ...
@@ -967,7 +1025,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
967 967
 
968 968
       set +f
969 969
 
970
-   exekutor cd "${owd}"
970
+   ) || exit 1
971 971
 
972 972
    local depend_subdir
973 973
 
... ...
@@ -1008,40 +1066,50 @@ ${C_MAGENTA}${C_BOLD}${configuration}${C_INFO} build of \
1008 1008
 ${C_MAGENTA}${C_BOLD}${name}${C_INFO} for SDK \
1009 1009
 ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
1010 1010
 
1011
-   local sdkpath
1012
-   local fallback
1013
-   local mapped
1014
-   local suffix
1015
-   local fallback
1016 1011
    local configureflags
1017 1012
 
1018
-   fallback="`echo "${OPTION_CONFIGURATIONS}" | tail -1`"
1019
-   fallback="`read_build_setting "${name}" "fallback-configuration" "${fallback}"`"
1020
-
1021 1013
    configureflags="`read_build_setting "${name}" "configure_flags"`"
1022 1014
 
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'`"
1015
+#   create_dummy_dirs_against_warnings "${mapped}" "${suffix}"
1027 1016
 
1028
-   create_dummy_dirs_against_warnings "${mapped}" "${suffix}"
1017
+   local c_compiler_line
1018
+   local cxx_compiler_line
1029 1019
 
1030
-   local mappedsubdir
1031
-   local fallbacksubdir
1032
-   local suffixsubdir
1020
+   if [ ! -z "${C_COMPILER}" ]
1021
+   then
1022
+      c_compiler_line="CC='${C_COMPILER}'"
1023
+   fi
1024
+   if [ ! -z "${CXX_COMPILER}" ]
1025
+   then
1026
+      cxx_compiler_line="CXX='${CXX_COMPILER}'"
1027
+   fi
1033 1028
 
1034
-   mappedsubdir="`determine_dependencies_subdir "${mapped}"`"
1035
-   suffixsubdir="`determine_dependencies_subdir "${suffix}"`"
1036
-   fallbacksubdir="`determine_dependencies_subdir "${fallback}"`"
1029
+   mkdir_if_missing "${builddir}"
1037 1030
 
1031
+   local flags
1032
+
1033
+   flags="`build_unix_flags "$@"`"
1034
+
1035
+   local other_cppflags
1038 1036
    local other_cflags
1039 1037
    local other_cxxflags
1040 1038
    local other_ldflags
1041 1039
 
1042
-   other_cflags="`gcc_cflags_value "${name}"`"
1043
-   other_cxxflags="`gcc_cxxflags_value "${name}"`"
1044
-   other_ldflags="`gcc_ldflags_value "${name}"`"
1040
+   other_cppflags="`echo "${flags}" | sed -n '1p'`"
1041
+   other_cflags="`echo "${flags}"   | sed -n '2p'`"
1042
+   other_cxxflags="`echo "${flags}" | sed -n '3p'`"
1043
+   other_ldflags="`echo "${flags}"  | sed -n '4p'`"
1044
+
1045
+   local sdkpath
1046
+
1047
+   sdkpath="`gcc_sdk_parameter "${sdk}"`"
1048
+   sdkpath="`echo "${sdkpath}" | sed -e 's/ /\\ /g'`"
1049
+
1050
+   if [ ! -z "${sdkpath}" ]
1051
+   then
1052
+      other_cppflags="`concat "-isysroot ${sdkpath}" "${other_cppflags}"`"
1053
+      other_ldflags="`concat "-isysroot ${sdkpath}" "${other_ldflags}"`"
1054
+   fi
1045 1055
 
1046 1056
    local logfile1
1047 1057
    local logfile2
... ...
@@ -1051,20 +1119,17 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
1051 1051
    logfile1="`build_log_name "configure" "${name}" "${configuration}" "${sdk}"`"
1052 1052
    logfile2="`build_log_name "make" "${name}" "${configuration}" "${sdk}"`"
1053 1053
 
1054
-   local owd
1055
-   local nativewd
1054
+   (
1055
+      local owd
1056
+      local nativewd
1056 1057
 
1057
-   owd="${PWD}"
1058
-   nativewd="`pwd ${BUILD_PWD_OPTIONS}`"
1058
+      owd="${PWD}"
1059
+      nativewd="`pwd ${BUILD_PWD_OPTIONS}`"
1059 1060
 
1060
-   mkdir_if_missing "${builddir}"
1061
-   exekutor cd "${builddir}" || fail "failed to enter ${builddir}"
1061
+      exekutor cd "${builddir}" || fail "failed to enter ${builddir}"
1062 1062
 
1063 1063
       # DONT READ CONFIG SETTING IN THIS INDENT
1064
-       set -f
1065
-
1066
-      logfile1="${owd}/${logfile1}"
1067
-      logfile2="${owd}/${logfile2}"
1064
+      set -f
1068 1065
 
1069 1066
       if [ "$MULLE_FLAG_VERBOSE_BUILD" = "YES" ]
1070 1067
       then
... ...
@@ -1079,94 +1144,15 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
1079 1079
 
1080 1080
       log_verbose "Build logs will be in \"${logfile1}\" and \"${logfile2}\""
1081 1081
 
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 1082
       local dependenciesdir
1125 1083
       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 1084
 
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
1085
+      dependenciesdir="${nativewd}/${REFERENCE_DEPENDENCIES_DIR}"
1086
+      addictionsdir="${nativewd}/${REFERENCE_ADDICTIONS_DIR}"
1159 1087
 
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
1088
+      local prefixbuild
1167 1089
 
1168
-      other_cxxflags"`concat "${other_cflags}" "${other_cxxflags}"`"
1169
-      IFS="${DEFAULT_IFS}"
1090
+      prefixbuild="`add_path "${prefixbuild}" "${nativewd}/${BUILD_DEPENDENCIES_DIR}"`"
1170 1091
 
1171 1092
       local oldpath
1172 1093
       local rval
... ...
@@ -1174,18 +1160,35 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
1174 1174
       oldpath="$PATH"
1175 1175
       PATH="${BUILDPATH}"
1176 1176
 
1177
+      local tool_flags
1178
+
1179
+      if [ ! -z "${other_cppflags}" ]
1180
+      then
1181
+         tool_flags="`concat "${tool_flags}" "CPPFLAGS='${other_cppflags}'"`"
1182
+      fi
1183
+      if [ ! -z "${other_cflags}" ]
1184
+      then
1185
+         tool_flags="`concat "${tool_flags}" "CFLAGS='${other_cflags}'"`"
1186
+      fi
1187
+      if [ ! -z "${other_cxxflags}" ]
1188
+      then
1189
+         tool_flags="`concat "${tool_flags}" "CXXFLAGS='${other_cxxflags}'"`"
1190
+      fi
1191
+      if [ ! -z "${other_ldflags}" ]
1192
+      then
1193
+         tool_flags="`concat "${tool_flags}" "LDFLAGS='${other_ldflags}'"`"
1194
+      fi
1195
+
1177 1196
       # use absolute paths for configure, safer (and easier to read IMO)
1178
-      logging_eval_redirekt_exekutor "${logfile1}" \
1197
+      logging_redirect_eval_exekutor "${logfile1}" \
1179 1198
          DEPENDENCIES_DIR="'${dependenciesdir}'" \
1180 1199
          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}'" \
1200
+         "${c_compiler_line}" \
1201
+         "${cxx_compiler_line}" \
1202
+         "${tool_flags}" \
1186 1203
          "'${owd}/${srcdir}/configure'" \
1187
-            "${configureflags}" \
1188
-             --prefix "'${prefixbuild}'"
1204
+         "${configureflags}" \
1205
+         --prefix "'${prefixbuild}'"
1189 1206
       rval=$?
1190 1207
 
1191 1208
       if [ $rval -ne 0 ]
... ...
@@ -1203,7 +1206,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
1203 1203
       PATH="${oldpath}"
1204 1204
       set +f
1205 1205
 
1206
-   exekutor cd "${owd}"
1206
+   ) || exit 1
1207 1207
 
1208 1208
    local depend_subdir
1209 1209
 
... ...
@@ -1395,7 +1398,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO}${info} in \
1395 1395
       sdk=
1396 1396
    fi
1397 1397
 
1398
-   create_dummy_dirs_against_warnings "${mapped}" "${suffix}"
1398
+#   create_dummy_dirs_against_warnings "${mapped}" "${suffix}"
1399 1399
 
1400 1400
    local mappedsubdir
1401 1401
    local fallbacksubdir
... ...
@@ -2141,7 +2144,7 @@ build_stashes()
2141 2141
                log_info "${C_MAGENTA}${C_BOLD}${name}${C_INFO} is a system library, so not building it"
2142 2142
                :
2143 2143
             else
2144
-               fail "Unknown repo ${name}"
2144
+               fail "Unknown repo \"${name}\""
2145 2145
             fi
2146 2146
          fi
2147 2147
       done
... ...
@@ -2316,8 +2319,11 @@ build_main()
2316 2316
          rmdir_safer "${DEPENDENCIES_DIR}"
2317 2317
       fi
2318 2318
    else
2319
-      log_fluff "Unprotecting \"${DEPENDENCIES_DIR}\" (as this is a partial build)."
2320
-      exekutor chmod -R u+w "${DEPENDENCIES_DIR}"
2319
+      if [ -d "${DEPENDENCIES_DIR}" ]
2320
+      then
2321
+         log_fluff "Unprotecting \"${DEPENDENCIES_DIR}\" (as this is a partial build)."
2322
+         exekutor chmod -R u+w "${DEPENDENCIES_DIR}"
2323
+      fi
2321 2324
    fi
2322 2325
 
2323 2326
    # 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 900
 
901 901
    parse_clone "${clone}"
902 902
 
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 903
    log_debug "Change: \"${clone}\" -> \"${newclone}\""
911 904
 
912 905
    if [ "${scm}" != "${newscm}" ]
... ...
@@ -914,8 +919,14 @@ required_action_for_clone()
914 914
       if ! [ "${scm}" = "symlink" -a "${newscm}" = "git" ]
915 915
       then
916 916
          log_fluff "SCM has changed from \"${scm}\" to \"${newscm}\", need to refetch"
917
-         echo "remove
918
-clone"
917
+
918
+         if [ "${scm}" != "minion" ]
919
+         then
920
+            log_fluff "Not removing \"${stashdir}\" because it's a minion"
921
+            echo "remove"
922
+         fi
923
+
924
+         echo "clone"
919 925
          return
920 926
       fi
921 927
    fi
... ...
@@ -924,13 +935,13 @@ clone"
924 924
    then
925 925
       if [ -e "${newstashdir}" ]
926 926
       then
927
-         log_fluff "Destination already exists. Remove old."
927
+         log_fluff "Destination \"${newstashdir}\" already exists. Remove old."
928 928
          echo "remove"
929 929
 
930
-         # hacque ?
930
+         # detect unlucky hacque
931 931
          if is_minion_bootstrap_project "${newstashdir}"
932 932
          then
933
-            return
933
+            fail "\"${stashdir}\" was renamed to minion \"${newstashdir}\""
934 934
          fi
935 935
       else
936 936
          log_fluff "Destination has changed from \"${stashdir}\" to \"${newstashdir}\", need to move"
... ...
@@ -1021,6 +1032,36 @@ get_old_stashdir()
1021 1021
 }
1022 1022
 
1023 1023
 
1024
+work_minions()
1025
+{
1026
+   local minions="$1"
1027
+
1028
+   local minion
1029
+
1030
+   log_debug "Exploit \"${minions}\""
1031
+
1032
+   IFS="
1033
+"
1034
+   for minion in ${minions}
1035
+   do
1036
+      IFS="${DEFAULT_IFS}"
1037
+
1038
+      if [ -z "${minion}" ]
1039
+      then
1040
+         continue
1041
+      fi
1042
+
1043
+      log_debug "${C_INFO}Doing ${minion}..."
1044
+
1045
+      [ ! -d "${minion}" ] && fail "Minion \"${minion}\" is gone"
1046
+
1047
+      bootstrap_auto_update "${minion}" "${minion}"
1048
+   done
1049
+
1050
+   IFS="${DEFAULT_IFS}"
1051
+}
1052
+
1053
+
1024 1054
 work_clones()
1025 1055
 {
1026 1056
    local reposdir="$1"
... ...
@@ -1083,121 +1124,138 @@ work_clones()
1083 1083
       stashdir="${dstdir}"
1084 1084
       [ -z "${stashdir}" ] && internal_fail "empty stashdir"
1085 1085
 
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}"
1086
+      case "${name}" in
1087
+         http:*|https:*)
1088
+            internal_fail "failed name: ${name}"
1089
+      esac
1096 1090
 
1097
-      IFS="
1098
-"
1099
-      for item in ${actionitems}
1100
-      do
1101
-         IFS="${DEFAULT_IFS}"
1091
+      case "${stashdir}" in
1092
+         http:*|https:*)
1093
+            internal_fail "failed stashdir: ${stashdir}"
1094
+      esac
1102 1095
 
1096
+      if is_minion_bootstrap_project "${name}"
1097
+      then
1098
+         log_fluff "Is a minion, ignoring possible changes"
1099
+         clone="`echo "${name};${name};${branch};minion;${tag}" | sed 's/;*$//'`"
1103 1100
          remember="YES"
1104
-
1105
-         case "${item}" in
1106
-            "checkout")
1107
-               checkout_repository "${reposdir}" \
1101
+      else
1102
+         actionitems="`required_action_for_clone "${clone}" \
1103
+                                                 "${reposdir}" \
1104
+                                                 "${name}" \
1105
+                                                 "${url}" \
1106
+                                                 "${branch}" \
1107
+                                                 "${scm}" \
1108
+                                                 "${tag}" \
1109
+                                                 "${stashdir}"`" || exit 1
1110
+
1111
+         log_debug "${C_INFO}Actions for \"${name}\": ${actionitems:-none}"
1112
+
1113
+         IFS="
1114
+"
1115
+         for item in ${actionitems}
1116
+         do
1117
+            IFS="${DEFAULT_IFS}"
1118
+
1119
+            remember="YES"
1120
+
1121
+            case "${item}" in
1122
+               "checkout")
1123
+                  checkout_repository "${reposdir}" \
1124
+                                      "${name}" \
1125
+                                      "${url}" \
1126
+                                      "${branch}" \
1127
+                                      "${scm}" \
1128
+                                      "${tag}" \
1129
+                                      "${stashdir}"
1130
+               ;;
1131
+
1132
+               "clone")
1133
+                  clone_repository "${reposdir}" \
1108 1134
                                    "${name}" \
1109 1135
                                    "${url}" \
1110 1136
                                    "${branch}" \
1111 1137
                                    "${scm}" \
1112 1138
                                    "${tag}" \
1113 1139
                                    "${stashdir}"
1114
-            ;;
1115 1140
 
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
1141
+                  case "$?" in
1142
+                     1)
1143
+                        # skipped
1144
+                        continue
1145
+                     ;;
1146
+                     2)
1147
+                        # if we used a symlink, we want to memorize that
1148
+                        scm="symlink"
1149
+                     ;;
1150
+                  esac
1151
+               ;;
1152
+
1153
+               "ignore")
1154
+                  remember="NO"
1155
+               ;;
1156
+
1157
+               move*)
1158
+                  oldstashdir="${item:5}"
1159
+
1160
+                  log_info "Moving ${repotype}stash ${C_MAGENTA}${C_BOLD}${name}${C_INFO} from \"${oldstashdir}\" to \"${stashdir}\""
1161
+
1162
+                  if ! exekutor mv ${COPYMOVEFLAGS} "${oldstashdir}" "${stashdir}"  >&2
1163
+                  then
1164
+                     fail "Move failed!"
1165
+                  fi
1166
+               ;;
1167
+
1168
+               "upgrade")
1169
+                  upgrade_repository "${reposdir}" \
1170
+                                     "${name}" \
1171
+                                     "${url}" \
1172
+                                     "${branch}" \
1173
+                                     "${scm}" \
1174
+                                     "${tag}" \
1175
+                                     "${stashdir}" > /dev/null
1176
+               ;;
1177
+
1178
+               remove*)
1179
+                  oldstashdir="${item:7}"
1180
+                  if [ -z "${oldstashdir}" ]
1181
+                  then
1182
+                     oldstashdir="`get_old_stashdir "${reposdir}" "${name}"`"
1183
+                  fi
1184
+
1185
+                  log_info "Removing old ${repotype}stash ${C_MAGENTA}${C_BOLD}${oldstashdir}${C_INFO}"
1186
+
1187
+                  rmdir_safer "${oldstashdir}"
1188
+               ;;
1189
+
1190
+               "set-remote")
1191
+                  log_info "Changing ${repotype}remote to \"${url}\""
1192
+
1193
+                  local remote
1194
+
1195
+                  remote="`git_get_default_remote "${stashdir}"`"
1196
+                  if [ -z "${remote}" ]
1197
+                  then
1198
+                     fail "Could not figure out a remote for \"$PWD/${stashdir}\""
1199
+                  fi
1200
+                  git_set_url "${stashdir}" "${remote}" "${url}"
1201
+               ;;
1202
+
1203
+               *)
1204
+                  internal_fail "Unknown action item \"${item}\""
1205
+               ;;
1206
+            esac
1207
+         done
1208
+
1209
+         if [ "${autoupdate}" = "YES" ]
1210
+         then
1211
+            bootstrap_auto_update "${name}" "${stashdir}"
1212
+         fi
1192 1213
 
1193
-      if [ "${autoupdate}" = "YES" ]
1194
-      then
1195
-         bootstrap_auto_update "${name}" "${stashdir}"
1214
+         # create clone as it is now
1215
+         clone="`echo "${url};${dstdir};${branch};${scm};${tag}" | sed 's/;*$//'`"
1196 1216
       fi
1197 1217
 
1198
-      # create clone as it is now
1199
-      clone="`echo "${url};${dstdir};${branch};${scm};${tag}" | sed 's/;*$//'`"
1200
-
1201 1218
       #
1202 1219
       # always remember, what we have now (except if its a minion)
1203 1220
       #
... ...
@@ -1287,6 +1345,15 @@ fetch_once_deep_embedded_repositories()
1287 1287
 }
1288 1288
 
1289 1289
 
1290
+extract_minion_precis()
1291
+{
1292
+   local minions
1293
+
1294
+   minions="`read_root_setting minions`"
1295
+   work_minions "${minions}"
1296
+}
1297
+
1298
+
1290 1299
 fetch_loop_repositories()
1291 1300
 {
1292 1301
    local loops
... ...
@@ -1373,6 +1440,10 @@ fetch_loop()
1373 1373
 
1374 1374
    bootstrap_auto_create
1375 1375
 
1376
+   log_info "Extracting minions' precis..."
1377
+
1378
+   extract_minion_precis
1379
+
1376 1380
    log_info "Checking repositories..."
1377 1381
 
1378 1382
    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 220
 }
221 221
 
222 222
 
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 223
 add_line()
238 224
 {
239 225
    local lines="$1"
... ...
@@ -714,6 +703,7 @@ combined_escaped_search_path_if_exists()
714 714
    echo "${combinedpath}"
715 715
 }
716 716
 
717
+
717 718
 combined_escaped_search_path()
718 719
 {
719 720
    local i
... ...
@@ -1261,7 +1251,10 @@ find_xcodeproj()
1261 1261
    local match
1262 1262
    local new_depth
1263 1263
 
1264