Browse code

Add a bit of internal documentation. Fix some scripts stuff. Fix a lot of various problems. Make symlinks a configuration option.

Nat! authored on 21/02/2017 13:47:17
Showing 20 changed files
... ...
@@ -32,7 +32,7 @@ REPOS_DIR         | CLONES_SUBDIR       |
32 32
 patch anymore. It's also convenient for the test scripts
33 33
 * various status files are now prefixed with .bootstrap_
34 34
 * **tag** as a setting does not exist anymore. Now its part of the repositories line
35
-* A lot of options have changed. Sorry about this, but progres...
35
+* A lot of options have changed. Too many to mention. Sorry about this, but progres...
36 36
 
37 37
 
38 38
 ### 2.6.1
... ...
@@ -17,10 +17,7 @@ Setting Name            |  Description
17 17
 `brews`                 | Homebrew formulae to install
18 18
 `repositories`          | Repositories to clone, specify the URLs
19 19
 `embedded_repositories` | Repositories to embed, specify the URLs
20
-`taps`                  | Homebrew taps to install
21 20
 `tarballs`              | Tarballs to install (currently filesystem only)
22
-`build_ignore`          | Repositories not to build
23
-
24 21
 
25 22
 
26 23
 > None of these settings are required, they are used to control the
... ...
@@ -69,10 +66,8 @@ Setting Name                     |  Description                               |
69 69
 Root Scripts
70 70
 ==========================
71 71
 
72
-`bin/pre-fetch.sh`
73
-`bin/post-fetch.sh`
74
-`bin/pre-update.sh`
75
-`bin/post-update.sh`
72
+`bin/pre-build.sh`
73
+`bin/post-build.sh`
76 74
 `bin/pre-tag.sh`
77 75
 `bin/post-tag.sh`
78 76
 
... ...
@@ -103,7 +98,8 @@ Setting Name                      |  Description
103 103
 Setting Name                      |  Description                                  | Default
104 104
 ----------------------------------|-----------------------------------------------|--------------
105 105
 `absolute_symlinks`               | Use absolute symlinks instead of relatives    | NO
106
-`symlink_forbidden`               | mulle-bootstrap will not attempt to symlink   | NO (ignored on MINGW)
106
+`embedded_symlinks`               | mulle-bootstrap will attempt to symlink regular repositories       | NO (ignored on MINGW)
107
+`symlinks`                        | mulle-bootstrap will attempt to symlink embedded repositories       | NO (ignored on MINGW)
107 108
 `update_gitignore`                | add cleanable directories to .gitignore       | YES
108 109
 `check_usr_local_include`         | do not fetch, if a system header of same      |
109 110
                                   | is present in `/usr/local/include`            | NO
110 111
new file mode 100644
... ...
@@ -0,0 +1,35 @@
0
+digraph linkage {
1
+	node [ shape="folder" ]
2
+
3
+	project      -> repository_a
4
+	repository_a -> embedded_repository1
5
+	repository_a -> embedded_repository2    [ label=" symlink", color=" blue" ]
6
+
7
+	project      -> repository_b    	    [ label=" symlink", color=" blue" ]
8
+	repository_b -> embedded_repository3     
9
+	repository_b -> embedded_repository4    [ label=" symlink", color=" blue" ]
10
+
11
+	project      -> embedded_repository_c    [ label=" symlink", color=" blue" ]
12
+
13
+	repository_a  [ label="repository (a)"]
14
+	repository_b  [ label="repository (b)", color="blue"]
15
+	embedded_repository1  [ label="embedded_repository (1)"]
16
+	embedded_repository2  [ label="embedded_repository (2)", color="blue"]
17
+	embedded_repository3  [ label="embedded_repository (3)"]
18
+	embedded_repository4  [ label="embedded_repository (4)", color="blue"]
19
+	embedded_repository_c [ label="embedded_repository (c)", color="blue"]
20
+
21
+  node [shape=plaintext]
22
+  subgraph cluster_01 { 
23
+    label = "Legend";
24
+    key [label=<<table border="0" cellpadding="2" cellspacing="0" cellborder="0">
25
+      <tr><td align="left">(a): Created by -a. Updates normally</td></tr>
26
+      <tr><td align="left">(1): Created by -a. Updates normally</td></tr>
27
+      <tr><td align="left">(2): Created by -y --embedded-symlinks (no cache found). Updates with --follow-symlinks</td></tr>
28
+      <tr><td align="left">(b): Created by -y. Updates with --follow-symlinks</td></tr>
29
+      <tr><td align="left">(3): Created by -y --embedded-symlinks --follow-symlinks (no cache found). Updates with --follow-symlinks</td></tr>
30
+      <tr><td align="left">(4): Created by -y --embedded-symlinks --follow-symlinks. Updates with --follow-symlinks</td></tr>
31
+      <tr><td align="left">(c): Created by -y --embedded-symlinks. Updates with --follow-symlinks</td></tr>
32
+      </table>>]
33
+  }
34
+}
... ...
@@ -647,7 +647,7 @@ bootstrap_main()
647 647
 
648 648
          *)
649 649
             case "${command}" in
650
-               bootstrap|nomagic|build|dist|clean|dist-clean|fetch|install|syteminstall|upgrade|update|setup-xcode|xcode|tag)
650
+               bootstrap|nomagic|build|dist|clean|dist-clean|fetch|install|syteminstall|upgrade|update|setup-xcode|show|status|xcode|tag)
651 651
                   fail "There is no ${BOOTSTRAP_DIR} or ${BOOTSTRAP_DIR}.local folder here, can't continue"
652 652
                ;;
653 653
             esac
... ...
@@ -662,7 +662,7 @@ bootstrap_main()
662 662
       if [ "${MULLE_FLAG_DIRTY_HARRY}" = "YES" ]
663 663
       then
664 664
          case "${command}" in
665
-            clean|dist-clean|init|status)
665
+            clean|dist-clean|init|status|show|config|setting)
666 666
             ;;
667 667
 
668 668
             *)
... ...
@@ -259,7 +259,7 @@ _bootstrap_auto_merge_root_settings()
259 259
       srcfile="${directory}/.bootstrap/${settingname}"
260 260
       if [ -d "${srcfile}" ]
261 261
       then
262
-         log_fluff "Directory \"${srcfile}\" not copied"
262
+         # log_fluff "Directory \"${srcfile}\" not copied"
263 263
          continue
264 264
       fi
265 265
 
... ...
@@ -282,7 +282,7 @@ _bootstrap_auto_merge_root_settings()
282 282
       match="`echo "${MERGABLE_SETTINGS}" | fgrep -s -x "${settingname}"`"
283 283
       if [ -z "${match}" ]
284 284
       then
285
-         log_fluff "Setting \"${settingname}\" is not mergable, so ignored"
285
+         # log_fluff "Setting \"${settingname}\" is not mergable, so ignored"
286 286
          continue
287 287
       fi
288 288
 
... ...
@@ -66,7 +66,7 @@ fetch_brew_if_needed()
66 66
 
67 67
    if [ -d "${ADDICTIONS_DIR}" ]
68 68
    then
69
-      fail "There is already an \"${ADDICTIONS_DIR}\" folder here, move it away"
69
+      fail "There is already an \"${ADDICTIONS_DIR}\" folder here ($PWD), move it away"
70 70
    fi
71 71
 
72 72
    case "${UNAME}" in
... ...
@@ -74,7 +74,7 @@ EOF
74 74
 
75 75
    local  repositories
76 76
 
77
-   repositories="`repository_directories_from_repos`"
77
+   repositories="`all_repository_directories_from_repos`"
78 78
    if [ -z "${repositories}" ]
79 79
    then
80 80
       echo "Currently available repositories are:"
... ...
@@ -413,7 +413,8 @@ build_log_name()
413 413
    [ $# -eq 0 ] || shift
414 414
 
415 415
    local logfile
416
-   logfile="${BUILDLOGS_SUBDIR}/${name}"
416
+
417
+   logfile="${BUILDLOGS_DIR}/${name}"
417 418
 
418 419
    while [ $# -gt 0 ]
419 420
    do
... ...
@@ -424,7 +425,7 @@ build_log_name()
424 424
       [ $# -eq 0 ] || shift
425 425
    done
426 426
 
427
-   echo "${logfile}.${tool}.log"
427
+   absolutepath "${logfile}.${tool}.log"
428 428
 }
429 429
 
430 430
 
... ...
@@ -678,7 +679,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
678 678
    fallback="`echo "${OPTION_CONFIGURATIONS}" | tail -1`"
679 679
    fallback="`read_build_setting "${name}" "fallback-configuration" "${fallback}"`"
680 680
    mapped="`read_build_setting "${name}" "cmake-${configuration}.map" "${configuration}"`"
681
-   localcmakeflags="`read_build_setting "${name}" "cmakeflags"`"
681
+   localcmakeflags="`read_build_setting "${name}" "CMAKEFLAGS"`"
682 682
    suffix="`determine_suffix "${configuration}" "${sdk}"`"
683 683
    sdkparameter="`cmake_sdk_parameter "${sdk}"`"
684 684
 
... ...
@@ -715,13 +716,11 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
715 715
    local logfile1
716 716
    local logfile2
717 717
 
718
-   mkdir_if_missing "${BUILDLOGS_SUBDIR}"
718
+   mkdir_if_missing "${BUILDLOGS_DIR}"
719 719
 
720 720
    logfile1="`build_log_name "cmake" "${name}" "${configuration}" "${sdk}"`"
721 721
    logfile2="`build_log_name "make" "${name}" "${configuration}" "${sdk}"`"
722 722
 
723
-   log_verbose "Build logs will be in \"${logfile1}\" and \"${logfile2}\""
724
-
725 723
    local local_make_flags
726 724
 
727 725
    if [ ! -z "${CORES}" ]
... ...
@@ -746,9 +745,6 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
746 746
       # DONT READ CONFIG SETTING IN THIS INDENT
747 747
       set -f
748 748
 
749
-      logfile1="${owd}/${logfile1}"
750
-      logfile2="${owd}/${logfile2}"
751
-
752 749
       if [ "$MULLE_FLAG_VERBOSE_BUILD" = "YES" ]
753 750
       then
754 751
          logfile1="`tty`"
... ...
@@ -760,6 +756,8 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
760 760
          logfile2="/dev/null"
761 761
       fi
762 762
 
763
+      log_verbose "Build logs will be in \"${logfile1}\" and \"${logfile2}\""
764
+
763 765
       local frameworklines
764 766
       local librarylines
765 767
       local includelines
... ...
@@ -1048,13 +1046,11 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
1048 1048
    local logfile1
1049 1049
    local logfile2
1050 1050
 
1051
-   mkdir_if_missing "${BUILDLOGS_SUBDIR}"
1051
+   mkdir_if_missing "${BUILDLOGS_DIR}"
1052 1052
 
1053 1053
    logfile1="`build_log_name "configure" "${name}" "${configuration}" "${sdk}"`"
1054 1054
    logfile2="`build_log_name "make" "${name}" "${configuration}" "${sdk}"`"
1055 1055
 
1056
-   log_verbose "Build logs will be in \"${logfile1}\" and \"${logfile2}\""
1057
-
1058 1056
    local owd
1059 1057
    local nativewd
1060 1058
 
... ...
@@ -1081,6 +1077,8 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
1081 1081
          logfile2="/dev/null"
1082 1082
       fi
1083 1083
 
1084
+      log_verbose "Build logs will be in \"${logfile1}\" and \"${logfile2}\""
1085
+
1084 1086
       local frameworklines
1085 1087
       local librarylines
1086 1088
       local includelines
... ...
@@ -1479,10 +1477,9 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO}${info} in \
1479 1479
 
1480 1480
    local logfile
1481 1481
 
1482
-   mkdir_if_missing "${BUILDLOGS_SUBDIR}"
1482
+   mkdir_if_missing "${BUILDLOGS_DIR}"
1483 1483
 
1484 1484
    logfile="`build_log_name "${toolname}" "${name}" "${configuration}" "${targetname}" "${schemename}" "${sdk}"`"
1485
-   log_verbose "Build log will be in: ${C_RESET_BOLD}${logfile}${C_VERBOSE}"
1486 1485
 
1487 1486
    set -f
1488 1487
 
... ...
@@ -1542,8 +1539,6 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO}${info} in \
1542 1542
    exekutor cd "${srcdir}" || exit 1
1543 1543
 
1544 1544
       # DONT READ CONFIG SETTING IN THIS INDENT
1545
-      logfile="${owd}/${logfile}"
1546
-
1547 1545
       if [ "${MULLE_FLAG_VERBOSE_BUILD}" = "YES" ]
1548 1546
       then
1549 1547
          logfile="`tty`"
... ...
@@ -1553,6 +1548,8 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO}${info} in \
1553 1553
          logfile="/dev/null"
1554 1554
       fi
1555 1555
 
1556
+      log_verbose "Build log will be in: ${C_RESET_BOLD}${logfile}${C_VERBOSE}"
1557
+
1556 1558
       # manually point xcode to our headers and libs
1557 1559
       # this is like manually doing xcode-setup
1558 1560
       local dependencies_framework_search_path
... ...
@@ -1746,9 +1743,11 @@ build_script()
1746 1746
    local targetname
1747 1747
    local logfile
1748 1748
 
1749
-   mkdir_if_missing "${BUILDLOGS_SUBDIR}"
1749
+   mkdir_if_missing "${BUILDLOGS_DIR}"
1750
+
1751
+   logfile="${BUILDLOGS_DIR}/${name}-${configuration}-${sdk}.script.log"
1752
+   logfile="`absolutepath "${logfile}"`"
1750 1753
 
1751
-   logfile="${BUILDLOGS_SUBDIR}/${name}-${configuration}-${sdk}.script.log"
1752 1754
    log_fluff "Build log will be in: ${C_RESET_BOLD}${logfile}${C_INFO}"
1753 1755
 
1754 1756
    mkdir_if_missing "${builddir}"
... ...
@@ -1758,8 +1757,6 @@ build_script()
1758 1758
    owd=`pwd`
1759 1759
    exekutor cd "${srcdir}" || exit 1
1760 1760
 
1761
-      logfile="${owd}/${logfile}"
1762
-
1763 1761
       if [ "$MULLE_FLAG_VERBOSE_BUILD" = "YES" ]
1764 1762
       then
1765 1763
          logfile="`tty`"
... ...
@@ -1834,7 +1831,7 @@ build_with_configuration_sdk_preferences()
1834 1834
 
1835 1835
    local builddir
1836 1836
 
1837
-   builddir="${CLONESBUILD_SUBDIR}/${configuration}/${name}"
1837
+   builddir="${CLONESBUILD_DIR}/${configuration}/${name}"
1838 1838
 
1839 1839
    if [ -d "${builddir}" -a "${OPTION_CLEAN_BEFORE_BUILD}" = "YES" ]
1840 1840
    then
... ...
@@ -2023,17 +2020,15 @@ build_wrapper()
2023 2023
    # need that path for includes though
2024 2024
    #
2025 2025
 
2026
-   run_build_settings_script "pre-build" "${name}" \
2027
-                                         "${REPOS_DIR}" \
2028
-                                         "?" \
2029
-                                         "${name}" \
2030
-                                         "-" \
2031
-                                         "-" \
2032
-                                         "${stashdir}" || exit 1
2026
+   run_build_settings_script "pre-build" \
2027
+                             "${name}" \
2028
+                             "${srcdir}"
2033 2029
 
2034
-   build "${name}" "${srcdir}" || exit 1
2030
+   build "${name}" "${srcdir}"
2035 2031
 
2036
-   run_build_settings_script "post-build" "${name}" "$@" || exit 1
2032
+   run_build_settings_script "post-build" \
2033
+                             "${name}" \
2034
+                             "${srcdir}"
2037 2035
 
2038 2036
    if [ "${COMMAND}" != "ibuild"  ]
2039 2037
    then
... ...
@@ -2073,7 +2068,7 @@ build_if_alive()
2073 2073
          BUILT="${name}
2074 2074
 ${BUILT}"
2075 2075
       else
2076
-         log_fluff "Ignoring \"${name}\". (Either in \"build_ignore\" or already built)"
2076
+         log_fluff "Ignoring \"${name}\" as already built."
2077 2077
       fi
2078 2078
    fi
2079 2079
 }
... ...
@@ -2275,7 +2270,7 @@ build_main()
2275 2275
 
2276 2276
          # TODO: outdated!
2277 2277
          # fetch options, are just ignored (need to update this!)
2278
-         -i|--ignore-branch|-fc|--force-checkout|-nr|--no-recursion|-e|--embedded-only|-es|--embedded-symlink|-u|--follow-symlinks)
2278
+         -e|--embedded-only|-es|--embedded-symlinks|-l|--symlinks)
2279 2279
             :
2280 2280
          ;;
2281 2281
 
... ...
@@ -46,11 +46,11 @@ _collect_stashdir()
46 46
 
47 47
    is_minion_bootstrap_project "${stashdir}" && return
48 48
 
49
-   local stashparentdir
50
-
51
-   stashparentdir="`dirname -- "${stashdir}"`"
52
-
53
-   [ "${stashparentdir}" = "${STASHES_DEFAULT_DIR}" ] && return
49
+   case "${stashdir}" in
50
+      stashes/*)
51
+         return
52
+      ;;
53
+   esac
54 54
 
55 55
    echo "${stashdir}"
56 56
 }
... ...
@@ -121,7 +121,7 @@ print_stashdir_embedded_repositories()
121 121
 setup_clean_environment()
122 122
 {
123 123
    [ -z "${DEPENDENCIES_DIR}"  ]   && internal_fail "DEPENDENCIES_DIR is empty"
124
-   [ -z "${CLONESBUILD_SUBDIR}" ]  && internal_fail "CLONESBUILD_SUBDIR is empty"
124
+   [ -z "${CLONESBUILD_DIR}" ]  && internal_fail "CLONESBUILD_DIR is empty"
125 125
    [ -z "${ADDICTIONS_DIR}" ]      && internal_fail "ADDICTIONS_DIR is empty"
126 126
    [ -z "${STASHES_DEFAULT_DIR}" ] && internal_fail "STASHES_DEFAULT_DIR is empty"
127 127
 
... ...
@@ -129,7 +129,7 @@ setup_clean_environment()
129 129
 
130 130
    OUTPUT_CLEANABLE_FILES="${REPOS_DIR}/.bootstrap_build_done"
131 131
 
132
-   BUILD_CLEANABLE_SUBDIRS="`read_sane_config_path_setting "clean_folders" "${CLONESBUILD_SUBDIR}
132
+   BUILD_CLEANABLE_SUBDIRS="`read_sane_config_path_setting "clean_folders" "${CLONESBUILD_DIR}
133 133
 ${DEPENDENCIES_DIR}/tmp"`"
134 134
    OUTPUT_CLEANABLE_SUBDIRS="`read_sane_config_path_setting "output_clean_folders" "${DEPENDENCIES_DIR}"`"
135 135
    INSTALL_CLEANABLE_SUBDIRS="`read_sane_config_path_setting "install_clean_folders" "${REPOS_DIR}
... ...
@@ -307,7 +307,7 @@ clean_execute()
307 307
    local style="$1"
308 308
 
309 309
    [ -z "${DEPENDENCIES_DIR}"  ]   && internal_fail "DEPENDENCIES_DIR is empty"
310
-   [ -z "${CLONESBUILD_SUBDIR}" ]  && internal_fail "CLONESBUILD_SUBDIR is empty"
310
+   [ -z "${CLONESBUILD_DIR}" ]  && internal_fail "CLONESBUILD_DIR is empty"
311 311
    [ -z "${ADDICTIONS_DIR}"   ]    && internal_fail "ADDICTIONS_DIR is empty"
312 312
    [ -z "${STASHES_DEFAULT_DIR}" ] && internal_fail "STASHES_DEFAULT_DIR is empty"
313 313
 
... ...
@@ -315,14 +315,14 @@ clean_execute()
315 315
 
316 316
    case "${style}" in
317 317
       build)
318
-         BUILD_CLEANABLE_SUBDIRS="`read_sane_config_path_setting "clean_folders" "${CLONESBUILD_SUBDIR}
318
+         BUILD_CLEANABLE_SUBDIRS="`read_sane_config_path_setting "clean_folders" "${CLONESBUILD_DIR}
319 319
 ${DEPENDENCIES_DIR}/tmp"`"
320 320
          clean_directories "${BUILD_CLEANABLE_SUBDIRS}"
321 321
          return
322 322
       ;;
323 323
 
324 324
       dist|output|install)
325
-         BUILD_CLEANABLE_SUBDIRS="`read_sane_config_path_setting "clean_folders" "${CLONESBUILD_SUBDIR}
325
+         BUILD_CLEANABLE_SUBDIRS="`read_sane_config_path_setting "clean_folders" "${CLONESBUILD_DIR}
326 326
 ${DEPENDENCIES_DIR}/tmp"`"
327 327
 
328 328
          clean_directories "${BUILD_CLEANABLE_SUBDIRS}"
... ...
@@ -84,8 +84,11 @@ build_complete_environment()
84 84
 
85 85
       *)
86 86
          # get number of cores, use 50% more for make -j
87
-         CORES="`get_core_count`"
88
-         CORES="`expr $CORES + $CORES / 2`"
87
+         if [ -z "${CORES}" ]
88
+         then
89
+            CORES="`get_core_count`"
90
+            CORES="`expr $CORES + $CORES / 2`"
91
+         fi
89 92
 
90 93
          BUILD_PWD_OPTIONS="-P"
91 94
          BUILDPATH="$PATH"
... ...
@@ -104,8 +107,8 @@ common_settings_initialize()
104 104
    [ -z "${MULLE_BOOTSTRAP_SETTINGS_SH}" ]          && . mulle-bootstrap-settings.sh
105 105
 
106 106
    # experimentally, these could reside outside the project folder but never tested
107
-   CLONESBUILD_SUBDIR="`read_sane_config_path_setting "build_dir" "build/.repos"`"
108
-   BUILDLOGS_SUBDIR="`read_sane_config_path_setting "build_log_dir" "${CLONESBUILD_SUBDIR}/.logs"`"
107
+   CLONESBUILD_DIR="`read_sane_config_path_setting "build_dir" "build/.repos"`"
108
+   BUILDLOGS_DIR="`read_sane_config_path_setting "build_log_dir" "${CLONESBUILD_DIR}/.logs"`"
109 109
 
110 110
    # all of these must reside in the project folder
111 111
    # used to be configurable, but what's the point really ? just slows us down
... ...
@@ -118,8 +121,8 @@ common_settings_initialize()
118 118
    # ADDICTIONS_DIR="`read_sane_config_path_setting "addictions_dir" "addictions"`"
119 119
    # STASHES_DEFAULT_DIR="`read_sane_config_path_setting "stashes_dir" "stashes"`"
120 120
 
121
-   [ -z "${CLONESBUILD_SUBDIR}" ]  && internal_fail "variable CLONESBUILD_SUBDIR is empty"
122
-   [ -z "${BUILDLOGS_SUBDIR}" ]    && internal_fail "variable BUILDLOGS_SUBDIR is empty"
121
+   [ -z "${CLONESBUILD_DIR}" ]  && internal_fail "variable CLONESBUILD_DIR is empty"
122
+   [ -z "${BUILDLOGS_DIR}" ]    && internal_fail "variable BUILDLOGS_DIR is empty"
123 123
 #   [ -z "${DEPENDENCIES_DIR}" ]    && internal_fail "variable DEPENDENCIES_DIR is empty"
124 124
 #   [ -z "${ADDICTIONS_DIR}" ]      && internal_fail "variable ADDICTIONS_DIR is empty"
125 125
 #   [ -z "${STASHES_DEFAULT_DIR}" ] && internal_fail "variable STASHES_DEFAULT_DIR is empty"
... ...
@@ -173,6 +173,8 @@ dependency_resolve()
173 173
    local map="$1"
174 174
    local name="$2"
175 175
 
176
+   log_debug ":dependency_resolve:"
177
+
176 178
    RESOLVED_DEPENDENCIES=
177 179
    UNRESOLVED_DEPENDENCIES=
178 180
 
... ...
@@ -63,7 +63,7 @@ usage:
63 63
       --check-usr-local   :  check /usr/local for duplicates
64 64
       --embedded-only     :  fetch embedded repositories only
65 65
 
66
-      --allow-symlinks    :  allow symlinking instead of cloning
66
+      --symlinks          :  allow symlinking instead of cloning
67 67
       --embedded-symlinks :  allow embedded symlinks (very experimental)
68 68
       --follow-symlinks   :  follow symlinks when updating (not recommended)
69 69
       --no-caches         :  don't use caches. Useful to counter flag -y
... ...
@@ -209,11 +209,13 @@ can_symlink_it()
209 209
 
210 210
    if [ "${OPTION_ALLOW_CREATING_SYMLINKS}" != "YES" ]
211 211
    then
212
+      log_trace "Can't symlink it, because forbidden"
212 213
       return 1
213 214
    fi
214 215
 
215 216
    case "${UNAME}" in
216 217
       minwgw)
218
+         log_trace "Can't symlink it, because symlinking is unavailable on this platform"
217 219
          return 1
218 220
       ;;
219 221
    esac
... ...
@@ -242,11 +244,6 @@ ask_symlink_it()
242 242
 
243 243
    directory="$1"
244 244
 
245
-   if [ ! -d "${directory}" ]
246
-   then
247
-      fail "You need to check out \"${directory}\" yourself, as it's not there."
248
-   fi
249
-
250 245
    if ! can_symlink_it "${directory}"
251 246
    then
252 247
       return 1
... ...
@@ -403,7 +400,7 @@ clone_or_symlink()
403 403
 
404 404
    if [ ! -z "${script}" ]
405 405
    then
406
-      fetch__run_script "${script}" "$@"
406
+      run_script "${script}" "$@"
407 407
       return $?
408 408
    fi
409 409
 
... ...
@@ -433,7 +430,7 @@ clone_or_symlink()
433 433
 
434 434
             if [ ! -z "${found}" ]
435 435
             then
436
-               user_say_yes "There is a \"${found}\" folder in the parent directory of this project.
436
+               user_say_yes "There is a \"${found}\" folder in the repository cache.
437 437
 (\"${PWD}\"). Use it ?"
438 438
                if [ $? -eq 0 ]
439 439
                then
... ...
@@ -553,7 +550,7 @@ checkout_repository()
553 553
    script="`find_build_setting_file "${name}" "bin/checkout.sh"`"
554 554
    if [ ! -z "${script}" ]
555 555
    then
556
-      fetch__run_script "${script}" "$@"
556
+      run_script "${script}" "$@"
557 557
    else
558 558
       "${operation}" "$@"
559 559
    fi
... ...
@@ -593,7 +590,7 @@ update_repository()
593 593
    script="`find_build_setting_file "${name}" "bin/update.sh"`"
594 594
    if [ ! -z "${script}" ]
595 595
    then
596
-      fetch__run_script "${script}" "$@"
596
+      run_script "${script}" "$@"
597 597
    else
598 598
       "${operation}" "$@"
599 599
    fi
... ...
@@ -633,7 +630,7 @@ upgrade_repository()
633 633
    script="`find_build_setting_file "${name}" "bin/upgrade.sh"`"
634 634
    if [ ! -z "${script}" ]
635 635
    then
636
-      fetch__run_script "${script}" "$@"
636
+      run_script "${script}" "$@"
637 637
    else
638 638
       "${operation}" "$@"
639 639
    fi
... ...
@@ -800,12 +797,6 @@ required_action_for_clone()
800 800
       return
801 801
    fi
802 802
 
803
-   if [ "${scm}" = "symlink" ]
804
-   then
805
-      log_fluff "\"${stashdir}\" is symlink. Ignoring possible differences."
806
-      return
807
-   fi
808
-
809 803
    log_debug "Change: \"${clone}\" -> \"${newclone}\""
810 804
 
811 805
    if [ "${scm}" != "${newscm}" ]
... ...
@@ -819,7 +810,7 @@ clone"
819 819
    #
820 820
    # if scm is not git, don't try to be clever
821 821
    #
822
-   if [ ! -z "${scm}"  -a "${scm}" != "git" ]
822
+   if [ ! -z "${scm}" ] && [ "${scm}" != "git" -a "${scm}" != "symlink" ]
823 823
    then
824 824
       echo "remove
825 825
 clone"
... ...
@@ -857,6 +848,19 @@ clone"
857 857
       fi
858 858
    fi
859 859
 
860
+   if [ "${scm}" = "symlink" ]
861
+   then
862
+      if [ -e "${newstashdir}" ]
863
+      then
864
+         log_fluff "\"${stashdir}\" is symlink. Ignoring possible differences."
865
+         return
866
+      fi
867
+
868
+      log_fluff "\"${newstashdir}\" is missing, reget."
869
+      echo "clone"
870
+      return
871
+   fi
872
+
860 873
    if [ "${branch}" != "${newbranch}" ]
861 874
    then
862 875
       log_fluff "Branch has changed from \"${branch}\" to \"${newbranch}\", need to fetch"
... ...
@@ -1345,12 +1349,11 @@ _common_main()
1345 1345
    local MULLE_FLAG_FOLLOW_SYMLINKS="NO"
1346 1346
    local OPTION_ALLOW_CREATING_SYMLINKS="NO"
1347 1347
    local OPTION_ALLOW_CREATING_EMBEDDED_SYMLINKS="NO"
1348
-   local OPTION_ALLOW_SEARCH_CACHES="NO"
1348
+   local OPTION_ALLOW_SEARCH_CACHES="YES"
1349 1349
    local OPTION_EMBEDDED_ONLY="NO"
1350 1350
    local OVERRIDE_BRANCH
1351 1351
    local DONT_WARN_SCRIPTS="NO"
1352 1352
 
1353
-
1354 1353
    local ROOT_DIR="`pwd -P`"
1355 1354
    local CACHES_PATH
1356 1355
 
... ...
@@ -1360,18 +1363,12 @@ _common_main()
1360 1360
    #
1361 1361
    # "repository" caches can and usually are outside the project folder
1362 1362
    # this can be multiple paths!
1363
-   local parent
1364
-   local default_caches_path
1365
-
1366
-   # our "sandbox" root, probably not changeable
1367
-   parent="`dirname -- "${ROOT_DIR}"`"
1368
-   default_caches_path="${CACHES_PATH:-${parent}}"
1369
-
1370
-   CACHES_PATH="`read_config_setting "cashes_dir" "${default_caches_path}"`"
1363
+   CACHES_PATH="`read_config_setting "cashes_path" "${CACHES_PATH}"`"
1371 1364
 
1372 1365
    OPTION_CHECK_USR_LOCAL_INCLUDE="`read_config_setting "check_usr_local_include" "NO"`"
1373 1366
    OVERRIDE_BRANCH="`read_config_setting "override_branch"`"
1374 1367
 
1368
+
1375 1369
    DONT_WARN_SCRIPTS="`read_config_setting "dont_warn_scripts" "${MULLE_FLAG_ANSWER:-NO}"`"
1376 1370
 
1377 1371
    if [ "${DONT_WARN_SCRIPTS}" = "YES" ]
... ...
@@ -1381,17 +1378,14 @@ _common_main()
1381 1381
 
1382 1382
    case "${UNAME}" in
1383 1383
       mingw)
1384
-         OPTION_ALLOW_CREATING_SYMLINKS="NO"
1385
-         MULLE_FLAG_FOLLOW_SYMLINKS="NO"
1386 1384
       ;;
1387 1385
 
1388 1386
       *)
1389
-         OPTION_ALLOW_CREATING_SYMLINKS="`read_config_setting "symlink_allowed" "${MULLE_FLAG_ANSWER}"`"
1387
+         OPTION_ALLOW_CREATING_SYMLINKS="`read_config_setting "symlinks" "${MULLE_FLAG_ANSWER}"`"
1388
+         OPTION_ALLOW_CREATING_EMBEDDED_SYMLINKS="`read_config_setting "embedded_symlinks" "NO"`"
1390 1389
       ;;
1391 1390
    esac
1392 1391
 
1393
-   OPTION_ALLOW_SEARCH_CACHES="${MULLE_FLAG_ANSWER}"
1394
-
1395 1392
    #
1396 1393
    # it is useful, that fetch understands build options and
1397 1394
    # ignores them
... ...
@@ -1403,10 +1397,6 @@ _common_main()
1403 1403
             ${USAGE}
1404 1404
          ;;
1405 1405
 
1406
-         -c|--caches)
1407
-            OPTION_ALLOW_SEARCH_CACHES="YES"
1408
-         ;;
1409
-
1410 1406
          -cu|--check-usr-local|--check-usr-local)
1411 1407
             OPTION_CHECK_USR_LOCAL_INCLUDE="YES"
1412 1408
          ;;
... ...
@@ -1420,8 +1410,8 @@ _common_main()
1420 1420
             MULLE_FLAG_FOLLOW_SYMLINKS="YES"
1421 1421
          ;;
1422 1422
 
1423
-         # create symlinks instead of clones for repositories
1424
-         -l|--symlink-creation)
1423
+         # allow creating symlinks instead of clones for repositories
1424
+         -l|--symlink-creation|--symlinks)
1425 1425
             OPTION_ALLOW_CREATING_SYMLINKS="YES"
1426 1426
          ;;
1427 1427
 
... ...
@@ -1437,13 +1427,12 @@ _common_main()
1437 1437
 
1438 1438
          --no-caches)
1439 1439
             OPTION_ALLOW_SEARCH_CACHES="NO"
1440
-            OPTION_ALLOW_CREATING_SYMLINKS="NO"
1441 1440
          ;;
1442 1441
 
1443 1442
          --no-symlink-creation|--no-symlinks)
1444 1443
             MULLE_FLAG_FOLLOW_SYMLINKS="NO"
1445
-            OPTION_ALLOW_CREATING_EMBEDDED_SYMLINKS="NO"
1446 1444
             OPTION_ALLOW_CREATING_SYMLINKS="NO"
1445
+            OPTION_ALLOW_CREATING_EMBEDDED_SYMLINKS="NO"
1447 1446
          ;;
1448 1447
 
1449 1448
          # TODO: outdated!
... ...
@@ -45,14 +45,19 @@ usage:
45 45
    Output flags for various tool types. You can specify multiple types.
46 46
 
47 47
    Types:
48
+      addictions     : output "addictions" path
49
+      binpath        : output paths for binaries
48 50
       cflags         : output CFLAGS for gcc, clang and friends
51
+      cmake-flags    : output cmake flag definitions
52
+      cmake-paths    : output cmake paths definitions
49 53
       cxxflags       : output CXXFLAGS
50
-      ldflags        : output LDFLAGS
51
-      path           : output PATH
54
+      dependencies   : output "dependencies" path
52 55
       environment*   : output CFLAGS, CXXFLAGS, LDFLAGS (default)
53 56
       frameworkpath  : output framework search paths PATH style
54 57
       headerpath     : output framework search paths PATH style
58
+      ldflags        : output LDFLAGS
55 59
       librarypath    : output library search paths PATH style
60
+      path           : output PATH
56 61
 EOF
57 62
   exit 1
58 63
 }
... ...
@@ -334,6 +339,8 @@ _flags_headerpath_value()
334 334
 
335 335
 _flags_librarypath_value()
336 336
 {
337
+   local result
338
+
337 339
    if [ "${OPTION_WITH_LIBRARYPATHS}" = "YES" ]
338 340
    then
339 341
       if [ "${OPTION_WITH_DEPENDENCIES}" = "YES" ]
... ...
@@ -356,6 +363,78 @@ _flags_librarypath_value()
356 356
 }
357 357
 
358 358
 
359
+_flags_do_cmake_flags()
360
+{
361
+   local result="$1"
362
+
363
+   local values
364
+   local line
365
+
366
+   values="`_flags_cflags_value`"
367
+   if [ ! -z "${values}" ]
368
+   then
369
+      values="`echo "${values}" | tr '\012' ' ' | sed 's/ *$//'`"
370
+      line="-DCMAKE_C_FLAGS=\"${values}\""
371
+      result="`add_line "${result}" "${line}"`"
372
+   fi
373
+
374
+   values="`_flags_cxxflags_value`"
375
+   if [ ! -z "${values}" ]
376
+   then
377
+      values="`echo "${values}" | tr '\012' ' ' | sed 's/ *$//'`"
378
+      line="-DCMAKE_CXX_FLAGS=\"${values}\""
379
+      result="`add_line "${result}" "${line}"`"
380
+   fi
381
+
382
+   values="`_flags_ldflags_value`"
383
+   if [ ! -z "${values}" ]
384
+   then
385
+      values="`echo "${values}" | tr '\012' ' ' | sed 's/ *$//'`"
386
+      line="-DCMAKE_EXE_LINKER_FLAGS=\"${values}\""
387
+      result="`add_line "${result}" "${line}"`"
388
+
389
+      line="-DCMAKE_SHARED_LINKER_FLAGS=\"${values}\""
390
+      result="`add_line "${result}" "${line}"`"
391
+   fi
392
+
393
+   printf "%s" "$result"
394
+}
395
+
396
+
397
+_flags_do_cmake_paths()
398
+{
399
+   local result="$1"
400
+
401
+   local values
402
+   local line
403
+
404
+   values="`_flags_headerpath_value`"
405
+   if [ ! -z "${values}" ]
406
+   then
407
+      line="-DCMAKE_INCLUDE_PATH =\"${values}\""
408
+      result="`add_line "${result}" "${line}"`"
409
+   fi
410
+
411
+   values="`_flags_librarypath_value`"
412
+   if [ ! -z "${values}" ]
413
+   then
414
+      line="-DCMAKE_LIBRARY_PATH=\"${values}\""
415
+      result="`add_line "${result}" "${line}"`"
416
+   fi
417
+
418
+   # does CMAKE_FRAMEWORK_PATH even exist ?
419
+   values="`_flags_frameworkpath_value`"
420
+   if [ ! -z "${values}" ]
421
+   then
422
+      line="-DCMAKE_FRAMEWORK_PATH=\"${values}\""
423
+      result="`add_line "${result}" "${line}"`"
424
+   fi
425
+
426
+   printf "%s" "$result"
427
+}
428
+
429
+
430
+
359 431
 _flags_do_path()
360 432
 {
361 433
    local result="$1"
... ...
@@ -545,11 +624,28 @@ flags_main()
545 545
       [ $# -ne 0 ] && shift
546 546
 
547 547
       case "${type}" in
548
+         addictions)
549
+            values="`_flags_emit_path "${ADDICTIONS_DIR}"`"
550
+            result="`add_line "${result}" "${values}"`"
551
+         ;;
552
+
553
+         dependencies)
554
+            values="`_flags_emit_path "${DEPENDENCIES_DIR}"`"
555
+            result="`add_line "${result}" "${values}"`"
556
+         ;;
557
+
548 558
          "cflags"|"cxxflags"|"ldflags"|"binpath"|"frameworkpath"|"headerpath"|"librarypath")
549 559
             values="`_flags_${type}_value`"
550 560
             result="`add_line "${result}" "${values}"`"
551 561
          ;;
552 562
 
563
+         "cmake-flags")
564
+            result="`_flags_do_cmake_flags "${result}"`"
565
+         ;;
566
+
567
+         "cmake-paths")
568
+            result="`_flags_do_cmake_paths "${result}"`"
569
+         ;;
553 570
 
554 571
          "path")
555 572
             result="`_flags_do_path "${result}"`"
... ...
@@ -572,7 +668,7 @@ flags_main()
572 572
    then
573 573
       if [ "${separator}" = " " ]
574 574
       then
575
-         printf "${result}" | tr '\012' ' '  | sed 's/ *$//'
575
+         printf "%s" "${result}" | tr '\012' ' '  | sed 's/ *$//'
576 576
          printf "\n"
577 577
       else
578 578
          printf "%s\n" "${result}"
... ...
@@ -57,44 +57,38 @@ eval_exekutor()
57 57
 
58 58
    if [ "${MULLE_FLAG_EXECUTOR_DRY_RUN}" != "YES" ]
59 59
    then
60
-      eval "$@"
60
+      ( eval "$@" )
61 61
    fi
62 62
 }
63 63
 
64 64
 
65 65
 redirect_append_eval_exekutor()
66 66
 {
67
-   local output
68
-
69
-   output="$1"
70
-   shift
67
+   local output="$1"; shift
71 68
 
72 69
    if [ "${MULLE_FLAG_EXECUTOR_DRY_RUN}" = "YES" -o "${MULLE_FLAG_LOG_EXECUTOR}" = "YES" ]
73 70
    then
74 71
       if [ -z "${MULLE_EXECUTOR_LOG_DEVICE}" ]
75 72
       then
76
-         echo "==>" "$@" ">" "${output}" >&2
73
+         echo "==>" "$@" ">>" "${output}" >&2
77 74
       else
78
-         echo "==>" "$@" ">" "${output}" > "${MULLE_EXECUTOR_LOG_DEVICE}"
75
+         echo "==>" "$@" ">>" "${output}" > "${MULLE_EXECUTOR_LOG_DEVICE}"
79 76
       fi
80 77
    fi
81 78
 
82 79
    if [ "${MULLE_FLAG_EXECUTOR_DRY_RUN}" != "YES" ]
83 80
    then
84
-      eval "$@" >> "${output}"
81
+      ( eval "$@" ) >> "${output}"
85 82
    fi
86 83
 }
87 84
 
88 85
 
89 86
 logging_redirect_eval_exekutor()
90 87
 {
91
-   local output
92
-
93
-   output="$1"
94
-   shift
88
+   local output="$1"; shift
95 89
 
96 90
    echo "==>" "$@" > "${output}" # to stdout
97
-   redirect_append_eval_exekutor "$1" "$@"
91
+   redirect_append_eval_exekutor "${output}" "$@"
98 92
 }
99 93
 
100 94
 
... ...
@@ -119,10 +113,7 @@ exekutor()
119 119
 
120 120
 redirect_exekutor()
121 121
 {
122
-   local output
123
-
124
-   output="$1"
125
-   shift
122
+   local output="$1"; shift
126 123
 
127 124
    if [ "${MULLE_FLAG_EXECUTOR_DRY_RUN}" = "YES" -o "${MULLE_FLAG_LOG_EXECUTOR}" = "YES" ]
128 125
    then
... ...
@@ -136,17 +127,14 @@ redirect_exekutor()
136 136
 
137 137
    if [ "${MULLE_FLAG_EXECUTOR_DRY_RUN}" != "YES" ]
138 138
    then
139
-      "$@" > "${output}"
139
+      ( "$@" ) > "${output}"
140 140
    fi
141 141
 }
142 142
 
143 143
 
144 144
 redirect_append_exekutor()
145 145
 {
146
-   local output
147
-
148
-   output="$1"
149
-   shift
146
+   local output="$1"; shift
150 147
 
151 148
    if [ "${MULLE_FLAG_EXECUTOR_DRY_RUN}" = "YES" -o "${MULLE_FLAG_LOG_EXECUTOR}" = "YES" ]
152 149
    then
... ...
@@ -160,17 +148,14 @@ redirect_append_exekutor()
160 160
 
161 161
    if [ "${MULLE_FLAG_EXECUTOR_DRY_RUN}" != "YES" ]
162 162
    then
163
-      "$@" >> "${output}"
163
+      ( "$@" ) >> "${output}"
164 164
    fi
165 165
 }
166 166
 
167 167
 
168 168
 logging_redirekt_exekutor()
169 169
 {
170
-   local output
171
-
172
-   output="$1"
173
-   shift
170
+   local output="$1"; shift
174 171
 
175 172
    echo "==>" "$@" > "${output}"
176 173
    redirect_append_exekutor "${output}" "$@"
... ...
@@ -548,7 +533,6 @@ _relative_path_between()
548 548
 #
549 549
 # the routine can not deal with ../ and ./
550 550
 # but is a bit faster than symlink_relpath
551
-# which uses simplify_path
552 551
 #
553 552
 relative_path_between()
554 553
 {
... ...
@@ -690,9 +674,9 @@ absolutepath()
690 690
 
691 691
 
692 692
 #
693
-# Imagine you are in a working directory pwd and you have two
694
-# paths `a` and  `b`. This function gives the relpath you need
695
-# if you were to symlink 'a' into 'b'
693
+# Imagine you are in a working directory `dirname b`
694
+# This function gives the relpath you need
695
+# if you were to create symlink 'b' pointing to 'a'
696 696
 #
697 697
 symlink_relpath()
698 698
 {
... ...
@@ -765,6 +749,8 @@ _simplify_components()
765 765
    local i
766 766
    local result
767 767
 
768
+   [ -z "${MULLE_BOOTSTRAP_ARRAY_SH}" ] && . mulle-bootstrap-array.sh
769
+
768 770
    result= # voodoo linux fix ?
769 771
    IFS="
770 772
 "
... ...
@@ -1381,9 +1367,6 @@ functions_initialize()
1381 1381
 
1382 1382
    log_debug ":functions_initialize:"
1383 1383
 
1384
-   [ -z "${MULLE_BOOTSTRAP_ARRAY_SH}" ] && . mulle-bootstrap-array.sh
1385
-
1386
-
1387 1384
    :
1388 1385
 }
1389 1386
 
... ...
@@ -172,6 +172,8 @@ check_version()
172 172
 # figure out if we need to run refresh
173 173
 build_needed()
174 174
 {
175
+   log_debug ":build_needed:"
176
+
175 177
    [ -z "${REPOS_DIR}" ] && internal_fail "REPOS_DIR undefined"
176 178
 
177 179
    if [ ! -f "${REPOS_DIR}/.bootstrap_build_done" ]
... ...
@@ -192,15 +194,9 @@ build_needed()
192 192
 
193 193
 fetch_needed()
194 194
 {
195
-   [ -z "${REPOS_DIR}" ]     && internal_fail "REPOS_DIR undefined"
196
-   [ -z "${BOOTSTRAP_DIR}" ] && internal_fail "BOOTSTRAP_DIR undefined"
195
+   log_debug ":fetch_needed:"
197 196
 
198
-   # doppelt gemoppelt
199
-   # if [ ! -f "${BOOTSTRAP_DIR}.auto/build_order" ]
200
-   # then
201
-   #    log_fluff "Need fetch because \"${BOOTSTRAP_DIR}.auto/build_order\" does not exist."
202
-   #    return 0
203
-   # fi
197
+   [ -z "${REPOS_DIR}" ] && internal_fail "REPOS_DIR undefined"
204 198
 
205 199
    if [ ! -f "${REPOS_DIR}/.bootstrap_fetch_done" ]
206 200
    then
... ...
@@ -208,18 +204,40 @@ fetch_needed()
208 208
       return 0
209 209
    fi
210 210
 
211
-   if [ "${REPOS_DIR}/.bootstrap_fetch_done" -ot "${BOOTSTRAP_DIR}" ]
211
+   local bootstrapdir="${BOOTSTRAP_DIR}"
212
+
213
+   [ -z "${bootstrapdir}" ] && internal_fail "BOOTSTRAP_DIR undefined"
214
+
215
+   if [ "${BOOTSTRAP_DIR}" -ot "${BOOTSTRAP_DIR}.local" ]
212 216
    then
213
-      log_fluff "Need fetch because \"${BOOTSTRAP_DIR}\" is modified"
214
-      return 0
217
+      bootstrapdir="${BOOTSTRAP_DIR}.local"
215 218
    fi
216 219
 
217
-   if [ "${REPOS_DIR}/.bootstrap_fetch_done" -ot "${BOOTSTRAP_DIR}.local" ]
220
+   if [ "${REPOS_DIR}/.bootstrap_fetch_done" -ot "${bootstrapdir}" ]
218 221
    then
219
-      log_fluff "Need fetch because \"${BOOTSTRAP_DIR}.local\" is modified"
222
+      log_fluff "Need fetch because \"${bootstrapdir}\" is modified"
220 223
       return 0
221 224
    fi
222 225
 
226
+   [ -z "${MULLE_BOOTSTRAP_REPOSITORIES_SH}" ] && . mulle-bootstrap-repositories.sh
227
+
228
+   local stashdir
229
+
230
+   IFS="
231
+"
232
+   for stashdir in `all_repository_stashes ${REPOS_DIR}`
233
+   do
234
+      IFS="${DEFAULT_IFS}"
235
+
236
+      if [ "${bootstrapdir}" -ot "${stashdir}/${BOOTSTRAP_DIR}" ]
237
+      then
238
+         log_fluff "Need fetch because \"${stashdir}/${BOOTSTRAP_DIR}\" is modified"
239
+         return 0
240
+      fi
241
+   done
242
+
243
+   IFS="${DEFAULT_IFS}"
244
+
223 245
    return 1
224 246
 }
225 247
 
... ...
@@ -309,7 +327,7 @@ _expanded_variables()
309 309
    then
310 310
       if [ -z "${default}" ]
311 311
       then
312
-         log_warning "\$\{${key}\} expanded to the empty string"
312
+         log_warning "\${${key}} expanded to the empty string."
313 313
       else
314 314
          log_setting "Root setting for ${C_MAGENTA}${key}${C_SETTING} set to default ${C_MAGENTA}${default}${C_SETTING}"
315 315
          value="${default}"
... ...
@@ -192,6 +192,35 @@ all_embedded_repository_stashes()
192 192
 }
193 193
 
194 194
 
195
+# all_minion_stashdirs()
196
+# {
197
+#    local reposdir="$1"
198
+
199
+#    [ -z "${reposdir}" ] && internal_fail "repos is empty"
200
+
201
+#    local name
202
+#    local stash
203
+
204
+#    IFS="
205
+# "
206
+#    for name in `ls -1 "${reposdir}/" 2> /dev/null`
207
+#    do
208
+#       IFS="${DEFAULT_IFS}"
209
+
210
+#       stash="`stash_of_repository "${reposdir}" "${name}"`"
211
+#       if [ ! -z "${stash}" ]
212
+#       then
213
+#          if is_minion_bootstrap_project "${stash}"
214
+#          then
215
+#             echo "${stash}"
216
+#          fi
217
+#       fi
218
+#    done
219
+
220
+#    IFS="${DEFAULT_IFS}"
221
+# }
222
+
223
+
195 224
 #
196 225
 # Walkers
197 226
 #
... ...
@@ -307,7 +336,6 @@ _get_all_repos_clones()
307 307
 }
308 308
 
309 309
 
310
-
311 310
 _deep_walk_repos_trampoline()
312 311
 {
313 312
    log_debug ":_deep_walk_repos_trampoline:" "$@"
... ...
@@ -374,8 +402,10 @@ _deep_walk_auto_trampoline()
374 374
 
375 375
       PARENT_REPOSITORY_NAME="${name}"
376 376
       PARENT_CLONE="${clone}"
377
+
377 378
       STASHES_DEFAULT_DIR=""
378 379
       STASHES_ROOT_DIR="${stashdir}"
380
+
379 381
       _walk_repositories "${embedded_clones}" \
380 382
                          "${callback}" \
381 383
                          "${permissions}" \
... ...
@@ -489,7 +519,6 @@ walk_raw_clones()
489 489
 }
490 490
 
491 491
 
492
-
493 492
 # deal with stuff like
494 493
 # foo
495 494
 # https://www./foo.git
... ...
@@ -725,7 +754,6 @@ read_repository_file()
725 725
 }
726 726
 
727 727
 
728
-
729 728
 ensure_reposdir_directory()
730 729
 {
731 730
    local reposdir
... ...
@@ -878,6 +906,7 @@ unique_repository_contents()
878 878
    echo "${output}"
879 879
 }
880 880
 
881
+
881 882
 #
882 883
 # Take an expanded .bootstrap.auto file and put the
883 884
 # entries in proper order, possibly removing duplicates
... ...
@@ -37,28 +37,21 @@ run_script()
37 37
 
38 38
    [ ! -z "$script" ] || internal_fail "script is empty"
39 39
 
40
-   local directory
41
-
42
-   directory="${PWD}/$3"
43
-   [ -d "$directory" ] || internal_fail "expected directory \"${directory}\" is missing from \"${PWD}\""
44
-
45 40
    if [ -x "${script}" ]
46 41
    then
47 42
       script="`absolutepath "${script}"`"
48
-      log_verbose "Executing script ${C_RESET_BOLD}${script}${C_VERBOSE} $1 ..."
49
-      if  [ "${MULLE_FLAG_LOG_SCRIPTS}" = "YES" ]
43
+      log_verbose "Executing script ${C_RESET_BOLD}${script}${C_VERBOSE} in ($PWD)..."
44
+
45
+      if [ "${MULLE_FLAG_LOG_SCRIPTS}" = "YES" ]
50 46
       then
51 47
          echo "ARGV=" "$@" >&2
52
-         echo "DIRECTORY=${directory}" >&2
48
+         echo "DIRECTORY=${PWD}" >&2
53 49
          echo "ENVIRONMENT=" >&2
54 50
          echo "{" >&2
55 51
          env | sed 's/^\(.\)/   \1/' >&2
56 52
          echo "}" >&2
57 53
       fi
58
-      (
59
-         cd "${directory}"
60
-         exekutor "${script}" "$@" >&2
61
-      ) || fail "script \"${script}\" did not run successfully"
54
+      exekutor "${script}" "$@" >&2 || fail "script \"${script}\" did not run successfully"
62 55
    else
63 56
       if [ ! -e "${script}" ]
64 57
       then
... ...
@@ -87,14 +80,19 @@ run_root_settings_script()
87 87
 run_build_settings_script()
88 88
 {
89 89
    local scriptname="$1" ; shift
90
-   local name="$1" ; shift
90
+   local name="$1"
91
+   local stashdir="$2"
91 92
 
92 93
    local script
93 94
 
94 95
    script="`find_build_setting_file "${name}" "bin/${scriptname}.sh"`"
95 96
    if [ ! -z "${script}" ]
96 97
    then
97
-      run_script "${script}" "$@"
98
+      script="`absolutepath "${script}"`"
99
+      (
100
+         cd "${stashdir}"
101
+         run_script "${script}" "$@"
102
+      ) || exit 1
98 103
    fi
99 104
 }
100 105
 
... ...
@@ -175,7 +175,7 @@ _read_setting()
175 175
       return 2   # it's grep :)
176 176
    fi
177 177
 
178
-   if [ "${MULLE_FLAG_LOG_VERBOSE}" = "YES"  ]
178
+   if [ "${MULLE_FLAG_LOG_VERBOSE}" = "YES" -o "$MULLE_FLAG_LOG_SETTINGS" = "YES" ]
179 179
    then
180 180
       local name
181 181
 
... ...
@@ -183,14 +183,15 @@ _read_setting()
183 183
       apath="`absolutepath "${apath}"`"
184 184
 
185 185
       # make some boring names less prominent
186
-      if [ "$MULLE_FLAG_LOG_SETTINGS" = "YES"  -o \
187
-           "${name}" = "repositories" -o \
188
-           "${name}" = "repositories.tmp" -o \
189
-           "${name}" = "build_order" -o \
190
-           "${name}" = "versions" -o \
191
-           "${name}" = "embedded_repositories" -o \
192
-           "${name}" = "MULLE_REPOSITORIES" -o \
193
-           "${name}" = "MULLE_NAT_REPOSITORIES"  ]
186
+      if [ "$MULLE_FLAG_LOG_SETTINGS" = "YES" ] ||
187
+         [ "${name}" != "repositories" -a \
188
+           "${name}" != "repositories.tmp" -a \
189
+           "${name}" != "build_order" -a \
190
+           "${name}" != "versions" -a \
191
+           "${name}" != "embedded_repositories" -a \
192
+           "${name}" != "MULLE_REPOSITORIES" -a \
193
+           "${name}" != "MULLE_NAT_REPOSITORIES" \
194
+         ]
194 195
       then
195 196
          log_printf "${C_SETTING}%b${C_RESET}\n" "Setting ${C_MAGENTA}${name}${C_SETTING} found in \"${apath}\" as ${C_MAGENTA}${C_BOLD}${value}${C_SETTING}"
196 197
       fi
... ...
@@ -291,6 +292,7 @@ list_environment_settings()
291 291
 {
292 292
    local line
293 293
    local key
294
+   local envkey
294 295
    local value
295 296
 
296 297
    env | while read line
... ...
@@ -303,7 +305,10 @@ list_environment_settings()
303 303
 
304 304
       if [ ! -z "${key}" -a ! -z "${value}" ]
305 305
       then
306
-         echo "${key}=${value}"
306
+         envkey="`echo "${line}" | \
307
+            sed -n 's/^\(MULLE_BOOTSTRAP_[^=]*\)=.*/\1/p'`"
308
+
309
+         echo "${key}=\"${value}\" (${envkey})"
307 310
       fi
308 311
    done
309 312
 }
... ...
@@ -346,7 +351,6 @@ list_dir_settings()
346 346
    local directory="$1"
347 347
 
348 348
    local filename
349
-   local name
350 349
    local key
351 350
    local value
352 351
 
... ...
@@ -356,11 +360,11 @@ list_dir_settings()
356 356
    do
357 357
       IFS="${DEFAULT_IFS}"
358 358
 
359
-      name="`basename -- "${filename}"`"
360
-      value="`_read_setting "${directory}"`"
359
+      key="`basename -- "${filename}"`"
360
+      value="`_read_setting "${directory}/${key}"`"
361 361
       if [ ! -z "${value}" ]
362 362
       then
363
-         echo "${key}=${value}"
363
+         echo "${key}=\"${value}\""
364 364
       fi
365 365
    done
366 366
 
... ...
@@ -699,10 +703,10 @@ ${keys3}
699 699
 #
700 700
 _config_list()
701 701
 {
702
-   log_info "Environment:"
702
+   log_info "environment:"
703 703
    list_environment_settings | sed 's/^/   /'
704 704
 
705
-   log_info ".bootstrap.local/config:"
705
+   log_info ".bootstrap.local/config ($PWD):"
706 706
    list_local_settings | sed 's/^/   /'
707 707
 
708 708
    log_info "~/.mulle-bootstrap:"
... ...
@@ -406,5 +406,10 @@ show_main()
406 406
    done
407 407
 
408 408
    _common_show "$@"
409
+
410
+   if [ "${SHOW_RAW}" != "YES" -a ! -d "${BOOTSTRAP_DIR}".auto ]
411
+   then
412
+      log_warning "Nothing to show yet. Maybe use --raw option ?"
413
+   fi
409 414
 }
410 415
 
... ...
@@ -275,5 +275,5 @@ tag_main()
275 275
 
276 276
    tag "${TAG}" "$@"
277 277
 
278
-   run_root_settings_script "pre-tag"
278
+   run_root_settings_script "post-tag"
279 279
 }
... ...
@@ -37,7 +37,7 @@ xcode_usage()
37 37
 {
38 38
    cat <<EOF >&2
39 39
 usage:
40
-   mulle-bootstrap xcode [<add|remove> [xcodeproj]
40
+   mulle-bootstrap xcode <add|remove> [xcodeproj]
41 41
 
42 42
    add      : add settings to Xcode project (default)
43 43
    remove   : remove settings from Xcode project
... ...
@@ -160,6 +160,7 @@ patch_library_configurations()
160 160
    for i in ${xcode_configurations}
161 161
    do
162 162
       IFS="${DEFAULT_IFS}"
163
+
163 164
       mapped=`map_configuration "${configurations}" "${i}" "${default}"`
164 165
       exekutor mulle-xcode-settings -configuration "${i}" "${flag}" "LIBRARY_CONFIGURATION" "${mapped}" "${project}" || exit 1
165 166
    done
... ...
@@ -193,6 +194,10 @@ patch_xcode_project()
193 193
       fi
194 194
    fi
195 195
 
196
+   local projectdir
197
+   local projectname
198
+
199
+   projectdir="`dirname -- "${project}"`"
196 200
    projectname="`basename -- "${project}"`"
197 201
 
198 202
    # mod_pbxproj can only do Debug/Release/All...
... ...
@@ -244,20 +249,15 @@ Release"
244 244
    local library_search_paths
245 245
    local framework_search_paths
246 246
 
247
-   #  figure out a way to make this nicer
248
-   local absolute
249
-   local absolute2
250
-
251
-   absolute="`absolutepath "${project}"`"
252
-   absolute="`dirname -- "${absolute}"`"
247
+   # grab values from master if needed
248
+   DEPENDENCIES_DIR="`mulle-bootstrap flags dependencies`"
249
+   ADDICTIONS_DIR="`mulle-bootstrap flags addictions`"
253 250
 
254
-   absolute2="`pwd -P`/${DEPENDENCIES_DIR}"
255
-   dependencies_dir='$(PROJECT_DIR)'/"${DEPENDENCIES_DIR}"
256
-#   dependencies_dir='$(PROJECT_DIR)'/"${relative_subdir}'"
251
+   relpath="`symlink_relpath "${DEPENDENCIES_DIR}" "${projectdir}"`"
252
+   dependencies_dir='$(PROJECT_DIR)'/"${relpath}"
257 253
 
258
-   absolute2="`pwd -P`/${ADDICTIONS_DIR}"
259
-   addictions_dir='$(PROJECT_DIR)'/"${ADDICTIONS_DIR}"
260
-#   addictions_dir='$(PROJECT_DIR)/'"${relative_subdir}"
254
+   relpath="`symlink_relpath "${ADDICTIONS_DIR}" "${projectdir}"`"
255
+   addictions_dir='$(PROJECT_DIR)'/"${relpath}"
261 256
 
262 257
    header_search_paths=""
263 258
    if [ "${MULLE_BOOTSTRAP_EXECUTABLE}" = "mulle-bootstrap" ]