Browse code

Reorganize project, because it got unwieldy. Improve mulle-bootstrap init generated files.

Nat! authored on 10-08-2016 13:32:37
Showing 27 changed files
1 1
deleted file mode 100644
... ...
@@ -1 +0,0 @@
1
-mulle-xcode-settings
2 0
deleted file mode 100644
... ...
@@ -1 +0,0 @@
1
-mulle-kybernetik/software
... ...
@@ -9,4 +9,4 @@ dependencies/
9 9
 mulle-bootstrap.sublime-workspace
10 10
 mulle-project
11 11
 relpath-python.sh
12
-relpath.sh
13 12
\ No newline at end of file
13
+relpath.shaddictions/
... ...
@@ -1,4 +1,7 @@
1
-# mulle-bootstrap, cross platform dependency manager
1
+# mulle-bootstrap, cross platform dependency manager for Linux, OS X, FreeBSD
2
+
3
+Everything `mulle-bootstrap` installs is relative to your project root.
4
+Downloaded packages and binaries don't "pollute" your system.
2 5
 
3 6
 * fetches [git](//enux.pl/article/en/2014-01-21/why-git-sucks) repositories
4 7
 (called here the "dependents"). In times of need, it can also checkout [svn](//andreasjacobsen.com/2008/10/26/subversion-sucks-get-over-it/).
... ...
@@ -6,8 +9,11 @@
6 9
 [xcodebuild](//devcodehack.com/xcode-sucks-and-heres-why/) and
7 10
 [configure](//quetzalcoatal.blogspot.de/2011/06/why-autoconf-sucks.html)
8 11
 projects
9
-* compiles dependents using the output of previous dependents
10
-* written in portable shell script, runs on OS X, FreeBSD, Linux
12
+* compiles dependents using the output of previous dependents into a project
13
+local "dependencies" folder
14
+* installs [brew](//dzone.com/articles/why-osx-sucks-and-you-should) binaries and
15
+libraries locally into an "addictions" folder
16
+* written in portable shell script, runs on OS X, FreeBSD (without brew), Linux
11 17
 
12 18
 ## Tell me more
13 19
 
... ...
@@ -1,3 +1,16 @@
1
+2.0
2
+===
3
+
4
+* Add pre-build.sh script phase for libcurl
5
+* Brew formulas are now installed locally into "addictions". A folder which
6
+lies besides "dependencies". This is a pretty huge change. By removing pips and
7
+gems, mulle-bootstrap can now claim to do only project relative installs.
8
+* mulle-bootstrap xcode changed to emit a non-xcode project relative
9
+ `$(DEPENDENCIES_DIR)` setting. Admittedly an experimental hack. But the old
10
+ more proper way, didn't work with cmake generated xcode projects.
11
+* reorganized repository structure a bit
12
+
13
+
1 14
 1.1
2 15
 ===
3 16
 
... ...
@@ -232,6 +232,7 @@ Build Script Settings
232 232
 2. `.bootstrap/${reponame}/settings/bin`
233 233
 3. `.bootstrap.auto/${reponame}/settings/bin`
234 234
 
235
+`pre-build.sh`
235 236
 `pre-install.sh
236 237
 `post-install.sh`
237 238
 `pre-upgrade.sh`
... ...
@@ -1,4 +1,3 @@
1
-* Use common dependencies dir
2 1
 * cmake use local mulle-configuration of subrepo. WRONG!
3 2
 * Use different build dir than just build.
4 3
 * Write "doctor" command to find common problems.
... ...
@@ -55,7 +55,7 @@ do
55 55
 done
56 56
 
57 57
 
58
-for i in mulle*.sh
58
+for i in src/mulle*.sh
59 59
 do
60 60
    mkdir -p "${libexec}" 2> /dev/null
61 61
    install -v -m "${mode}" "$i" "${libexec}" || exit 1
... ...
@@ -29,7 +29,7 @@
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
 
32
-VERSION=1.2
32
+VERSION=2.0
33 33
 export VERSION
34 34
 
35 35
 #
... ...
@@ -38,7 +38,7 @@ export VERSION
38 38
 #
39 39
 BOOTSTRAP_SUBDIR=.bootstrap
40 40
 
41
-PATH="/usr/local/libexec/mulle-bootstrap:$PATH"
41
+PATH="/usr/local/libexec/mulle-bootstrap:`pwd -P`/addictions/bin:$PATH"
42 42
 export PATH
43 43
 
44 44
 #
... ...
@@ -223,10 +223,10 @@ bootstrap()
223 223
    #
224 224
    # this is run when checking mulle-project itself out
225 225
    #
226
-   if [ -f mulle-bootstrap-local-environment.sh -a -x install.sh ]
226
+   if [ -f "src/mulle-bootstrap-local-environment.sh" -a -x install.sh ]
227 227
    then
228 228
       . install.sh "$@"
229
-      export MULLE_BOOTSTRAP=mulle-bootstrap
229
+      exit 0
230 230
    else
231 231
       mulle-bootstrap-warn-scripts.sh "${BOOTSTRAP_SUBDIR}" || exit 1
232 232
    fi
233 233
similarity index 100%
234 234
rename from mulle-bootstrap-auto-update.sh
235 235
rename to src/mulle-bootstrap-auto-update.sh
236 236
similarity index 69%
237 237
rename from mulle-bootstrap-brew.sh
238 238
rename to src/mulle-bootstrap-brew.sh
... ...
@@ -29,49 +29,64 @@
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
 
32
-fetch_brew_if_needed()
32
+
33
+#
34
+# Install brew into "addictions" via git clone
35
+# this has the following advantages:
36
+#    When fetching libraries or binaries they will
37
+#    automatically appear in addictions/bin and addictions/lib / addictionsinclude
38
+#    It's all local (!) to the project. Due to it being a git clone
39
+#    and dependencies being wiped occasionally, its better to have a second
40
+#    directory
41
+#
42
+
43
+BREW="${ADDICTION_SUBDIR}/bin/brew"
44
+
45
+
46
+touch_last_update()
33 47
 {
34 48
    local last_update
35
-   local binary
36 49
 
37
-   last_update="${HOME}/.mulle-bootstrap/brew-update"
50
+   last_update="${ADDICTION_SUBDIR}/.last_update"
51
+   log_fluff "Touching ${last_update}"
52
+   exekutor touch "${last_update}"
53
+}
38 54
 
39
-   binary=`which brew`
40
-   if [ "${binary}" = "" ]
55
+
56
+fetch_brew_if_needed()
57
+{
58
+   if [ -x "${BREW}" ]
41 59
    then
42
-      user_say_yes "Brew isn't installed on this system.
43
-Install brew now (Linux or OS X should work) ? "
44
-      if [ $? -ne 0 ]
45
-      then
46
-         return 2
47
-      fi
60
+      return
61
+   fi
48 62
 
49
-      if [ "`uname`" = 'Darwin' ]
50
-      then
63
+   case "`uname`" in
64
+      Darwin)
51 65
          log_info "Installing OS X brew"
52
-         exekutor ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" || exit 1
53
-      else
66
+         exekutor git clone https://github.com/Homebrew/brew.git "${ADDICTION_SUBDIR}"
67
+         ;;
68
+
69
+      Linux)
54 70
          log_info "Installing Linux brew"
55
-         exekutor ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)" || exit 1
56
-      fi
71
+         exekutor git clone https://github.com/Linuxbrew/brew.git "${ADDICTION_SUBDIR}"
72
+         ;;
57 73
 
58
-      log_fluff "Touching ${last_update}"
59
-      exekutor mkdir_if_missing "`dirname -- "${last_update}"`"
60
-      exekutor touch "${last_update}"
61
-      return 1
62
-   fi
63
-   return 0
74
+      *)
75
+         log_fail "Missing brew support for `uname`"
76
+         ;;
77
+   esac
78
+
79
+   touch_last_update
80
+   return 1
64 81
 }
65 82
 
66 83
 
67 84
 brew_update_if_needed()
68 85
 {
69 86
    local stale
70
-   local last_update
71 87
    local what
72 88
 
73 89
    what="$1"
74
-   last_update="${HOME}/.mulle-bootstrap/brew-update"
75 90
 
76 91
    local flag
77 92
 
... ...
@@ -97,9 +112,8 @@ brew_update_if_needed()
97 112
    if [ $? -eq 0 ]
98 113
    then
99 114
       log_fluff "Updating brew, this can take some time..."
100
-   	exekutor brew update
115
+   	exekutor "${BREW}" update
101 116
 
102
-	   mkdir_if_missing "`dirname -- "${last_update}"`"
103
-   	exekutor touch "${last_update}"
117
+      touch_last_update
104 118
    fi
105 119
 }
106 120
similarity index 96%
107 121
rename from mulle-bootstrap-build.sh
108 122
rename to src/mulle-bootstrap-build.sh
... ...
@@ -636,25 +636,27 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
636 636
 "-DCMAKE_INSTALL_PREFIX:PATH=${owd}/${BUILD_DEPENDENCY_SUBDIR}"  \
637 637
 "-DCMAKE_C_FLAGS=\
638 638
 -I${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${HEADER_DIR_NAME} \
639
--I/usr/local/include \
639
+-I${owd}/${REFERENCE_ADDICTION_SUBDIR}/${HEADER_DIR_NAME} \
640 640
 ${frameworklines} \
641 641
 -F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME} \
642
+-F${owd}/${REFERENCE_ADDICTION_SUBDIR}/${FRAMEWORK_DIR_NAME} \
642 643
 ${other_cflags}" \
643 644
 "-DCMAKE_CXX_FLAGS=\
644 645
 -I${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${HEADER_DIR_NAME} \
645
--I/usr/local/include \
646
+-I${owd}/${REFERENCE_ADDICTION_SUBDIR}/${HEADER_DIR_NAME} \
646 647
 ${frameworklines} \
647 648
 -F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME} \
649
+-F${owd}/${REFERENCE_ADDICTION_SUBDIR}/${FRAMEWORK_DIR_NAME} \
648 650
 ${other_cppflags}" \
649 651
 "-DCMAKE_EXE_LINKER_FLAGS=\
650 652
 ${librarylines} \
651 653
 -L${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${LIBRARY_DIR_NAME} \
652
--L/usr/local/lib \
654
+-L${owd}/${REFERENCE_ADDICTION_SUBDIR}/${LIBRARY_DIR_NAME} \
653 655
 ${other_ldflags}" \
654 656
 "-DCMAKE_SHARED_LINKER_FLAGS=\
655 657
 ${librarylines} \
656 658
 -L${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${LIBRARY_DIR_NAME} \
657
--L/usr/local/lib \
659
+-L${owd}/${REFERENCE_ADDICTION_SUBDIR}/${LIBRARY_DIR_NAME} \
658 660
 ${other_ldflags}" \
659 661
 "-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH};\${CMAKE_MODULE_PATH}" \
660 662
 ${CMAKE_FLAGS} \
... ...
@@ -800,24 +802,27 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
800 802
        DEPENDENCIES_DIR="'${owd}/${REFERENCE_DEPENDENCY_SUBDIR}'" \
801 803
        CFLAGS="\
802 804
 -I${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${HEADER_DIR_NAME} \
803
--I/usr/local/include \
805
+-I${owd}/${REFERENCE_ADDICTION_SUBDIR}/${HEADER_DIR_NAME} \
804 806
 ${frameworklines}
805 807
 -F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME} \
808
+-F${owd}/${REFERENCE_ADDICTION_SUBDIR}/${FRAMEWORK_DIR_NAME} \
806 809
 ${other_cflags} \
807 810
 -isysroot ${sdkpath}" \
808 811
       CPPFLAGS="\
809 812
 -I${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${HEADER_DIR_NAME} \
810
--I/usr/local/include \
813
+-I${owd}/${REFERENCE_ADDICTION_SUBDIR}/${HEADER_DIR_NAME} \
811 814
 ${frameworklines}
812 815
 -F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME} \
816
+-F${owd}/${REFERENCE_ADDICTION_SUBDIR}/${FRAMEWORK_DIR_NAME} \
813 817
 ${other_cppflags} \
814 818
 -isysroot ${sdkpath}" \
815 819
       LDFLAGS="\
816 820
 ${frameworklines}
817 821
 -F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME} \
822
+-F${owd}/${REFERENCE_ADDICTION_SUBDIR}/${FRAMEWORK_DIR_NAME} \
818 823
 ${librarylines}
819 824
 -L${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${LIBRARY_DIR_NAME} \
820
--L/usr/local/lib \
825
+-L${owd}/${REFERENCE_ADDICTION_SUBDIR}/${LIBRARY_DIR_NAME} \
821 826
 ${other_ldflags} \
822 827
 -isysroot ${sdkpath}" \
823 828
        logging_exekutor "${owd}/${srcdir}/configure" ${configureflags} \
... ...
@@ -1201,7 +1206,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO}${info} in \
1201 1206
       inherited="`xcode_get_setting HEADER_SEARCH_PATHS ${arguments}`" || exit 1
1202 1207
       path=`combined_escaped_search_path \
1203 1208
 "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${HEADER_DIR_NAME}" \
1204
-"/usr/local/include"`
1209
+"${owd}/${REFERENCE_ADDICTION_SUBDIR}/${HEADER_DIR_NAME}"`
1205 1210
       if [ -z "${inherited}" ]
1206 1211
       then
1207 1212
          dependencies_header_search_path="${path}"
... ...
@@ -1214,7 +1219,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO}${info} in \
1214 1219
 "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}${mappedsubdir}/${LIBRARY_DIR_NAME}" \
1215 1220
 "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}${fallbacksubdir}/${LIBRARY_DIR_NAME}" \
1216 1221
 "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${LIBRARY_DIR_NAME}" \
1217
-"/usr/local/lib"`
1222
+"${owd}/${REFERENCE_ADDICTION_SUBDIR}/${LIBRARY_DIR_NAME}"`
1218 1223
       if [ ! -z "$sdk" ]
1219 1224
       then
1220 1225
          escaped="`escaped_spaces "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}${mappedsubdir}/${LIBRARY_DIR_NAME}"'-$(EFFECTIVE_PLATFORM_NAME)'`"
... ...
@@ -1231,7 +1236,8 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO}${info} in \
1231 1236
       path=`combined_escaped_search_path \
1232 1237
 "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}${mappedsubdir}/${FRAMEWORK_DIR_NAME}" \
1233 1238
 "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}${fallbacksubdir}/${FRAMEWORK_DIR_NAME}" \
1234
-"${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}"`
1239
+"${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}" \
1240
+"${owd}/${REFERENCE_ADDICTION_SUBDIR}/${FRAMEWORK_DIR_NAME}"`
1235 1241
       if [ ! -z "$sdk" ]
1236 1242
       then
1237 1243
          escaped="`escaped_spaces "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}${mappedsubdir}/${FRAMEWORK_DIR_NAME}"'-$(EFFECTIVE_PLATFORM_NAME)'`"
... ...
@@ -1260,6 +1266,7 @@ DSTROOT='${owd}/${BUILD_DEPENDENCY_SUBDIR}' \
1260 1266
 SYMROOT='${owd}/${builddir}/' \
1261 1267
 OBJROOT='${owd}/${builddir}/obj' \
1262 1268
 DEPENDENCIES_DIR='${owd}/${REFERENCE_DEPENDENCY_SUBDIR}' \
1269
+ADDICTIONS_DIR='${owd}/${REFERENCE_ADDICTION_SUBDIR}' \
1263 1270
 ONLY_ACTIVE_ARCH=${ONLY_ACTIVE_ARCH:-NO} \
1264 1271
 ${skip_install} \
1265 1272
 ${other_cflags} \
... ...
@@ -1523,13 +1530,22 @@ configure"`"
1523 1530
             rmdir_safer "${builddir}"
1524 1531
          fi
1525 1532
 
1533
+         #
1534
+         # execute pre-build script (f.e. for libcurl)
1535
+         #
1536
+         local script
1537
+
1538
+         script="`find_build_setting_file "${name}" "bin/pre-build.sh"`"
1539
+         if [ -x "${script}" ]
1540
+         then
1541
+            build_script "${script}" "${configuration}" "${srcdir}" "${builddir}" "${name}" "${sdk}" || exit 1
1542
+         fi
1543
+
1526 1544
          hasbuilt=no
1527 1545
          for preference in ${preferences}
1528 1546
          do
1529 1547
             if [ "${preference}" = "script" ]
1530 1548
             then
1531
-               local script
1532
-
1533 1549
                script="`find_build_setting_file "${name}" "bin/build.sh"`"
1534 1550
                if [ -x "${script}" ]
1535 1551
                then
... ...
@@ -1609,10 +1625,12 @@ build_wrapper()
1609 1625
    name="$1"
1610 1626
    srcdir="$2"
1611 1627
 
1628
+   REFERENCE_ADDICTION_SUBDIR="${ADDICTION_SUBDIR}"
1612 1629
    REFERENCE_DEPENDENCY_SUBDIR="${DEPENDENCY_SUBDIR}"
1613 1630
    BUILD_DEPENDENCY_SUBDIR="${DEPENDENCY_SUBDIR}/tmp"
1614 1631
 
1615 1632
    DEPENDENCY_SUBDIR="WRONG_DONT_USE_DEPENDENCY_SUBDIR_DURING_BUILD"
1633
+   ADDICTION_SUBDIR="WRONG_DONT_USE_ADDICTION_SUBDIR_DURING_BUILD"
1616 1634
 
1617 1635
    log_fluff "Setting up BUILD_DEPENDENCY_SUBDIR as \"${BUILD_DEPENDENCY_SUBDIR}\""
1618 1636
 
... ...
@@ -1624,6 +1642,7 @@ build_wrapper()
1624 1642
 
1625 1643
    export BUILD_DEPENDENCY_SUBDIR
1626 1644
    export REFERENCE_DEPENDENCY_SUBDIR
1645
+   export REFERENCE_ADDICTION_SUBDIR
1627 1646
 
1628 1647
    #
1629 1648
    # move dependencies we have so far away into safety,
... ...
@@ -1643,6 +1662,7 @@ build_wrapper()
1643 1662
    fi
1644 1663
 
1645 1664
    DEPENDENCY_SUBDIR="${REFERENCE_DEPENDENCY_SUBDIR}"
1665
+   ADDICTION_SUBDIR="${REFERENCE_ADDICTION_SUBDIR}"
1646 1666
 
1647 1667
    # for mulle-bootstrap developers
1648 1668
    REFERENCE_DEPENDENCY_SUBDIR="WRONG_DONT_USE_REFERENCE_DEPENDENCY_SUBDIR_AFTER_BUILD"
... ...
@@ -1893,8 +1913,7 @@ main()
1893 1913
 
1894 1914
    if [ -d "${DEPENDENCY_SUBDIR}" ]
1895 1915
    then
1896
-      log_info "Write-protecting ${C_RESET_BOLD}${DEPENDENCY_SUBDIR}${C_INFO} to avoid spurious header edits"
1897
-      exekutor chmod -R a-w "${DEPENDENCY_SUBDIR}"
1916
+      write_protect_directory "${DEPENDENCY_SUBDIR}"
1898 1917
    else
1899 1918
       log_fluff "No dependencies have been generated"
1900 1919
    fi
1901 1920
similarity index 98%
1902 1921
rename from mulle-bootstrap-clean.sh
1903 1922
rename to src/mulle-bootstrap-clean.sh
... ...
@@ -38,6 +38,7 @@ BUILD_CLEANABLE_SUBDIRS="`read_sane_config_path_setting "clean_folders" "${CLONE
38 38
 ${DEPENDENCY_SUBDIR}/tmp"`"
39 39
 OUTPUT_CLEANABLE_SUBDIRS="`read_sane_config_path_setting "output_clean_folders" "${DEPENDENCY_SUBDIR}"`"
40 40
 DIST_CLEANABLE_SUBDIRS="`read_sane_config_path_setting "dist_clean_folders" "${CLONES_SUBDIR}
41
+${ADDICTION_SUBDIR}
41 42
 .bootstrap.auto"`"
42 43
 INSTALL_CLEANABLE_SUBDIRS="`read_sane_config_path_setting "install_clean_folders" "${BUILD_CLEANABLE_SUBDIRS}
43 44
 ${CLONES_SUBDIR}
... ...
@@ -99,7 +100,7 @@ ${BUILD_CLEANABLE_SUBDIRS}
99 100
 ${OUTPUT_CLEANABLE_SUBDIRS}
100 101
 ---
101 102
 
102
-   dist    : remove all clones and dependencies. It cleans
103
+   dist    : remove all clones, dependencies, addictions. It cleans
103 104
 ---
104 105
 ${BUILD_CLEANABLE_SUBDIRS}
105 106
 ${OUTPUT_CLEANABLE_SUBDIRS}
106 107
similarity index 93%
107 108
rename from mulle-bootstrap-fetch.sh
108 109
rename to src/mulle-bootstrap-fetch.sh
... ...
@@ -132,7 +132,7 @@ install_taps()
132 132
       for tap in ${taps}
133 133
       do
134 134
          IFS="${old}"
135
-         exekutor brew tap "${tap}" > /dev/null || exit 1
135
+         exekutor "${BREW}" tap "${tap}" > /dev/null || exit 1
136 136
       done
137 137
       IFS="${old}"
138 138
    else
... ...
@@ -141,48 +141,105 @@ install_taps()
141 141
 }
142 142
 
143 143
 
144
+
145
+write_protect_directory()
146
+{
147
+   if [ -d "${1}" ]
148
+   then
149
+      #
150
+      # ensure basic structure is there to squelch linker warnings
151
+      #
152
+      exekutor mkdir "${1}/Frameworks" 2> /dev/null
153
+      exekutor mkdir "${1}/lib" 2> /dev/null
154
+      exekutor mkdir "${1}/include" 2> /dev/null
155
+
156
+      log_info "Write-protecting ${C_RESET_BOLD}${1}${C_INFO} to avoid spurious header edits"
157
+      exekutor chmod -R a-w "${1}"
158
+   fi
159
+}
160
+
161
+#
162
+# brews are now installed using a local brew
163
+# if we are on linx
164
+#
144 165
 install_brews()
145 166
 {
146 167
    local brew
147 168
    local brews
169
+   local brewcmd
148 170
 
149 171
    install_taps
150 172
 
151 173
    log_fluff "Looking for brews"
152 174
 
175
+   case "${COMMAND}" in
176
+      install)
177
+         brewcmd="install"
178
+         ;;
179
+      update)
180
+         brewcmd="upgrade"
181
+         ;;
182
+   esac
183
+
153 184
    brews=`read_fetch_setting "brews" | sort | sort -u`
154
-   if [ "${brews}" != "" ]
185
+   if [ -z "${brews}" ]
155 186
    then
156
-      local old
157
-      local flag
187
+      log_fluff "No brews found"
188
+      return
189
+   fi
158 190
 
159
-      old="${IFS:-" "}"
160
-      IFS="
191
+   if [ -d "${ADDICTION_SUBDIR}" ]
192
+   then
193
+      log_fluff "Unprotecting \"${ADDICTION_SUBDIR}\" for ${command}."
194
+      exekutor chmod -R u+w "${ADDICTION_SUBDIR}"
195
+   fi
196
+
197
+   local old
198
+   local flag
199
+
200
+   old="${IFS:-" "}"
201
+   IFS="
161 202
 "
162
-      for brew in ${brews}
163
-      do
164
-         IFS="${old}"
165
-         if [ "`which "${brew}"`" = "" ]
166
-         then
167
-            brew_update_if_needed "${brew}"
168
-            flag=$?
203
+   for formula in ${brews}
204
+   do
205
+      IFS="${old}"
169 206
 
170
-            if [ $flag -eq 2 ]
171
-            then
172
-               log_info "No brewing being done."
173
-               return 1
174
-            fi
207
+      if [ ! -x "${BREW}" ]
208
+      then
209
+         brew_update_if_needed "${formula}"
210
+         flag=$?
175 211
 
176
-            log_fluff "brew ${COMMAND} \"${brew}\""
177
-            exekutor brew "${COMMAND}" "${brew}" || exit 1
178
-         else
179
-            log_info "\"${brew}\" is already installed."
212
+         if [ $flag -eq 2 ]
213
+         then
214
+            log_info "No brewing being done."
215
+            write_protect_directory "${ADDICTION_SUBDIR}"
216
+            return 1
180 217
          fi
181
-      done
182
-      IFS="${old}"
183
-   else
184
-      log_fluff "No brews found"
185
-   fi
218
+      fi
219
+
220
+      local versions
221
+
222
+      versions=""
223
+      if [ "$brewcmd" = "install" ]
224
+      then
225
+         versions="`${BREW} ls --versions "${formula}" 2> /dev/null`"
226
+      fi
227
+
228
+      if [ -z "${versions}" ]
229
+      then
230
+         log_fluff "brew ${brewcmd} \"${formula}\""
231
+         exekutor "${BREW}" "${brewcmd}" "${formula}" || exit 1
232
+
233
+         log_info "Force linking it, in case it was keg-only"
234
+         exekutor "${BREW}" link --force "${formula}" || exit 1
235
+      else
236
+         log_info "\"${formula}\" is already installed."
237
+      fi
238
+   done
239
+
240
+   write_protect_directory "${ADDICTION_SUBDIR}"
241
+
242
+   IFS="${old}"
186 243
 }
187 244
 
188 245
 
... ...
@@ -1264,17 +1321,6 @@ update_embedded_repositories()
1264 1321
 }
1265 1322
 
1266 1323
 
1267
-append_dir_to_gitignore_if_needed()
1268
-{
1269
-   grep -s -x "$1/" .gitignore > /dev/null 2>&1
1270
-   if [ $? -ne 0 ]
1271
-   then
1272
-      exekutor echo "$1/" >> .gitignore || fail "Couldn\'t append to .gitignore"
1273
-      log_info "Added \"$1/\" to \".gitignore\""
1274
-   fi
1275
-}
1276
-
1277
-
1278 1324
 main()
1279 1325
 {
1280 1326
    log_verbose "::: fetch :::"
... ...
@@ -1306,13 +1352,13 @@ main()
1306 1352
    #
1307 1353
    if [ "${COMMAND}" = "install" ]
1308 1354
    then
1309
-      case "`uname`" in
1310
-         Darwin|Linux)
1311
-            install_brews
1312
-            ;;
1313
-      esac
1314
-      install_gems
1315
-      install_pips
1355
+       install_brews
1356
+
1357
+#
1358
+# remove these, as they aren't installing locally
1359
+#
1360
+#      install_gems
1361
+#      install_pips
1316 1362
 
1317 1363
       clone_repositories
1318 1364
       clone_embedded_repositories
... ...
@@ -1339,6 +1385,7 @@ main()
1339 1385
          append_dir_to_gitignore_if_needed "${BOOTSTRAP_SUBDIR}.auto"
1340 1386
          append_dir_to_gitignore_if_needed "${BOOTSTRAP_SUBDIR}.local"
1341 1387
          append_dir_to_gitignore_if_needed "${DEPENDENCY_SUBDIR}"
1388
+         append_dir_to_gitignore_if_needed "${ADDICTION_SUBDIR}"
1342 1389
          append_dir_to_gitignore_if_needed "${CLONES_SUBDIR}"
1343 1390
       fi
1344 1391
    fi
1345 1392
similarity index 95%
1346 1393
rename from mulle-bootstrap-functions.sh
1347 1394
rename to src/mulle-bootstrap-functions.sh
... ...
@@ -883,6 +883,24 @@ has_usr_local_include()
883 883
 }
884 884
 
885 885
 
886
+write_protect_directory()
887
+{
888
+   if [ -d "$1" ]
889
+   then
890
+      #
891
+      # ensure basic structure is there to squelch linker warnings
892
+      #
893
+      log_fluff "Create default lib/include/Frameworks in $1"
894
+      exekutor mkdir "$1/Frameworks" 2> /dev/null
895
+      exekutor mkdir "$1/lib" 2> /dev/null
896
+      exekutor mkdir "$1/include" 2> /dev/null
897
+
898
+      log_info "Write-protecting ${C_RESET_BOLD}$1${C_INFO} to avoid spurious header edits"
899
+      exekutor chmod -R a-w "$1"
900
+   fi
901
+}
902
+
903
+
886 904
 ensure_clones_directory()
887 905
 {
888 906
    if [ ! -d "${CLONESFETCH_SUBDIR}" ]
... ...
@@ -928,3 +946,17 @@ get_core_count()
928 946
     fi
929 947
     echo $count
930 948
 }
949
+
950
+
951
+append_dir_to_gitignore_if_needed()
952
+{
953
+   grep -s -x "$1/" .gitignore > /dev/null 2>&1
954
+   if [ $? -ne 0 ]
955
+   then
956
+      exekutor echo "$1/" >> .gitignore || fail "Couldn\'t append to .gitignore"
957
+      log_info "Added \"$1/\" to \".gitignore\""
958
+   fi
959
+}
960
+
961
+
962
+## 962: getting close to 1000 here
931 963
\ No newline at end of file
932 964
similarity index 100%
933 965
rename from mulle-bootstrap-gcc.sh
934 966
rename to src/mulle-bootstrap-gcc.sh
935 967
similarity index 83%
936 968
rename from mulle-bootstrap-init.sh
937 969
rename to src/mulle-bootstrap-init.sh
... ...
@@ -54,6 +54,7 @@ then
54 54
    exit 1
55 55
 fi
56 56
 
57
+
57 58
 main()
58 59
 {
59 60
    project=""
... ...
@@ -85,9 +86,20 @@ main()
85 86
 #EOF
86 87
 
87 88
       exekutor cat <<EOF > "${BOOTSTRAP_SUBDIR}/repositories"
88
-# Add git URLs to this file.
89 89
 #
90
-# Possible types of repository specifications:
90
+# Add repository URLs to this file.
91
+#
92
+# mulle-bootstrap [fetch] will download these into "${CLONES_SUBDIR}"
93
+# mulle-bootstrap [build] will then build them into "${DEPENDENCY_SUBDIR}"
94
+#
95
+# Each line consists of four fields, only the URL is necessary.
96
+#
97
+# URL;NAME;TAG;SCM
98
+# ================
99
+# ex. foo.com/bla.git;mybla;master;git
100
+# ex. foo.com/bla.svn;;;svn
101
+#
102
+# Possible URLS for repositories:
91 103
 #
92 104
 # https://www.mulle-kybernetik.com/repositories/MulleScion
93 105
 # git@github.com:mulle-nat/MulleScion.git
... ...
@@ -95,28 +107,48 @@ main()
95 107
 # /Volumes/Source/srcM/MulleScion
96 108
 #
97 109
 EOF
98
-   fi
99
-
100
-   if [ "${CREATE_EXAMPLE_FILES}" = "YES" ]
101
-   then
102
-      log_fluff "Create example repository files"
103 110
 
111
+      exekutor cat <<EOF > "${BOOTSTRAP_SUBDIR}/embedded_repositories"
112
+#
113
+# Add repository URLs to this file.
114
+#
115
+# mulle-bootstrap [fetch] will download these into your project root
116
+# mulle-bootstrap [build] will NOT build them
117
+#
118
+# Each line consists of four fields, only the URL is necessary.
119
+#
120
+# URL;NAME;TAG;SCM
121
+# ================
122
+# ex. foo.com/bla.git;mybla;master;git
123
+# ex. foo.com/bla.svn;;;svn
124
+#
125
+# Possible URLS for repositories:
126
+#
127
+# https://www.mulle-kybernetik.com/repositories/MulleScion
128
+# git@github.com:mulle-nat/MulleScion.git
129
+# ../MulleScion
130
+# /Volumes/Source/srcM/MulleScion
131
+#
132
+EOF
104 133
       exekutor cat <<EOF > "${BOOTSTRAP_SUBDIR}/brews"
105
-# add projects that should be installed by brew
134
+#
135
+# Add homebrew packages to this file (https://brew.sh/)
136
+#
137
+# mulle-bootstrap [fetch] will install those into "${ADDICTION_SUBDIR}"
138
+#
106 139
 # e.g.
107 140
 # zlib
141
+#
108 142
 EOF
109 143
 
144
+   fi
145
+
146
+   if [ "${CREATE_EXAMPLE_FILES}" = "YES" ]
147
+   then
110 148
       log_fluff "Create example repository settings"
111 149
 
112 150
       mkdir_if_missing "${BOOTSTRAP_SUBDIR}/settings/MulleScion.example/bin"
113 151
 
114
-      exekutor cat <<EOF > "${BOOTSTRAP_SUBDIR}/settings/MulleScion.example/tag"
115
-# specify a tag or branch for a project named MulleScion
116
-# leave commented out or delete file for default branch (usually master)
117
-# v1848.5.p3
118
-EOF
119
-
120 152
       exekutor cat <<EOF > "${BOOTSTRAP_SUBDIR}/settings/MulleScion.example/Release.map"
121 153
 # map configuration Release in project MulleScion to DebugRelease
122 154
 # leave commented out or delete file for no mapping
... ...
@@ -169,6 +201,7 @@ Now add your repositories to \"${BOOTSTRAP_SUBDIR}/repositories${C_INFO}"
169 201
   local open
170 202
 
171 203
   open="`read_config_setting "open_repositories_file" "ASK"`"
204
+
172 205
   if [ "${open}" = "ASK" ]
173 206
   then
174 207
     user_say_yes "Edit the ${C_MAGENTA}${C_BOLD}repositories${C_RESET_BOLD} file now ?"
175 208
similarity index 100%
176 209
rename from mulle-bootstrap-install.sh
177 210
rename to src/mulle-bootstrap-install.sh
178 211
similarity index 95%
179 212
rename from mulle-bootstrap-local-environment.sh
180 213
rename to src/mulle-bootstrap-local-environment.sh
... ...
@@ -29,7 +29,7 @@
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
 
32
-EXEC_VERSION=1.2
32
+EXEC_VERSION=2.0  # paranoia
33 33
 
34 34
 if [ "${EXEC_VERSION}" != "${VERSION}" ]
35 35
 then
... ...
@@ -111,6 +111,7 @@ RELATIVE_ROOT=""
111 111
 
112 112
 CLONESBUILD_SUBDIR=`read_sane_config_path_setting "build_foldername" "${RELATIVE_ROOT}build/.repos"`
113 113
 DEPENDENCY_SUBDIR=`read_sane_config_path_setting "output_foldername" "${RELATIVE_ROOT}dependencies"`
114
+ADDICTION_SUBDIR=`read_sane_config_path_setting "brew_foldername" "${RELATIVE_ROOT}addictions"`
114 115
 BUILDLOG_SUBDIR=`read_sane_config_path_setting "build_log_foldername" "${CLONESBUILD_SUBDIR}/.logs"`
115 116
 
116 117
 
... ...
@@ -128,6 +129,7 @@ fi
128 129
 [ -z "${CLONESBUILD_SUBDIR}" ]   && internal_fail "variable CLONESBUILD_SUBDIR is empty"
129 130
 [ -z "${BUILDLOG_SUBDIR}" ]      && internal_fail "variable BUILDLOG_SUBDIR is empty"
130 131
 [ -z "${DEPENDENCY_SUBDIR}" ]    && internal_fail "variable DEPENDENCY_SUBDIR is empty"
132
+[ -z "${ADDICTION_SUBDIR}" ]     && internal_fail "variable ADDICTION_SUBDIR is empty"
131 133
 
132 134
 #
133 135
 # Global Settings
... ...
@@ -145,6 +147,7 @@ export CLONESFETCH_SUBDIR
145 147
 export CLONESBUILD_SUBDIR
146 148
 export BUILDLOG_SUBDIR
147 149
 export DEPENDENCY_SUBDIR
150
+export ADDICTION_SUBDIR
148 151
 export HEADER_DIR_NAME
149 152
 export LIBRARY_DIR_NAME
150 153
 export FRAMEWORK_DIR_NAME
151 154
similarity index 100%
152 155
rename from mulle-bootstrap-project.sh
153 156
rename to src/mulle-bootstrap-project.sh
154 157
similarity index 100%
155 158
rename from mulle-bootstrap-refresh.sh
156 159
rename to src/mulle-bootstrap-refresh.sh
157 160
similarity index 100%
158 161
rename from mulle-bootstrap-scm.sh
159 162
rename to src/mulle-bootstrap-scm.sh
160 163
similarity index 100%
161 164
rename from mulle-bootstrap-scripts.sh
162 165
rename to src/mulle-bootstrap-scripts.sh
163 166
similarity index 100%
164 167
rename from mulle-bootstrap-settings.sh
165 168
rename to src/mulle-bootstrap-settings.sh
166 169
similarity index 100%
167 170
rename from mulle-bootstrap-tag.sh
168 171
rename to src/mulle-bootstrap-tag.sh
169 172
similarity index 100%
170 173
rename from mulle-bootstrap-warn-scripts.sh
171 174
rename to src/mulle-bootstrap-warn-scripts.sh
172 175
similarity index 93%
173 176
rename from mulle-bootstrap-xcode.sh
174 177
rename to src/mulle-bootstrap-xcode.sh
... ...
@@ -40,6 +40,7 @@ then
40 40
    fail "for now xcode only works on OS X"
41 41
 fi
42 42
 
43
+
43 44
 usage()
44 45
 {
45 46
    cat <<EOF
... ...
@@ -80,9 +81,9 @@ list_configurations()
80 81
    local project
81 82
 
82 83
    project="${1}"
83
-  #
84
-  # Figure out all configurations
85
-  #
84
+   #
85
+   # Figure out all configurations
86
+   #
86 87
    xcodebuild -list -project "${project}" 2> /dev/null | \
87 88
    grep -A100 'Build Configurations' | \
88 89
    grep -B100 'Schemes' | \
... ...
@@ -276,6 +277,7 @@ Release"
276 277
       fi
277 278
    fi
278 279
 
280
+   local addictions_dir
279 281
    local dependencies_dir
280 282
    local header_search_paths
281 283
    local library_search_paths
... ...
@@ -288,13 +290,19 @@ Release"
288 290
 
289 291
    absolute="`realpath "${project}"`"
290 292
    absolute="`dirname -- "${absolute}"`"
293
+
291 294
    absolute2="`pwd -P`/${DEPENDENCY_SUBDIR}"
292 295
    relative_subdir="`relative_path_between "${absolute2}" "${absolute}" `"
296
+   dependencies_dir='$(PROJECT_DIR)'/"${DEPENDENCY_SUBDIR}"
297
+#   dependencies_dir='$(PROJECT_DIR)'/"${relative_subdir}'"
293 298
 
294
-   dependencies_dir='$(PROJECT_DIR)/'"${relative_subdir}"
299
+   absolute2="`pwd -P`/${ADDICTION_SUBDIR}"
300
+   relative_subdir="`relative_path_between "${absolute2}" "${absolute}" `"
301
+   addictions_dir='$(PROJECT_DIR)'/"${ADDICTION_SUBDIR}"
302
+#   addictions_dir='$(PROJECT_DIR)/'"${relative_subdir}"
295 303
 
296 304
    header_search_paths="\$(DEPENDENCIES_DIR)/${HEADER_DIR_NAME}"
297
-   header_search_paths="${header_search_paths} /usr/local/include"
305
+   header_search_paths="${header_search_paths} \$(ADDICTIONS_DIR)/include"
298 306
    header_search_paths="${header_search_paths} \$(inherited)"
299 307
 
300 308
    local default
... ...
@@ -305,7 +313,7 @@ Release"
305 313
    library_search_paths="${library_search_paths} \$(DEPENDENCIES_DIR)/\$(LIBRARY_CONFIGURATION)/${LIBRARY_DIR_NAME}"
306 314
    library_search_paths="${library_search_paths} \$(DEPENDENCIES_DIR)/\$(EFFECTIVE_PLATFORM_NAME)/${LIBRARY_DIR_NAME}"
307 315
    library_search_paths="${library_search_paths} \$(DEPENDENCIES_DIR)/${LIBRARY_DIR_NAME}"
308
-   library_search_paths="${library_search_paths} /usr/local/lib"
316
+   library_search_paths="${library_search_paths} \$(ADDICTIONS_DIR)/lib"
309 317
    library_search_paths="${library_search_paths} \$(inherited)"
310 318
 
311 319
 
... ...
@@ -313,6 +321,7 @@ Release"
313 321
    framework_search_paths="${framework_search_paths} \$(DEPENDENCIES_DIR)/\$(LIBRARY_CONFIGURATION)/${FRAMEWORK_DIR_NAME}"
314 322
    framework_search_paths="${framework_search_paths} \$(DEPENDENCIES_DIR)/\$(EFFECTIVE_PLATFORM_NAME)/${FRAMEWORK_DIR_NAME}"
315 323
    framework_search_paths="${framework_search_paths} \$(DEPENDENCIES_DIR)/${FRAMEWORK_DIR_NAME}"
324
+   framework_search_paths="${framework_search_paths} \$(ADDICTIONS_DIR)/${FRAMEWORK_DIR_NAME}"
316 325
    framework_search_paths="${framework_search_paths} \$(inherited)"
317 326
 
318 327
    local query
... ...
@@ -330,6 +339,7 @@ Release"
330 339
          #     012345678901234567890123456789012345678901234567890123456789
331 340
          printf "${C_RESET_BOLD}Common.xcconfig:${C_RESET}\n"
332 341
          printf "${C_RESET_BOLD}-----------------------------------------------------------\n${C_RESET}" >&2
342
+         echo "ADDICTIONS_DIR=${addictions_dir}"
333 343
          echo "DEPENDENCIES_DIR=${dependencies_dir}"
334 344
          echo "HEADER_SEARCH_PATHS=${header_search_paths}"
335 345
          echo "LIBRARY_SEARCH_PATHS=${library_search_paths}"
... ...
@@ -368,6 +378,7 @@ Release"
368 378
 
369 379
    patch_library_configurations "${xcode_configurations}" "${configurations}" "${project}" "${default}" "${flag}"
370 380
 
381
+   exekutor mulle-xcode-settings "${flag}" "ADDICTIONS_DIR" "${addictions_dir}" "${project}"  || exit 1
371 382
    exekutor mulle-xcode-settings "${flag}" "DEPENDENCIES_DIR" "${dependencies_dir}" "${project}"  || exit 1
372 383
    exekutor mulle-xcode-settings "${flag}" "HEADER_SEARCH_PATHS" "${header_search_paths}" "${project}"  || exit 1
373 384
    exekutor mulle-xcode-settings "${flag}" "LIBRARY_SEARCH_PATHS" "${library_search_paths}" "${project}"  || exit 1