Browse code

Add mulle-bootstrap. Add support code for mulle-brew. Fix a bug in the config key list.

Nat! authored on 24-04-2017 16:38:17
Showing 12 changed files
... ...
@@ -10,6 +10,7 @@ create demo files any more. Inverted meaning of -d flag.
10 10
 * Various improvements to mulle-brew handling
11 11
 * The paths default is now to output an unquoted one-liner. This is less
12 12
 correct but simpler.
13
+* Added `mulle-bootstrap run`. See mulle-brew for more details.
13 14
 
14 15
 
15 16
 ### 3.4.0
... ...
@@ -41,12 +41,13 @@ fail()
41 41
 _prepend_path_if_relative()
42 42
 {
43 43
    case "$2" in
44
-      /* )
44
+      /*)
45 45
          echo "$2"
46
-         ;;
47
-      * )
46
+      ;;
47
+
48
+      *)
48 49
          echo "$1/$2"
49
-         ;;
50
+      ;;
50 51
    esac
51 52
 }
52 53
 
... ...
@@ -66,35 +67,19 @@ resolve_symlinks()
66 67
 }
67 68
 
68 69
 
69
-_canonicalize_dir_path()
70
-{
71
-   (
72
-      cd "$1" 2>/dev/null &&
73
-      pwd -P
74
-   ) || exit 1
75
-}
76
-
77
-
78
-_canonicalize_file_path()
79
-{
80
-    local dir file
81
-
82
-    dir="`dirname "$1"`"
83
-    file="`basename -- "$1"`"
84
-    (
85
-      cd "${dir}" 2>/dev/null &&
86
-      echo "`pwd -P`/${file}"
87
-    ) || exit 1
88
-}
89
-
90 70
 
91 71
 canonicalize_path()
92 72
 {
93 73
    if [ -d "$1" ]
94 74
    then
95
-      _canonicalize_dir_path "$1"
75
+      ( cd "$1" && pwd -P )
96 76
    else
97
-      _canonicalize_file_path "$1"
77
+      local dir
78
+      local file
79
+
80
+      dir="`dirname "$1"`"
81
+      file="`basename -- "$1"`"
82
+      ( cd "${dir}" 2>/dev/null && echo "`pwd -P`/${file}" )
98 83
    fi
99 84
 }
100 85
 
... ...
@@ -142,84 +127,97 @@ sed_mangle_escape_slashes()
142 127
 }
143 128
 
144 129
 
145
-prefix=${1:-"/usr/local"}
146
-[ $# -eq 0 ] || shift
147
-prefix="`realpath "${prefix}"`"
130
+main()
131
+{
132
+   local prefix
133
+   local mode
148 134
 
149
-mode=${1:-755}
150
-[ $# -eq 0 ] || shift
135
+   prefix=${1:-"/usr/local"}
136
+   [ $# -eq 0 ] || shift
137
+   mode=${1:-755}
138
+   [ $# -eq 0 ] || shift
151 139
 
152
-bin="${prefix}/bin"
153
-libexec="${prefix}/libexec/mulle-bootstrap"
140
+   if [ -z "${prefix}" ] || [ -z "${mode}" ]
141
+   then
142
+      fail "usage: install.sh [prefix] [mode]"
143
+   fi
154 144
 
155
-if [ "$prefix" = "" ] || [ "$bin" = "" ] || [ "$libexec" = "" ] || [ "$mode" = "" ]
156
-then
157
-   echo "usage: install.sh [prefix] [mode] [binpath] [libexecpath]" >&2
158
-   exit 1
159
-fi
145
+   prefix="`realpath "${prefix}" 2> /dev/null`"
146
+   if [ ! -d "${prefix}" ]
147
+   then
148
+      fail "\"${prefix}\" does not exist"
149
+   fi
160 150
 
161
-if [ ! -d "${bin}" ]
162
-then
163
-   mkdir -p "${bin}" || fail "could not create ${bin}"
164
-fi
165
-if [ ! -d "${libexec}" ]
166
-then
167
-   mkdir -p "${libexec}" || fail "could not create ${libexec}"
168
-fi
151
+   local bin
152
+   local libexec
169 153
 
154
+   bin="${prefix}/bin"
155
+   libexec="${prefix}/libexec/mulle-bootstrap"
170 156
 
171
-install -m "${mode}" "mulle-bootstrap" "${bin}/mulle-bootstrap" || exit 1
172
-printf "install: ${C_MAGENTA}${C_BOLD}%s${C_RESET}\n" "${bin}/mulle-bootstrap" >&2
157
+   if [ ! -d "${bin}" ]
158
+   then
159
+      mkdir -p "${bin}" || fail "could not create ${bin}"
160
+   fi
173 161
 
174
-install -m "${mode}" "mulle-bootstrap-dotdump" "${bin}/mulle-bootstrap-dotdump" || exit 1
175
-printf "install: ${C_MAGENTA}${C_BOLD}%s${C_RESET}\n" "${bin}/mulle-bootstrap-dotdump" >&2
162
+   if [ ! -d "${libexec}" ]
163
+   then
164
+      mkdir -p "${libexec}" || fail "could not create ${libexec}"
165
+   fi
176 166
 
177
-case `uname` in
178
-   MINGW*)
179
-      install -m "${mode}" "mulle-bootstrap" "${bin}/mulle-brew" || exit 1
180
-      printf "install: ${C_MAGENTA}${C_BOLD}%s${C_RESET}\n" "${bin}/mulle-brew" >&2
181
-   ;;
182 167
 
183
-   *)
184
-      ln -f "${bin}/mulle-bootstrap" "${bin}/mulle-brew" || exit 1
185
-      printf "install: ${C_MAGENTA}${C_BOLD}%s${C_RESET}\n" "${bin}/mulle-brew" >&2
186
-   ;;
187
-esac
168
+   install -m "${mode}" "mulle-bootstrap" "${bin}/mulle-bootstrap" || exit 1
169
+   printf "install: ${C_MAGENTA}${C_BOLD}%s${C_RESET}\n" "${bin}/mulle-bootstrap" >&2
188 170
 
171
+   install -m "${mode}" "mulle-bootstrap-dotdump" "${bin}/mulle-bootstrap-dotdump" || exit 1
172
+   printf "install: ${C_MAGENTA}${C_BOLD}%s${C_RESET}\n" "${bin}/mulle-bootstrap-dotdump" >&2
189 173
 
190
-case `uname` in
191
-   MINGW*)
192
-      for i in mulle-mingw-*sh
193
-      do
194
-         install -m "${mode}" "${i}" "${bin}/$i" || exit 1
195
-         printf "install: ${C_MAGENTA}${C_BOLD}%s${C_RESET}\n" "$bin/$i" >&2
196
-      done
174
+   case `uname` in
175
+      MINGW*)
176
+         install -m "${mode}" "mulle-bootstrap" "${bin}/mulle-brew" || exit 1
177
+         printf "install: ${C_MAGENTA}${C_BOLD}%s${C_RESET}\n" "${bin}/mulle-brew" >&2
178
+      ;;
197 179
 
198
-      SH_PATH="`get_sh_windows_path | sed_mangle_escape_slashes`"
199
-      INSTALL_PATH="${bin}" # `get_windows_path "${bin}" | sed_mangle_escape_slashes`"
180
+      *)
181
+         ln -f "${bin}/mulle-bootstrap" "${bin}/mulle-brew" || exit 1
182
+         printf "install: ${C_MAGENTA}${C_BOLD}%s${C_RESET}\n" "${bin}/mulle-brew" >&2
183
+      ;;
184
+   esac
200 185
 
201
-      for i in mulle-mingw-*bat
202
-      do
203 186
 
204
-         sed -e "s|SH_PATH|${SH_PATH}|g" -e "s|INSTALL_PATH|${INSTALL_PATH}|g" < "${i}" > "${bin}/$i" || exit 1
205
-         chmod "${mode}" "${bin}/${i}" || exit 1
206
-         printf "install: ${C_MAGENTA}${C_BOLD}%s${C_RESET}\n" "$bin/$i" >&2
207
-      done
208
-   ;;
209
-esac
187
+   case `uname` in
188
+      MINGW*)
189
+         for i in mulle-mingw-*sh
190
+         do
191
+            install -m "${mode}" "${i}" "${bin}/$i" || exit 1
192
+            printf "install: ${C_MAGENTA}${C_BOLD}%s${C_RESET}\n" "$bin/$i" >&2
193
+         done
210 194
 
211
-for i in src/mulle*.sh
212
-do
213
-   mkdir -p "${libexec}" 2> /dev/null
214
-   install -v -m "${mode}" "${i}" "${libexec}" || exit 1
215
-done
195
+         SH_PATH="`get_sh_windows_path | sed_mangle_escape_slashes`"
196
+         INSTALL_PATH="${bin}" # `get_windows_path "${bin}" | sed_mangle_escape_slashes`"
216 197
 
217
-if [ -d "test" ]
218
-then
219
-   # use attractive colors :)
220
-   printf "${C_GREEN}If you are new to mulle-bootstrap I would suggest checking out\n" >&2
221
-   printf "the ${C_YELLOW}README.md${C_GREEN} in ${C_CYAN}./test${C_GREEN} and doing the examples.\n" >&2
222
-fi
198
+         for i in mulle-mingw-*bat
199
+         do
200
+
201
+            sed -e "s|SH_PATH|${SH_PATH}|g" -e "s|INSTALL_PATH|${INSTALL_PATH}|g" < "${i}" > "${bin}/$i" || exit 1
202
+            chmod "${mode}" "${bin}/${i}" || exit 1
203
+            printf "install: ${C_MAGENTA}${C_BOLD}%s${C_RESET}\n" "$bin/$i" >&2
204
+         done
205
+      ;;
206
+   esac
207
+
208
+   for i in src/mulle*.sh
209
+   do
210
+      mkdir -p "${libexec}" 2> /dev/null
211
+      install -v -m "${mode}" "${i}" "${libexec}" || exit 1
212
+   done
213
+
214
+   if [ -d "test" ]
215
+   then
216
+      # use attractive colors :)
217
+      printf "${C_GREEN}If you are new to mulle-bootstrap I would suggest checking out\n" >&2
218
+      printf "the ${C_YELLOW}README.md${C_GREEN} in ${C_CYAN}./test${C_GREEN} and doing the examples.\n" >&2
219
+   fi
220
+}
221
+
222
+main "$@"
223 223
 
224
-# for people who source us
225
-PATH="${libexec}:$PATH"
... ...
@@ -66,6 +66,7 @@ HIDDEN_COMMANDS="\
66 66
    git           : run git commands on fetched repositories
67 67
    library-path  : print path to mulle-bootstrap libexec
68 68
    project-path  : print path to folder containing .bootstrap
69
+   run           : run command with proper dependencies PATHs
69 70
    setting       : read or edit build settings
70 71
    status        : show status of repositories and brews
71 72
    systeminstall : install dependencies as system headers
... ...
@@ -539,6 +540,12 @@ bootstrap_main()
539 540
          return 0
540 541
       ;;
541 542
 
543
+      run)
544
+         . mulle-bootstrap-paths.sh
545
+
546
+         run_main "$@" || exit 1
547
+      ;;
548
+
542 549
       setting)
543 550
          . mulle-bootstrap-settings.sh
544 551
 
... ...
@@ -41,9 +41,22 @@ Usage:
41 41
    You can specify the names of the formulae to ${COMMAND}.
42 42
 
43 43
 Options:
44
-   -cs   :  check /usr/local for duplicates
44
+   -cs        : check /usr/local for duplicates
45
+EOF
45 46
 
47
+   case "${UNAME}" in
48
+      darwin)
49
+         cat <<EOF >&2
50
+   -c         : change @rpath for shared libraries and frameworks
51
+   -n         : don't change @rpath for shared libraries (if config option is set)
52
+   -f <rpath> : @rpath for Frameworks (default: ${OPTION_RPATH_FRAMEWORKS})
53
+   -l <rpath> : @rpath for shared libraries (default: ${OPTION_RPATH_LIBRARIES})
46 54
 EOF
55
+      ;;
56
+   esac
57
+
58
+   echo >&2
59
+
47 60
    exit 1
48 61
 }
49 62
 
... ...
@@ -164,6 +177,133 @@ _brew_action()
164 177
 }
165 178
 
166 179
 
180
+darwin_get_shared_library_id()
181
+{
182
+   otool -L "$1" | \
183
+      sed -n '2p' | \
184
+      sed 's/^\([^(]*\).*$/\1/' | \
185
+      sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'
186
+}
187
+
188
+
189
+darwin_hack_shared_library()
190
+{
191
+   local path="$1"
192
+   local rpath="$2"
193
+
194
+   chmod u+w "${path}" || return 1
195
+
196
+   install_name_tool -id "${rpath}" "${path}" || return 2
197
+   log_fluff "Otool \"${path}\": `otool -L "${path}"`"
198
+
199
+   chmod u-w "${path}"
200
+
201
+   echo "${path}"
202
+
203
+   return 0
204
+}
205
+
206
+
207
+darwin_hack_shared_libraries()
208
+{
209
+   local rpathprefix="$1"
210
+
211
+   local name
212
+   local path
213
+   local rpath
214
+   local i
215
+
216
+   local hacked
217
+
218
+   hacked=""
219
+   IFS="
220
+"
221
+   for i in `find "${ADDICTIONS_DIR}/lib" -name "*.dylib" -print`
222
+   do
223
+      IFS="${OLDIFS}"
224
+
225
+      path="`resolve_symlinks "${i}"`"
226
+
227
+      echo "${hacked}" | fgrep -s -q -x "${path}" > /dev/null
228
+      if [ $? -eq 0 ]
229
+      then
230
+         continue
231
+      fi
232
+
233
+      local libid
234
+
235
+      #
236
+      # maybe overzealous, but try to keep dylibname as given
237
+      # in the executable
238
+      #
239
+      libid="`darwin_get_shared_library_id "${path}"`"
240
+      if [ -z "${libid}" ]
241
+      then
242
+         log_warning "\"${path}\" is not really a dylib"
243
+         continue
244
+      fi
245
+
246
+      name="`basename -- "${libid}"`"
247
+      rpath="`add_component "${rpathprefix}" "${name}"`"
248
+
249
+      log_info "Setting id on library \"${name}\" to \"${rpath}\" ..."
250
+      if ! darwin_hack_shared_library "${path}" "${rpath}"
251
+      then
252
+         fail "Could not hack \"${i}\"'s @rpath."
253
+      fi
254
+
255
+      hacked="`add_line "${hacked}" "${path}"`"
256
+   done
257
+
258
+   IFS="${OLDIFS}"
259
+}
260
+
261
+
262
+#
263
+# this needs to become more sophisticated, because
264
+# there could be bundles inside the framework
265
+#
266
+darwin_hack_frameworks()
267
+{
268
+   local rpathprefix="$1"
269
+
270
+   local name
271
+   local path
272
+   local rpath
273
+   local framework
274
+   local frameworkname
275
+   local i
276
+
277
+   IFS="
278
+"
279
+   for i in `find "${ADDICTIONS_DIR}/Frameworks/"*.framework -maxdepth 1 -print 2>/dev/null`
280
+   do
281
+      IFS="${OLDIFS}"
282
+
283
+      name="`basename -- "${i}"`"
284
+      framework="`dirname -- "${i}"`"
285
+      frameworkname="`basename -- "${framework}" .framework`"
286
+
287
+      if [ "${name}" != "${frameworkname}" ]
288
+      then
289
+         continue
290
+      fi
291
+
292
+      path="`resolve_symlinks "${i}"`"
293
+      rpath="`add_component "${rpathprefix}" "${frameworkname}.framework"`"
294
+      rpath="`add_component "${rpath}" "${name}"`"
295
+
296
+      log_info "Setting id on framework \"${frameworkname}\" to \"${rpath}\" ..."
297
+      if ! darwin_hack_shared_library "${path}" "${rpath}"
298
+      then
299
+         fail "Could not hack \"${i}\"'s @rpath."
300
+      fi
301
+   done
302
+
303
+   IFS="${OLDIFS}"
304
+}
305
+
306
+
167 307
 find_brews()
168 308
 {
169 309
    log_fluff "Looking for brew formulae"
... ...
@@ -297,9 +437,16 @@ _brew_common_main()
297 437
    [ -z "${MULLE_BOOTSTRAP_LOCAL_ENVIRONMENT_SH}" ] && . mulle-bootstrap-local-environment.sh
298 438
    [ -z "${MULLE_BOOTSTRAP_SETTINGS_SH}" ]          && . mulle-bootstrap-settings.sh
299 439
 
300
-   local  OPTION_CHECK_USR_LOCAL_INCLUDE
440
+   local OPTION_CHECK_USR_LOCAL_INCLUDE
441
+   local OPTION_CHANGE_RPATH
442
+   local OPTION_RPATH_LIBRARY
443
+   local OPTION_RPATH_FRAMEWORK
301 444
 
302 445
    OPTION_CHECK_USR_LOCAL_INCLUDE="`read_config_setting "check_usr_local_include" "NO"`"
446
+   OPTION_CHANGE_RPATH="`read_config_setting "change_rpath" "NO"`"
447
+   # @rpath/../Resources is lazy and wrong, but so convenient for quick hacks
448
+   OPTION_RPATH_LIBRARY="`read_config_setting "rpath_library" "@rpath/../Resources"`"
449
+   OPTION_RPATH_FRAMEWORK="`read_config_setting "rpath_framework" "@rpath/../Frameworks"`"
303 450
 
304 451
    while [ $# -ne 0 ]
305 452
    do
... ...
@@ -312,6 +459,26 @@ _brew_common_main()
312 459
             OPTION_CHECK_USR_LOCAL_INCLUDE="YES"
313 460
             ;;
314 461
 
462
+         -f|--rpath-framework)
463
+            [ $# -eq 1 ] && fail "missing argument to $1"
464
+            shift
465
+            OPTION_RPATH_FRAMEWORK="$1"
466
+         ;;
467
+
468
+         -l|--rpath-library)
469
+            [ $# -eq 1 ] && fail "missing argument to $1"
470
+            shift
471
+            OPTION_RPATH_LIBRARY="$1"
472
+         ;;
473
+
474
+         -n|--no-rpath)
475
+            OPTION_CHANGE_RPATH="NO"
476
+         ;;
477
+
478
+         -r|--rpath)
479
+            OPTION_CHANGE_RPATH="YES"
480
+         ;;
481
+
315 482
          -*)
316 483
             log_error "${MULLE_EXECUTABLE_FAIL_PREFIX}: Unknown ${COMMAND} option $1"
317 484
             ${USAGE}
... ...
@@ -328,7 +495,6 @@ _brew_common_main()
328 495
    [ -z "${MULLE_BOOTSTRAP_SCRIPTS_SH}" ] && . mulle-bootstrap-scripts.sh
329 496
    [ -z "${ADDICTIONS_DIR}" ] && internal_fail "missing ADDICTIONS_DIR"
330 497
 
331
-
332 498
    #
333 499
    # should we check for '/usr/local/include/<name>' and don't fetch if
334 500
    # present (somewhat dangerous, because we do not check versions)
... ...
@@ -348,7 +514,25 @@ _brew_common_main()
348 514
 
349 515
       *)
350 516
          internal_fail "Command \"${COMMAND}\" is unknown"
517
+      ;;
351 518
    esac
519
+
520
+   if [ "${OPTION_CHANGE_RPATH}" = "YES" ]
521
+   then
522
+      case "${UNAME}" in
523
+         darwin)
524
+            if [ ! -z "${OPTION_RPATH_LIBRARY}" ]
525
+            then
526
+               darwin_hack_shared_libraries "${OPTION_RPATH_LIBRARY}"
527
+            fi
528
+
529
+            if [ ! -z "${OPTION_RPATH_FRAMEWORK}" ]
530
+            then
531
+               darwin_hack_frameworks "${OPTION_RPATH_FRAMEWORK}"
532
+            fi
533
+         ;;
534
+      esac
535
+   fi
352 536
 }
353 537
 
354 538
 
... ...
@@ -468,6 +468,9 @@ enforce_build_sanity()
468 468
    then
469 469
       fail "A previous build left \"${BUILD_DEPENDENCIES_DIR}\", can't continue"
470 470
    fi
471
+
472
+   # now make it appear
473
+   mkdir_if_missing "${BUILD_DEPENDENCIES_DIR}"
471 474
 }
472 475
 
473 476
 
... ...
@@ -1172,7 +1175,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
1172 1175
 
1173 1176
       local prefixbuild
1174 1177
 
1175
-      prefixbuild="`add_path "${prefixbuild}" "${nativewd}/${BUILD_DEPENDENCIES_DIR}"`"
1178
+      prefixbuild="`add_component "${prefixbuild}" "${nativewd}/${BUILD_DEPENDENCIES_DIR}"`"
1176 1179
 
1177 1180
       local oldpath
1178 1181
       local rval
... ...
@@ -1742,6 +1745,8 @@ build_script()
1742 1745
    name="$4"
1743 1746
    sdk="$5"
1744 1747
 
1748
+   enforce_build_sanity "${builddir}"
1749
+
1745 1750
    local project
1746 1751
    local schemename
1747 1752
    local targetname
... ...
@@ -2031,7 +2036,6 @@ build_wrapper()
2031 2036
       rmdir_safer "${BUILD_DEPENDENCIES_DIR}"
2032 2037
    fi
2033 2038
 
2034
-
2035 2039
    #
2036 2040
    # move dependencies we have so far away into safety,
2037 2041
    # need that path for includes though
... ...
@@ -38,18 +38,6 @@ build_complete_environment()
38 38
 {
39 39
    log_debug ":build_complete_environment:"
40 40
 
41
-   #
42
-   # Global Settings
43
-   # used to be configurable, but just slows me down
44
-   HEADER_DIR_NAME="include"
45
-   LIBRARY_DIR_NAME="lib"
46
-   FRAMEWORK_DIR_NAME="Frameworks"
47
-
48
-   # HEADER_DIR_NAME="`read_config_setting "header_dir_name" "include"`"
49
-   # LIBRARY_DIR_NAME="`read_config_setting "library_dir_name" "lib"`"
50
-   # FRAMEWORK_DIR_NAME="`read_config_setting "framework_dir_name" "Frameworks"`"
51
-
52
-   OPTION_CLEAN_BEFORE_BUILD=`read_config_setting "clean_before_build"`
53 41
    if [ -z "${OPTION_CONFIGURATIONS}" ]
54 42
    then
55 43
       OPTION_CONFIGURATIONS="`read_config_setting "configurations" "Release"`"
... ...
@@ -57,6 +45,8 @@ build_complete_environment()
57 45
    fi
58 46
    N_CONFIGURATIONS="`echo "${OPTION_CONFIGURATIONS}" | wc -l | awk '{ print $1 }'`"
59 47
 
48
+   OPTION_CLEAN_BEFORE_BUILD=`read_config_setting "clean_before_build"`
49
+
60 50
    # experimentally, these could reside outside the project folder but never tested
61 51
    CLONESBUILD_DIR="`read_sane_config_path_setting "build_dir" "build/.repos"`"
62 52
    BUILDLOGS_DIR="`read_sane_config_path_setting "build_log_dir" "${CLONESBUILD_DIR}/.logs"`"
... ...
@@ -110,6 +100,17 @@ common_settings_initialize()
110 100
 {
111 101
    log_debug ":common_settings_initialize:"
112 102
 
103
+   #
104
+   # Global Settings
105
+   # used to be configurable, but just slows me down
106
+   HEADER_DIR_NAME="include"
107
+   LIBRARY_DIR_NAME="lib"
108
+   FRAMEWORK_DIR_NAME="Frameworks"
109
+
110
+   # HEADER_DIR_NAME="`read_config_setting "header_dir_name" "include"`"
111
+   # LIBRARY_DIR_NAME="`read_config_setting "library_dir_name" "lib"`"
112
+   # FRAMEWORK_DIR_NAME="`read_config_setting "framework_dir_name" "Frameworks"`"
113
+
113 114
    # all of these must reside in the project folder
114 115
    # used to be configurable, but what's the point really ? just slows us down
115 116
 
... ...
@@ -491,7 +491,7 @@ clone_or_symlink()
491 491
       ;;
492 492
 
493 493
       *)
494
-         fail "Unknown scm system ${scm}"
494
+         fail "Unknown scm system \"${scm}\""
495 495
       ;;
496 496
    esac
497 497
 
... ...
@@ -677,7 +677,7 @@ checkout_repository()
677 677
          operation="svn_checkout"
678 678
       ;;
679 679
       *)
680
-         fail "Unknown scm system ${scm}"
680
+         fail "Unknown scm system \"${scm}\""
681 681
       ;;
682 682
    esac
683 683
 
... ...
@@ -717,7 +717,7 @@ update_repository()
717 717
          return
718 718
       ;;
719 719
       *)
720
-         fail "Unknown scm system ${scm}"
720
+         fail "Unknown scm system \"${scm}\""
721 721
       ;;
722 722
    esac
723 723
 
... ...
@@ -757,7 +757,7 @@ upgrade_repository()
757 757
          return
758 758
       ;;
759 759
       *)
760
-         fail "Unknown scm system ${scm}"
760
+         fail "Unknown scm system \"${scm}\""
761 761
       ;;
762 762
    esac
763 763
 
... ...
@@ -423,6 +423,9 @@ get_core_count()
423 423
 }
424 424
 
425 425
 
426
+#
427
+# this is for PATH style variables
428
+#
426 429
 add_path()
427 430
 {
428 431
    local line="$1"
... ...
@@ -459,6 +462,27 @@ add_path_if_exists()
459 462
 }
460 463
 
461 464
 
465
+
466
+#
467
+# this is for constructing filesystem paths
468
+#
469
+add_component()
470
+{
471
+   local filepath="$1"
472
+   local component="$2"
473
+
474
+   [ -z "${COMPONENT_SEPARATOR}" ] && fail "COMPONENT_SEPARATOR is undefined"
475
+
476
+   if [ -z "${filepath}" ]
477
+   then
478
+      echo "${component}"
479
+   else
480
+      echo "${filepath}${COMPONENT_SEPARATOR}${component}"
481
+   fi
482
+}
483
+
484
+
485
+
462 486
 unpostpone_trace()
463 487
 {
464 488
    if [ ! -z "${MULLE_TRACE_POSTPONE}" -a "${MULLE_TRACE}" = "1848" ]
... ...
@@ -834,6 +858,8 @@ local_environment_initialize()
834 858
    # used by embedded repositories to change location
835 859
    STASHES_ROOT_DIR=""
836 860
 
861
+   COMPONENT_SEPARATOR="/"
862
+
837 863
    log_fluff "${UNAME} detected"
838 864
    case "${UNAME}" in
839 865
       mingw)
... ...
@@ -478,6 +478,12 @@ _flags_do_make_environment()
478 478
    local values
479 479
    local line
480 480
 
481
+   values="`_flags_emit_path "${ADDICTIONS_DIR}"`"
482
+   result="`add_line "${result}" "ADDICTIONS_DIR=${OPTION_QUOTE}${values}${OPTION_QUOTE}"`"
483
+
484
+   values="`_flags_emit_path "${DEPENDENCIES_DIR}"`"
485
+   result="`add_line "${result}" "DEPENDENCIES_DIR=${OPTION_QUOTE}${values}${OPTION_QUOTE}"`"
486
+
481 487
    values="`_flags_cppflags_value`"
482 488
    if [ ! -z "${values}" ]
483 489
    then
... ...
@@ -512,7 +518,19 @@ _flags_do_run_environment()
512 518
    local values
513 519
    local line
514 520
 
521
+   values="`_flags_emit_path "${ADDICTIONS_DIR}"`"
522
+   if [ ! -z "${values}" ]
523
+   then
524
+      result="`add_line "${result}" "ADDICTIONS_DIR=${OPTION_QUOTE}${values}${OPTION_QUOTE}"`"
525
+   fi
526
+   values="`_flags_emit_path "${DEPENDENCIES_DIR}"`"
527
+
528
+   if [ ! -z "${values}" ]
529
+   then
530
+      result="`add_line "${result}" "DEPENDENCIES_DIR=${OPTION_QUOTE}${values}${OPTION_QUOTE}"`"
531
+   fi
515 532
    values="`_flags_librarypath_value`"
533
+
516 534
    if [ ! -z "${values}" ]
517 535
    then
518 536
       case "${UNAME}" in
... ...
@@ -560,7 +578,7 @@ run_main()
560 578
    # use mulle-bootstrap this way to get properly deferred
561 579
    # paths
562 580
    #
563
-   commandline="`${MULLE_EXECUTABLE} -s paths -1 -q "'"`"
581
+   commandline="`${MULLE_EXECUTABLE} -s paths -1 -q "'" run addictions `"
564 582
    while [ $# -ne 0 ]
565 583
    do
566 584
       value="$1"
... ...
@@ -165,7 +165,7 @@ git_checkout()
165 165
    then
166 166
       log_info "Checking out version ${C_RESET_BOLD}${tag}${C_INFO} of ${C_MAGENTA}${C_BOLD}${stashdir}${C_INFO} ..."
167 167
       (
168
-         exekutor cd "${stashdir}" ;
168
+         exekutor cd "${stashdir}" &&
169 169
          exekutor git ${GITFLAGS} checkout ${options} "${tag}"  >&2
170 170
       ) || return 1
171 171
 
... ...
@@ -190,22 +190,22 @@ _git_clone()
190 190
 
191 191
    local url="$1"; shift
192 192
    local stashdir="$1"; shift
193
-   local branch="$1"; [ $# -ne 0 ] && shift
193
+   local branch="$1"
194 194
 
195 195
    [ ! -z "${url}" ]      || internal_fail "url is empty"
196 196
    [ ! -z "${stashdir}" ] || internal_fail "stashdir is empty"
197 197
 
198
-   [ -e "${stashdir}" ] && internal_fail "${stashdir} already exists"
198
+   [ -e "${stashdir}" ]   && internal_fail "${stashdir} already exists"
199 199
 
200 200
    local options
201 201
    local dstdir
202 202
 
203 203
    dstdir="${stashdir}"
204
-   options="$*"
204
+   options=""
205 205
    if [ ! -z "${branch}" ]
206 206
    then
207 207
       log_info "Cloning branch ${C_RESET_BOLD}$branch${C_INFO} of ${C_MAGENTA}${C_BOLD}${url}${C_INFO} into \"${stashdir}\" ..."
208
-      options="`concat "${options}" "-b ${branch}"`"
208
+      options="-b ${branch}"
209 209
    else
210 210
       log_info "Cloning ${C_MAGENTA}${C_BOLD}${url}${C_INFO} into \"${stashdir}\" ..."
211 211
    fi
... ...
@@ -273,11 +273,6 @@ _git_clone()
273 273
       log_error "git clone of \"${url}\" into \"${stashdir}\" failed"
274 274
       return 1
275 275
    fi
276
-
277
-   if [ ! -z "${tag}" ]
278
-   then
279
-      git_checkout "$@"
280
-   fi
281 276
 }
282 277
 
283 278
 
... ...
@@ -286,15 +281,23 @@ git_clone()
286 281
 {
287 282
    [ $# -ge 7 ] || internal_fail "git_clone: parameters missing"
288 283
 
289
-   local reposdir="$1" ; shift
290
-   local name="$1"; shift
291
-   local url="$1"; shift
292
-   local branch="$1"; shift
293
-   local scm="$1"; shift
294
-   local tag="$1"; shift
295
-   local stashdir="$1"; shift
284
+#   local reposdir="$1"
285
+#   local name="$2"
286
+   local url="$3"
287
+   local branch="$4"
288
+#   local scm="$5"
289
+   local tag="$6"
290
+   local stashdir="$7"
291
+
292
+   if ! _git_clone "${url}" "${stashdir}" "${branch}"
293
+   then
294
+      return 1
295
+   fi
296 296
 
297
-   _git_clone "${url}" "${stashdir}" "${branch}" "$@"
297
+   if [ ! -z "${tag}" ]
298
+   then
299
+      git_checkout "$@"
300
+   fi
298 301
 }
299 302
 
300 303
 
... ...
@@ -134,9 +134,12 @@ install_symlinks
134 134
 library_dir_name
135 135
 mangle_minwg_compiler
136 136
 no_warn_local_setting
137
-open_${mainfile}_file
137
+open_brews_file
138
+open_repositories_file
138 139
 output_clean_folders
139 140
 override_branch
141
+rpath_frameworks
142
+rpath_libraries
140 143
 stashes_dir
141 144
 symlinks
142 145
 use_cc_cxx
... ...
@@ -159,6 +159,7 @@ override
159 159
 a/.bootstrap.auto/c.build/bin:
160 160
 c.sh
161 161
 a/.bootstrap.repos:
162
+.creator
162 163
 .fetch_done
163 164
 b
164 165
 c