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 66
 Root Scripts
70 67
 ==========================
71 68
 
72
-`bin/pre-fetch.sh`
73
-`bin/post-fetch.sh`
74
-`bin/pre-update.sh`
75
-`bin/post-update.sh`
69
+`bin/pre-build.sh`
70
+`bin/post-build.sh`
76 71
 `bin/pre-tag.sh`
77 72
 `bin/post-tag.sh`
78 73
 
... ...
@@ -103,7 +98,8 @@ Setting Name                      |  Description
103 98
 Setting Name                      |  Description                                  | Default
104 99
 ----------------------------------|-----------------------------------------------|--------------
105 100
 `absolute_symlinks`               | Use absolute symlinks instead of relatives    | NO
106
-`symlink_forbidden`               | mulle-bootstrap will not attempt to symlink   | NO (ignored on MINGW)
101
+`embedded_symlinks`               | mulle-bootstrap will attempt to symlink regular repositories       | NO (ignored on MINGW)
102
+`symlinks`                        | mulle-bootstrap will attempt to symlink embedded repositories       | NO (ignored on MINGW)
107 103
 `update_gitignore`                | add cleanable directories to .gitignore       | YES
108 104
 `check_usr_local_include`         | do not fetch, if a system header of same      |
109 105
                                   | is present in `/usr/local/include`            | NO
110 106
new file mode 100644
... ...
@@ -0,0 +1,35 @@
1
+digraph linkage {
2
+	node [ shape="folder" ]
3
+
4
+	project      -> repository_a
5
+	repository_a -> embedded_repository1
6
+	repository_a -> embedded_repository2    [ label=" symlink", color=" blue" ]
7
+
8
+	project      -> repository_b    	    [ label=" symlink", color=" blue" ]
9
+	repository_b -> embedded_repository3     
10
+	repository_b -> embedded_repository4    [ label=" symlink", color=" blue" ]
11
+
12
+	project      -> embedded_repository_c    [ label=" symlink", color=" blue" ]
13
+
14
+	repository_a  [ label="repository (a)"]
15
+	repository_b  [ label="repository (b)", color="blue"]
16
+	embedded_repository1  [ label="embedded_repository (1)"]
17
+	embedded_repository2  [ label="embedded_repository (2)", color="blue"]
18
+	embedded_repository3  [ label="embedded_repository (3)"]
19
+	embedded_repository4  [ label="embedded_repository (4)", color="blue"]
20
+	embedded_repository_c [ label="embedded_repository (c)", color="blue"]
21
+
22
+  node [shape=plaintext]
23
+  subgraph cluster_01 { 
24
+    label = "Legend";
25
+    key [label=<<table border="0" cellpadding="2" cellspacing="0" cellborder="0">
26
+      <tr><td align="left">(a): Created by -a. Updates normally</td></tr>
27
+      <tr><td align="left">(1): Created by -a. Updates normally</td></tr>
28
+      <tr><td align="left">(2): Created by -y --embedded-symlinks (no cache found). Updates with --follow-symlinks</td></tr>
29
+      <tr><td align="left">(b): Created by -y. Updates with --follow-symlinks</td></tr>
30
+      <tr><td align="left">(3): Created by -y --embedded-symlinks --follow-symlinks (no cache found). Updates with --follow-symlinks</td></tr>
31
+      <tr><td align="left">(4): Created by -y --embedded-symlinks --follow-symlinks. Updates with --follow-symlinks</td></tr>
32
+      <tr><td align="left">(c): Created by -y --embedded-symlinks. Updates with --follow-symlinks</td></tr>
33
+      </table>>]
34
+  }
35
+}
... ...
@@ -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 425
       [ $# -eq 0 ] || shift
425 426
    done
426 427
 
427
-   echo "${logfile}.${tool}.log"
428
+   absolutepath "${logfile}.${tool}.log"
428 429
 }
429 430
 
430 431
 
... ...
@@ -678,7 +679,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
678 679
    fallback="`echo "${OPTION_CONFIGURATIONS}" | tail -1`"
679 680
    fallback="`read_build_setting "${name}" "fallback-configuration" "${fallback}"`"
680 681
    mapped="`read_build_setting "${name}" "cmake-${configuration}.map" "${configuration}"`"
681
-   localcmakeflags="`read_build_setting "${name}" "cmakeflags"`"
682
+   localcmakeflags="`read_build_setting "${name}" "CMAKEFLAGS"`"
682 683
    suffix="`determine_suffix "${configuration}" "${sdk}"`"
683 684
    sdkparameter="`cmake_sdk_parameter "${sdk}"`"
684 685
 
... ...
@@ -715,13 +716,11 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
715 716
    local logfile1
716 717
    local logfile2
717 718
 
718
-   mkdir_if_missing "${BUILDLOGS_SUBDIR}"
719
+   mkdir_if_missing "${BUILDLOGS_DIR}"
719 720
 
720 721
    logfile1="`build_log_name "cmake" "${name}" "${configuration}" "${sdk}"`"
721 722
    logfile2="`build_log_name "make" "${name}" "${configuration}" "${sdk}"`"
722 723
 
723
-   log_verbose "Build logs will be in \"${logfile1}\" and \"${logfile2}\""
724
-
725 724
    local local_make_flags
726 725
 
727 726
    if [ ! -z "${CORES}" ]
... ...
@@ -746,9 +745,6 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
746 745
       # DONT READ CONFIG SETTING IN THIS INDENT
747 746
       set -f
748 747
 
749
-      logfile1="${owd}/${logfile1}"
750
-      logfile2="${owd}/${logfile2}"
751
-
752 748
       if [ "$MULLE_FLAG_VERBOSE_BUILD" = "YES" ]
753 749
       then
754 750
          logfile1="`tty`"
... ...
@@ -760,6 +756,8 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
760 756
          logfile2="/dev/null"
761 757
       fi
762 758
 
759
+      log_verbose "Build logs will be in \"${logfile1}\" and \"${logfile2}\""
760
+
763 761
       local frameworklines
764 762
       local librarylines
765 763
       local includelines
... ...
@@ -1048,13 +1046,11 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
1048 1046
    local logfile1
1049 1047
    local logfile2
1050 1048
 
1051
-   mkdir_if_missing "${BUILDLOGS_SUBDIR}"
1049
+   mkdir_if_missing "${BUILDLOGS_DIR}"
1052 1050
 
1053 1051
    logfile1="`build_log_name "configure" "${name}" "${configuration}" "${sdk}"`"
1054 1052
    logfile2="`build_log_name "make" "${name}" "${configuration}" "${sdk}"`"
1055 1053
 
1056
-   log_verbose "Build logs will be in \"${logfile1}\" and \"${logfile2}\""
1057
-
1058 1054
    local owd
1059 1055
    local nativewd
1060 1056
 
... ...
@@ -1081,6 +1077,8 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
1081 1077
          logfile2="/dev/null"
1082 1078
       fi
1083 1079
 
1080
+      log_verbose "Build logs will be in \"${logfile1}\" and \"${logfile2}\""
1081
+
1084 1082
       local frameworklines
1085 1083
       local librarylines
1086 1084
       local includelines
... ...
@@ -1479,10 +1477,9 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO}${info} in \
1479 1477
 
1480 1478
    local logfile
1481 1479
 
1482
-   mkdir_if_missing "${BUILDLOGS_SUBDIR}"
1480
+   mkdir_if_missing "${BUILDLOGS_DIR}"
1483 1481
 
1484 1482
    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 1483
 
1487 1484
    set -f
1488 1485
 
... ...
@@ -1542,8 +1539,6 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO}${info} in \
1542 1539
    exekutor cd "${srcdir}" || exit 1
1543 1540
 
1544 1541
       # DONT READ CONFIG SETTING IN THIS INDENT
1545
-      logfile="${owd}/${logfile}"
1546
-
1547 1542
       if [ "${MULLE_FLAG_VERBOSE_BUILD}" = "YES" ]
1548 1543
       then
1549 1544
          logfile="`tty`"
... ...
@@ -1553,6 +1548,8 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO}${info} in \
1553 1548
          logfile="/dev/null"
1554 1549
       fi
1555 1550
 
1551
+      log_verbose "Build log will be in: ${C_RESET_BOLD}${logfile}${C_VERBOSE}"
1552
+
1556 1553
       # manually point xcode to our headers and libs
1557 1554
       # this is like manually doing xcode-setup
1558 1555
       local dependencies_framework_search_path
... ...
@@ -1746,9 +1743,11 @@ build_script()
1746 1743
    local targetname
1747 1744
    local logfile
1748 1745
 
1749
-   mkdir_if_missing "${BUILDLOGS_SUBDIR}"
1746
+   mkdir_if_missing "${BUILDLOGS_DIR}"
1747
+
1748
+   logfile="${BUILDLOGS_DIR}/${name}-${configuration}-${sdk}.script.log"
1749
+   logfile="`absolutepath "${logfile}"`"
1750 1750
 
1751
-   logfile="${BUILDLOGS_SUBDIR}/${name}-${configuration}-${sdk}.script.log"
1752 1751
    log_fluff "Build log will be in: ${C_RESET_BOLD}${logfile}${C_INFO}"
1753 1752
 
1754 1753
    mkdir_if_missing "${builddir}"
... ...
@@ -1758,8 +1757,6 @@ build_script()
1758 1757
    owd=`pwd`
1759 1758
    exekutor cd "${srcdir}" || exit 1
1760 1759
 
1761
-      logfile="${owd}/${logfile}"
1762
-
1763 1760
       if [ "$MULLE_FLAG_VERBOSE_BUILD" = "YES" ]
1764 1761
       then
1765 1762
          logfile="`tty`"
... ...
@@ -1834,7 +1831,7 @@ build_with_configuration_sdk_preferences()
1834 1831
 
1835 1832
    local builddir
1836 1833
 
1837
-   builddir="${CLONESBUILD_SUBDIR}/${configuration}/${name}"
1834
+   builddir="${CLONESBUILD_DIR}/${configuration}/${name}"
1838 1835
 
1839 1836
    if [ -d "${builddir}" -a "${OPTION_CLEAN_BEFORE_BUILD}" = "YES" ]
1840 1837
    then
... ...
@@ -2023,17 +2020,15 @@ build_wrapper()
2023 2020
    # need that path for includes though
2024 2021
    #
2025 2022
 
2026
-   run_build_settings_script "pre-build" "${name}" \
2027
-                                         "${REPOS_DIR}" \
2028
-                                         "?" \
2029
-                                         "${name}" \
2030
-                                         "-" \
2031
-                                         "-" \
2032
-                                         "${stashdir}" || exit 1
2023
+   run_build_settings_script "pre-build" \
2024
+                             "${name}" \
2025
+                             "${srcdir}"
2033 2026
 
2034
-   build "${name}" "${srcdir}" || exit 1
2027
+   build "${name}" "${srcdir}"
2035 2028
 
2036
-   run_build_settings_script "post-build" "${name}" "$@" || exit 1
2029
+   run_build_settings_script "post-build" \
2030
+                             "${name}" \
2031
+                             "${srcdir}"
2037 2032
 
2038 2033
    if [ "${COMMAND}" != "ibuild"  ]
2039 2034
    then
... ...
@@ -2073,7 +2068,7 @@ build_if_alive()
2073 2068
          BUILT="${name}
2074 2069
 ${BUILT}"
2075 2070
       else
2076
-         log_fluff "Ignoring \"${name}\". (Either in \"build_ignore\" or already built)"
2071
+         log_fluff "Ignoring \"${name}\" as already built."
2077 2072
       fi
2078 2073
    fi
2079 2074
 }
... ...
@@ -2275,7 +2270,7 @@ build_main()
2275 2270
 
2276 2271
          # TODO: outdated!
2277 2272
          # 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)
2273
+         -e|--embedded-only|-es|--embedded-symlinks|-l|--symlinks)
2279 2274
             :
2280 2275
          ;;
2281 2276
 
... ...
@@ -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 107
    [ -z "${MULLE_BOOTSTRAP_SETTINGS_SH}" ]          && . mulle-bootstrap-settings.sh
105 108
 
106 109
    # 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"`"
110
+   CLONESBUILD_DIR="`read_sane_config_path_setting "build_dir" "build/.repos"`"
111
+   BUILDLOGS_DIR="`read_sane_config_path_setting "build_log_dir" "${CLONESBUILD_DIR}/.logs"`"
109 112
 
110 113
    # all of these must reside in the project folder
111 114
    # used to be configurable, but what's the point really ? just slows us down
... ...
@@ -118,8 +121,8 @@ common_settings_initialize()
118 121
    # ADDICTIONS_DIR="`read_sane_config_path_setting "addictions_dir" "addictions"`"
119 122
    # STASHES_DEFAULT_DIR="`read_sane_config_path_setting "stashes_dir" "stashes"`"
120 123
 
121
-   [ -z "${CLONESBUILD_SUBDIR}" ]  && internal_fail "variable CLONESBUILD_SUBDIR is empty"
122
-   [ -z "${BUILDLOGS_SUBDIR}" ]    && internal_fail "variable BUILDLOGS_SUBDIR is empty"
124
+   [ -z "${CLONESBUILD_DIR}" ]  && internal_fail "variable CLONESBUILD_DIR is empty"
125
+   [ -z "${BUILDLOGS_DIR}" ]    && internal_fail "variable BUILDLOGS_DIR is empty"
123 126
 #   [ -z "${DEPENDENCIES_DIR}" ]    && internal_fail "variable DEPENDENCIES_DIR is empty"
124 127
 #   [ -z "${ADDICTIONS_DIR}" ]      && internal_fail "variable ADDICTIONS_DIR is empty"
125 128
 #   [ -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 244
 
243 245
    directory="$1"
244 246
 
245
-   if [ ! -d "${directory}" ]
246
-   then
247
-      fail "You need to check out \"${directory}\" yourself, as it's not there."
248
-   fi
249
-
250 247
    if ! can_symlink_it "${directory}"
251 248
    then
252 249
       return 1
... ...
@@ -403,7 +400,7 @@ clone_or_symlink()
403 400
 
404 401
    if [ ! -z "${script}" ]
405 402
    then
406
-      fetch__run_script "${script}" "$@"
403
+      run_script "${script}" "$@"
407 404
       return $?
408 405
    fi
409 406
 
... ...
@@ -433,7 +430,7 @@ clone_or_symlink()
433 430
 
434 431
             if [ ! -z "${found}" ]
435 432
             then
436
-               user_say_yes "There is a \"${found}\" folder in the parent directory of this project.
433
+               user_say_yes "There is a \"${found}\" folder in the repository cache.
437 434
 (\"${PWD}\"). Use it ?"
438 435
                if [ $? -eq 0 ]
439 436
                then
... ...
@@ -553,7 +550,7 @@ checkout_repository()
553 550
    script="`find_build_setting_file "${name}" "bin/checkout.sh"`"
554 551
    if [ ! -z "${script}" ]
555 552
    then
556
-      fetch__run_script "${script}" "$@"
553
+      run_script "${script}" "$@"
557 554
    else
558 555
       "${operation}" "$@"
559 556
    fi
... ...
@@ -593,7 +590,7 @@ update_repository()
593 590
    script="`find_build_setting_file "${name}" "bin/update.sh"`"
594 591
    if [ ! -z "${script}" ]
595 592
    then
596
-      fetch__run_script "${script}" "$@"
593
+      run_script "${script}" "$@"
597 594
    else
598 595
       "${operation}" "$@"
599 596
    fi
... ...
@@ -633,7 +630,7 @@ upgrade_repository()
633 630
    script="`find_build_setting_file "${name}" "bin/upgrade.sh"`"
634 631
    if [ ! -z "${script}" ]
635 632
    then
636
-      fetch__run_script "${script}" "$@"
633
+      run_script "${script}" "$@"
637 634
    else
638 635
       "${operation}" "$@"
639 636
    fi
... ...
@@ -800,12 +797,6 @@ required_action_for_clone()
800 797
       return
801 798
    fi
802 799
 
803
-   if [ "${scm}" = "symlink" ]
804
-   then
805
-      log_fluff "\"${stashdir}\" is symlink. Ignoring possible differences."
806
-      return
807
-   fi
808
-
809 800
    log_debug "Change: \"${clone}\" -> \"${newclone}\""
810 801
 
811 802
    if [ "${scm}" != "${newscm}" ]
... ...
@@ -819,7 +810,7 @@ clone"
819 810
    #
820 811
    # if scm is not git, don't try to be clever
821 812
    #
822
-   if [ ! -z "${scm}"  -a "${scm}" != "git" ]
813
+   if [ ! -z "${scm}" ] && [ "${scm}" != "git" -a "${scm}" != "symlink" ]
823 814
    then
824 815
       echo "remove
825 816
 clone"
... ...
@@ -857,6 +848,19 @@ clone"
857 848
       fi
858 849
    fi
859 850
 
851
+   if [ "${scm}" = "symlink" ]
852
+   then
853
+      if [ -e "${newstashdir}" ]
854
+      then
855
+         log_fluff "\"${stashdir}\" is symlink. Ignoring possible differences."
856
+         return
857
+      fi
858
+
859
+      log_fluff "\"${newstashdir}\" is missing, reget."
860
+      echo "clone"
861
+      return
862
+   fi
863
+
860 864
    if [ "${branch}" != "${newbranch}" ]
861 865
    then
862 866
       log_fluff "Branch has changed from \"${branch}\" to \"${newbranch}\", need to fetch"
... ...
@@ -1345,12 +1349,11 @@ _common_main()
1345 1349
    local MULLE_FLAG_FOLLOW_SYMLINKS="NO"
1346 1350
    local OPTION_ALLOW_CREATING_SYMLINKS="NO"
1347 1351
    local OPTION_ALLOW_CREATING_EMBEDDED_SYMLINKS="NO"
1348
-   local OPTION_ALLOW_SEARCH_CACHES="NO"
1352
+   local OPTION_ALLOW_SEARCH_CACHES="YES"
1349 1353
    local OPTION_EMBEDDED_ONLY="NO"
1350 1354
    local OVERRIDE_BRANCH
1351 1355
    local DONT_WARN_SCRIPTS="NO"
1352 1356
 
1353
-
1354 1357
    local ROOT_DIR="`pwd -P`"
1355 1358
    local CACHES_PATH
1356 1359
 
... ...
@@ -1360,18 +1363,12 @@ _common_main()
1360 1363
    #
1361 1364
    # "repository" caches can and usually are outside the project folder
1362 1365
    # 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}"`"
1366
+   CACHES_PATH="`read_config_setting "cashes_path" "${CACHES_PATH}"`"
1371 1367
 
1372 1368
    OPTION_CHECK_USR_LOCAL_INCLUDE="`read_config_setting "check_usr_local_include" "NO"`"
1373 1369
    OVERRIDE_BRANCH="`read_config_setting "override_branch"`"
1374 1370
 
1371
+
1375 1372
    DONT_WARN_SCRIPTS="`read_config_setting "dont_warn_scripts" "${MULLE_FLAG_ANSWER:-NO}"`"
1376 1373
 
1377 1374
    if [ "${DONT_WARN_SCRIPTS}" = "YES" ]
... ...
@@ -1381,17 +1378,14 @@ _common_main()
1381 1378
 
1382 1379
    case "${UNAME}" in
1383 1380
       mingw)
1384
-         OPTION_ALLOW_CREATING_SYMLINKS="NO"
1385
-         MULLE_FLAG_FOLLOW_SYMLINKS="NO"
1386 1381
       ;;
1387 1382
 
1388 1383
       *)
1389
-         OPTION_ALLOW_CREATING_SYMLINKS="`read_config_setting "symlink_allowed" "${MULLE_FLAG_ANSWER}"`"
1384
+         OPTION_ALLOW_CREATING_SYMLINKS="`read_config_setting "symlinks" "${MULLE_FLAG_ANSWER}"`"
1385
+         OPTION_ALLOW_CREATING_EMBEDDED_SYMLINKS="`read_config_setting "embedded_symlinks" "NO"`"
1390 1386
       ;;
1391 1387
    esac
1392 1388
 
1393
-   OPTION_ALLOW_SEARCH_CACHES="${MULLE_FLAG_ANSWER}"
1394
-
1395 1389
    #
1396 1390
    # it is useful, that fetch understands build options and
1397 1391
    # ignores them
... ...
@@ -1403,10 +1397,6 @@ _common_main()
1403 1397
             ${USAGE}
1404 1398
          ;;
1405 1399
 
1406
-         -c|--caches)
1407
-            OPTION_ALLOW_SEARCH_CACHES="YES"
1408
-         ;;
1409
-
1410 1400
          -cu|--check-usr-local|--check-usr-local)
1411 1401
             OPTION_CHECK_USR_LOCAL_INCLUDE="YES"
1412 1402
          ;;
... ...
@@ -1420,8 +1410,8 @@ _common_main()
1420 1410
             MULLE_FLAG_FOLLOW_SYMLINKS="YES"
1421 1411
          ;;
1422 1412
 
1423
-         # create symlinks instead of clones for repositories
1424
-         -l|--symlink-creation)
1413
+         # allow creating symlinks instead of clones for repositories
1414
+         -l|--symlink-creation|--symlinks)
1425 1415
             OPTION_ALLOW_CREATING_SYMLINKS="YES"
1426 1416
          ;;
1427 1417
 
... ...
@@ -1437,13 +1427,12 @@ _common_main()
1437 1427
 
1438 1428
          --no-caches)
1439 1429
             OPTION_ALLOW_SEARCH_CACHES="NO"
1440
-            OPTION_ALLOW_CREATING_SYMLINKS="NO"
1441 1430
          ;;
1442 1431
 
1443 1432
          --no-symlink-creation|--no-symlinks)
1444 1433
             MULLE_FLAG_FOLLOW_SYMLINKS="NO"
1445
-            OPTION_ALLOW_CREATING_EMBEDDED_SYMLINKS="NO"
1446 1434
             OPTION_ALLOW_CREATING_SYMLINKS="NO"
1435
+            OPTION_ALLOW_CREATING_EMBEDDED_SYMLINKS="NO"
1447 1436
          ;;
1448 1437
 
1449 1438
          # 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 339
 
335 340
 _flags_librarypath_value()
336 341
 {
342
+   local result
343
+
337 344
    if [ "${OPTION_WITH_LIBRARYPATHS}" = "YES" ]
338 345
    then
339 346
       if [ "${OPTION_WITH_DEPENDENCIES}" = "YES" ]
... ...
@@ -356,6 +363,78 @@ _flags_librarypath_value()
356 363
 }
357 364
 
358 365
 
366
+_flags_do_cmake_flags()
367
+{
368
+   local result="$1"
369
+
370
+   local values
371
+   local line
372
+
373
+   values="`_flags_cflags_value`"
374
+   if [ ! -z "${values}" ]
375
+   then
376
+      values="`echo "${values}" | tr '\012' ' ' | sed 's/ *$//'`"
377
+      line="-DCMAKE_C_FLAGS=\"${values}\""
378
+      result="`add_line "${result}" "${line}"`"
379
+   fi
380
+
381
+   values="`_flags_cxxflags_value`"
382
+   if [ ! -z "${values}" ]
383
+   then
384
+      values="`echo "${values}" | tr '\012' ' ' | sed 's/ *$//'`"
385
+      line="-DCMAKE_CXX_FLAGS=\"${values}\""
386
+      result="`add_line "${result}" "${line}"`"
387
+   fi
388
+
389
+   values="`_flags_ldflags_value`"
390
+   if [ ! -z "${values}" ]
391
+   then
392
+      values="`echo "${values}" | tr '\012' ' ' | sed 's/ *$//'`"
393
+      line="-DCMAKE_EXE_LINKER_FLAGS=\"${values}\""
394
+      result="`add_line "${result}" "${line}"`"
395
+
396
+      line="-DCMAKE_SHARED_LINKER_FLAGS=\"${values}\""
397
+      result="`add_line "${result}" "${line}"`"
398
+   fi
399
+
400
+   printf "%s" "$result"
401
+}
402
+
403
+
404
+_flags_do_cmake_paths()
405
+{
406
+   local result="$1"
407
+
408
+   local values
409
+   local line
410
+
411
+   values="`_flags_headerpath_value`"
412
+   if [ ! -z "${values}" ]
413
+   then
414
+      line="-DCMAKE_INCLUDE_PATH =\"${values}\""
415
+      result="`add_line "${result}" "${line}"`"
416
+   fi
417
+
418
+   values="`_flags_librarypath_value`"
419
+   if [ ! -z "${values}" ]
420
+   then
421
+      line="-DCMAKE_LIBRARY_PATH=\"${values}\""
422
+      result="`add_line "${result}" "${line}"`"
423
+   fi
424
+
425
+   # does CMAKE_FRAMEWORK_PATH even exist ?
426
+   values="`_flags_frameworkpath_value`"
427
+   if [ ! -z "${values}" ]
428
+   then
429
+      line="-DCMAKE_FRAMEWORK_PATH=\"${values}\""
430
+      result="`add_line "${result}" "${line}"`"
431
+   fi
432
+
433
+   printf "%s" "$result"
434
+}
435
+
436
+
437
+
359 438
 _flags_do_path()
360 439
 {
361 440
    local result="$1"
... ...
@@ -545,11 +624,28 @@ flags_main()
545 624
       [ $# -ne 0 ] && shift
546 625
 
547 626
       case "${type}" in
627
+         addictions)
628
+            values="`_flags_emit_path "${ADDICTIONS_DIR}"`"
629
+            result="`add_line "${result}" "${values}"`"
630
+         ;;
631
+
632
+         dependencies)
633
+            values="`_flags_emit_path "${DEPENDENCIES_DIR}"`"
634
+            result="`add_line "${result}" "${values}"`"
635
+         ;;
636
+
548 637
          "cflags"|"cxxflags"|"ldflags"|"binpath"|"frameworkpath"|"headerpath"|"librarypath")
549 638
             values="`_flags_${type}_value`"
550 639
             result="`add_line "${result}" "${values}"`"
551 640
          ;;
552 641
 
642
+         "cmake-flags")
643
+            result="`_flags_do_cmake_flags "${result}"`"
644
+         ;;
645
+
646
+         "cmake-paths")
647
+            result="`_flags_do_cmake_paths "${result}"`"
648
+         ;;
553 649
 
554 650
          "path")
555 651
             result="`_flags_do_path "${result}"`"
... ...
@@ -572,7 +668,7 @@ flags_main()
572 668
    then
573 669
       if [ "${separator}" = " " ]
574 670
       then
575
-         printf "${result}" | tr '\012' ' '  | sed 's/ *$//'
671
+         printf "%s" "${result}" | tr '\012' ' '  | sed 's/ *$//'
576 672
          printf "\n"
577 673
       else
578 674
          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 113
 
120 114
 redirect_exekutor()
121 115
 {
122
-   local output
123
-
124
-   output="$1"
125
-   shift
116
+   local output="$1"; shift
126 117
 
127 118
    if [ "${MULLE_FLAG_EXECUTOR_DRY_RUN}" = "YES" -o "${MULLE_FLAG_LOG_EXECUTOR}" = "YES" ]
128 119
    then
... ...
@@ -136,17 +127,14 @@ redirect_exekutor()
136 127
 
137 128
    if [ "${MULLE_FLAG_EXECUTOR_DRY_RUN}" != "YES" ]
138 129
    then
139
-      "$@" > "${output}"
130
+      ( "$@" ) > "${output}"
140 131
    fi
141 132
 }
142 133
 
143 134
 
144 135
 redirect_append_exekutor()
145 136
 {
146
-   local output
147
-
148
-   output="$1"
149
-   shift
137
+   local output="$1"; shift
150 138
 
151 139
    if [ "${MULLE_FLAG_EXECUTOR_DRY_RUN}" = "YES" -o "${MULLE_FLAG_LOG_EXECUTOR}" = "YES" ]
152 140
    then
... ...
@@ -160,17 +148,14 @@ redirect_append_exekutor()
160 148
 
161 149
    if [ "${MULLE_FLAG_EXECUTOR_DRY_RUN}" != "YES" ]
162 150
    then
163
-      "$@" >> "${output}"
151
+      ( "$@" ) >> "${output}"
164 152
    fi
165 153
 }
166 154
 
167 155
 
168 156
 logging_redirekt_exekutor()
169 157
 {
170
-   local output
171
-
172
-   output="$1"
173
-   shift
158
+   local output="$1"; shift
174 159
 
175 160
    echo "==>" "$@" > "${output}"
176 161
    redirect_append_exekutor "${output}" "$@"
... ...
@@ -548,7 +533,6 @@ _relative_path_between()
548 533
 #
549 534
 # the routine can not deal with ../ and ./
550 535
 # but is a bit faster than symlink_relpath
551
-# which uses simplify_path
552 536
 #
553 537
 relative_path_between()
554 538
 {
... ...
@@ -690,9 +674,9 @@ absolutepath()
690 674
 
691 675
 
692 676
 #
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'
677
+# Imagine you are in a working directory `dirname b`
678
+# This function gives the relpath you need
679
+# if you were to create symlink 'b' pointing to 'a'
696 680
 #
697 681
 symlink_relpath()
698 682
 {
... ...
@@ -765,6 +749,8 @@ _simplify_components()
765 749
    local i
766 750
    local result
767 751
 
752
+   [ -z "${MULLE_BOOTSTRAP_ARRAY_SH}" ] && . mulle-bootstrap-array.sh
753
+
768 754
    result= # voodoo linux fix ?
769 755
    IFS="
770 756
 "
... ...
@@ -1381,9 +1367,6 @@ functions_initialize()
1381 1367
 
1382 1368
    log_debug ":functions_initialize:"
1383 1369
 
1384
-   [ -z "${MULLE_BOOTSTRAP_ARRAY_SH}" ] && . mulle-bootstrap-array.sh
1385
-
1386
-
1387 1370
    :
1388 1371
 }
1389 1372
 
... ...
@@ -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 194
 
193 195
 fetch_needed()
194 196
 {
195
-   [ -z "${REPOS_DIR}" ]     && internal_fail "REPOS_DIR undefined"
196
-   [ -z "${BOOTSTRAP_DIR}" ] && internal_fail "BOOTSTRAP_DIR undefined"
197
+   log_debug ":fetch_needed:"
197 198
 
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
199
+   [ -z "${REPOS_DIR}" ] && internal_fail "REPOS_DIR undefined"
204 200
 
205 201
    if [ ! -f "${REPOS_DIR}/.bootstrap_fetch_done" ]
206 202
    then
... ...
@@ -208,18 +204,40 @@ fetch_needed()
208 204
       return 0
209 205
    fi
210 206
 
211
-   if [ "${REPOS_DIR}/.bootstrap_fetch_done" -ot "${BOOTSTRAP_DIR}" ]
207
+   local bootstrapdir="${BOOTSTRAP_DIR}"
208
+
209
+   [ -z "${bootstrapdir}" ] && internal_fail "BOOTSTRAP_DIR undefined"
210
+
211
+   if [ "${BOOTSTRAP_DIR}" -ot "${BOOTSTRAP_DIR}.local" ]
212 212
    then
213
-      log_fluff "Need fetch because \"${BOOTSTRAP_DIR}\" is modified"
214
-      return 0
213
+      bootstrapdir="${BOOTSTRAP_DIR}.local"
215 214
    fi
216 215
 
217
-   if [ "${REPOS_DIR}/.bootstrap_fetch_done" -ot "${BOOTSTRAP_DIR}.local" ]
216
+   if [ "${REPOS_DIR}/.bootstrap_fetch_done" -ot "${bootstrapdir}" ]
218 217
    then
219
-      log_fluff "Need fetch because \"${BOOTSTRAP_DIR}.local\" is modified"
218
+      log_fluff "Need fetch because \"${bootstrapdir}\" is modified"
220 219
       return 0
221 220
    fi
222 221
 
222
+   [ -z "${MULLE_BOOTSTRAP_REPOSITORIES_SH}" ] && . mulle-bootstrap-repositories.sh
223
+
224
+   local stashdir
225
+
226
+   IFS="
227
+"
228
+   for stashdir in `all_repository_stashes ${REPOS_DIR}`
229
+   do
230
+      IFS="${DEFAULT_IFS}"
231
+
232
+      if [ "${bootstrapdir}" -ot "${stashdir}/${BOOTSTRAP_DIR}" ]
233
+      then
234
+         log_fluff "Need fetch because \"${stashdir}/${BOOTSTRAP_DIR}\" is modified"
235
+         return 0
236
+      fi
237
+   done
238
+
239
+   IFS="${DEFAULT_IFS}"
240
+
223 241
    return 1
224 242
 }
225 243
 
... ...
@@ -309,7 +327,7 @@ _expanded_variables()
309 327
    then
310 328
       if [ -z "${default}" ]
311 329
       then
312
-         log_warning "\$\{${key}\} expanded to the empty string"
330
+         log_warning "\${${key}} expanded to the empty string."
313 331
       else
314 332
          log_setting "Root setting for ${C_MAGENTA}${key}${C_SETTING} set to default ${C_MAGENTA}${default}${C_SETTING}"
315 333
          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 336
 }
308 337
 
309 338
 
310
-
311 339
 _deep_walk_repos_trampoline()
312 340
 {
313 341
    log_debug ":_deep_walk_repos_trampoline:" "$@"
... ...
@@ -374,8 +402,10 @@ _deep_walk_auto_trampoline()
374 402
 
375 403
       PARENT_REPOSITORY_NAME="${name}"
376 404
       PARENT_CLONE="${clone}"
405
+
377 406
       STASHES_DEFAULT_DIR=""
378 407
       STASHES_ROOT_DIR="${stashdir}"
408
+
379 409
       _walk_repositories "${embedded_clones}" \
380 410
                          "${callback}" \
381 411
                          "${permissions}" \
... ...
@@ -489,7 +519,6 @@ walk_raw_clones()
489 519
 }
490 520
 
491 521
 
492
-
493 522
 # deal with stuff like
494 523
 # foo
495 524
 # https://www./foo.git
... ...
@@ -725,7 +754,6 @@ read_repository_file()
725 754
 }
726 755
 
727 756
 
728
-
729 757
 ensure_reposdir_directory()
730 758
 {
731 759
    local reposdir
... ...
@@ -878,6 +906,7 @@ unique_repository_contents()
878 906
    echo "${output}"
879 907
 }
880 908
 
909
+
881 910
 #
882 911
 # Take an expanded .bootstrap.auto file and put the
883 912
 # 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 80
 run_build_settings_script()
88 81
 {
89 82
    local scriptname="$1" ; shift
90
-   local name="$1" ; shift
83
+   local name="$1"
84
+   local stashdir="$2"
91 85
 
92 86
    local script
93 87
 
94 88
    script="`find_build_setting_file "${name}" "bin/${scriptname}.sh"`"
95 89
    if [ ! -z "${script}" ]
96 90
    then
97
-      run_script "${script}" "$@"
91
+      script="`absolutepath "${script}"`"
92
+      (
93
+         cd "${stashdir}"
94
+         run_script "${script}" "$@"
95
+      ) || exit 1
98 96
    fi
99 97
 }
100 98
 
... ...
@@ -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 292
 {
292 293
    local line
293 294
    local key
295
+   local envkey
294 296
    local value
295 297
 
296 298
    env | while read line
... ...
@@ -303,7 +305,10 @@ list_environment_settings()
303 305
 
304 306
       if [ ! -z "${key}" -a ! -z "${value}" ]
305 307
       then
306
-         echo "${key}=${value}"
308
+         envkey="`echo "${line}" | \
309
+            sed -n 's/^\(MULLE_BOOTSTRAP_[^=]*\)=.*/\1/p'`"
310
+
311
+         echo "${key}=\"${value}\" (${envkey})"
307 312
       fi
308 313
    done
309 314
 }
... ...
@@ -346,7 +351,6 @@ list_dir_settings()
346 351
    local directory="$1"
347 352
 
348 353
    local filename
349
-   local name
350 354
    local key
351 355
    local value
352 356
 
... ...
@@ -356,11 +360,11 @@ list_dir_settings()
356 360
    do
357 361
       IFS="${DEFAULT_IFS}"
358 362
 
359
-      name="`basename -- "${filename}"`"
360
-      value="`_read_setting "${directory}"`"
363
+      key="`basename -- "${filename}"`"
364
+      value="`_read_setting "${directory}/${key}"`"
361 365
       if [ ! -z "${value}" ]
362 366
       then
363
-         echo "${key}=${value}"
367
+         echo "${key}=\"${value}\""
364 368
       fi
365 369
    done
366 370
 
... ...
@@ -699,10 +703,10 @@ ${keys3}
699 703
 #
700 704
 _config_list()
701 705
 {
702
-   log_info "Environment:"
706
+   log_info "environment:"
703 707
    list_environment_settings | sed 's/^/   /'
704 708
 
705
-   log_info ".bootstrap.local/config:"
709
+   log_info ".bootstrap.local/config ($PWD):"
706 710
    list_local_settings | sed 's/^/   /'
707 711
 
708 712
    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 194
       fi
194 195
    fi
195 196
 
197
+   local projectdir
198
+   local projectname
199
+
200
+   projectdir="`dirname -- "${project}"`"
196 201
    projectname="`basename -- "${project}"`"
197 202
 
198 203
    # mod_pbxproj can only do Debug/Release/All...
... ...
@@ -244,20 +249,15 @@ Release"
244 249
    local library_search_paths
245 250
    local framework_search_paths
246 251
 
247
-   #  figure out a way to make this nicer
248
-   local absolute
249
-   local absolute2
250
-
251
-   absolute="`absolutepath "${project}"`"
252
-   absolute="`dirname -- "${absolute}"`"
252
+   # grab values from master if needed
253
+   DEPENDENCIES_DIR="`mulle-bootstrap flags dependencies`"
254
+   ADDICTIONS_DIR="`mulle-bootstrap flags addictions`"
253 255
 
254
-   absolute2="`pwd -P`/${DEPENDENCIES_DIR}"
255
-   dependencies_dir='$(PROJECT_DIR)'/"${DEPENDENCIES_DIR}"
256
-#   dependencies_dir='$(PROJECT_DIR)'/"${relative_subdir}'"
256
+   relpath="`symlink_relpath "${DEPENDENCIES_DIR}" "${projectdir}"`"
257
+   dependencies_dir='$(PROJECT_DIR)'/"${relpath}"
257 258
 
258
-   absolute2="`pwd -P`/${ADDICTIONS_DIR}"
259
-   addictions_dir='$(PROJECT_DIR)'/"${ADDICTIONS_DIR}"
260
-#   addictions_dir='$(PROJECT_DIR)/'"${relative_subdir}"
259
+   relpath="`symlink_relpath "${ADDICTIONS_DIR}" "${projectdir}"`"
260
+   addictions_dir='$(PROJECT_DIR)'/"${relpath}"
261 261
 
262 262
    header_search_paths=""
263 263
    if [ "${MULLE_BOOTSTRAP_EXECUTABLE}" = "mulle-bootstrap" ]