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 1
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 6
 [xcodebuild](//devcodehack.com/xcode-sucks-and-heres-why/) and
7 7
 [configure](//quetzalcoatal.blogspot.de/2011/06/why-autoconf-sucks.html)
8 8
 projects
9
-* compiles dependents using the output of previous dependents
10
-* written in portable shell script, runs on OS X, FreeBSD, Linux
9
+* compiles dependents using the output of previous dependents into a project
10
+local "dependencies" folder
11
+* installs [brew](//dzone.com/articles/why-osx-sucks-and-you-should) binaries and
12
+libraries locally into an "addictions" folder
13
+* written in portable shell script, runs on OS X, FreeBSD (without brew), Linux
11 14
 
12 15
 ## Tell me more
13 16
 
... ...
@@ -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 97
    if [ $? -eq 0 ]
98 98
    then
99 99
       log_fluff "Updating brew, this can take some time..."
100
-   	exekutor brew update
100
+   	exekutor "${BREW}" update
101 101
 
102
-	   mkdir_if_missing "`dirname -- "${last_update}"`"
103
-   	exekutor touch "${last_update}"
102
+      touch_last_update
104 103
    fi
105 104
 }
106 105
similarity index 96%
107 106
rename from mulle-bootstrap-build.sh
108 107
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 800
        DEPENDENCIES_DIR="'${owd}/${REFERENCE_DEPENDENCY_SUBDIR}'" \
801 801
        CFLAGS="\
802 802
 -I${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${HEADER_DIR_NAME} \
803
--I/usr/local/include \
803
+-I${owd}/${REFERENCE_ADDICTION_SUBDIR}/${HEADER_DIR_NAME} \
804 804
 ${frameworklines}
805 805
 -F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME} \
806
+-F${owd}/${REFERENCE_ADDICTION_SUBDIR}/${FRAMEWORK_DIR_NAME} \
806 807
 ${other_cflags} \
807 808
 -isysroot ${sdkpath}" \
808 809
       CPPFLAGS="\
809 810
 -I${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${HEADER_DIR_NAME} \
810
--I/usr/local/include \
811
+-I${owd}/${REFERENCE_ADDICTION_SUBDIR}/${HEADER_DIR_NAME} \
811 812
 ${frameworklines}
812 813
 -F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME} \
814
+-F${owd}/${REFERENCE_ADDICTION_SUBDIR}/${FRAMEWORK_DIR_NAME} \
813 815
 ${other_cppflags} \
814 816
 -isysroot ${sdkpath}" \
815 817
       LDFLAGS="\
816 818
 ${frameworklines}
817 819
 -F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME} \
820
+-F${owd}/${REFERENCE_ADDICTION_SUBDIR}/${FRAMEWORK_DIR_NAME} \
818 821
 ${librarylines}
819 822
 -L${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${LIBRARY_DIR_NAME} \
820
--L/usr/local/lib \
823
+-L${owd}/${REFERENCE_ADDICTION_SUBDIR}/${LIBRARY_DIR_NAME} \
821 824
 ${other_ldflags} \
822 825
 -isysroot ${sdkpath}" \
823 826
        logging_exekutor "${owd}/${srcdir}/configure" ${configureflags} \
... ...
@@ -1201,7 +1206,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO}${info} in \
1201 1201
       inherited="`xcode_get_setting HEADER_SEARCH_PATHS ${arguments}`" || exit 1
1202 1202
       path=`combined_escaped_search_path \
1203 1203
 "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${HEADER_DIR_NAME}" \
1204
-"/usr/local/include"`
1204
+"${owd}/${REFERENCE_ADDICTION_SUBDIR}/${HEADER_DIR_NAME}"`
1205 1205
       if [ -z "${inherited}" ]
1206 1206
       then
1207 1207
          dependencies_header_search_path="${path}"
... ...
@@ -1214,7 +1219,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO}${info} in \
1214 1214
 "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}${mappedsubdir}/${LIBRARY_DIR_NAME}" \
1215 1215
 "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}${fallbacksubdir}/${LIBRARY_DIR_NAME}" \
1216 1216
 "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${LIBRARY_DIR_NAME}" \
1217
-"/usr/local/lib"`
1217
+"${owd}/${REFERENCE_ADDICTION_SUBDIR}/${LIBRARY_DIR_NAME}"`
1218 1218
       if [ ! -z "$sdk" ]
1219 1219
       then
1220 1220
          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 1231
       path=`combined_escaped_search_path \
1232 1232
 "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}${mappedsubdir}/${FRAMEWORK_DIR_NAME}" \
1233 1233
 "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}${fallbacksubdir}/${FRAMEWORK_DIR_NAME}" \
1234
-"${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}"`
1234
+"${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}" \
1235
+"${owd}/${REFERENCE_ADDICTION_SUBDIR}/${FRAMEWORK_DIR_NAME}"`
1235 1236
       if [ ! -z "$sdk" ]
1236 1237
       then
1237 1238
          escaped="`escaped_spaces "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}${mappedsubdir}/${FRAMEWORK_DIR_NAME}"'-$(EFFECTIVE_PLATFORM_NAME)'`"
... ...
@@ -1260,6 +1266,7 @@ DSTROOT='${owd}/${BUILD_DEPENDENCY_SUBDIR}' \
1260 1260
 SYMROOT='${owd}/${builddir}/' \
1261 1261
 OBJROOT='${owd}/${builddir}/obj' \
1262 1262
 DEPENDENCIES_DIR='${owd}/${REFERENCE_DEPENDENCY_SUBDIR}' \
1263
+ADDICTIONS_DIR='${owd}/${REFERENCE_ADDICTION_SUBDIR}' \
1263 1264
 ONLY_ACTIVE_ARCH=${ONLY_ACTIVE_ARCH:-NO} \
1264 1265
 ${skip_install} \
1265 1266
 ${other_cflags} \
... ...
@@ -1523,13 +1530,22 @@ configure"`"
1523 1523
             rmdir_safer "${builddir}"
1524 1524
          fi
1525 1525
 
1526
+         #
1527
+         # execute pre-build script (f.e. for libcurl)
1528
+         #
1529
+         local script
1530
+
1531
+         script="`find_build_setting_file "${name}" "bin/pre-build.sh"`"
1532
+         if [ -x "${script}" ]
1533
+         then
1534
+            build_script "${script}" "${configuration}" "${srcdir}" "${builddir}" "${name}" "${sdk}" || exit 1
1535
+         fi
1536
+
1526 1537
          hasbuilt=no
1527 1538
          for preference in ${preferences}
1528 1539
          do
1529 1540
             if [ "${preference}" = "script" ]
1530 1541
             then
1531
-               local script
1532
-
1533 1542
                script="`find_build_setting_file "${name}" "bin/build.sh"`"
1534 1543
                if [ -x "${script}" ]
1535 1544
                then
... ...
@@ -1609,10 +1625,12 @@ build_wrapper()
1609 1609
    name="$1"
1610 1610
    srcdir="$2"
1611 1611
 
1612
+   REFERENCE_ADDICTION_SUBDIR="${ADDICTION_SUBDIR}"
1612 1613
    REFERENCE_DEPENDENCY_SUBDIR="${DEPENDENCY_SUBDIR}"
1613 1614
    BUILD_DEPENDENCY_SUBDIR="${DEPENDENCY_SUBDIR}/tmp"
1614 1615
 
1615 1616
    DEPENDENCY_SUBDIR="WRONG_DONT_USE_DEPENDENCY_SUBDIR_DURING_BUILD"
1617
+   ADDICTION_SUBDIR="WRONG_DONT_USE_ADDICTION_SUBDIR_DURING_BUILD"
1616 1618
 
1617 1619
    log_fluff "Setting up BUILD_DEPENDENCY_SUBDIR as \"${BUILD_DEPENDENCY_SUBDIR}\""
1618 1620
 
... ...
@@ -1624,6 +1642,7 @@ build_wrapper()
1624 1624
 
1625 1625
    export BUILD_DEPENDENCY_SUBDIR
1626 1626
    export REFERENCE_DEPENDENCY_SUBDIR
1627
+   export REFERENCE_ADDICTION_SUBDIR
1627 1628
 
1628 1629
    #
1629 1630
    # move dependencies we have so far away into safety,
... ...
@@ -1643,6 +1662,7 @@ build_wrapper()
1643 1643
    fi
1644 1644
 
1645 1645
    DEPENDENCY_SUBDIR="${REFERENCE_DEPENDENCY_SUBDIR}"
1646
+   ADDICTION_SUBDIR="${REFERENCE_ADDICTION_SUBDIR}"
1646 1647
 
1647 1648
    # for mulle-bootstrap developers
1648 1649
    REFERENCE_DEPENDENCY_SUBDIR="WRONG_DONT_USE_REFERENCE_DEPENDENCY_SUBDIR_AFTER_BUILD"
... ...
@@ -1893,8 +1913,7 @@ main()
1893 1893
 
1894 1894
    if [ -d "${DEPENDENCY_SUBDIR}" ]
1895 1895
    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}"
1896
+      write_protect_directory "${DEPENDENCY_SUBDIR}"
1898 1897
    else
1899 1898
       log_fluff "No dependencies have been generated"
1900 1899
    fi
1901 1900
similarity index 98%
1902 1901
rename from mulle-bootstrap-clean.sh
1903 1902
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 99
 ${OUTPUT_CLEANABLE_SUBDIRS}
100 100
 ---
101 101
 
102
-   dist    : remove all clones and dependencies. It cleans
102
+   dist    : remove all clones, dependencies, addictions. It cleans
103 103
 ---
104 104
 ${BUILD_CLEANABLE_SUBDIRS}
105 105
 ${OUTPUT_CLEANABLE_SUBDIRS}
106 106
similarity index 93%
107 107
rename from mulle-bootstrap-fetch.sh
108 108
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 1264
 }
1265 1265
 
1266 1266
 
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 1267
 main()
1279 1268
 {
1280 1269
    log_verbose "::: fetch :::"
... ...
@@ -1306,13 +1352,13 @@ main()
1306 1306
    #
1307 1307
    if [ "${COMMAND}" = "install" ]
1308 1308
    then
1309
-      case "`uname`" in
1310
-         Darwin|Linux)
1311
-            install_brews
1312
-            ;;
1313
-      esac
1314
-      install_gems
1315
-      install_pips
1309
+       install_brews
1310
+
1311
+#
1312
+# remove these, as they aren't installing locally
1313
+#
1314
+#      install_gems
1315
+#      install_pips
1316 1316
 
1317 1317
       clone_repositories
1318 1318
       clone_embedded_repositories
... ...
@@ -1339,6 +1385,7 @@ main()
1339 1339
          append_dir_to_gitignore_if_needed "${BOOTSTRAP_SUBDIR}.auto"
1340 1340
          append_dir_to_gitignore_if_needed "${BOOTSTRAP_SUBDIR}.local"
1341 1341
          append_dir_to_gitignore_if_needed "${DEPENDENCY_SUBDIR}"
1342
+         append_dir_to_gitignore_if_needed "${ADDICTION_SUBDIR}"
1342 1343
          append_dir_to_gitignore_if_needed "${CLONES_SUBDIR}"
1343 1344
       fi
1344 1345
    fi
1345 1346
similarity index 95%
1346 1347
rename from mulle-bootstrap-functions.sh
1347 1348
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 928
     fi
929 929
     echo $count
930 930
 }
931
+
932
+
933
+append_dir_to_gitignore_if_needed()
934
+{
935
+   grep -s -x "$1/" .gitignore > /dev/null 2>&1
936
+   if [ $? -ne 0 ]
937
+   then
938
+      exekutor echo "$1/" >> .gitignore || fail "Couldn\'t append to .gitignore"
939
+      log_info "Added \"$1/\" to \".gitignore\""
940
+   fi
941
+}
942
+
943
+
944
+## 962: getting close to 1000 here
931 945
\ No newline at end of file
932 946
similarity index 100%
933 947
rename from mulle-bootstrap-gcc.sh
934 948
rename to src/mulle-bootstrap-gcc.sh
935 949
similarity index 83%
936 950
rename from mulle-bootstrap-init.sh
937 951
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 85
 #EOF
86 86
 
87 87
       exekutor cat <<EOF > "${BOOTSTRAP_SUBDIR}/repositories"
88
-# Add git URLs to this file.
89 88
 #
90
-# Possible types of repository specifications:
89
+# Add repository URLs to this file.
90
+#
91
+# mulle-bootstrap [fetch] will download these into "${CLONES_SUBDIR}"
92
+# mulle-bootstrap [build] will then build them into "${DEPENDENCY_SUBDIR}"
93
+#
94
+# Each line consists of four fields, only the URL is necessary.
95
+#
96
+# URL;NAME;TAG;SCM
97
+# ================
98
+# ex. foo.com/bla.git;mybla;master;git
99
+# ex. foo.com/bla.svn;;;svn
100
+#
101
+# Possible URLS for repositories:
91 102
 #
92 103
 # https://www.mulle-kybernetik.com/repositories/MulleScion
93 104
 # git@github.com:mulle-nat/MulleScion.git
... ...
@@ -95,28 +107,48 @@ main()
95 95
 # /Volumes/Source/srcM/MulleScion
96 96
 #
97 97
 EOF
98
-   fi
99
-
100
-   if [ "${CREATE_EXAMPLE_FILES}" = "YES" ]
101
-   then
102
-      log_fluff "Create example repository files"
103 98
 
99
+      exekutor cat <<EOF > "${BOOTSTRAP_SUBDIR}/embedded_repositories"
100
+#
101
+# Add repository URLs to this file.
102
+#
103
+# mulle-bootstrap [fetch] will download these into your project root
104
+# mulle-bootstrap [build] will NOT build them
105
+#
106
+# Each line consists of four fields, only the URL is necessary.
107
+#
108
+# URL;NAME;TAG;SCM
109
+# ================
110
+# ex. foo.com/bla.git;mybla;master;git
111
+# ex. foo.com/bla.svn;;;svn
112
+#
113
+# Possible URLS for repositories:
114
+#
115
+# https://www.mulle-kybernetik.com/repositories/MulleScion
116
+# git@github.com:mulle-nat/MulleScion.git
117
+# ../MulleScion
118
+# /Volumes/Source/srcM/MulleScion
119
+#
120
+EOF
104 121
       exekutor cat <<EOF > "${BOOTSTRAP_SUBDIR}/brews"
105
-# add projects that should be installed by brew
122
+#
123
+# Add homebrew packages to this file (https://brew.sh/)
124
+#
125
+# mulle-bootstrap [fetch] will install those into "${ADDICTION_SUBDIR}"
126
+#
106 127
 # e.g.
107 128
 # zlib
129
+#
108 130
 EOF
109 131
 
132
+   fi
133
+
134
+   if [ "${CREATE_EXAMPLE_FILES}" = "YES" ]
135
+   then
110 136
       log_fluff "Create example repository settings"
111 137
 
112 138
       mkdir_if_missing "${BOOTSTRAP_SUBDIR}/settings/MulleScion.example/bin"
113 139
 
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 140
       exekutor cat <<EOF > "${BOOTSTRAP_SUBDIR}/settings/MulleScion.example/Release.map"
121 141
 # map configuration Release in project MulleScion to DebugRelease
122 142
 # leave commented out or delete file for no mapping
... ...
@@ -169,6 +201,7 @@ Now add your repositories to \"${BOOTSTRAP_SUBDIR}/repositories${C_INFO}"
169 169
   local open
170 170
 
171 171
   open="`read_config_setting "open_repositories_file" "ASK"`"
172
+
172 173
   if [ "${open}" = "ASK" ]
173 174
   then
174 175
     user_say_yes "Edit the ${C_MAGENTA}${C_BOLD}repositories${C_RESET_BOLD} file now ?"
175 176
similarity index 100%
176 177
rename from mulle-bootstrap-install.sh
177 178
rename to src/mulle-bootstrap-install.sh
178 179
similarity index 95%
179 180
rename from mulle-bootstrap-local-environment.sh
180 181
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 128
 [ -z "${CLONESBUILD_SUBDIR}" ]   && internal_fail "variable CLONESBUILD_SUBDIR is empty"
129 129
 [ -z "${BUILDLOG_SUBDIR}" ]      && internal_fail "variable BUILDLOG_SUBDIR is empty"
130 130
 [ -z "${DEPENDENCY_SUBDIR}" ]    && internal_fail "variable DEPENDENCY_SUBDIR is empty"
131
+[ -z "${ADDICTION_SUBDIR}" ]     && internal_fail "variable ADDICTION_SUBDIR is empty"
131 132
 
132 133
 #
133 134
 # Global Settings
... ...
@@ -145,6 +147,7 @@ export CLONESFETCH_SUBDIR
145 145
 export CLONESBUILD_SUBDIR
146 146
 export BUILDLOG_SUBDIR
147 147
 export DEPENDENCY_SUBDIR
148
+export ADDICTION_SUBDIR
148 149
 export HEADER_DIR_NAME
149 150
 export LIBRARY_DIR_NAME
150 151
 export FRAMEWORK_DIR_NAME
151 152
similarity index 100%
152 153
rename from mulle-bootstrap-project.sh
153 154
rename to src/mulle-bootstrap-project.sh
154 155
similarity index 100%
155 156
rename from mulle-bootstrap-refresh.sh
156 157
rename to src/mulle-bootstrap-refresh.sh
157 158
similarity index 100%
158 159
rename from mulle-bootstrap-scm.sh
159 160
rename to src/mulle-bootstrap-scm.sh
160 161
similarity index 100%
161 162
rename from mulle-bootstrap-scripts.sh
162 163
rename to src/mulle-bootstrap-scripts.sh
163 164
similarity index 100%
164 165
rename from mulle-bootstrap-settings.sh
165 166
rename to src/mulle-bootstrap-settings.sh
166 167
similarity index 100%
167 168
rename from mulle-bootstrap-tag.sh
168 169
rename to src/mulle-bootstrap-tag.sh
169 170
similarity index 100%
170 171
rename from mulle-bootstrap-warn-scripts.sh
171 172
rename to src/mulle-bootstrap-warn-scripts.sh
172 173
similarity index 93%
173 174
rename from mulle-bootstrap-xcode.sh
174 175
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 80
    local project
81 81
 
82 82
    project="${1}"
83
-  #
84
-  # Figure out all configurations
85
-  #
83
+   #
84
+   # Figure out all configurations
85
+   #
86 86
    xcodebuild -list -project "${project}" 2> /dev/null | \
87 87
    grep -A100 'Build Configurations' | \
88 88
    grep -B100 'Schemes' | \
... ...
@@ -276,6 +277,7 @@ Release"
276 276
       fi
277 277
    fi
278 278
 
279
+   local addictions_dir
279 280
    local dependencies_dir
280 281
    local header_search_paths
281 282
    local library_search_paths
... ...
@@ -288,13 +290,19 @@ Release"
288 288
 
289 289
    absolute="`realpath "${project}"`"
290 290
    absolute="`dirname -- "${absolute}"`"
291
+
291 292
    absolute2="`pwd -P`/${DEPENDENCY_SUBDIR}"
292 293
    relative_subdir="`relative_path_between "${absolute2}" "${absolute}" `"
294
+   dependencies_dir='$(PROJECT_DIR)'/"${DEPENDENCY_SUBDIR}"
295
+#   dependencies_dir='$(PROJECT_DIR)'/"${relative_subdir}'"
293 296
 
294
-   dependencies_dir='$(PROJECT_DIR)/'"${relative_subdir}"
297
+   absolute2="`pwd -P`/${ADDICTION_SUBDIR}"
298
+   relative_subdir="`relative_path_between "${absolute2}" "${absolute}" `"
299
+   addictions_dir='$(PROJECT_DIR)'/"${ADDICTION_SUBDIR}"
300
+#   addictions_dir='$(PROJECT_DIR)/'"${relative_subdir}"
295 301
 
296 302
    header_search_paths="\$(DEPENDENCIES_DIR)/${HEADER_DIR_NAME}"
297
-   header_search_paths="${header_search_paths} /usr/local/include"
303
+   header_search_paths="${header_search_paths} \$(ADDICTIONS_DIR)/include"
298 304
    header_search_paths="${header_search_paths} \$(inherited)"
299 305
 
300 306
    local default
... ...
@@ -305,7 +313,7 @@ Release"
305 305
    library_search_paths="${library_search_paths} \$(DEPENDENCIES_DIR)/\$(LIBRARY_CONFIGURATION)/${LIBRARY_DIR_NAME}"
306 306
    library_search_paths="${library_search_paths} \$(DEPENDENCIES_DIR)/\$(EFFECTIVE_PLATFORM_NAME)/${LIBRARY_DIR_NAME}"
307 307
    library_search_paths="${library_search_paths} \$(DEPENDENCIES_DIR)/${LIBRARY_DIR_NAME}"
308
-   library_search_paths="${library_search_paths} /usr/local/lib"
308
+   library_search_paths="${library_search_paths} \$(ADDICTIONS_DIR)/lib"
309 309
    library_search_paths="${library_search_paths} \$(inherited)"
310 310
 
311 311
 
... ...
@@ -313,6 +321,7 @@ Release"
313 313
    framework_search_paths="${framework_search_paths} \$(DEPENDENCIES_DIR)/\$(LIBRARY_CONFIGURATION)/${FRAMEWORK_DIR_NAME}"
314 314
    framework_search_paths="${framework_search_paths} \$(DEPENDENCIES_DIR)/\$(EFFECTIVE_PLATFORM_NAME)/${FRAMEWORK_DIR_NAME}"
315 315
    framework_search_paths="${framework_search_paths} \$(DEPENDENCIES_DIR)/${FRAMEWORK_DIR_NAME}"
316
+   framework_search_paths="${framework_search_paths} \$(ADDICTIONS_DIR)/${FRAMEWORK_DIR_NAME}"
316 317
    framework_search_paths="${framework_search_paths} \$(inherited)"
317 318
 
318 319
    local query
... ...
@@ -330,6 +339,7 @@ Release"
330 330
          #     012345678901234567890123456789012345678901234567890123456789
331 331
          printf "${C_RESET_BOLD}Common.xcconfig:${C_RESET}\n"
332 332
          printf "${C_RESET_BOLD}-----------------------------------------------------------\n${C_RESET}" >&2
333
+         echo "ADDICTIONS_DIR=${addictions_dir}"
333 334
          echo "DEPENDENCIES_DIR=${dependencies_dir}"
334 335
          echo "HEADER_SEARCH_PATHS=${header_search_paths}"
335 336
          echo "LIBRARY_SEARCH_PATHS=${library_search_paths}"
... ...
@@ -368,6 +378,7 @@ Release"
368 368
 
369 369
    patch_library_configurations "${xcode_configurations}" "${configurations}" "${project}" "${default}" "${flag}"
370 370
 
371
+   exekutor mulle-xcode-settings "${flag}" "ADDICTIONS_DIR" "${addictions_dir}" "${project}"  || exit 1
371 372
    exekutor mulle-xcode-settings "${flag}" "DEPENDENCIES_DIR" "${dependencies_dir}" "${project}"  || exit 1
372 373
    exekutor mulle-xcode-settings "${flag}" "HEADER_SEARCH_PATHS" "${header_search_paths}" "${project}"  || exit 1
373 374
    exekutor mulle-xcode-settings "${flag}" "LIBRARY_SEARCH_PATHS" "${library_search_paths}" "${project}"  || exit 1