Browse code

fix Big .bootstrap for newer build code, improve verbose output. Split test into demo and tutorial, rework A B C. Started work on better tutorial text, but lost interest as weekend started... :)

Nat! authored on 02-10-2015 16:20:45 • Nat! committed on 02-10-2015 20:59:44
Showing 33 changed files
... ...
@@ -18,10 +18,14 @@ Build Settings (Global only)
18 18
 
19 19
 Setting Name            | Description                           |  Default
20 20
 ------------------------|---------------------------------------|----------------------------
21
-buildignore             |  repositories not to build            |
22
-buildorder              |  repositories to build in that order. You only need to specify those, that need ordering. Otherwise mulle-bootstrap build in default sort order by name.   |
23
-configurations          |  configurations to build              | Debug\nRelease
24
-sdks                    |  SDKs to build                        | Default
21
+buildignore             | repositories not to build             |
22
+buildorder              | repositories to build in that order.  |
23
+                        | You only need to specify those, that  |
24
+                        | need ordering. Otherwise              |
25
+                        | mulle-bootstrap builds in default `ls`|
26
+                        | sort order by name.                   |
27
+configurations          | configurations to build               | Debug\nRelease
28
+sdks                    | SDKs to build                         | Default
25 29
 
26 30
 Build Settings
27 31
 ===================
... ...
@@ -41,16 +45,29 @@ as a repository.
41 45
 
42 46
 #### Settings
43 47
 
44
-Setting Name                   |  Description                              | Default
45
-${configuration}.map           | rename configuration for xcodebuild       |
46
-cmake-${configuration}.map     | rename configuration for cmake            |
47
-configure-${configuration}.map | rename configuration for configure        |
48
-xcode_proper_skip_install      | assume SKIP_INSTALL is set correctly in Xcode project                          | NO
49
-xcode_mangle_header_settings   | mangle Xcode header paths. Specifcally PUBLIC_HEADERS_FOLDER_PATH and PRIVATE_HEADERS_FOLDER_PATH        | NO
50
-xcode_mangle_include_prefix    | remove /usr/local from Xcode header paths | NO
51
-xcode_mangle_header_dash       | convert '-' to '_' in Xcode header paths  | NO
52
-
48
+Setting Name                   |  Description                               | Default
49
+-------------------------------|--------------------------------------------|---------------
50
+${configuration}.map           | rename configuration for xcodebuild        |
51
+cmake-${configuration}.map     | rename configuration for cmake             |
52
+configure-${configuration}.map | rename configuration for configure         |
53
+dispense_headers_path          | where the build should put headers,        |
54
+                               | relative to dependencies. Preferred way    |
55
+                               | for cmake and  configure projects to place |
56
+                               | headers.                                   | /usr/local/${HEADER_DIR_NAME}
57
+dispense_other_files           | where the build should put other files     |
58
+                               | (excluding libraries, frameworks and headers),|
59
+                               | relative to dependencies                   | /usr/local
60
+xcode_proper_skip_install      | assume SKIP_INSTALL is set correctly in    |
61
+                               | Xcode project                              | NO
62
+xcode_public_headers           | Substitute for PUBLIC_HEADERS_FOLDER_PATH  |
63
+xcode_private_headers          | Substitute for PRIVATE_HEADERS_FOLDER_PATH |
64
+                               |                                            |
65
+xcode_mangle_header_paths      | Mangle Xcode header paths. Specifcally     |
66
+                               | PUBLIC_HEADERS_FOLDER_PATH and             |
67
+                               | PRIVATE_HEADERS_FOLDER_PATH. Mangling is   |
68
+                               | controlled by the following settings       | NO
69
+xcode_mangle_include_prefix    | remove /usr/local from Xcode header paths  | NO
70
+xcode_mangle_header_dash       | convert '-' to '_' in Xcode header paths   | NO
53 71
 
54 72
 Settings Repository Specific
55 73
 ===================
... ...
@@ -94,7 +111,9 @@ tarballs           | Tarballs to install (currently filesystem only)
94 111
 Config Settings
95 112
 ===================
96 113
 
97
-Environment variables use the setting name, transformed to upper case and prepended with "MULLE_BOOTSTRAP_". So preferences is MULLE_BOOTSTRAP_PREFERENCES in the environment.
114
+Environment variables use the setting name, transformed to upper case and
115
+prepended with "MULLE_BOOTSTRAP_". So preferences is MULLE_BOOTSTRAP_PREFERENCES
116
+in the environment.
98 117
 
99 118
 #### Search Paths
100 119
 
... ...
@@ -104,34 +123,42 @@ Environment variables use the setting name, transformed to upper case and prepen
104 123
 3. ./bootstrap.auto/config
105 124
 5. ~/.mulle-bootstrap
106 125
 
107
-Setting Name                   |  Description                                  | Default
108
-clean_before_build             | should mulle-bootstrap clean before building  | NO
109
-dont_clean_dependencies_before_build |  usually before a build, mulle-bootstrap cleans dependencies to avoid surprising  "it worked the second time" builds due to wrong buildorder
110
-                                                                               | NO
111
-framework_path                  | name of the Frameworks folder                | Frameworks
112
-header_dir_name                 | name of the headers folder in
113
-dependencies. e.g. You dislike "include" and favor "headers".                                                                      | include
126
+Setting Name                    |  Description                                  | Default
127
+--------------------------------|-----------------------------------------------|--------------
128
+clean_before_build              | should mulle-bootstrap clean before building  | YES
129
+clean_dependencies_before_build | usually before a build, mulle-bootstrap       |
130
+                                | cleans dependencies to avoid surprising       |
131
+                                | worked the second time" builds due to a wrong |
132
+                                | buildorder                                    | YES
133
+framework_dir_name              | name of the Frameworks folder                 | Frameworks
134
+header_dir_name                 | name of the headers folder in dependencies.   |
135
+                                | e.g. You dislike "include" and favor          |
136
+                                | "headers".                                    | include
114 137
 library_dir_name                | as above, but for libraries                   | lib
115
-preferences                    | list order of preferred build tools. Will be used in deciding if to use cmake or xcodebuild, if both are available       | script\nxcodebuild\ncmake\nconfigure
116
-headers_c_and_d_prefix  | where the build should put headers, relative to dependencies | /usr/local
117
-others_c_and_d_prefix   | where the build should put other files (excluding libraries, frameworks and headers), relative to dependencies | /usr/local
118
-symlink_forbidden              | mulle-bootstrap will not attempt to symlink          | NO
119
-trace                          | see MULLE_BOOTSTRAP_TRACE for more info   | NO
120
-xcodebuild                     | tool to use instead of xcodebuild (xctool ?) | xcodebuild
121
-                     |                                                     |
122
-clean_folders        | folders to delete for mulle-bootstrap clean         | build/.repos
123
-dist_clean_folders   | folders to delete for mulle-bootstrap clean dist    | .repos\n/.bootstrap.auto
124
-output_clean_folders | folders to delete for mulle-bootstrap clean output  | dependencies
125
-                  |                                                        |
126
-repos_foldername  |  Where to place cloned repositories                    | .repos
127
-output_foldername |  DSTROOT, --prefix of headers and libraries            | dependencies
128
-build_foldername  |  OBJROOT, build root for intermediate files like .o    | build/.repos
129
-      |                                                        |
130
-no_warn_environment_setting | don't warn when a setting is defined by environment        | NO
131
-no_warn_local_setting       | don't warn when a setting is defined by .bootstrap.local   | NO
132
-no_warn_user_setting        | don't warn when a setting is defined by ~/.mulle-bootstrap | NO
133
-      |                                                        |
138
+preferences                     | list order of preferred build tools. Will be  |
139
+                                | used in deciding if to use cmake or           |
140
+                                | xcodebuild, if both are available             | script\nxcodebuild\ncmake\nconfigure
141
+symlink_forbidden               | mulle-bootstrap will not attempt to symlink   | NO
142
+trace                           | see MULLE_BOOTSTRAP_TRACE for more info       | NO
143
+xcodebuild                      | tool to use instead of xcodebuild (xctool ?)  | xcodebuild
144
+                                |                                               |
145
+clean_folders                   | folders to delete for mulle-bootstrap clean   | build/.repos
146
+dist_clean_folders              | folders to delete for mulle-bootstrap clean   |
147
+                                | dist                                          | .repos\n/.bootstrap.auto
148
+output_clean_folders            | folders to delete for mulle-bootstrap clean   |
149
+                                | output                                        | dependencies
150
+                                |                                               |
151
+repos_foldername                |  Where to place cloned repositories           | .repos
152
+output_foldername               |  DSTROOT, --prefix of headers and libraries   | dependencies
153
+build_foldername                |  OBJROOT, build root for intermediate files   |
154
+                                |  like .o                                      | build/.repos
155
+                                |                                               |
156
+no_warn_environment_setting     | don't warn when a setting is defined by       |
157
+                                | environment                                   | NO
158
+no_warn_local_setting           | don't warn when a setting is defined by       |
159
+                                | .bootstrap.local                              | NO
160
+no_warn_user_setting            | don't warn when a setting is defined by       |
161
+                                | ~/.mulle-bootstrap                            | NO
134 162
 
135 163
 Fetch Script Settings
136 164
 ==========================
137 165
similarity index 78%
138 166
rename from test/Big/.bootstrap/gits
139 167
rename to demo/.bootstrap/gits
... ...
@@ -3,5 +3,5 @@ git://git.savannah.gnu.org/readline.git
3 3
 # A cmake project
4 4
 https://github.com/madler/zlib
5 5
 # An Xcode project
6
-git@github.com:zoul/Finch.git
6
+git@github.com:mulle-nat/Finch.git
7 7
 
8 8
new file mode 100644
... ...
@@ -0,0 +1 @@
1
+/usr/local/include/Finch
0 2
new file mode 100644
... ...
@@ -0,0 +1 @@
1
+/usr/local/include/zlib
0 2
new file mode 100644
... ...
@@ -0,0 +1,61 @@
1
+# Demo
2
+
3
+This demo shows an already created `.bootstrap` folder in action.
4
+**mulle-bootstrap** clones and builds a xcodebuild based project, a cmake make
5
+based project and a configure based project.
6
+
7
+Just run mulle-bootstrap in here and examine the created output in the folder
8
+`dependencies`:
9
+
10
+```console
11
+$ mulle-bootstrap
12
+$ ls -R dependencies
13
+```
14
+
15
+### What is in .bootstrap ?
16
+
17
+There is very little configuration needed to get this result. The
18
+.bootstrap folder contains:
19
+
20
+Folder                     | Files                 | Folders
21
+---------------------------|-----------------------|---------------
22
+.bootstrap						| gits                  | settings/
23
+.bootstrap/settings			|                       | Finch/	zlib/
24
+.bootstrap/settings/Finch	| xcode_public_headers  |
25
+.bootstrap/settings/zlib	| dispense_headers_path |
26
+
27
+
28
+`.bootstrap/gits` defines the repositories to fetch
29
+```
30
+# A configure project
31
+git://git.savannah.gnu.org/readline.git
32
+# A cmake project
33
+https://github.com/madler/zlib
34
+# An Xcode project
35
+git@github.com:mulle-nat/Finch.git
36
+```
37
+
38
+`.bootstrap/settings/Finch/xcode_public_headers` contains a mapping for the
39
+public header output of Finch, (which is currently broken in that repository).
40
+
41
+```
42
+/usr/local/include/Finch
43
+```
44
+
45
+Usually zlib places it's headers into "/usr/local/include", for demo purposes
46
+we want it to be in "/usr/local/include/zlib". As this is not an Xcode project
47
+we use an alternative method `.bootstrap/settings/zlib/dispense_headers_path`
48
+
49
+```
50
+/usr/local/include/zlib
51
+```
52
+
53
+Notice that the settings are specified on a per repository, which usually makes
54
+the most sense.
55
+
56
+
57
+Finally lets get rid of the download repositories and all build products with:
58
+
59
+```console
60
+$ mulle-bootstrap clean dist
61
+```
... ...
@@ -51,21 +51,24 @@ fi
51 51
 
52 52
 if [ "$1" = "-v" ]
53 53
 then
54
-   MULLE_BOOTSTRAP_TRACE=VERBOSE
55
-   export MULLE_BOOTSTRAP_TRACE
54
+   if [ -z "${MULLE_BOOTSTRAP_TRACE}" ]
55
+   then
56
+       MULLE_BOOTSTRAP_TRACE=VERBOSE
57
+      export MULLE_BOOTSTRAP_TRACE
58
+   fi
56 59
    GITFLAGS="-v"
57 60
    export GITFLAGS
58 61
    shift
59
-fi
60
-
61
-if [ "$1" = "-s" ] # silent
62
-then
63
-   MULLE_BOOTSTRAP_TRACE=
64
-   MULLE_BOOTSTRAP_TERSE=YES
65
-   export MULLE_BOOTSTRAP_TERSE
66
-   GITFLAGS="-q"
67
-   export GITFLAGS
68
-   shift
62
+else
63
+   if [ "$1" = "-s" ] # silent
64
+   then
65
+      MULLE_BOOTSTRAP_TRACE=
66
+      MULLE_BOOTSTRAP_TERSE=YES
67
+      export MULLE_BOOTSTRAP_TERSE
68
+      GITFLAGS="-q"
69
+      export GITFLAGS
70
+      shift
71
+   fi
69 72
 fi
70 73
 
71 74
 
... ...
@@ -73,12 +76,12 @@ fi
73 76
 usage()
74 77
 {
75 78
    cat <<EOF
76
-usage: mulle-bootstrap [-n][-v][-s] [command] [--help]
79
+usage: mulle-bootstrap [-n][-v|-s] [command] [--help]
77 80
        version 0.4
78 81
 
79 82
  Specify the -h or --help option after each command to get more help.
80 83
 
81
- Flags (must be in this order)
84
+ Flags (-n must be first, if present)
82 85
    -n        : do nothing creative or destructive
83 86
    -v        : be more verbose
84 87
    -s        : be more terse
... ...
@@ -127,15 +130,6 @@ bootstrap()
127 130
        check_and_usage_and_help >&2
128 131
        exit 1
129 132
    fi
130
-   #
131
-   # Parameter
132
-   #
133
-
134
-   if [ ! -d "${BOOTSTRAP_SUBDIR}" ]
135
-   then
136
-      echo "there is no ${BOOTSTRAP_SUBDIR} here, can't continue" >&2
137
-      exit 1
138
-   fi
139 133
 
140 134
    #
141 135
    # this is run when checking mulle-project itself out
... ...
@@ -160,6 +154,13 @@ bootstrap()
160 154
 
161 155
 main()
162 156
 {
157
+
158
+   if [ ! -d "${BOOTSTRAP_SUBDIR}" -a "${command}" != "init" ]
159
+   then
160
+      echo "there is no ${BOOTSTRAP_SUBDIR} here, can't continue" >&2
161
+      exit 1
162
+   fi
163
+
163 164
    case "${command}" in
164 165
       bootstrap)
165 166
          bootstrap "$@" || exit 1
... ...
@@ -37,7 +37,8 @@ check_and_usage_and_help()
37 37
 {
38 38
    cat <<EOF
39 39
 usage: build [repos]*
40
-   You can specify the names of the repositories to build.
40
+
41
+   You can optionally specify the names of the repositories to build.
41 42
    Currently available names are:
42 43
 EOF
43 44
    (cd "${CLONES_SUBDIR}" ; ls -1d ) 2> /dev/null
... ...
@@ -51,7 +52,7 @@ then
51 52
 fi
52 53
 
53 54
 
54
-CLEAN_BEFORE_BUILD=`read_config_setting "clean_before_build"`
55
+CLEAN_BEFORE_BUILD=`read_config_setting "clean_before_build" "YES"`
55 56
 
56 57
 #
57 58
 # move stuff produced my cmake and configure to places
... ...
@@ -60,29 +61,32 @@ CLEAN_BEFORE_BUILD=`read_config_setting "clean_before_build"`
60 61
 #
61 62
 dispense_headers()
62 63
 {
63
-   local  src
64
+   local name
65
+   local src
64 66
 
65
-   src="$1"
67
+   name="${1}"
68
+   src="$2"
66 69
 
67 70
    local dst
68
-   local usrlocal
71
+   local headers
72
+   local suffix
69 73
 
70
-   log_fluff "Considering copying ${src}"
74
+   log_fluff "Consider copying headers from \"${src}\""
71 75
 
72 76
    if [ -d "${src}" ]
73 77
    then
74 78
       if dir_has_files "${src}"
75 79
       then
76
-         usrlocal="`read_config_setting "headers_c_and_d_prefix" "/usr/local"`"
80
+         headers="`read_build_setting "${name}" "dispense_headers_path" "/usr/local/${HEADER_DIR_NAME}"`"
77 81
 
78
-         dst="${REFERENCE_DEPENDENCY_SUBDIR}${usrlocal}/${HEADER_DIR_NAME}"
79
-         mkdir_if_missing "${REFERENCE_DEPENDENCY_SUBDIR}${usrlocal}/${HEADER_DIR_NAME}"
82
+         dst="${REFERENCE_DEPENDENCY_SUBDIR}${headers}"
83
+         mkdir_if_missing "${dst}"
80 84
 
81
-         log_fluff "Copying ${src} to ${dst}"
85
+         log_fluff "Copying \"${src}\" to \"${dst}\""
82 86
          exekutor find -x "${src}" ! -path "${src}" -depth 1 -type d -print0 | \
83 87
             exekutor xargs -0 -J % mv -v -n % "${dst}"
84 88
          [ $? -eq 0 ]  || exit 1
85
-         exekutor find -x "${src}" ! -path "${src}" -depth 1 -type f -print0 | \
89
+         exekutor find -x "${src}" ! -path "${src}" -depth 1 \( -type f -o -type l \) -print0 | \
86 90
             exekutor xargs -0 -J % mv -v -n % "${dst}"
87 91
          [ $? -eq 0 ]  || exit 1
88 92
          rmdir_safer "${src}"
... ...
@@ -94,15 +98,26 @@ dispense_headers()
94 98
 dispense_binaries()
95 99
 {
96 100
    local src
101
+   local findtype
102
+   local subpath
103
+   local name
97 104
 
98
-   src="$1"
99
-   findtype="$2"
100
-   subpath="$3"
105
+   name="$1"
106
+   src="$2"
107
+   findtype="$3"
108
+   subpath="$4"
101 109
 
102 110
    local dst
103 111
    local usrlocal
112
+   local findtype2
113
+
114
+   findtype2="${findtype}"
115
+   if [ "${findtype}" = "f" ]
116
+   then
117
+      findtype2="l"
118
+   fi
104 119
 
105
-   log_fluff "Considering copying ${src}"
120
+   log_fluff "Consider copying binaries from \"${src}\" for type \"${findtype}/${findtype2}\""
106 121
 
107 122
    if [ -d "${src}" ]
108 123
    then
... ...
@@ -110,9 +125,9 @@ dispense_binaries()
110 125
       then
111 126
          dst="${REFERENCE_DEPENDENCY_SUBDIR}${subpath}${subdir}"
112 127
 
113
-         log_fluff "Copying ${src} to ${dst}"
128
+         log_fluff "Copying \"${src}\" to \"${dst}\""
114 129
          mkdir_if_missing "${dst}"
115
-         exekutor find -x "${src}" ! -path "${src}" -type "${findtype}" -depth 1 -print0 | \
130
+         exekutor find -x "${src}" ! -path "${src}" \( -type "${findtype}" -o -type "${findtype2}" \) -depth 1 -print0 | \
116 131
             exekutor xargs -0 -J % mv -v -n % "${dst}"
117 132
          [ $? -eq 0 ]  || exit 1
118 133
       fi
... ...
@@ -123,14 +138,18 @@ dispense_binaries()
123 138
 
124 139
 collect_and_dispense_product()
125 140
 {
141
+   local  name
126 142
    local  subdir
143
+   local  name
144
+
145
+   name="${1}"
146
+   subdir="${2}"
147
+   wasxcode="${3}"
148
+
127 149
    local  dst
128 150
    local  src
129 151
 
130
-   subdir="$1"
131
-   wasxcode="$2"
132
-
133
-   log_fluff "Start collecting and dispensing product"
152
+   log_info "Collecting and dispensing \"${name}\" \"`basename "${subdir}"`\" products "
134 153
    #
135 154
    # probably should use install_name_tool to hack all dylib paths that contain .ref
136 155
    # (will this work with signing stuff ?)
... ...
@@ -140,31 +159,31 @@ collect_and_dispense_product()
140 159
       log_fluff "Choosing xcode dispense path"
141 160
 
142 161
       src="${BUILD_DEPENDENCY_SUBDIR}/usr/local/include"
143
-      dispense_headers "${src}"
162
+      dispense_headers "${name}" "${src}"
144 163
 
145 164
       src="${BUILD_DEPENDENCY_SUBDIR}/usr/include"
146
-      dispense_headers "${src}"
165
+      dispense_headers "${name}" "${src}"
147 166
 
148 167
       src="${BUILD_DEPENDENCY_SUBDIR}/include"
149
-      dispense_headers "${src}"
168
+      dispense_headers "${name}" "${src}"
150 169
 
151 170
       src="${BUILD_DEPENDENCY_SUBDIR}/lib${subdir}"
152
-      dispense_binaries "${src}" "f" "/${LIBRARY_DIR_NAME}"
171
+      dispense_binaries "${name}" "${src}" "f" "/${LIBRARY_DIR_NAME}"
153 172
 
154 173
       src="${BUILD_DEPENDENCY_SUBDIR}/Frameworks${subdir}"
155
-      dispense_binaries "${src}" "d" "${FRAMEWORK_PATH}"
174
+      dispense_binaries "${name}" "${src}" "d" "${FRAMEWORK_PATH}"
156 175
    else
157 176
       log_fluff "Choosing cmake/configure dispense path"
158 177
 
159 178
       src="${BUILD_DEPENDENCY_SUBDIR}/usr/local/include"
160
-      dispense_headers "${src}"
179
+      dispense_headers "${name}" "${src}"
161 180
 
162 181
       src="${BUILD_DEPENDENCY_SUBDIR}/usr/local/lib"
163
-      dispense_binaries "${src}" "f" "/${LIBRARY_DIR_NAME}"
182
+      dispense_binaries "${name}" "${src}" "f" "/${LIBRARY_DIR_NAME}"
164 183
 
165 184
       # coming from Cmake and configure
166 185
       src="${BUILD_DEPENDENCY_SUBDIR}/usr/local/Frameworks"
167
-      dispense_binaries "${src}" "d" "${FRAMEWORK_PATH}"
186
+      dispense_binaries "${name}" "${src}" "d" "${FRAMEWORK_PATH}"
168 187
    fi
169 188
 
170 189
    #
... ...
@@ -188,7 +207,7 @@ collect_and_dispense_product()
188 207
    # probably should hack all executables with install_name_tool that contain .ref
189 208
    #
190 209
    # now copy over the rest of the output
191
-   usrlocal="`read_config_setting "others_c_and_d_prefix" "/usr/local"`"
210
+   usrlocal="`read_build_setting "${name}" "dispense_other_files" "/usr/local"`"
192 211
 
193 212
    log_fluff "Considering copying ${BUILD_DEPENDENCY_SUBDIR}/*"
194 213
 
... ...
@@ -202,19 +221,19 @@ collect_and_dispense_product()
202 221
    then
203 222
       dst="${REFERENCE_DEPENDENCY_SUBDIR}${usrlocal}"
204 223
 
205
-      log_fluff "Copying ${src}/* to ${dst}"
206
-      exekutor find -x "${src}" ! -path "${src}" -depth 1 -exec mv -v -n '{}' "${dst}" | \
224
+      log_fluff "Copying \"${src}/*\" to \"${dst}\""
225
+      exekutor find -x "${src}" ! -path "${src}" -depth 1 -print0 | \
207 226
             exekutor xargs -0 -J % mv -v -n % "${dst}"
208
-      [ $? -eq 0 ]  || exit 1
227
+      [ $? -eq 0 ]  || fail "moving files from ${src} to ${dst} failed"
209 228
    fi
210 229
 
211 230
    if [ "$MULLE_BOOTSTRAP_VERBOSE" = "YES"  ]
212 231
    then
213 232
       if dir_has_files "${BUILD_DEPENDENCY_SUBDIR}"
214 233
       then
215
-         log_fluff "${BUILD_DEPENDENCY_SUBDIR} contained files after collect and dispense"
234
+         log_fluff "Directory \"${BUILD_DEPENDENCY_SUBDIR}\" contained files after collect and dispense"
216 235
          log_fluff "--------------------"
217
-         ( cd "${BUILD_DEPENDENCY_SUBDIR}" ; ls -R >&2 )
236
+         ( cd "${BUILD_DEPENDENCY_SUBDIR}" ; ls -lR >&2 )
218 237
          log_fluff "--------------------"
219 238
       fi
220 239
    fi
... ...
@@ -235,12 +254,7 @@ enforce_build_sanity()
235 254
    # these must not exist
236 255
    if [ -d "${BUILD_DEPENDENCY_SUBDIR}" ]
237 256
    then
238
-      fail "A previous build left ${BUILD_DEPENDENCY_SUBDIR} can't continue"
239
-   fi
240
-
241
-   if [ -d "${builddir}" -a "${CLEAN_BEFORE_BUILD}" != "" ]
242
-   then
243
-      rmdir_safer "${builddir}"
257
+      fail "A previous build left ${BUILD_DEPENDENCY_SUBDIR}, can't continue"
244 258
    fi
245 259
 }
246 260
 
... ...
@@ -279,6 +293,43 @@ cmake_sdk_parameter()
279 293
    fi
280 294
 }
281 295
 
296
+
297
+
298
+create_dummy_dirs_against_warnings()
299
+{
300
+   local relative
301
+   local suffix
302
+
303
+   builddir="$1"
304
+   configuration="$2"
305
+   suffix="$3"
306
+   relative="$4"
307
+
308
+   local owd
309
+
310
+   owd="${PWD}"
311
+
312
+   # to avoid warnings make sure directories are all there
313
+   [ ! -e "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${HEADER_DIR_NAME}" ]  &&  \
314
+      mkdir_if_missing "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${HEADER_DIR_NAME}"
315
+   [ ! -e "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}/${configuration}" ]  &&  \
316
+      mkdir_if_missing "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}/${configuration}"
317
+   [ ! -e "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}${suffix}" ]  &&  \
318
+      mkdir_if_missing "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}${suffix}"
319
+
320
+
321
+   mkdir_if_missing "${builddir}"
322
+   exekutor cd "${builddir}" ||  fail "failed to enter ${builddir}"
323
+
324
+      # check that relative is right
325
+   exekutor [ -d "${relative}/${REFERENCE_DEPENDENCY_SUBDIR}/${HEADER_DIR_NAME}" ] || internal_fail "${relative} is wrong"
326
+   exekutor [ -d "${relative}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}/${configuration}" ] || internal_fail "${relative} is wrong"
327
+   exekutor [ -d "${relative}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}${suffix}" ] || internal_fail "${relative} is wrong"
328
+
329
+   exekutor cd "${owd}" ||  fail "failed to enter ${owd}"
330
+}
331
+
332
+
282 333
 #
283 334
 # remove old builddir, create a new one
284 335
 # depending on configuration cmake with flags
... ...
@@ -319,23 +370,12 @@ ${C_MAGENTA}${name}${C_INFO} for SDK ${C_MAGENTA}${sdk}${C_INFO} ..."
319 370
    other_cppflags="`gcc_cppflags_value "${name}"`"
320 371
    other_ldflags="`gcc_ldflags_value "${name}"`"
321 372
 
322
-   owd="${PWD}"
323
-   # to avoid warning make sure directories are all there
324
-   # TODO: I DONT LIKE THIS
325
-   [ ! -e "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${HEADER_DIR_NAME}" ]  &&  \
326
-      mkdir_if_missing "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${HEADER_DIR_NAME}"
327
-   [ ! -e "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${HEADER_DIR_NAME}" ]  &&  \
328
-      mkdir_if_missing "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}/${configuration}"
329
-   [ ! -e "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${HEADER_DIR_NAME}" ]  &&  \
330
-      mkdir_if_missing "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}${suffix}"
331 373
 
332
-   mkdir_if_missing "${builddir}"
333
-   exekutor cd "${builddir}" || exit 1
374
+   create_dummy_dirs_against_warnings "${builddir}" "${configuration}" "${suffix}" "${relative}"
334 375
 
335
-      # check that relative ise right
336
-      exekutor [ -d "${relative}/${REFERENCE_DEPENDENCY_SUBDIR}/${HEADER_DIR_NAME}" ] || exit 1
337
-      exekutor [ -d "${relative}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}/${configuration}" ] || exit 1
338
-      exekutor [ -d "${relative}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}${suffix}" ] || exit 1
376
+   owd="${PWD}"
377
+   mkdir_if_missing "${builddir}"
378
+   exekutor cd "${builddir}" || fail "failed to enter ${builddir}"
339 379
 
340 380
       #
341 381
       # cmake doesn't seem to "get" CMAKE_CXX_FLAGS or -INCLUDE
... ...
@@ -367,18 +407,19 @@ ${sdk}" \
367 407
 -F${relative}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME} \
368 408
 ${other_ldflags} \
369 409
 ${sdk}" \
370
-"${relative}/${srcdir}" 1>&2  || exit 1
410
+"${relative}/${srcdir}" 1>&2  || fail "cmake failed for ${srcdir}" 1
371 411
 
372
-      exekutor make all install 1>&2 || exit 1
412
+      exekutor make all install 1>&2 || fail "make install failed for ${srcdir}" 1
373 413
 
374 414
       set +f
375 415
 
376 416
    exekutor cd "${owd}"
377 417
 
378
-   collect_and_dispense_product "${suffix}" || exit 1
418
+   collect_and_dispense_product "${name}" "${suffix}" || internal_fail "collect failed silently"
379 419
 }
380 420
 
381 421
 
422
+
382 423
 #
383 424
 # remove old builddir, create a new one
384 425
 # depending on configuration cmake with flags
... ...
@@ -408,36 +449,25 @@ build_configure()
408 449
 ${C_MAGENTA}${name}${C_INFO} for SDK ${C_MAGENTA}${sdk}${C_INFO} ..."
409 450
 
410 451
 
411
-   mapped=`read_build_setting "$name" "configure-${configuration}.map" "${configuration}"`
412
-   suffix=`determine_suffix "${configuration}" "${sdk}"`
413
-   sdk=`gcc_sdk_parameter "${sdk}"`
452
+   mapped="`read_build_setting "$name" "configure-${configuration}.map" "${configuration}"`"
453
+   suffix="`determine_suffix "${configuration}" "${sdk}"`"
454
+   sdk="`gcc_sdk_parameter "${sdk}"`"
414 455
 
415 456
    local other_cflags
416 457
    local other_cppflags
417 458
    local other_ldflags
418 459
 
419
-   other_cflags=`gcc_cflags_value "${name}"`
420
-   other_cppflags=`gcc_cppflags_value "${name}"`
421
-   other_ldflags=`gcc_ldflags_value "${name}"`
422
-
423
-   owd="${PWD}"
424
-   # to avoid warnings make sure directories are all there
425
-   [ ! -e "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${HEADER_DIR_NAME}" ]  &&  \
426
-      mkdir_if_missing "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${HEADER_DIR_NAME}"
427
-   [ ! -e "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${HEADER_DIR_NAME}" ]  &&  \
428
-      mkdir_if_missing "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}/${configuration}"
429
-   [ ! -e "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${HEADER_DIR_NAME}" ]  &&  \
430
-      mkdir_if_missing "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}${suffix}"
460
+   other_cflags="`gcc_cflags_value "${name}"`"
461
+   other_cppflags="`gcc_cppflags_value "${name}"`"
462
+   other_ldflags="`gcc_ldflags_value "${name}"`"
431 463
 
432
-   mkdir_if_missing "${builddir}" 2> /dev/null
433
-   exekutor cd "${builddir}" || exit 1
464
+   create_dummy_dirs_against_warnings "${builddir}" "${configuration}" "${suffix}" "${relative}"
434 465
 
435
-      # check that relative is right
436
-      exekutor [ -d "${relative}/${REFERENCE_DEPENDENCY_SUBDIR}/${HEADER_DIR_NAME}" ] || exit 1
437
-      exekutor [ -d "${relative}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}/${configuration}" ] || exit 1
438
-      exekutor [ -d "${relative}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}${suffix}" ] || exit 1
466
+   owd="${PWD}"
467
+   mkdir_if_missing "${builddir}"
468
+   exekutor cd "${builddir}" || fail "failed to enter ${builddir}"
439 469
 
440
-      set -f
470
+       set -f
441 471
 
442 472
       # use absolute paths for configure, safer (and easier to read IMO)
443 473
       CFLAGS="\
... ...
@@ -471,7 +501,7 @@ ${sdk}" \
471 501
 
472 502
    exekutor cd "${owd}"
473 503
 
474
-   collect_and_dispense_product "${suffix}" || exit 1
504
+   collect_and_dispense_product "${name}" "${suffix}" || exit 1
475 505
 }
476 506
 
477 507
 
... ...
@@ -563,7 +593,7 @@ fixup_header_path()
563 593
    headers="`read_repo_setting "${name}" "${setting_key}"`"
564 594
    if [ "$headers" = "" ]
565 595
    then
566
-      read_yes_no_build_setting "${name}" "xcode_mangle_header_settings"
596
+      read_yes_no_build_setting "${name}" "xcode_mangle_header_paths"
567 597
       if [ $? -ne 0 ]
568 598
       then
569 599
          return 1
... ...
@@ -751,9 +781,9 @@ ${info} ..."
751 781
    local default
752 782
 
753 783
    default="/include/${name}"
754
-   public_headers="`fixup_header_path "PUBLIC_HEADERS_FOLDER_PATH" "public_headers" "${name}" "${default}" ${arguments}`"
784
+   public_headers="`fixup_header_path "PUBLIC_HEADERS_FOLDER_PATH" "xcode_public_headers" "${name}" "${default}" ${arguments}`"
755 785
    default="/include/${name}/private"
756
-   private_headers="`fixup_header_path "PRIVATE_HEADERS_FOLDER_PATH" "private_headers" "${name}" "${default}" ${arguments}`"
786
+   private_headers="`fixup_header_path "PRIVATE_HEADERS_FOLDER_PATH" "xcode_private_headers" "${name}" "${default}" ${arguments}`"
757 787
 
758 788
    owd=`pwd`
759 789
    cd "${srcdir}" || exit 1
... ...
@@ -870,7 +900,7 @@ FRAMEWORK_SEARCH_PATHS='${dependencies_framework_search_path}'"
870 900
 
871 901
    cd "${owd}"
872 902
 
873
-   collect_and_dispense_product "${suffix}" "YES" || exit 1
903
+   collect_and_dispense_product "${name}" "${suffix}" "YES" || exit 1
874 904
 }
875 905
 
876 906
 
... ...
@@ -884,8 +914,9 @@ build_xcodebuild_schemes_or_target()
884 914
    name="$5"
885 915
    project="$7"
886 916
 
887
-   if [ -d "${builddir}" -a "${CLEAN_BEFORE_BUILD}" != "" ]
917
+   if [ -d "${builddir}" -a "${CLEAN_BEFORE_BUILD}" = "YES" ]
888 918
    then
919
+      log_fluff "Cleaning build directory \"${builddir}\""
889 920
       rmdir_safer "${builddir}"
890 921
    fi
891 922
 
... ...
@@ -1210,27 +1241,31 @@ install_tars()
1210 1241
 
1211 1242
 main()
1212 1243
 {
1213
-   local  no_clean
1244
+   local  clean
1214 1245
 
1215 1246
    log_fluff "::: build :::"
1216 1247
 
1217
-   log_fluff "Setting up ${DEPENDENCY_SUBDIR}"
1218
-   no_clean="`read_config_setting "dont_clean_dependencies_before_build"`"
1219
-   if [ "${no_clean}" != "YES" ]
1220
-   then
1221
-      rmdir_safer "${DEPENDENCY_SUBDIR}"
1222
-   fi
1223
-
1224
-
1225 1248
    #
1226 1249
    # START
1227 1250
    #
1228 1251
    if [ ! -d "${CLONES_SUBDIR}" ]
1229 1252
    then
1230
-      log_fluff "No repos fetched, nothing to do."
1253
+      log_info "No repos fetched, so nothing to build."
1231 1254
       return 0
1232 1255
    fi
1233 1256
 
1257
+   if [ $# -eq 0 ]
1258
+   then
1259
+      log_fluff "Setting up ${DEPENDENCY_SUBDIR}"
1260
+      clean="`read_config_setting "clean_dependencies_before_build" "YES"`"
1261
+      if [ "${clean}" = "YES" ]
1262
+      then
1263
+         rmdir_safer "${DEPENDENCY_SUBDIR}"
1264
+      fi
1265
+   else
1266
+      log_fluff "Keep \"${DEPENDENCY_SUBDIR}\" intact, as this is a partial build"
1267
+   fi
1268
+
1234 1269
    # if present then we didnt't want to clean and we do nothing special
1235 1270
    if [ ! -d "${DEPENDENCY_SUBDIR}" ]
1236 1271
    then
... ...
@@ -10,6 +10,7 @@ ${DEPENDENCY_SUBDIR}/tmp"`"
10 10
 OUTPUT_CLEANABLE_SUBDIRS="`read_sane_config_path_setting "output_clean_folders" "${DEPENDENCY_SUBDIR}"`"
11 11
 DIST_CLEANABLE_SUBDIRS="`read_sane_config_path_setting "dist_clean_folders" "${CLONES_SUBDIR}
12 12
 .bootstrap.auto"`"
13
+CLEAN_EMPTY_PARENTS="`read_sane_config_path_setting "clean_empty_parent_folders" "YES"`"
13 14
 
14 15
 
15 16
 usage()
... ...
@@ -66,6 +67,38 @@ clean_asserted_folder()
66 67
 }
67 68
 
68 69
 
70
+clean_parent_folders_if_empty()
71
+{
72
+   local dir
73
+   local stop
74
+
75
+   if [ "${CLEAN_EMPTY_PARENTS}" = "YES" ]
76
+   then
77
+      dir="$1"
78
+      stop="$2"
79
+
80
+      local parent
81
+
82
+      parent="${dir}"
83
+      while :
84
+      do
85
+         parent="`dirname "${parent}"`"
86
+         if [ "${parent}" = "." -o "${parent}" = "${stop}" ]
87
+         then
88
+             break
89
+         fi
90
+
91
+         if dir_can_be_rmdir "${parent}"
92
+         then
93
+            assert_sane_subdir_path "${parent}"
94
+            log_info "Deleting \"${parent}\""
95
+            exekutor rmdir "${parent}"
96
+         fi
97
+      done
98
+   fi
99
+}
100
+
101
+
69 102
 #
70 103
 # cleanability is checked, because in some cases its convenient
71 104
 # to have other tools provide stuff besides /include and /lib
... ...
@@ -88,6 +121,7 @@ clean()
88 121
          for dir in ${BUILD_CLEANABLE_SUBDIRS}
89 122
          do
90 123
             clean_asserted_folder "${dir}"
124
+            clean_parent_folders_if_empty "${dir}" "${pwd}"
91 125
             flag="YES"
92 126
          done
93 127
       fi
... ...
@@ -101,6 +135,7 @@ clean()
101 135
          for dir in ${OUTPUT_CLEANABLE_SUBDIRS}
102 136
          do
103 137
             clean_asserted_folder "${dir}"
138
+            clean_parent_folders_if_empty "${dir}" "${pwd}"
104 139
             flag="YES"
105 140
          done
106 141
       fi
... ...
@@ -114,6 +149,7 @@ clean()
114 149
          for dir in ${DIST_CLEANABLE_SUBDIRS}
115 150
          do
116 151
             clean_asserted_folder "${dir}"
152
+            clean_parent_folders_if_empty "${dir}" "${pwd}"
117 153
             flag="YES"
118 154
          done
119 155
       fi
... ...
@@ -251,7 +251,7 @@ mkdir_if_missing()
251 251
 {
252 252
    if [ ! -d "${1}" ]
253 253
    then
254
-      exekutor mkdir -p "$1" || fail "failed to create directory $1"
254
+      exekutor mkdir -p "$1" || fail "failed to create directory \"$1\""
255 255
    fi
256 256
 }
257 257
 
... ...
@@ -309,15 +309,21 @@ user_say_yes()
309 309
 }
310 310
 
311 311
 
312
-is_dir_empty()
312
+dir_can_be_rmdir()
313 313
 {
314 314
    local empty
315 315
 
316
-   empty=`ls "$1"/* 2> /dev/null` 2> /dev/null
316
+   if [ ! -d "$1" ]
317
+   then
318
+      return 2
319
+   fi
320
+
321
+   empty="`ls -A "$1" 2> /dev/null`"
317 322
    [ "$empty" = "" ]
318 323
 }
319 324
 
320 325
 
326
+# this does not check for hidden files
321 327
 dir_has_files()
322 328
 {
323 329
    local empty
... ...
@@ -329,9 +335,9 @@ dir_has_files()
329 335
 
330 336
    if [ "$result" -eq 1 ]
331 337
    then
332
-      log_fluff "directory \"$1\" has no files"
338
+      log_fluff "Directory \"$1\" has no files"
333 339
    else
334
-      log_fluff "directory \"$1\" has files"
340
+      log_fluff "Directory \"$1\" has files"
335 341
    fi
336 342
    return "$result"
337 343
 }
... ...
@@ -40,7 +40,7 @@ gcc_sdk_parameter()
40 40
    then
41 41
       if [ "${sdk}" != "Default" ]
42 42
       then
43
-         sdkpath=`xcrun --sdk macosx --show-sdk-path`
43
+         sdkpath="`xcrun --sdk macosx --show-sdk-path`"
44 44
          if [ "${sdkpath}" = "" ]
45 45
          then
46 46
             fail "SDK \"${sdk}\" is not installed"
... ...
@@ -65,12 +65,12 @@ gcc_cflags_value()
65 65
 
66 66
    name="${1}"
67 67
 
68
-   result=`get_build_setting "${name}" "OTHER_CFLAGS"`
69
-   value=`get_build_setting "${name}"  "WARNING_CFLAGS"`
70
-   result=`concat "$result" "$value"`
71
-   for i in `get_build_setting "${name}" "GCC_PREPROCESSOR_DEFINITIONS"`
68
+   result="`read_build_setting "${name}" "OTHER_CFLAGS"`"
69
+   value="`read_build_setting "${name}"  "WARNING_CFLAGS"`"
70
+   result="`concat "$result" "$value"`"
71
+   for i in `read_build_setting "${name}" "GCC_PREPROCESSOR_DEFINITIONS"`
72 72
    do
73
-      result=`concat "$result" "-D${i}"`
73
+      result="`concat "$result" "-D${i}"`"
74 74
    done
75 75
 
76 76
    echo "${result}"
... ...
@@ -85,9 +85,9 @@ gcc_cppflags_value()
85 85
 
86 86
    name="${1}"
87 87
 
88
-   result=`get_build_setting "${name}" "OTHER_CPPFLAGS"`
89
-   value=`gcc_cflags_value "${name}"`
90
-   result=`concat "$result" "$value"`
88
+   result="`read_build_setting "${name}" "OTHER_CPPFLAGS"`"
89
+   value="`gcc_cflags_value "${name}"`"
90
+   result="`concat "$result" "$value"`"
91 91
 
92 92
    echo "${result}"
93 93
 }
... ...
@@ -99,7 +99,7 @@ gcc_ldflags_value()
99 99
    local name
100 100
 
101 101
    name="${1}"
102
-   result=`get_build_setting "${name}" "OTHER_LDFLAGS"`
102
+   result="`read_build_setting "${name}" "OTHER_LDFLAGS"`"
103 103
 
104 104
    echo "${result}"
105 105
 }
... ...
@@ -43,17 +43,14 @@ fi
43 43
 
44 44
 BOOTSTRAP_SUBDIR=.bootstrap
45 45
 
46
-NO_DEFAULT_FILES=${1:-""}
47
-shift
48
-NO_EXAMPLE_FILES=${1:-""}
49
-shift
50
-DONT_OPEN_GITS=${1:-""}
51
-shift
46
+
47
+CREATE_DEFAULT_FILES="`read_config_setting "create_default_files" "YES"`"
48
+CREATE_EXAMPLE_FILES="`read_config_setting "create_example_files" "YES"`"
52 49
 
53 50
 
54 51
 if [ -d "${BOOTSTRAP_SUBDIR}" ]
55 52
 then
56
-   echo "${BOOTSTRAP_SUBDIR} already exists" >&2
53
+   log_warning "\"${BOOTSTRAP_SUBDIR}\" already exists"
57 54
    exit 1
58 55
 fi
59 56
 
... ...
@@ -66,18 +63,20 @@ main()
66 63
       then
67 64
         if [ "$project" != "" ]
68 65
         then
69
-           echo "more than one xcodeproj found, cant' deal with it" >&1
70
-           exit 1
66
+           fail "more than one xcodeproj found, cant' deal with it"
71 67
         fi
72 68
         project="$i"
73 69
       fi
74 70
    done
75 71
 
76 72
 
77
-   mkdir -p "${BOOTSTRAP_SUBDIR}" || exit 1
73
+   log_fluff "Create \"${BOOTSTRAP_SUBDIR}\""
74
+   mkdir_if_missing "${BOOTSTRAP_SUBDIR}"
78 75
 
79
-   if [ "${NO_DEFAULT_FILES}" = "" ]
76
+   if [ "${CREATE_DEFAULT_FILES}" = "YES" ]
80 77
    then
78
+      log_fluff "Create default files"
79
+
81 80
       exekutor cat <<EOF > "${BOOTSTRAP_SUBDIR}/brews"
82 81
 # add projects that should be installed by brew
83 82
 # e.g.
... ...
@@ -94,7 +93,7 @@ EOF
94 93
 # add projects that should be cloned with git in order
95 94
 # of their inter-dependencies
96 95
 #
97
-# possible types of repository URIs:
96
+# some possible types of repository specifications:
98 97
 # http://www.mulle-kybernetik.com/repositories/MulleScion
99 98
 # git@github.com:mulle-nat/MulleScion.git
100 99
 # ../MulleScion
... ...
@@ -103,9 +102,11 @@ EOF
103 102
 EOF
104 103
    fi
105 104
 
106
-   if [ "${NO_EXAMPLE_FILES}" = "" ]
105
+   if [ "${CREATE_EXAMPLE_FILES}" = "YES" ]
107 106
    then
108
-      mkdir -p "${BOOTSTRAP_SUBDIR}/settings/MulleScion.example/bin" || exit 1
107
+     log_fluff "Create example repository settings"
108
+
109
+      mkdir_if_missing "${BOOTSTRAP_SUBDIR}/settings/MulleScion.example/bin"
109 110
 
110 111
       exekutor cat <<EOF > "${BOOTSTRAP_SUBDIR}/settings/MulleScion.example/tag"
111 112
 # specify a tag or branch for a project named MulleScion
... ...
@@ -120,20 +121,20 @@ EOF
120 121
 EOF
121 122
 
122 123
       exekutor cat <<EOF > "${BOOTSTRAP_SUBDIR}/settings/MulleScion.example/project"
123
-# Specify a xcodeproj to compile in project MulleScion instead of default
124
+# Specify a xcodeproj to compile in project MulleScion instead of the default
124 125
 # leave commented out or delete file for default project
125 126
 # mulle-scion
126 127
 EOF
127 128
 
128 129
       exekutor cat <<EOF > "${BOOTSTRAP_SUBDIR}/settings/MulleScion.example/scheme"
129
-# Specify a scheme to compile in project MulleScion instead of default
130
+# Specify a scheme to compile in project MulleScion instead of the default
130 131
 # Might bite itself with TARGET, so only specify one.
131 132
 # leave commented out or delete file for default scheme
132 133
 # mulle-scion
133 134
 EOF
134 135
 
135 136
       exekutor cat <<EOF > "${BOOTSTRAP_SUBDIR}/settings/MulleScion.example/target"
136
-# Specify a target to compile in project MulleScion instead of default.
137
+# Specify a target to compile in project MulleScion instead of the default.
137 138
 # Might bite itself with SCHEME, so only specify one.
138 139
 # leave commented out or delete file for default scheme
139 140
 # mulle-scion
... ...
@@ -157,14 +158,29 @@ EOF
157 158
 EOF
158 159
 #chmod 755 "${BOOTSTRAP_SUBDIR}/MulleScion.example/bin/post-upgrade.sh"
159 160
 
160
-   fi
161
+  fi
161 162
 
162
-   echo "${BOOTSTRAP_SUBDIR} folder has been set up. Now add your gits to ${BOOTSTRAP_SUBDIR}/gits"
163
+  log_info "${BOOTSTRAP_SUBDIR} folder has been set up. Now add your gits to ${BOOTSTRAP_SUBDIR}/gits"
163 164
 
164
-   if [ "${DONT_OPEN_GITS}" = "" -a "${NO_DEFAULT_FILES}" = "" ]
165
-   then
166
-       exekutor open -e "${BOOTSTRAP_SUBDIR}/gits"
167
-   fi
165
+  local open
166
+
167
+  open="`read_config_setting "open_gits_file" "ASK"`"
168
+  if [ "${open}" = "ASK" ]
169
+  then
170
+    user_say_yes "Edit the \"gits\" file now ?"
171
+    if [ $? -eq 0 ]
172
+    then
173
+       open="YES"
174
+    fi
175
+  fi
176
+
177
+  if [ "${open}" = "YES" ]
178
+  then
179
+     local editor
180
+
181
+     editor="`read_config_setting "editor" "${EDITOR:-vi}"`"
182
+     exekutor $editor "${BOOTSTRAP_SUBDIR}/gits"
183
+  fi
168 184
 }
169 185
 
170 186
 main "$@"
171 187
\ No newline at end of file
... ...
@@ -38,12 +38,6 @@ then
38 38
    BOOTSTRAP_SUBDIR=.bootstrap
39 39
 fi
40 40
 
41
-if [ ! -d "${BOOTSTRAP_SUBDIR}" ]
42
-then
43
-   echo "there is no ${BOOTSTRAP_SUBDIR} here, can't continue" >&2
44
-   exit 1
45
-fi
46
-
47 41
 . mulle-bootstrap-settings.sh
48 42
 
49 43
 
... ...
@@ -52,18 +46,17 @@ MULLE_BOOTSTRAP_TRACE="`read_config_setting "trace"`"
52 46
 case "${MULLE_BOOTSTRAP_TRACE}" in
53 47
    VERBOSE)
54 48
       MULLE_BOOTSTRAP_VERBOSE="YES"
55
-      MULLE_BOOTSTRAP_TRACE_SETTINGS="YES"
56 49
       MULLE_BOOTSTRAP_TRACE="YES"
57 50
       log_trace "VERBOSE trace started"
58 51
       ;;
59 52
    FULL|ALL)
60
-      MULLE_BOOTSTRAP_TRACE_ACCESS_SETTINGS="YES"
61 53
       MULLE_BOOTSTRAP_TRACE_SETTINGS="YES"
62 54
       MULLE_BOOTSTRAP_VERBOSE="YES"
63 55
       MULLE_BOOTSTRAP_TRACE="YES"
64 56
       log_trace "FULL trace started"
65 57
       ;;
66 58
    1848)
59
+      MULLE_BOOTSTRAP_TRACE_SETTINGS="NO"
67 60
       MULLE_BOOTSTRAP_VERBOSE="YES"
68 61
       MULLE_BOOTSTRAP_TRACE="YES"
69 62
       log_trace "1848 trace (set -x) started"
... ...
@@ -83,7 +83,7 @@ _read_setting()
83 83
    [ -r "${file}" ]
84 84
    flag=$?
85 85
 
86
-   if [ "$MULLE_BOOTSTRAP_TRACE_ACCESS_SETTINGS" = "YES" ]
86
+   if [ "$MULLE_BOOTSTRAP_TRACE_SETTINGS" = "YES" ]
87 87
    then
88 88
       local  yesno
89 89
       yesno="not found"
... ...
@@ -100,9 +100,9 @@ _read_setting()
100 100
    fi
101 101
 
102 102
    value=`egrep -v '^#|^[ ]*$' "${file}"`
103
-   if [ "$MULLE_BOOTSTRAP_TRACE_SETTINGS" = "YES" -o "$MULLE_BOOTSTRAP_TRACE_ACCESS_SETTINGS" = "YES" ]
103
+   if [ "$MULLE_BOOTSTRAP_VERBOSE" = "YES"  ]
104 104
    then
105
-      log_trace "setting `basename "${file}"` found in "${file}" to \"${value}\""
105
+      log_fluff "Setting ${C_MAGENTA}`basename "${file}"`${C_FLUFF} found in ${C_WHITE}\"${file}\"${C_FLUFF} to ${C_MAGENTA}\"${value}\"${C_FLUFF}"
106 106
    fi
107 107
 
108 108
    case "${file}" in
109 109
deleted file mode 100644
110 110
deleted file mode 100644
... ...
@@ -1 +0,0 @@
1
-../A
2 0
deleted file mode 100644
... ...
@@ -1,3 +0,0 @@
1
-cmake
2
-configure
3
-xcodebuild
4 0
deleted file mode 100644
... ...
@@ -1,2 +0,0 @@
1
-A
2
-B
3 0
deleted file mode 100644
... ...
@@ -1 +0,0 @@
1
-../B
2 0
deleted file mode 100644
... ...
@@ -1,2 +0,0 @@
1
-iphoneos
2
-iphonesimulator
3 0
deleted file mode 100644
... ...
@@ -1,90 +0,0 @@
1
-# A B C
2
-
3
-## Using xcodebuild
4
-
5
-This directory contains a simple test, where C depends on B, which depends on A.
6
-Issue these commands in a terminal:
7
-
8
-```
9
-cd C
10
-mulle-bootstrap
11
-```
12
-
13
-This should create a `dependencies` folder with the stuff you need in `C`:
14
-
15
-```console
16
-ls -R dependencies
17
-```
18
-
19
-Building the project **C** itself won't work yet, because the `dependencies`
20
-folder is not yet known to the project `C.xcodeproj`.
21
-
22
-```console
23
-xcodebuild  # fails
24
-```
25
-
26
-You could add the search paths to HEADER_SEARCH_PATHS, LIBRATY_SEARCH_PATHS and
27
-FRAMEWORK_SEARCH_PATHS manually, but why bother, when **mulle-bootstrap** can
28
-do it for you:
29
-
30
-```console
31
-mulle-bootstrap  setup-xcode
32
-xcodebuild  # works
33
-cd ..
34
-```
35
-
36
-## Using cmake
37
-
38
-Then try it again with cmake. Here we set up **mulle-bootstrap** to fetch cmake
39
-if not present and to use cmake as the only build tool:
40
-
41
-```console
42
-cd C
43
-mulle-bootstrap clean    # throw away results from "Using xcodebuild"
44
-echo "cmake" >> .bootstrap/brews
45
-mkdir -p .bootstrap/settings
46
-echo "cmake" >> .bootstrap/settings/build_preferences
47
-mulle-bootstrap
48
-```
49
-
50
-Now at this point it can be assumed that C.xcodeproj already has the proper
51
-settings, from doing the example above, but doing it again should be harmless:
52
-
53
-```console
54
-mulle-bootstrap xcode
55
-xcodebuild
56
-```
57
-
58
-In many cases, especially if you didn't change any mulle-bootstrap settings,
59
-you can also easily remove the added settings again:
60
-
61
-```console
62
-mulle-bootstrap xcode remove
63
-xcodebuild  # fails again
64
-cd ..
65
-```
66
-
67
-## Play around with some settings
68
-
69
-
70
-### Clone or symlink from local folder
71
-
72
-Change the `gits` file of C and see what happens
73
-
74
-```console
75
-mulle-bootstrap clean dist
76
-echo "git@github.com:invalid-user/B" > ".bootstrap.local/gits"
77
-mulle-bootstrap
78
-```
79
-
80
-# Big
81
-
82
-This shows a more complicated setup, where **mulle-bootstrap** clones and
83
-builds a xcodebuild based projeczt, a cmake make based project and a configure
84
-based project.
85
-
86
-```console
87
-cd Big
88
-mulle-bootstrap
89
-```
90
-
91 0
similarity index 100%
92 1
rename from test/A/A.xcodeproj/project.pbxproj
93 2
rename to tutorial/A/A.xcodeproj/project.pbxproj
94 3
similarity index 100%
95 4
rename from test/A/CMakeLists.txt
96 5
rename to tutorial/A/CMakeLists.txt
97 6
similarity index 100%
98 7
rename from test/A/src/A.h
99 8
rename to tutorial/A/src/A.h
100 9
similarity index 100%
101 10
rename from test/A/src/A.m
102 11
rename to tutorial/A/src/A.m
103 12
similarity index 100%
104 13
rename from test/B/B.xcodeproj/project.pbxproj
105 14
rename to tutorial/B/B.xcodeproj/project.pbxproj
106 15
similarity index 100%
107 16
rename from test/B/CMakeLists.txt
108 17
rename to tutorial/B/CMakeLists.txt
109 18
similarity index 100%
110 19
rename from test/B/src/B.h
111 20
rename to tutorial/B/src/B.h
112 21
similarity index 100%
113 22
rename from test/B/src/B.m
114 23
rename to tutorial/B/src/B.m
115 24
similarity index 100%
116 25
rename from test/C/C.xcodeproj/project.pbxproj
117 26
rename to tutorial/C/C.xcodeproj/project.pbxproj
118 27
similarity index 100%
119 28
rename from test/C/CMakeLists.txt
120 29
rename to tutorial/C/CMakeLists.txt
121 30
similarity index 100%
122 31
rename from test/C/src/C.h
123 32
rename to tutorial/C/src/C.h
124 33
similarity index 100%
125 34
rename from test/C/src/C.m
126 35
rename to tutorial/C/src/C.m
127 36
new file mode 100644
... ...
@@ -0,0 +1,212 @@
1
+---
2
+layout: post
3
+author: Nat!
4
+title:
5
+open_comments: true
6
+date: 2015-10-02 20:48
7
+---
8
+# "A B C" Tutorial
9
+
10
+This directory contains a simple test with 3 folder A B C, each containing a
11
+minimal Objective-C project.  C depends on B, which depends on A.
12
+A depends on a system library "Foundation", which is a given.
13
+
14
+A.h
15
+
16
+```objectivec
17
+#import <Foundation/Foundation.h>
18
+
19
+@interface A : NSObject
20
+
21
+@end
22
+```
23
+
24
+B imports A, but expects the header to reside in a subdirectory A
25
+
26
+B.h
27
+
28
+```objectivec
29
+#import <A/A.h>
30
+
31
+@interface B : A
32
+
33
+@end
34
+```
35
+
36
+C is quite like B.
37
+
38
+C.h
39
+
40
+```objectivec
41
+#import <B/B.h>
42
+
43
+@interface C : B
44
+
45
+@end
46
+```
47
+
48
+Initially none of the folders contain a `.bootstrap` folder.
49
+
50
+## Using xcodebuild
51
+
52
+
53
+### First problem: the header isn't found
54
+
55
+Try to build B with `xcodebuild`. It will not work, because the header
56
+`<A/A.h>` will not be found.
57
+
58
+The first step is to initalize A for **mulle-bootstrap**. You use
59
+
60
+```console
61
+$ mulle-bootstrap init
62
+```
63
+
64
+At that point a `.bootstrap` will be created with some default
65
+content. Take the option to edit **gists** and you should be in an editor
66
+seeing:
67
+
68
+```shell
69
+# add projects that should be cloned with git in order
70
+# of their inter-dependencies
71
+#
72
+# some possible types of repository specifications:
73
+# http://www.mulle-kybernetik.com/repositories/MulleScion
74
+# git@github.com:mulle-nat/MulleScion.git
75
+# ../MulleScion
76
+# /Volumes/Source/srcM/MulleScion
77
+#
78
+```
79
+Lines starting with a '#' are comments, these are just useless fluff in the
80
+long run, so delete them all, and add a line containing 'A'.
81
+The file now looks like this.
82
+
83
+```
84
+$ cat .bootstrap/gists
85
+A
86
+```
87
+
88
+Alright, ready to bootstrap.  First lets see what **mulle-bootstrap** will do
89
+using the `-n`option
90
+
91
+```console
92
+$ mulle-bootstrap -n
93
+Dry run is active.
94
+mkdir -p .repos
95
+There is a ../A folder in the parent
96
+directory of this project.
97
+Use it instead of cloning A ? (y/N)
98
+```
99
+
100
+**A** will be found in the parent directory, and you have the option to use it, which you should do.
101
+
102
+```console
103
+y
104
+../A is not a git repository (yet ?)
105
+So symlinking is the only way to go.
106
+ln -s -f ../../A .repos/A
107
+[ -e .repos/A ]
108
+
109
+Dry run is active.
110
+No repos fetched, nothing to do.
111
+```
112
+
113
+It can not preview the build stage, because there are no repositories really setup yet.
114
+
115
+The conservative choice now is to do it in two steps. **mulle-bootstrap fetch** and then **mulle-bootstrap build**. **mulle-bootstrap** alone combined both steps into one.
116
+
117
+Lets go with **mulle-bootstrap fetch** first, so we can examine the build
118
+processs afterwards. It will be just like above, but the symlink should be in place now.
119
+
120
+```console
121
+$ mulle-bootstrap -n build
122
+Dry run is active.
123
+mkdir -p dependencies/usr/local/include
124
+ln -s usr/local/include dependencies/include
125
+Do a xcodebuild Debug of A for SDK Default  ...
126
+"xcodebuild" "install"  -project "./A.xcodeproj" -configuration "Debug" ARCHS='${ARCHS_STANDARD_32_64_BIT}' DEPLOYMENT_LOCATION=YES DSTROOT='/Volumes/Source/srcM/mulle-bootstrap/tutorial/B/dependencies/tmp' INSTALL_PATH='/lib/Debug' SYMROOT='/Volumes/Source/srcM/mulle-bootstrap/tutorial/B/build/.repos/Debug/A/' OBJROOT='/Volumes/Source/srcM/mulle-bootstrap/tutorial/B/build/.repos/Debug/A/obj' ONLY_ACTIVE_ARCH=NO SKIP_INSTALL=NO HEADER_SEARCH_PATHS='/Volumes/Source/srcM/mulle-bootstrap/tutorial/B/dependencies/include /usr/local/include /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include' LIBRARY_SEARCH_PATHS='/Volumes/Source/srcM/mulle-bootstrap/tutorial/B/dependencies/include /usr/local/include /Volumes/Source/srcM/mulle-bootstrap/tutorial/B/dependencies/lib/Debug /Volumes/Source/srcM/mulle-bootstrap/tutorial/B/dependencies/lib /usr/local/lib' FRAMEWORK_SEARCH_PATHS='/Volumes/Source/srcM/mulle-bootstrap/tutorial/B/dependencies/include /usr/local/include /Volumes/Source/srcM/mulle-bootstrap/tutorial/B/dependencies/lib/Debug /Volumes/Source/srcM/mulle-bootstrap/tutorial/B/dependencies/lib /usr/local/lib /Volumes/Source/srcM/mulle-bootstrap/tutorial/B/dependencies/Frameworks/Debug /Volumes/Source/srcM/mulle-bootstrap/tutorial/B/dependencies/Frameworks'
127
+Collecting and dispensing "A" "Debug" products
128
+Do a xcodebuild Release of A for SDK Default  ...
129
+"xcodebuild" "install"  -project "./A.xcodeproj" -configuration "Release" ARCHS='${ARCHS_STANDARD_32_64_BIT}' DEPLOYMENT_LOCATION=YES DSTROOT='/Volumes/Source/srcM/mulle-bootstrap/tutorial/B/dependencies/tmp' INSTALL_PATH='/lib/Release' SYMROOT='/Volumes/Source/srcM/mulle-bootstrap/tutorial/B/build/.repos/Release/A/' OBJROOT='/Volumes/Source/srcM/mulle-bootstrap/tutorial/B/build/.repos/Release/A/obj' ONLY_ACTIVE_ARCH=NO SKIP_INSTALL=NO HEADER_SEARCH_PATHS='/Volumes/Source/srcM/mulle-bootstrap/tutorial/B/dependencies/include /usr/local/include /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include' LIBRARY_SEARCH_PATHS='/Volumes/Source/srcM/mulle-bootstrap/tutorial/B/dependencies/include /usr/local/include /Volumes/Source/srcM/mulle-bootstrap/tutorial/B/dependencies/lib/Release /Volumes/Source/srcM/mulle-bootstrap/tutorial/B/dependencies/lib /usr/local/lib' FRAMEWORK_SEARCH_PATHS='/Volumes/Source/srcM/mulle-bootstrap/tutorial/B/dependencies/include /usr/local/include /Volumes/Source/srcM/mulle-bootstrap/tutorial/B/dependencies/lib/Release /Volumes/Source/srcM/mulle-bootstrap/tutorial/B/dependencies/lib /usr/local/lib /Volumes/Source/srcM/mulle-bootstrap/tutorial/B/dependencies/Frameworks/Release /Volumes/Source/srcM/mulle-bootstrap/tutorial/B/dependencies/Frameworks'
130
+Collecting and dispensing "A" "Release" products
131
+```
132
+
133
+As the saying goes "Probieren geht ├╝ber Studieren", so lets do it for real,
134
+and use **mulle-bootstrap** build (or just **mulle-bootstrap**). This creates
135
+a lot of output now shown here.
136
+
137
+In the end we wind up with the "dependencies" folder, which should contain
138
+the following files (`ls -GFR dependencies`):
139
+
140
+~~~
141
+include@
142
+dependencies/lib/Debug/libA.a
143
+dependencies/lib/Release/libA.a
144
+dependencies/usr/local/include/A.h