Browse code

Fix various mulle-brew related bugs. Add mulle-bootstrap-command to share some functionality with mulle-build.

Nat! authored on 02-04-2017 15:12:33
Showing 12 changed files
... ...
@@ -1,3 +1,10 @@
1
+### 3.2.0
2
+
3
+Do not specify cmake dependency in formula, since cmake is not
4
+absolutely required. Rather check this at runtime and output
5
+some helpful hints.
6
+
7
+
1 8
 ### 3.1.0
2 9
 
3 10
 You can allow optional fetches to fail my listing repository-names, that
4 11
new file mode 100644
... ...
@@ -0,0 +1,93 @@
1
+# mulle-brew, C/C++/Objective-C developer sandboxing with homebrew
2
+
3
+![Last version](https://img.shields.io/github/tag/mulle-nat/mulle-bootstrap.svg)
4
+
5
+[Homebrew](brew.sh) is the de facto standard package manager of OS X. Usually
6
+it is used to install packages system-wide into '/usr/local/'. But you can
7
+actually place homebrew anywhere. Then you can create your own playground
8
+development environment of tools and libraries.
9
+
10
+**mulle-brew** helps you set-up and share such playgrounds.
11
+
12
+## How does it work ?
13
+
14
+In the simplest form, `mulle-brew` is just a simple loop over a
15
+`.bootstrap/brews` file, that installs all the listed formulae. This list is
16
+the playground specification, that can be easily shared.
17
+
18
+Here is a sample `.bootstrap/brews` file that installs **autoconf** and
19
+**libpng**:
20
+
21
+```
22
+mkdir .bootstrap 2> /dev/null
23
+cat << EOF > .bootstrap/brews
24
+autoconf
25
+libpng
26
+EOF
27
+```
28
+
29
+When you call `mulle-brew` this will setup a local brew installation in a folder
30
+called `addictions`. The **autoconf** binaries will appear in `addictions/bin`
31
+and the **libpng** library in `addictions/lib` and `addictions/include`.
32
+`addictions` is your playground's '/usr/local' so to speak
33
+
34
+
35
+## Various Playground configurations
36
+
37
+
38
+### Pure playground, gcc/clang based
39
+
40
+You install a complete set of custom tools and libraries. The easiest way then
41
+is to pass `--sysroot` to your tool chain like f.e.
42
+
43
+```
44
+PATH=`mulle-brew paths -m path`
45
+gcc --sysroot="`mulle-brew paths -m addictions`"
46
+```
47
+
48
+### Mixed playground, gcc/clang based
49
+
50
+You use the Xcode supplied toolset, but you want the playground headers and
51
+libraries to override the system files.
52
+
53
+```
54
+gcc `mulle-brew paths -m -q '' cflags`
55
+```
56
+
57
+
58
+### Sharing playgrounds with other projects
59
+
60
+You might find that you have multiple projects with overlapping depencies on
61
+brew formula and the duplication becomes tedious. You can create a "master"
62
+playground in the common parent directory with:
63
+
64
+```
65
+mulle-bootstrap defer
66
+```
67
+
68
+And revert back to a private playground with
69
+
70
+```
71
+mulle-bootstrap emancipate
72
+```
73
+
74
+Here the use of `mulle-brew paths` comes in handy, as it adapts to the
75
+new position of the `addictions` folder in the filesystem.
76
+
77
+
78
+## Tips
79
+
80
+### Keep a cache of homebrew locally
81
+
82
+Cloning **brew** from GitHub can get tedious. You can use a local cache with:
83
+
84
+```
85
+mulle-brew config -g "clone_cache" "${HOME}/Library/Caches/mulle-brew"
86
+```
87
+
88
+
89
+## GitHub and Mulle kybernetiK
90
+
91
+The development is done on [Mulle kybernetiK](https://www.mulle-kybernetik.com/software/git/mulle-bootstrap/master). Releases and bug-tracking are on [GitHub](https://github.com/mulle-nat/mulle-bootstrap).
92
+
93
+
... ...
@@ -29,8 +29,8 @@
29 29
 #   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 30
 #   POSSIBILITY OF SUCH DAMAGE.
31 31
 MULLE_EXECUTABLE_VERSION_MAJOR=3
32
-MULLE_EXECUTABLE_VERSION_MINOR=1
33
-MULLE_EXECUTABLE_VERSION_PATCH=3
32
+MULLE_EXECUTABLE_VERSION_MINOR=2
33
+MULLE_EXECUTABLE_VERSION_PATCH=0
34 34
 
35 35
 MULLE_EXECUTABLE_VERSION="${MULLE_EXECUTABLE_VERSION_MAJOR}.${MULLE_EXECUTABLE_VERSION_MINOR}.${MULLE_EXECUTABLE_VERSION_PATCH}"
36 36
 
... ...
@@ -390,7 +390,7 @@ bootstrap_main()
390 390
    if [ "${MULLE_FLAG_MAGNUM_FORCE}" = "NO" ]
391 391
    then
392 392
       case "${command}" in
393
-         clean|dist-clean|init|status|show|config|setting|uname)
393
+         clean|config|dist-clean|expansion|init|status|show|paths|setting|uname)
394 394
          ;;
395 395
 
396 396
          *)
... ...
@@ -29,8 +29,8 @@
29 29
 #   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 30
 #   POSSIBILITY OF SUCH DAMAGE.
31 31
 MULLE_EXECUTABLE_VERSION_MAJOR=3
32
-MULLE_EXECUTABLE_VERSION_MINOR=1
33
-MULLE_EXECUTABLE_VERSION_PATCH=3
32
+MULLE_EXECUTABLE_VERSION_MINOR=2
33
+MULLE_EXECUTABLE_VERSION_PATCH=0
34 34
 
35 35
 MULLE_EXECUTABLE_VERSION="${MULLE_EXECUTABLE_VERSION_MAJOR}.${MULLE_EXECUTABLE_VERSION_MINOR}.${MULLE_EXECUTABLE_VERSION_PATCH}"
36 36
 
... ...
@@ -317,12 +317,6 @@ brew_main()
317 317
          emancipate_main "$@" || exit 1
318 318
       ;;
319 319
 
320
-      paths)
321
-         . mulle-bootstrap-flags.sh
322
-
323
-         flags_main "$@" || exit 1
324
-      ;;
325
-
326 320
       help)
327 321
          mulle_brew_usage "$@" || exit 1
328 322
       ;;
... ...
@@ -344,6 +338,12 @@ brew_main()
344 338
          return 0
345 339
       ;;
346 340
 
341
+      paths)
342
+         . mulle-bootstrap-paths.sh
343
+
344
+         paths_main "$@" || exit 1
345
+      ;;
346
+
347 347
       setting)
348 348
          . mulle-bootstrap-settings.sh
349 349
 
... ...
@@ -145,7 +145,7 @@ _brew_action()
145 145
 
146 146
          if [ -z "${versions}" ]
147 147
          then
148
-            log_fluff "brew install \"${formula}\""
148
+            log_info "Installing ${C_MAGENTA}${C_BOLD}${formula}${C_INFO} ..."
149 149
             exekutor "${BREW}" install "${formula}" || exit 1
150 150
 
151 151
             log_info "Force linking it, in case it was keg-only"
... ...
@@ -156,7 +156,7 @@ _brew_action()
156 156
       ;;
157 157
 
158 158
       upgrade)
159
-         log_fluff "brew upgrade \"${formula}\""
159
+         log_info "Upgrading ${C_MAGENTA}${C_BOLD}${formula}${C_INFO} ..."
160 160
          exekutor "${BREW}" upgrade "${formula}"
161 161
       ;;
162 162
    esac
... ...
@@ -214,7 +214,7 @@ _brew_install_brews()
214 214
 
215 215
    local flag
216 216
 
217
-   walk_brews "_brew_action" "${brewcmd}"
217
+   walk_brews "${brews}" _brew_action "${brewcmd}"
218 218
 }
219 219
 
220 220
 
... ...
@@ -381,6 +381,7 @@ brew_initialize()
381 381
 
382 382
    [ -z "${MULLE_BOOTSTRAP_LOCAL_ENVIRONMENT_SH}" ] && . mulle-bootstrap-local-environment.sh
383 383
    [ -z "${MULLE_BOOTSTRAP_FUNCTIONS_SH}" ]         && . mulle-bootstrap-functions.sh
384
+   [ -z "${MULLE_BOOTSTRAP_SCM_SH}" ]               && . mulle-bootstrap-scm.sh
384 385
 
385 386
    BREW="${ADDICTIONS_DIR}/bin/brew"
386 387
 
... ...
@@ -87,6 +87,149 @@ EOF
87 87
 
88 88
 
89 89
 
90
+find_cmake()
91
+{
92
+   local name="$1"
93
+
94
+   local toolname
95
+
96
+   toolname=`read_build_setting "${name}" "cmake" "cmake"`
97
+   verify_binary "${toolname}" "cmake" "cmake"
98
+}
99
+
100
+
101
+find_make()
102
+{
103
+   local name="$1"
104
+   local defaultname="${2:-make}"
105
+
106
+   local toolname
107
+
108
+   toolname=`read_build_setting "${name}" "make" "${defaultname}"`
109
+   verify_binary "${toolname}" "make" "${defaultname}"
110
+}
111
+
112
+
113
+
114
+find_xcodebuild()
115
+{
116
+   local name
117
+
118
+   name="$1"
119
+
120
+   local toolname
121
+
122
+   toolname=`read_build_setting "${name}" "xcodebuild" "xcodebuild"`
123
+   verify_binary "${toolname}" "xcodebuild" "xcodebuild"
124
+}
125
+
126
+
127
+find_compiler()
128
+{
129
+   local name="$1"
130
+   local srcdir="$2"
131
+   local compiler_name="$3"
132
+
133
+   local compiler
134
+   local filename
135
+
136
+   compiler="`read_build_setting "${name}" "${compiler_name}"`"
137
+   if [ -z "${compiler}" ]
138
+   then
139
+      filename="${srcdir}/.${compiler_name}"
140
+      compiler="`cat "${filename}" 2>/dev/null`"
141
+      if [  ! -z "${compiler}" ]
142
+      then
143
+         log_verbose "Compiler ${C_RESET_BOLD}${compiler_name}${C_VERBOSE} set to ${C_MAGENTA}${C_BOLD}${compiler}${C_VERBOSE} found in \"${filename}\""
144
+      fi
145
+   fi
146
+
147
+   case "${UNAME}" in
148
+      mingw)
149
+         if [ "`read_config_setting "mangle_minwg_compiler" "YES"`" = "YES" ]
150
+         then
151
+            compiler="`mingw_mangle_compiler "${compiler}"`"
152
+         fi
153
+      ;;
154
+   esac
155
+
156
+   if [ ! -z "${compiler}" ]
157
+   then
158
+      compiler=`which_binary "${toolname}"`
159
+      if [ -z "${compiler}" ]
160
+      then
161
+         suggest_binary_install "${toolname}"
162
+         exit 1
163
+      fi
164
+      echo "${compiler}"
165
+   fi
166
+}
167
+
168
+
169
+tools_environment_common()
170
+{
171
+   local name="$1"
172
+   local srcdir="$2"
173
+
174
+   # no problem if those are empty
175
+   C_COMPILER="`find_compiler "${name}" "${srcdir}" CC`"
176
+   CXX_COMPILER="`find_compiler "${name}" "${srcdir}" CXX`"
177
+}
178
+
179
+
180
+tools_environment_xcodebuild()
181
+{
182
+   local name="$1"
183
+   local srcdir="$2"
184
+
185
+   tools_environment_common "$@"
186
+
187
+   XCODEBUILD="`find_xcodebuild "${name}"`"
188
+}
189
+
190
+
191
+tools_environment_make()
192
+{
193
+   local name="$1"
194
+   local srcdir="$2"
195
+
196
+   tools_environment_common "$@"
197
+
198
+   local defaultmake
199
+
200
+   defaultmake="`platform_make "${C_COMPILER}"`"
201
+
202
+   case "${UNAME}" in
203
+      mingw)
204
+         MAKE="`find_make "${name}" "${defaultmake}"`"
205
+      ;;
206
+
207
+      darwin)
208
+         MAKE="`find_make "${name}"`"
209
+      ;;
210
+
211
+      *)
212
+         MAKE="`find_make "${name}"`"
213
+      ;;
214
+   esac
215
+}
216
+
217
+
218
+tools_environment_cmake()
219
+{
220
+   local name="$1"
221
+   local srcdir="$2"
222
+
223
+   tools_environment_make "$@"
224
+
225
+   local defaultgenerator
226
+
227
+   defaultgenerator="`platform_cmake_generator "${defaultmake}"`"
228
+   CMAKE="`find_cmake "${name}"`"
229
+   CMAKE_GENERATOR="`read_build_setting "${name}" "cmake_generator" "${defaultgenerator}"`"
230
+}
231
+
232
+
90 233
 #
91 234
 # move stuff produced my cmake and configure to places
92 235
 # where we expect them. Expect  others to build to
... ...
@@ -1714,12 +1857,14 @@ build_with_configuration_sdk_preferences()
1714 1857
             then
1715 1858
                project="`(cd "${srcdir}" ; find_xcodeproj "${name}")`"
1716 1859
 
1717
-               if [ ! -z "${project}" ]
1860
+               if [ -z "${project}" ]
1718 1861
                then
1862
+                  log_fluff "There is no Xcode project in \"${srcdir}\""
1863
+               else
1864
+                  tools_environment_xcodebuild "${name}" "${srcdir}"
1865
+
1719 1866
                   build_xcodebuild_schemes_or_target "${configuration}" "${srcdir}" "${builddir}" "${name}" "${sdk}" "${project}"  || exit 1
1720 1867
                   return 0
1721
-               else
1722
-                  log_fluff "There is no Xcode project in \"${srcdir}\""
1723 1868
                fi
1724 1869
             fi
1725 1870
          ;;
... ...
@@ -1736,6 +1881,8 @@ build_with_configuration_sdk_preferences()
1736 1881
                then
1737 1882
                   log_warning "Found a configure, but make is not installed"
1738 1883
                else
1884
+                  tools_environment_make "${name}" "${srcdir}"
1885
+
1739 1886
                   build_configure "${configuration}" "${srcdir}" "${builddir}" "${name}" "${sdk}"  || exit 1
1740 1887
                   return 0
1741 1888
                fi
... ...
@@ -1751,6 +1898,8 @@ build_with_configuration_sdk_preferences()
1751 1898
                then
1752 1899
                   log_warning "Found a CMakeLists.txt, but cmake is not installed"
1753 1900
                else
1901
+                  tools_environment_cmake "${name}" "${srcdir}"
1902
+
1754 1903
                   build_cmake "${configuration}" "${srcdir}" "${builddir}" "${name}" "${sdk}"  || exit 1
1755 1904
                   return 0
1756 1905
                fi
... ...
@@ -1781,10 +1930,6 @@ build()
1781 1930
 
1782 1931
    log_verbose "Building ${name} ..."
1783 1932
 
1784
-   # find make, cmake compilers for this repo
1785
-
1786
-   tools_environment "${name}" "${srcdir}"
1787
-
1788 1933
    local preferences
1789 1934
 
1790 1935
    #
1791 1936
new file mode 100644
... ...
@@ -0,0 +1,257 @@
1
+#! /usr/bin/env bash
2
+#
3
+#   Copyright (c) 2017 Nat! - Mulle kybernetiK
4
+#   All rights reserved.
5
+#
6
+#   Redistribution and use in source and binary forms, with or without
7
+#   modification, are permitted provided that the following conditions are met:
8
+#
9
+#   Redistributions of source code must retain the above copyright notice, this
10
+#   list of conditions and the following disclaimer.
11
+#
12
+#   Redistributions in binary form must reproduce the above copyright notice,
13
+#   this list of conditions and the following disclaimer in the documentation
14
+#   and/or other materials provided with the distribution.
15
+#
16
+#   Neither the name of Mulle kybernetiK nor the names of its contributors
17
+#   may be used to endorse or promote products derived from this software
18
+#   without specific prior written permission.
19
+#
20
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+#   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+#   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23
+#   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24
+#   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25
+#   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
+#   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
+#   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
+#   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
+#   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
+#   POSSIBILITY OF SUCH DAMAGE.
31
+#
32
+MULLE_BOOTSTRAP_COMMAND_SH="included"
33
+
34
+
35
+suggest_binary_install()
36
+{
37
+   toolname="$1"
38
+
39
+   log_warning "Suggested fix:"
40
+
41
+   case "${toolname}" in
42
+      mulle-cl*)
43
+         case "${UNAME}" in
44
+            darwin)
45
+               log_info "brew install mulle-xcode-developer"
46
+            ;;
47
+
48
+            *)
49
+               log_info "Visit https://mulle-objc.github.io/ for instructions how to install ${toolname}"
50
+            ;;
51
+         esac
52
+      ;;
53
+
54
+      *)
55
+         case "${UNAME}" in
56
+            darwin)
57
+               log_info "brew install $1"
58
+            ;;
59
+
60
+            linux)
61
+               if command -v "apt-get" > /dev/null 2>&1
62
+               then
63
+                  log_info "apt-get install $1"
64
+               else
65
+                  if command -v "yum" > /dev/null 2>&1
66
+                  then
67
+                     log_info "yum install $1"
68
+                  else
69
+                     fail "You need to install $1 manually"
70
+                  fi
71
+               fi
72
+            ;;
73
+
74
+            FreeBSD)
75
+               if command -v "pkg" > /dev/null 2>&1
76
+               then
77
+                  log_info pkg install "$1"
78
+               else
79
+                  if command -v "pkg_add" > /dev/null 2>&1
80
+                  then
81
+                     log_info pkg_add -r "$1"
82
+                  else
83
+                     log_info "You need to install $1 manually"
84
+                  fi
85
+               fi
86
+            ;;
87
+
88
+            *)
89
+               log_info "You need to install $1 manually"
90
+            ;;
91
+         esac
92
+      ;;
93
+   esac
94
+}
95
+
96
+
97
+platform_make()
98
+{
99
+   local compiler="$1"
100
+
101
+   case "${UNAME}" in
102
+      mingw)
103
+         case "${compiler}" in
104
+            ""|cl|cl.exe)
105
+               echo "nmake"
106
+            ;;
107
+            *)
108
+               echo "mingw32-make"
109
+            ;;
110
+         esac
111
+      ;;
112
+
113
+      *)
114
+         echo "make"
115
+      ;;
116
+   esac
117
+}
118
+
119
+
120
+platform_cmake_generator()
121
+{
122
+   local make="$1"
123
+
124
+   case "${UNAME}" in
125
+      mingw)
126
+         case "${make}" in
127
+            n*|N*)
128
+               defaultgenerator="NMake Makefiles"
129
+            ;;
130
+            mingw*|MINGW*)
131
+               defaultgenerator="MinGW Makefiles"
132
+            ;;
133
+            *)
134
+               defaultgenerator="MSYS Makefiles"
135
+            ;;
136
+         esac
137
+      ;;
138
+
139
+      *)
140
+         echo "Unix Makefiles"
141
+      ;;
142
+   esac
143
+}
144
+
145
+
146
+#
147
+# first find a project with matching name, otherwise find
148
+# first nearest project
149
+#
150
+find_xcodeproj()
151
+{
152
+   local found
153
+   local expect
154
+   local depth
155
+
156
+   found=""
157
+   expect="$1"
158
+   depth=1000
159
+   #     IFS='\0'
160
+
161
+   local match
162
+   local new_depth
163
+
164
+   #
165
+   # don't go too deep in search
166
+   #
167
+   for i in `find . -maxdepth 2 -name "*.xcodeproj" -print`
168
+   do
169
+      match=`basename -- "${i}" .xcodeproj`
170
+      if [ "$match" = "$expect" ]
171
+      then
172
+         echo "$i"
173
+         return 0
174
+      fi
175
+
176
+      new_depth=`path_depth "$i"`
177
+      if [ "$new_depth" -lt "$depth" ]
178
+      then
179
+         found="${i}"
180
+         depth="$new_depth"
181
+      fi
182
+   done
183
+
184
+   if [ ! -z "$found" ]
185
+   then
186
+      echo "${found}"
187
+      return 0
188
+   fi
189
+
190
+   return 1
191
+}
192
+
193
+
194
+which_binary()
195
+{
196
+   local toolname
197
+
198
+   toolname="$1"
199
+   case "${UNAME}" in
200
+      mingw)
201
+         case "${toolname}" in
202
+            *.exe)
203
+            ;;
204
+
205
+            *)
206
+               toolname="${toolname}.exe"
207
+            ;;
208
+         esac
209
+      ;;
210
+   esac
211
+
212
+   which "${toolname}" 2> /dev/null
213
+}
214
+
215
+
216
+#
217
+# toolname : ex. mulle-clang
218
+# toolfamily: CC
219
+# tooldefaultname: gcc
220
+#
221
+verify_binary()
222
+{
223
+   local toolname="$1"
224
+   local toolfamily="$2"
225
+   local tooldefaultname="$3"
226
+
227
+   [ -z "${toolname}" ] && internal_fail "toolname for \"${toolfamily}\" is empty"
228
+
229
+   local path
230
+
231
+   path=`which_binary "${toolname}"`
232
+   if [ ! -z "${path}" ]
233
+   then
234
+      echo "`basename ${path}`"
235
+      return 0
236
+   fi
237
+
238
+   #
239
+   # If the user (via config) specified a certain tool, then it not being
240
+   # there is bad.
241
+   # Otherwise it's maybe OK (f.e. only using xcodebuild not cmake)
242
+   #
243
+   toolname="`extension_less_basename "${toolname}"`"
244
+   tooldefaultname="`extension_less_basename "${tooldefaultname}"`"
245
+
246
+   if [ "${toolname}" != "${tooldefaultname}" ]
247
+   then
248
+      log_fail "${toolfamily} named \"${toolname}\" not found in PATH"
249
+      suggest_binary_install "${toolname}"
250
+      _bail
251
+   else
252
+      log_fluff "${toolfamily} named \"${toolname}\" not found in PATH"
253
+   fi
254
+
255
+   return 1
256
+}
257
+
... ...
@@ -1633,20 +1633,6 @@ _common_main()
1633 1633
    local DONT_WARN_SCRIPTS="NO"
1634 1634
 
1635 1635
    local ROOT_DIR="`pwd -P`"
1636
-   local CACHES_PATH
1637
-   local CLONE_CACHE
1638
-
1639
-   #
1640
-   # where we look for symlink sources
1641
-   # user can set also set via environment "MULLE_BOOTSTRAP_CACHES_PATH"
1642
-   #
1643
-   # "repository" caches can and usually are outside the project folder
1644
-   # this can be multiple paths!
1645
-   CACHES_PATH="`read_config_setting "caches_path" "${MULLE_BOOTSTRAP_CACHES_PATH}"`"
1646
-
1647
-   # stuff clones get intermediate saved too, default empty
1648
-   CLONE_CACHE="`read_config_setting "clone_cache"`"
1649
-   CACHES_PATH="`add_path "${CACHES_PATH}" "${CLONE_CACHE}"`"
1650 1636
 
1651 1637
    OPTION_CHECK_USR_LOCAL_INCLUDE="`read_config_setting "check_usr_local_include" "NO"`"
1652 1638
    OVERRIDE_BRANCH="`read_config_setting "override_branch"`"
... ...
@@ -975,10 +975,7 @@ assert_sane_path()
975 975
 
976 976
 prepend_to_search_path_if_missing()
977 977
 {
978
-   local fullpath
979
-
980
-   fullpath="$1"
981
-   shift
978
+   local fullpath="$1"; shift
982 979
 
983 980
    local new_path
984 981
    local tail_path
... ...
@@ -1265,81 +1262,11 @@ dir_has_files()
1265 1262
 }
1266 1263
 
1267 1264
 
1268
-#
1269
-# first find a project with matching name, otherwise find
1270
-# first nearest project
1271
-#
1272
-find_xcodeproj()
1273
-{
1274
-   local found
1275
-   local expect
1276
-   local depth
1277
-
1278
-   found=""
1279
-   expect="$1"
1280
-   depth=1000
1281
-   #     IFS='\0'
1282
-
1283
-   local match
1284
-   local new_depth
1285
-
1286
-   #
1287
-   # don't go too deep in search
1288
-   #
1289
-   for i in `find . -maxdepth 2 -name "*.xcodeproj" -print`
1290
-   do
1291
-      match=`basename -- "${i}" .xcodeproj`
1292
-      if [ "$match" = "$expect" ]
1293
-      then
1294
-         echo "$i"
1295
-         return 0
1296
-      fi
1297
-
1298
-      new_depth=`path_depth "$i"`
1299
-      if [ "$new_depth" -lt "$depth" ]
1300
-      then
1301
-         found="${i}"
1302
-         depth="$new_depth"
1303
-      fi
1304
-   done
1305
-
1306
-   if [ ! -z "$found" ]
1307
-   then
1308
-      echo "${found}"
1309
-      return 0
1310
-   fi
1311
-
1312
-   return 1
1313
-}
1314
-
1315
-
1316
-which_binary()
1317
-{
1318
-   local toolname
1319
-
1320
-   toolname="$1"
1321
-   case "${UNAME}" in
1322
-      mingw)
1323
-         case "${toolname}" in
1324
-            *.exe)
1325
-            ;;
1326
-
1327
-            *)
1328
-               toolname="${toolname}.exe"
1329
-            ;;
1330
-         esac
1331
-      ;;
1332
-   esac
1333
-
1334
-   which "${toolname}" 2> /dev/null
1335
-}
1336
-
1337 1265
 
1338 1266
 has_usr_local_include()
1339 1267
 {
1340
-   local name
1268
+   local name="$1"
1341 1269
 
1342
-   name="$1"
1343 1270
    if [ -d "${USR_LOCAL_INCLUDE}/${name}" ]
1344 1271
    then
1345 1272
       return 0
... ...
@@ -165,9 +165,15 @@ _bail()
165 165
 }
166 166
 
167 167
 
168
-fail()
168
+log_fail()
169 169
 {
170 170
    log_error "${MULLE_EXECUTABLE_FAIL_PREFIX} Error: $*"
171
+}
172
+
173
+
174
+fail()
175
+{
176
+   log_fail "$*"
171 177
    _bail
172 178
 }
173 179
 
... ...
@@ -872,6 +872,16 @@ scm_initialize()
872 872
    log_debug ":scm_initialize:"
873 873
    [ -z "${MULLE_BOOTSTRAP_FUNCTIONS_SH}" ] && . mulle-bootstrap-functions.sh
874 874
    [ -z "${MULLE_BOOTSTRAP_REPOSITORIES_SH}" ] && . mulle-bootstrap-repositories.sh
875
+
876
+   #
877
+   # "repository" caches can and usually are outside the project folder
878
+   # this can be multiple paths!
879
+   CACHES_PATH="`read_config_setting "caches_path" "${MULLE_BOOTSTRAP_CACHES_PATH}"`"
880
+
881
+   # stuff clones get intermediate saved too, default empty
882
+   CLONE_CACHE="`read_config_setting "clone_cache"`"
883
+   CACHES_PATH="`add_path "${CACHES_PATH}" "${CLONE_CACHE}"`"
884
+
875 885
    :
876 886
 }
877 887
 
... ...
@@ -1159,7 +1159,7 @@ _generic_main()
1159 1159
    while [ $# -ne 0 ]
1160 1160
    do
1161 1161
       case "${type}" in
1162
-         setting|expansion)
1162
+         setting|config|expansion)
1163 1163
             case "$1" in
1164 1164
                -g|--global)
1165 1165
                   OPTION_GLOBAL="YES"