Browse code

first checkin

Nat! authored on 24-09-2015 18:25:40
Showing 38 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,2 @@
1
+shellcheck
2
+
0 3
new file mode 100644
... ...
@@ -0,0 +1,6 @@
1
+.DS_Store
2
+*.chk
3
+build/
4
+.repos/
5
+.bootstrap.auto/
6
+dependencies/
0 7
new file mode 100644
... ...
@@ -0,0 +1,146 @@
1
+---
2
+layout: post
3
+author: Nat!
4
+title:
5
+open_comments: true
6
+date: 2015-09-26 18:56
7
+---
8
+# FAQ
9
+
10
+Or rather, stuff I would ask, if I hadn't written it myself :)
11
+
12
+## Where is what ?
13
+
14
+* `.bootstrap` is the bootstrap configuration of the repository
15
+* `.bootstrap.auto` is generated by mulle-bootstrap fetch, it contains
16
+information recursively collected from dependent repostiories, that have their
17
+own .bootstrap folder.
18
+* `.bootstrap.local` contains local settings you can use to override settings
19
+in .bootstrap and .bootstrap.auto. You create it manually.
20
+* `~/.mulle-bootstrap` contains some global customizations. This becomes
21
+autogenerated when using brew stuff.
22
+* `build/.repos` contains intermediate files generated by the build, which can
23
+be safely thrown away
24
+* `dependencies` contains the produced headers, libraries and frameworks
25
+* `/usr/local/libexec/mulle-bootstrap` contains scripts for mulle-bootstrap
26
+
27
+
28
+### The default target/scheme is not the one I want ?
29
+
30
+Put the target name into `.bootstrap/{reponame}/target`
31
+
32
+```console
33
+echo "Finch Demo" > .bootstrap/Finch/target
34
+```
35
+
36
+### Can it build to various specific SDKs ?
37
+
38
+Put the SDK names into ".bootstrap/sdks".
39
+
40
+```console
41
+cat <<EOF > .bootstrap/sdks
42
+iphoneos
43
+iphonesimulator
44
+EOF
45
+```
46
+
47
+Or if you don't want to change .bootstrap for temporary edits:
48
+
49
+```console
50
+cat <<EOF > .bootstrap.local/sdks
51
+iphoneos
52
+iphonesimulator
53
+EOF
54
+```
55
+
56
+
57
+### I don't like the name "dependencies" for the output folder ?
58
+
59
+You could rename it to "output" persistently with
60
+
61
+```console
62
+echo "output" > ~/.mulle-bootstrap/output_foldername
63
+```
64
+
65
+If want to rename for just this project ?
66
+
67
+```console
68
+mkdir -p .bootstrap.local 2> /dev/null
69
+echo "output" > .bootstrap.local/output_foldername
70
+```
71
+
72
+If you do this after running **mulle-bootstrap setup-xcode**, you will run into
73
+problems.
74
+
75
+### Can I change the build folder from build/.repos to something else  ?
76
+
77
+Better not. You can set it with "build_foldername".
78
+But beware:
79
+
80
+><font color=red>mulle-bootstrap assumes that it can just **rm -rf** the folder,
81
+so choosing `~` or `/tmp` as a build folder is not a great idea.</font>
82
+
83
+```console
84
+echo "you_have/been_warned" > ~/.bootstrap.local/build_foldername
85
+```
86
+
87
+### Can I change the repository folder name from .repos to something else ?
88
+
89
+Somewhat, but it must remain toplevel for now, otherwise the
90
+detection of local clone copies gets wonky. So with that in mind: as above, but
91
+use "repos_foldername" instead.
92
+
93
+### What happens when I symlink something ?
94
+
95
+It is assumed, that the repository link is "usable" as is. Specifically it won't
96
+be recursively bootstrapped. It also won't get any kind of .bootstrap
97
+inheritance. `mulle-bootstrap` will just **cd** there, give it the target
98
+dependency folder, ### I specified SKIP_INSTALL=YES in my Xcode project, but
99
+stuff gets installed nonetheless ?
100
+
101
+Because this SKIP_INSTALL=YES is the default unfortunately and lots of project
102
+maintainers forget to turn it off, **mulle-bootstrap** sets this flag to NO at
103
+compile time. If you know that SKIP_INSTALL is correctly set, set
104
+"proper_skip_install" to "YES".
105
+
106
+```console
107
+echo "YES" > .bootstrap/{reponame}/proper_skip_install
108
+```
109
+
110
+### How can I tweak some Xcode project settings ?
111
+
112
+Lots of ways, probably the quickest is:
113
+
114
+```console
115
+mkdir -p .bootstrap/Foo 2> /dev/null
116
+echo "BrandedFoo" > .bootstrap/Foo/PRODUCT_NAME
117
+```
118
+
119
+
120
+If you have lots of stuff, you may want to use your own **.xcconfig** file. This
121
+is likely to be more useful if placed into the .bootstrap folder directly.
122
+
123
+```console
124
+cp myconfig.xcconfig > .bootstrap/xcconfig
125
+```
126
+
127
+
128
+Need to add some other magic Xcode build flags ?
129
+
130
+```console
131
+echo "-verbose" > .bootstrap/xcodebuild-flags
132
+```
133
+
134
+### Should I put build settings into .bootstrap/{reponame} or into .bootstrap ?
135
+
136
+It's better to specify build settings on a per repository basis. Repository
137
+settings can be inherited over recursive fetches. Build settings in `.bootstrap`
138
+do not.
139
+
140
+### My Xcode project's headers do not show up ?
141
+
142
+Check that your Xcode project has a **Header Phase** and that the header files
143
+are in "public".
144
+
145
+
146
+
0 147
new file mode 100644
... ...
@@ -0,0 +1,17 @@
1
+# How to install **mulle-bootstrap**
2
+
3
+This will install **mulle-bootstrap** into `/usr/local`:
4
+
5
+```console
6
+./mulle-bootstrap
7
+```
8
+
9
+Here is an example, that installs **mulle-bootstrap** into /tmp:
10
+
11
+```console
12
+./mulle-bootstrap bootstrap /tmp
13
+```
14
+## What now ?
15
+
16
+Make sure /usr/local/bin is in your PATH, and try the examples contained in
17
+`./test`. Read [test/README.md]() for details.
0 18
\ No newline at end of file
1 19
new file mode 100644
... ...
@@ -0,0 +1,31 @@
1
+This is a BSD-3 style license
2
+-----------------------------
3
+
4
+Copyright (c) 2015 Nat! - Mulle kybernetiK
5
+All rights reserved.
6
+
7
+Redistribution and use in source and binary forms, with or without
8
+modification, are permitted provided that the following conditions are met:
9
+
10
+Redistributions of source code must retain the above copyright notice, this
11
+list of conditions and the following disclaimer.
12
+
13
+Redistributions in binary form must reproduce the above copyright notice,
14
+this list of conditions and the following disclaimer in the documentation
15
+and/or other materials provided with the distribution.
16
+
17
+Neither the name of Mulle kybernetiK nor the names of its contributors
18
+may be used to endorse or promote products derived from this software
19
+without specific prior written permission.
20
+
21
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31
+POSSIBILITY OF SUCH DAMAGE.
0 32
new file mode 100644
... ...
@@ -0,0 +1,31 @@
1
+SCRIPTS=install.sh \
2
+mulle-bootstrap-build.sh \
3
+mulle-bootstrap-clean.sh \
4
+mulle-bootstrap-fetch.sh \
5
+mulle-bootstrap-functions.sh \
6
+mulle-bootstrap-init.sh \
7
+mulle-bootstrap-local-environment.sh \
8
+mulle-bootstrap-setup-xcode.sh \
9
+mulle-bootstrap-tag.sh \
10
+mulle-bootstrap-warn-scripts.sh
11
+
12
+CHECKSTAMPS=$(SCRIPTS:.sh=.chk)
13
+SHELLFLAGS=-e SC2006 -s sh
14
+
15
+.PHONY: all
16
+.PHONY: clean
17
+
18
+%.chk:	%.sh
19
+		- ( shellcheck $(SHELLFLAGS) $< || touch $@ )
20
+
21
+all:	$(CHECKSTAMPS) mulle-bootstrap.chk
22
+
23
+mulle-bootstrap.chk:	mulle-bootstrap
24
+		- ( shellcheck $(SHELLFLAGS) $< || touch $@ )
25
+
26
+install:
27
+		./install.sh
28
+
29
+clean:
30
+	@- rm *.chk
31
+
0 32
new file mode 100644
... ...
@@ -0,0 +1,93 @@
1
+# mulle-bootstrap, yet another dependency manager for developers
2
+
3
+* downloads [github](http://rants.arantius.com/github-sucks) repositories ("dependents")
4
+* can deal with [cmake](http://blog.cppcms.com/post/54), [xcodebuild](http://devcodehack.com/xcode-sucks-and-heres-why/) and [configure](http://quetzalcoatal.blogspot.de/2011/06/why-autoconf-sucks.html) projects
5
+* instead of installing headers and libraries to `/usr/local`, mulle-bootstrap installs to `./dependencies`
6
+* can tag your repository and all dependents. dependents get a vendor tag
7
+* installs brew taps and formulae
8
+* installs gems and pips
9
+* compiles dependents using the output of previous dependents
10
+* written in portable shell script, will run eventually also on Linux
11
+
12
+## What mulle-bootstrap can do for you
13
+
14
+So you need a bunch of first and third party repositories to build your own project ? **mulle-bootstrap init** does the initial setup of the `.bootstrap` folder. Lets put the git repository URLs in a file called `.bootstrap/gits`.
15
+
16
+```console
17
+cat > .bootstrap/gits
18
+git@github.com:mulle-nat/MulleScion.git
19
+git@github.com:mulle-nat/UISS.git
20
+git@github.com:mulle-nat/Finch.git
21
+```
22
+
23
+Now **mulle-bootstrap** can iterate over them and check them out into a common directory `.repos`. Ok the repository **MulleScion** has a local clone in the parent directory. mulle-bootstrap can clone (or even symlink) from there, if you want.
24
+
25
+After cloning **mulle-bootstrap** does a simple security check with respect to `.bootstrap` shell scripts and Xcode script phases. Finally it looks for a `.bootstrap` folder in the freshly checked out repositories! They might have dependencies too, if they do, those dependencies are added to the source repositories dependencies.
26
+
27
+Everything you need should be present at this time. so **mulle-bootstrap** will now  build a **Debug** and a **Release** version for each library, and places the headers and the produced libraries into "./dependencies".
28
+
29
+Your Xcode project can be optionally massaged by **mulle-bootstrap setup-xcode** to have the .dependency folder in its search paths.
30
+
31
+## What a project user needs to do
32
+
33
+```console
34
+brew tap mulle-kybernetik/software
35
+brew install mulle-bootstrap
36
+```
37
+
38
+
39
+Download a project which is mulle-bootstrap enabled.
40
+
41
+```console
42
+cd <project>
43
+mulle-bootstrap
44
+```
45
+
46
+
47
+And all dependencies should be recreated as they were on your development machine (if you set it up correctly). `mulle-bootstrap` is a shortened command of `mulle-bootstrap bootstrap`, which in turn executes:
48
+
49
+#### mulle-bootstrap fetch
50
+
51
+Downloads all required libraries into a `.repos` folder.
52
+
53
+#### mulle-bootstrap build
54
+
55
+Compiles the required libraries contained in the `.repos` folder into `dependency`. It compiles each project once for Release and once for Debug (and given a file `.bootstrap/sdks` multiplied by the number of sdks needed)
56
+
57
+
58
+
59
+## What a project maintainer needs to do
60
+
61
+#### mulle-bootstrap init
62
+
63
+This is the first action. It sets up a `.bootstrap` folder in your project directory root (e.g. alongside .git). At this point you should edit `.bootstrap/gits` to add git projects dependencies.
64
+
65
+For each repository add a line like
66
+
67
+```console
68
+git@github.com:mulle-nat/MulleScion.git
69
+```
70
+
71
+In the file `.bootstrap/brews` you can specify homebrew projects that need to be installed. These will be installed into `/usr/local` as usual though.
72
+
73
+```console
74
+zlib
75
+openssl
76
+```
77
+
78
+
79
+#### mulle-bootstrap setup-xcode
80
+
81
+Prepares a Xcode project to use the libraries that are compiled into the `dependency` folder. You still need to add the libraries to your targets though.
82
+
83
+#### mulle-bootstrap tag
84
+
85
+Tag your project and all fetched repositories, with a tag.
86
+
87
+
88
+## Known limitations
89
+
90
+* no "-n" test run option
91
+* only works for libraries so far
92
+* not much tested
93
+
0 94
new file mode 100755
... ...
@@ -0,0 +1,51 @@
1
+#! /bin/sh
2
+#
3
+# (c) 2015, coded by Nat!, Mulle KybernetiK
4
+#
5
+
6
+#
7
+# restore colors if stuff gets wonky
8
+#
9
+trap 'echo "\033[0m"' TERM EXIT
10
+
11
+prefix=${1:-"/usr/local"}
12
+shift
13
+mode=${1:-755}
14
+shift
15
+bin=${1:-"${prefix}/bin"}
16
+shift
17
+libexec=${1:-"${prefix}/libexec/mulle-bootstrap"}
18
+shift
19
+
20
+if [ "$prefix" = "" ] || [ "$bin" = "" ] || [ "$libexec" = "" ] || [ "$mode" = "" ]
21
+then
22
+   echo "usage: install.sh [prefix] [mode] [binpath] [libexecpath]"
23
+   exit 1
24
+fi
25
+
26
+echo "\033[0;37m"
27
+
28
+for i in mulle*bootstrap
29
+do
30
+   mkdir -p "${bin}" 2> /dev/null
31
+   sed "s|/usr/local/libexec/mulle-bootstrap|${libexec}|g" < "${i}" > "${bin}/$i" || exit 1
32
+   chmod "${mode}" "${bin}/${i}" || exit 1
33
+   echo "installed $bin/$i" >&2
34
+done
35
+
36
+
37
+for i in mulle*.sh
38
+do
39
+   mkdir -p "${libexec}" 2> /dev/null
40
+   install -v -m "${mode}" "$i" "${libexec}" || exit 1
41
+done
42
+
43
+if [ -d "test" ]
44
+then
45
+   # use attractive colors :)
46
+   echo "\033[0;32mIf you are new to mulle-bootstrap I would suggest checking out" >&2
47
+   echo "the \033[0;33mREADME.md\033[0;32m in \033[0;36m`pwd`/test\033[0;32m and doing the examples." >&2
48
+fi
49
+
50
+# for people who source us
51
+PATH="${libexec}:$PATH"
0 52
new file mode 100755
... ...
@@ -0,0 +1,132 @@
1
+#! /bin/sh
2
+#
3
+#   Copyright (c) 2015 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
+
33
+#
34
+# This is the main user interface to mulle-bootstrap
35
+# sorta like git
36
+#
37
+BOOTSTRAP_SUBDIR=.bootstrap
38
+
39
+PATH="/usr/local/libexec/mulle-bootstrap:$PATH"
40
+export PATH
41
+
42
+command=${1:-"bootstrap"}
43
+shift
44
+
45
+. mulle-bootstrap-warn-scripts.sh
46
+
47
+
48
+bootstrap()
49
+{
50
+   if [ ! -d "${BOOTSTRAP_SUBDIR}" ]
51
+   then
52
+      echo "there is no ${BOOTSTRAP_SUBDIR} here, can't continue" >&2
53
+      exit 1
54
+   fi
55
+
56
+   #
57
+   # this is run when checking mulle-project itself out
58
+   #
59
+   if [ -f mulle-bootstrap-local-environment.sh -a -x install.sh ]
60
+   then
61
+      . install.sh "$@"
62
+      export MULLE_BOOTSTRAP=mulle-bootstrap
63
+   fi
64
+
65
+   #
66
+   # should run a script, where we test the project.pbxproj for
67
+   # script phases too
68
+   #
69
+   warn_scripts "${BOOTSTRAP_SUBDIR}" "." || exit 1
70
+
71
+   if [ "${DONT_RECURSE}" = "" ]
72
+   then
73
+      mulle-bootstrap-fetch.sh "$@" || exit 1
74
+   else
75
+      mulle-bootstrap-fetch.sh nonrecursive "$@" || exit 1
76
+   fi
77
+   mulle-bootstrap-build.sh "$@" || exit 1
78
+}
79
+
80
+
81
+case "${command}" in
82
+   bootstrap)
83
+      bootstrap "$@" || exit 1
84
+      ;;
85
+
86
+   nomagic)
87
+      DONT_RECURSE=YES bootstrap "$@" || exit 1
88
+      ;;
89
+
90
+   build)
91
+      mulle-bootstrap-build.sh "$@" || exit 1
92
+      ;;
93
+
94
+   clean)
95
+      mulle-bootstrap-clean.sh "$@" || exit 1
96
+      ;;
97
+
98
+   fetch)
99
+      mulle-bootstrap-fetch.sh "$@" || exit 1
100
+      ;;
101
+
102
+   init)
103
+      mulle-bootstrap-init.sh "$@" || exit 1
104
+      ;;
105
+
106
+   setup-xcode)
107
+      mulle-bootstrap-setup-xcode.sh "$@"|| exit 1
108
+      ;;
109
+
110
+   tag)
111
+      mulle-bootstrap-tag.sh "$@" || exit 1
112
+      ;;
113
+   *)
114
+      echo "usage: mulle-bootstrap [command]" >&2
115
+      echo "version 0.0" >&2
116
+      echo    " Common user commands:" >&2
117
+      echo    "   bootstrap : does fetch and build recursively [default]" >&2
118
+      echo    "   nomagic   : does fetch and build, but not recursively" >&2
119
+      echo    "" >& 2
120
+      echo    " Common maintainer commands:" >&2
121
+      echo    "   init      : initializes a bootstrap project" >&2
122
+      echo    "   setup-xcode : sets up the xcodeproj settings" >&2
123
+      echo    "   tag       : tag this project and fetched repositories" >&2
124
+      echo    "" >& 2
125
+      echo    " Specialized commands:" >&2
126
+      echo    "   build     : builds fetched repositories" >&2
127
+      echo    "   fetch [o] : fetches required repositories recursively." >&2
128
+      echo    "               whith [o=:nonrecursive] fetches non recursively." >&2
129
+      echo    "   clean [o] : cleans intermediate build files." >&2
130
+      echo    "               with [o=dist] cleans clones and dependencies too." >&2
131
+      exit 1
132
+esac
0 133
new file mode 100755
... ...
@@ -0,0 +1,766 @@
1
+#! /bin/sh
2
+#
3
+#   Copyright (c) 2015 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-local-environment.sh
33
+
34
+
35
+CLEAN_BEFORE_BUILD=`read_local_setting "clean"`
36
+HEADER_PATH=`read_local_setting "header_path" "/include"`
37
+LIBRARY_PATH=`read_local_setting "library_path" "/lib"`
38
+FRAMEWORK_PATH=`read_local_setting "frameworks_path" "/Frameworks"`
39
+
40
+
41
+#
42
+# move stuff produced my cmake and configure to places
43
+# where we expect them. Expect  others to build to
44
+# <prefix>/include  and <prefix>/lib or <prefix>/Frameworks
45
+#
46
+collect_and_dispense_product()
47
+{
48
+   local  subdir
49
+   local  dst
50
+   local  src
51
+
52
+   output="$1"
53
+   subdir="$2"
54
+
55
+   src="${output}/include"
56
+   if [ -d "${src}" ]
57
+   then
58
+      if dir_has_files "${src}"
59
+      then
60
+         dst="${DEPENDENCY_SUBDIR}${HEADER_PATH}"
61
+         mkdir -p "${dst}" 2> /dev/null
62
+         find -x "${src}" ! -path "${src}" -depth 1 -type d -exec mv -v -n '{}' "${dst}" \;  2> /dev/null
63
+         find -x  "${src}" ! -path "${src}" -depth 1 -type f -exec mv -v -n '{}' "${dst}" \;  2> /dev/null
64
+      fi
65
+      rm -rf "${src}"
66
+   fi
67
+
68
+   src="${output}/lib"
69
+   if [ -d  "${src}" ]
70
+   then
71
+      if dir_has_files "${src}"
72
+      then
73
+         dst="${DEPENDENCY_SUBDIR}${LIBRARY_PATH}${subdir}"
74
+         mkdir -p "${dst}" 2> /dev/null
75
+         find -x  "${src}" ! -path "${src}" -depth 1 -exec mv -v '{}' "${dst}" \;  2> /dev/null
76
+      fi
77
+      rm -rf "${src}"
78
+   fi
79
+
80
+   src="${output}/Frameworks"
81
+   if [ -d "${src}" ]
82
+   then
83
+      if dir_has_files "${src}"
84
+      then
85
+         dst="${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH}${subdir}"
86
+         mkdir -p "${dst}" 2> /dev/null
87
+         find -x "${src}" ! -path "${src}" -depth 1 -exec mv -v '{}' "${dst}" \; 2> /dev/null
88
+      fi
89
+      rm -rf "${src}"
90
+   fi
91
+
92
+   # now copy over the rest of the output
93
+
94
+   dst="${DEPENDENCY_SUBDIR}"
95
+   find -x "${output}" ! -path "${output}" -depth 1 -exec mv -v -n '{}' "${dst}" \;  2> /dev/null
96
+
97
+   return 0
98
+}
99
+
100
+
101
+enforce_build_sanity()
102
+{
103
+   # these must not exist
104
+   if [ -d "${DEPENDENCY_SUBDIR}/tmp" ]
105
+   then
106
+      fail "A previous build left ${DEPENDENCY_SUBDIR}/tmp can't continue"
107
+   fi
108
+
109
+   if [ -d "${builddir}" -a "${CLEAN_BEFORE_BUILD}" != "" ]
110
+   then
111
+      rm -rf "${builddir}"
112
+   fi
113
+
114
+}
115
+
116
+
117
+determine_suffix()
118
+{
119
+   local mode
120
+   local sdk
121
+   local suffix
122
+   local hackish
123
+
124
+   mode="$1"
125
+   sdk="$2"
126
+
127
+   suffix="/${mode}"
128
+   if [ "${sdk}" != "Default" ]
129
+   then
130
+      hackish=`echo "${sdk}" | sed 's/^\([a-zA-Z]*\).*$/\1/g'`
131
+      suffix="${suffix}-${hackish}"
132
+   fi
133
+   echo "${suffix}"
134
+}
135
+
136
+
137
+gcc_sdk_parameter()
138
+{
139
+   local mode
140
+   local sdk
141
+   local suffix
142
+   local sdkpath
143
+
144
+
145
+   mode="$1"
146
+   sdk="$2"
147
+   suffix="$2"
148
+
149
+   if [ "`uname`" = "Darwin" ]
150
+   then
151
+      if [ "${sdk}" != "Default" ]
152
+      then
153
+         sdkpath="`xcrun --sdk macosx --show-sdk-path`"
154
+         if [ "${sdkpath}" = "" ]
155
+         then
156
+            fail "SDK \"${sdk}\" is not installed"
157
+         fi
158
+         echo '-DCMAKE_OSX_SYSROOT='"${sdkpath}"
159
+      fi
160
+   fi
161
+}
162
+
163
+
164
+#
165
+# remove old builddir, create a new one
166
+# depending on mode cmake with flags
167
+# build stuff into dependencies
168
+#
169
+#
170
+build_cmake()
171
+{
172
+   local mode
173
+   local srcdir
174
+   local builddir
175
+   local relative
176
+   local name
177
+   local sdk
178
+   local mapped
179
+
180
+   mode="$1"
181
+   srcdir="$2"
182
+   builddir="$3"
183
+   relative="$4"
184
+   name="$5"
185
+   sdk="$6"
186
+
187
+   enforce_build_sanity
188
+
189
+   mapped=`read_build_setting "$name" "cmake-${mode}.map" "${mode}"`
190
+   suffix=`determine_suffix "${mode}" "${sdk}"`
191
+   sdk=`gcc_sdk_parameter "${mode}" "${sdk}" "${suffix}"`
192
+
193
+   owd="${PWD}"
194
+   # to avoid warning make sure directories are all there
195
+   mkdir -p "${owd}/${DEPENDENCY_SUBDIR}${HEADER_PATH}" 2> /dev/null
196
+   mkdir -p "${owd}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH}/${mode}" 2> /dev/null
197
+   mkdir -p "${owd}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH}${suffix}" 2> /dev/null
198
+
199
+   mkdir -p "${builddir}" 2> /dev/null
200
+   cd "${builddir}" || exit 1
201
+
202
+      # check that relative ise right
203
+      [ -d "${relative}/${DEPENDENCY_SUBDIR}${HEADER_PATH}" ] || exit 1
204
+      [ -d "${relative}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH}/${mode}" ] || exit 1
205
+      [ -d "${relative}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH}${suffix}" ] || exit 1
206
+
207
+
208
+      #
209
+      # cmake doesn't seem to "get" CMAKE_CXX_FLAGS or -INCLUDE
210
+      #
211
+      set -f
212
+      set -x
213
+      cmake "-DCMAKE_BUILD_TYPE=${mapped}" \
214
+"-DCMAKE_INSTALL_PREFIX:PATH=${owd}/${DEPENDENCY_SUBDIR}/tmp"  \
215
+"-DCMAKE_C_FLAGS=\
216
+-I${relative}/${DEPENDENCY_SUBDIR}${HEADER_PATH} \
217
+-F${relative}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH}${suffix} \
218
+-F${relative}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH}/${mode} \
219
+-F${relative}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH} \
220
+${sdk}" \
221
+"-DCMAKE_CXX_FLAGS=\
222
+-I${relative}/${DEPENDENCY_SUBDIR}${HEADER_PATH} \
223
+-F${relative}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH}${suffix} \
224
+-F${relative}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH}/${mode} \
225
+-F${relative}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH}" \
226
+"-DCMAKE_LD_FLAGS=\
227
+-L${relative}/${DEPENDENCY_SUBDIR}${LIBRARY_PATH}${suffix} \
228
+-L${relative}/${DEPENDENCY_SUBDIR}${LIBRARY_PATH}/${mode} \
229
+-L${relative}/${DEPENDENCY_SUBDIR}${LIBRARY_PATH} \
230
+-F${relative}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH}${suffix} \
231
+-F${relative}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH}/${mode} \
232
+-F${relative}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH} \
233
+${sdk}" \
234
+"${relative}/${srcdir}" 1>&2  || exit 1
235
+
236
+      make all install 1>&2 || exit 1
237
+      set +x
238
+      set +f
239
+
240
+   cd "${owd}"
241
+
242
+   collect_and_dispense_product "${owd}/${DEPENDENCY_SUBDIR}/tmp" "${suffix}" || exit 1
243
+
244
+   rm -rf "${owd}/${DEPENDENCY_SUBDIR}/tmp"
245
+}
246
+
247
+
248
+#
249
+# remove old builddir, create a new one
250
+# depending on mode cmake with flags
251
+# build stuff into dependencies
252
+#
253
+#
254
+build_configure()
255
+{
256
+   local mode
257
+   local srcdir
258
+   local builddir
259
+   local relative
260
+   local name
261
+   local sdk
262
+   local mapped
263
+
264
+   mode="$1"
265
+   srcdir="$2"
266
+   builddir="$3"
267
+   relative="$4"
268
+   name="$5"
269
+   sdk="$6"
270
+
271
+   enforce_build_sanity
272
+
273
+   mapped=`read_build_setting "$name" "configure-${mode}.map" "${mode}"`
274
+   suffix=`determine_suffix "${mode}" "${sdk}"`
275
+   sdk=`gcc_sdk_parameter "${mode}" "${sdk}" "${suffix}"`
276
+
277
+   owd="${PWD}"
278
+   # to avoid warning make sure directories are all there
279
+   mkdir -p "${owd}/${DEPENDENCY_SUBDIR}${HEADER_PATH}" 2> /dev/null
280
+   mkdir -p "${owd}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH}/${mode}" 2> /dev/null
281
+   mkdir -p "${owd}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH}${suffix}" 2> /dev/null
282
+
283
+   mkdir -p "${builddir}" 2> /dev/null
284
+   cd "${builddir}" || exit 1
285
+
286
+      # check that relative ise right
287
+      [ -d "${relative}/${DEPENDENCY_SUBDIR}${HEADER_PATH}" ] || exit 1
288
+      [ -d "${relative}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH}/${mode}" ] || exit 1
289
+      [ -d "${relative}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH}${suffix}" ] || exit 1
290
+
291
+      set -f
292
+      set -x
293
+
294
+      # use absolute paths for configure, safer (and easier to read IMO)
295
+      CFLAGS="\
296
+-I${owd}/${DEPENDENCY_SUBDIR}${HEADER_PATH} \
297
+-F${owd}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH}${suffix} \
298
+-F${owd}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH}/${mode} \
299
+-F${owd}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH} \
300
+${sdk}" \
301
+      CPPFLAGS="\
302
+-I${owd}/${DEPENDENCY_SUBDIR}${HEADER_PATH} \
303
+-F${owd}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH}${suffix} \
304
+-F${owd}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH}/${mode} \
305
+-F${owd}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH} \
306
+${sdk}" \
307
+      LDFLAGS="\
308
+-F${owd}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH}${suffix} \
309
+-F${owd}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH}/${mode} \
310
+-F${owd}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH} \
311
+-L${owd}/${DEPENDENCY_SUBDIR}${LIBRARY_PATH}${suffix} \
312
+-L${owd}/${DEPENDENCY_SUBDIR}${LIBRARY_PATH}/${mode} \
313
+-L${owd}/${DEPENDENCY_SUBDIR}${LIBRARY_PATH}" \
314
+      "${owd}/${srcdir}/configure" --prefix "${owd}/${DEPENDENCY_SUBDIR}/tmp" 1>&2  || exit 1
315
+
316
+      make all install 1>&2 || exit 1
317
+
318
+      set +x
319
+      set +f
320
+
321
+   cd "${owd}"
322
+
323
+   collect_and_dispense_product "${owd}/${DEPENDENCY_SUBDIR}/tmp" "${suffix}" || exit 1
324
+
325
+   rm -rf "${owd}/${DEPENDENCY_SUBDIR}/tmp"
326
+}
327
+
328
+
329
+xcode_get_setting()
330
+{
331
+   local key
332
+   local configuration
333
+
334
+   key="$1"
335
+   shift
336
+   configuration="$1"
337
+   shift
338
+
339
+   xcodebuild -showBuildSettings -configuration "${configuration}" "$@" | egrep "^[ ]*${key}" | sed 's/^[^=]*=[ ]*\(.*\)/\1/' || exit 1
340
+}
341
+
342
+
343
+build_xcodebuild()
344
+{
345
+   local mode
346
+   local srcdir
347
+   local builddir
348
+   local relative
349
+   local name
350
+   local sdk
351
+   local project
352
+
353
+   mode="$1"
354
+   srcdir="$2"
355
+   builddir="$3"
356
+   relative="$4"
357
+   name="$5"
358
+   sdk="$6"
359
+   project="$7"
360
+
361
+   if [ -d "${builddir}" -a "${CLEAN_BEFORE_BUILD}" != "" ]
362
+   then
363
+      rm -rf "${builddir}"
364
+   fi
365
+
366
+   local project
367
+   local projectname
368
+
369
+   # always pass project directly
370
+   projectname=`read_repo_setting "${name}" "project"`
371
+   if [ "${projectname}" != "" ]
372
+   then
373
+      project="-project ${projectname}"
374
+   else
375
+      project="-project ${project}"
376
+   fi
377
+
378
+   local scheme
379
+   local schemename
380
+
381
+   scheme=
382
+   schemename=`read_repo_setting "${name}" "scheme"`
383
+   if [ "$schemename" != "" ]
384
+   then
385
+      scheme="-scheme ${schemename}"
386
+   fi
387
+
388
+   local target
389
+   local targetname
390
+
391
+   target=
392
+   targetname=`read_repo_setting "${name}" "target"`
393
+   if [ "$targetname" != "" ]
394
+   then
395
+      target="-target ${targetname}"
396
+   fi
397
+
398
+   local mapped
399
+
400
+   mapped=`read_build_setting "${name}" "${mode}.map" "${mode}"`
401
+
402
+   local hackish
403
+   local targetname
404
+   local suffix
405
+
406
+   suffix="/${mode}"
407
+   if [ "${sdk}" != "Default" ]
408
+   then
409
+      hackish=`echo "${sdk}" | sed 's/^\([a-zA-Z]*\).*$/\1/g'`
410
+      suffix="${suffix}-${hackish}"
411
+      sdk="-sdk ${sdk}"
412
+   else
413
+      sdk=
414
+   fi
415
+
416
+   local proper_skip_install
417
+   local skip_install
418
+
419
+   skip_install=
420
+   proper_skip_install=`read_repo_setting "${name}" "proper_skip_install" "NO"`
421
+   if [ "$proper_skip_install" != "YES" ]
422
+   then
423
+      skip_install="SKIP_INSTALL=NO"
424
+   fi
425
+
426
+   local public_headers
427
+   local private_headers_subdir
428
+
429
+   public_headers=`read_repo_setting "${name}" "public_headers" "${HEADER_PATH}/${name}"`
430
+   private_headers_subdir=`read_repo_setting "${name}" "private_headers_subdir" "private"`
431
+
432
+   local xcodebuild
433
+   local binary
434
+
435
+   xcodebuild=`read_local_setting "xcodebuild" "xcodebuild"`
436
+   binary=`which "${xcodebuild}"`
437
+   if [ "${binary}"  = "" ]
438
+   then
439
+      echo "${xcodebuild} is an unknown build tool" >& 2
440
+      exit 1
441
+   fi
442
+
443
+   local xcflags
444
+
445
+   xcflags=`read_build_setting "${name}" "xcodebuild-flags"`
446
+   local xcconfig
447
+   local xcconfigname
448
+
449
+   xcconfig=
450
+   xcconfigname=`read_build_setting "${name}" xcconfig`
451
+   if [ "$xcconfigname" != "" ]
452
+   then
453
+      xcconfig="-xcconfig ${xcconfigname}"
454
+   fi
455
+   #
456
+   # xctool needs schemes, these are often autocreated, which xctool cant do
457
+   # xcodebuild can just use a target
458
+   # xctool is by and large useless fluff IMO
459
+   #
460
+   if [ "$xcodebuild" = "xctool"  -a "${schemename}" = ""  ]
461
+   then
462
+      if [ "$targetname" != "" ]
463
+      then
464
+         target=
465
+         scheme="-scheme ${targetname}"
466
+      else
467
+         echo "Please specify a scheme to compile in ${BOOTSTRAP_SUBDIR}/${name}/SCHEME for xctool" >& 2
468
+         echo "and be sure that this scheme exists and is shared." >& 2
469
+         echo "Or just delete ${HOME}/.mulle-bootstrap/xcodebuild and use xcodebuild (preferred)" >& 2
470
+         exit 1
471
+      fi
472
+   fi
473
+
474
+   local key
475
+   local aux
476
+   local value
477
+   local keys
478
+
479
+   aux=
480
+   keys=`all_build_flag_keys "${name}"`
481
+   for key in ${keys}
482
+   do
483
+      value=`read_build_setting "${name}" "${key}"`
484
+      aux="${aux} ${key}=${value}"
485
+   done
486
+
487
+   # now don't load any settings anymoe
488
+   local owd
489
+   local command
490
+
491
+   if [ "$MULLE_BOOTSTRAP_DRY" != "" ]
492
+   then
493
+      command=-showBuildSettings
494
+   else
495
+      command=install
496
+   fi
497
+
498
+   owd=`pwd`
499
+   cd "${srcdir}" || exit 1
500
+
501
+      # manually point xcode to our headers and libs
502
+      # this is like manually doing xcode-setup
503
+      local dependencies_framework_search_path
504
+      local dependencies_header_search_path
505
+      local dependencies_lib_search_path
506
+      local inherited
507
+
508
+      #
509
+      # TODO: need to figure out the correct mapping here
510
+      #
511
+      inherited=`xcode_get_setting HEADER_SEARCH_PATHS "${mapped}" $project $scheme $target`
512
+      dependencies_header_search_path="HEADER_SEARCH_PATHS=\
513
+${owd}/${DEPENDENCY_SUBDIR}${HEADER_PATH} \
514
+/usr/local/include \
515
+${inherited}"
516
+
517
+      inherited=`xcode_get_setting LIBRARY_SEARCH_PATHS "${mapped}" $project $scheme $target`
518
+      dependencies_lib_search_path="LIBRARY_SEARCH_PATHS=\
519
+${owd}/${DEPENDENCY_SUBDIR}${LIBRARY_PATH}/${mapped}-\$(EFFECTIVE_PLATFORM_NAME) \
520
+${owd}/${DEPENDENCY_SUBDIR}${LIBRARY_PATH}/${mapped} \
521
+${owd}/${DEPENDENCY_SUBDIR}${LIBRARY_PATH} \
522
+/usr/local/lib \
523
+${inherited}"
524
+
525
+      inherited=`xcode_get_setting FRAMEWORK_SEARCH_PATHS "${mapped}" $project $scheme $target`
526
+      dependencies_framework_search_path="FRAMEWORK_SEARCH_PATHS=\
527
+${owd}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH}/${mapped}-\$(EFFECTIVE_PLATFORM_NAME) \
528
+${owd}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH}/${mapped} \
529
+${owd}/${DEPENDENCY_SUBDIR}${FRAMEWORK_PATH} \
530
+/usr/local/lib \
531
+${inherited}"
532
+
533
+      set -f
534
+      set -x
535
+
536
+      echo "${BOOTSTRAP_SUBDIR}" >&2
537
+      # if it doesn't install, probably SKIP_INSTALL is set
538
+      $xcodebuild $command $project $sdk $scheme $target -configuration "${mapped}" \
539
+      ${xcflags} \
540
+      ${xcconfig} \
541
+      ${aux} \
542
+      "ARCHS=\${ARCHS_STANDARD_32_64_BIT}" \
543
+      "DEPLOYMENT_LOCATION=YES" \
544
+      "DSTROOT=${owd}/${DEPENDENCY_SUBDIR}" \
545
+      "INSTALL_PATH=${LIBRARY_PATH}${suffix}" \
546
+      "PUBLIC_HEADERS_FOLDER_PATH=${public_headers}" \
547
+      "PRIVATE_HEADERS_FOLDER_PATH=${public_headers}/${private_headers_subdir}" \
548
+      SYMROOT="${owd}/${builddir}/" \
549
+      OBJROOT="${owd}/${builddir}/obj" \
550
+      ONLY_ACTIVE_ARCH=NO \
551
+      ${skip_install} \
552
+      "${dependencies_header_search_path}" \
553
+      "${dependencies_lib_search_path}" \
554
+      "${dependencies_framework_search_path} " \
555
+      1>&2 || exit 1
556
+   # TODO: why is it ${builddir} and not ../../${builddir} ??
557
+      set +x
558
+      set +f
559
+
560
+   cd "${owd}"
561
+}
562
+
563
+
564
+build()
565
+{
566
+   local clone
567
+   local name
568
+   local builddir
569
+   local relative
570
+   local srcdir
571
+   local built
572
+   local sdk
573
+   local configuration
574
+   local preference
575
+
576
+   srcdir="$1"
577
+   name=`basename "${srcdir}"`
578
+
579
+   local preferences
580
+   local configurations
581
+   local sdks
582
+   local cmake
583
+   local xcodebuild
584
+
585
+   preferences=`read_local_setting "preferences"`
586
+   if [ "$preferences" = "" ]
587
+   then
588
+      preferences=`read_build_root_setting "preferences" "script
589
+xcodebuild
590
+cmake
591
+configure"`
592
+   fi
593
+
594
+   configurations=`read_local_setting "configurations"`
595
+   if [ "$configurations" = "" ]
596
+   then
597
+      configurations=`read_build_root_setting "configurations" "Debug
598
+Release"`
599
+   fi
600
+
601
+   xcodebuild=`which "xcodebuild"`
602
+   cmake=`which "cmake"`
603
+
604
+   # need uniform SDK for our builds
605
+   sdks=`read_build_root_setting "sdks" "Default"`
606
+
607
+   for sdk in ${sdks}
608
+   do
609
+      for configuration in ${configurations}
610
+      do
611
+         if [ "$/{configuration}" = "${LIBRARY_PATH}" -o "/${configuration}" = "${HEADER_PATH}" -o "/${configuration}" = "${FRAMEWORK_PATH}" ]
612
+         then
613
+            fail "You are just asking for trouble."
614
+         fi
615
+
616
+         if [ "${configuration}" = "lib" -o "${configuration}" = "include" -o "${configuration}" = "Frameworks" ]
617
+         then
618
+            fail "You are just asking for major trouble."
619
+         fi
620
+
621
+         builddir="${CLONESBUILD_SUBDIR}/${configuration}/${name}"
622
+         relative="${CLONESBUILD_RELATIVE}/../.."
623
+
624
+         built=no
625
+         for preference in ${preferences}
626
+         do
627
+            if [ -x "${SCRIPT}" -a "${preference}" = "script" ]
628
+            then
629
+               "${SCRIPT}" "${configuration}" "${srcdir}" "${builddir}" "${relative}" "${name}" "${sdk}" || exit 1
630
+               built=yes
631
+               break
632
+            fi
633
+
634
+            if [ "${preference}" = "xcodebuild" -a -x "${xcodebuild}" ]
635
+            then
636
+               project=`(cd "${srcdir}" ; find_xcodeproj "${name}")`
637
+
638
+               if [ "$project" != "" ]
639
+               then
640
+                  build_xcodebuild "${configuration}" "${srcdir}" "${builddir}" "${relative}" "${name}" "${sdk}" "${project}"  || exit 1
641
+                  built=yes
642
+                  break
643
+               fi
644
+            fi
645
+
646
+            if [ "${preference}" = "configure"  ]
647
+            then
648
+               if [ ! -f "${srcdir}/configure"  ]
649
+               then
650
+                  # try for autogen if installed (not coded yet)
651
+                  :
652
+               fi
653
+               if [ -x "${srcdir}/configure" ]
654
+               then
655
+                  build_configure "${configuration}" "${srcdir}" "${builddir}" "${relative}" "${name}" "${sdk}" || exit 1
656
+                  built=yes
657
+                  break
658
+               fi
659
+            fi
660
+
661
+            if [ "${preference}" = "cmake" -a -x "${cmake}" ]
662
+            then
663
+               if [ -f "${srcdir}/CMakeLists.txt" ]
664
+               then
665
+                  build_cmake "${configuration}" "${srcdir}" "${builddir}" "${relative}" "${name}" "${sdk}" || exit 1
666
+                  built=yes
667
+                  break
668
+               fi
669
+            fi
670
+         done
671
+
672
+         if [ "$built" != "yes" ]
673
+         then
674
+            fail "Don't know how to build ${name}"
675
+         fi
676
+      done
677
+   done
678
+}
679
+
680
+
681
+build_clones()
682
+{
683
+   local clone
684
+   local built
685
+   local xdone
686
+   local name
687
+
688
+   #
689
+   # START
690
+   #
691
+   if [ ! -d "${CLONES_SUBDIR}" ]
692
+   then
693
+      return 0
694
+   fi
695
+
696
+   for clone in ${CLONES_SUBDIR}/*.failed
697
+   do
698
+      if [ -d "${clone}" ]
699
+      then
700
+         fail "failed checkout $clone detected, can't continue"
701
+      fi
702
+   done
703
+
704
+   #
705
+   # build order is there, because we want to have gits
706
+   # and maybe later hgs
707
+   #
708
+   if [ "$#" -eq 0 ]
709
+   then
710
+      built=`read_build_root_setting "buildignore"`
711
+      for name in `read_build_root_setting "buildorder"`
712
+      do
713
+         clone="${CLONES_SUBDIR}/${name}"
714
+
715
+         if [ -d "${clone}" ]
716
+         then
717
+            xdone=`/bin/echo "${built}" | grep "${name}"`
718
+            if [ "$xdone" = "" ]
719
+            then
720
+               build "${clone}"
721
+               built="${name}
722
+${built}"
723
+            fi
724
+         else
725
+            fail "buildorder contains unknown repo ${name}"
726
+         fi
727
+      done
728
+
729
+      for clone in ${CLONES_SUBDIR}/*
730
+      do
731
+         name=`basename "${clone}"`
732
+
733
+         if [ -d "${clone}" ]
734
+         then
735
+            xdone=`/bin/echo "${built}" | grep "${name}"`
736
+            if [ "$xdone" = "" ]
737
+            then
738
+               build "${clone}"
739
+               built="${name}
740
+${built}"
741
+            fi
742
+         fi
743
+      done
744
+   else
745
+      for clone in "$@"
746
+      do
747
+         clone="${CLONES_SUBDIR}/${name}"
748
+
749
+         xdone=`/bin/echo "${built}" | grep "${name}"`
750
+         if [ "$xdone" = "" ]
751
+         then
752
+            build "${clone}"
753
+            built="${name}
754
+${built}"
755
+         fi
756
+      done
757
+   fi
758
+}
759
+
760
+
761
+main()
762
+{
763
+   build_clones "$@"
764
+}
765
+
766
+main "$@"
0 767
new file mode 100644
... ...
@@ -0,0 +1,50 @@
1
+#! /bin/sh
2
+#
3
+# (c) 2015, coded by Nat!, Mulle KybernetiK
4
+#
5
+COMMAND=${1:-"build"}
6
+
7
+. mulle-bootstrap-local-environment.sh
8
+
9
+case "$COMMAND" in
10
+   build)
11
+   ;;
12
+   dist)
13
+   ;;
14
+   *)
15
+   echo "usage: mulle-bootstrap-clean.sh <build|dist>" 2>&1
16
+   exit 1
17
+   ;;
18
+esac
19
+
20
+#
21
+# cleanability is checked, because in some cases its convenient
22
+# to have other tools provide stuff besides /include and /lib
23
+# and sometimes  projects install other stuff into /share
24
+#
25
+if [ "${CLONES_SUBDIR_IS_CLEANABLE}" = "YES" ]
26
+then
27
+   if [ "${COMMAND}" = "objects" -o "${COMMAND}" = "dist" -o "${COMMAND}" = "build"  ]
28
+   then
29
+      rm -rf "${CLONESBUILD_SUBDIR}" 2> /dev/null
30
+   fi
31
+fi
32
+
33
+if [ "${DEPENDENCY_SUBDIR_IS_DIST_CLEANABLE}" = "YES" ]
34
+then
35
+   if [ "${COMMAND}" = "dist" -o "${COMMAND}" = "build"  ]
36
+   then
37
+      rm -rf "${DEPENDENCY_SUBDIR}" 2> /dev/null
38
+   fi
39
+fi
40
+
41
+
42
+if [ "${COMMAND}" = "dist" ]
43
+then
44
+   rm -rf "${BOOTSTRAP_SUBDIR}.auto" 2> /dev/null
45
+
46
+   if [ "${CLONES_SUBDIR_IS_CLEANABLE}" = "YES" ]
47
+   then
48
+      rm -rf "${CLONES_SUBDIR}"  2> /dev/null
49
+   fi
50
+fi
0 51
new file mode 100755
... ...
@@ -0,0 +1,603 @@
1
+ #! /bin/sh
2
+#
3
+#   Copyright (c) 2015 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
+#
33
+# this script installs the proper git clones into "clones"
34
+# it does not to git subprojects.
35
+# You can also specify a list of "brew" dependencies. That
36
+# will be third party libraries, you don't tag or debug
37
+#
38
+COMMAND=${1:-"install"}
39
+
40
+. mulle-bootstrap-local-environment.sh
41
+. mulle-bootstrap-warn-scripts.sh
42
+
43
+
44
+if [ "${MULLE_BOOTSTRAP}" = "mulle-bootstrap" ]
45
+then
46
+   COMMAND="install"
47
+fi
48
+
49
+case "$COMMAND" in
50
+   install)
51
+   ;;
52
+   nonrecursive)
53
+     COMMAND=install