Browse code

make build systems pluggable, to make it easier to add stuff

Nat! authored on 21-08-2017 15:13:40
Showing 13 changed files
... ...
@@ -41,6 +41,7 @@ src/mulle-bootstrap-common-settings.sh
41 41
 src/mulle-bootstrap-core-options.sh
42 42
 src/mulle-bootstrap-copy.sh
43 43
 src/mulle-bootstrap-defer.sh
44
+src/mulle-bootstrap-dispense.sh
44 45
 src/mulle-bootstrap-dependency-resolve.sh
45 46
 src/mulle-bootstrap-fetch.sh
46 47
 src/mulle-bootstrap-functions.sh
... ...
@@ -66,6 +67,15 @@ src/mulle-bootstrap-xcode.sh
66 67
 src/mulle-bootstrap-zombify.sh
67 68
 )
68 69
 
70
+
71
+set( BUILD_PLUGIN_SCRIPTS
72
+src/mulle-bootstrap-build-plugins/cmake.sh
73
+src/mulle-bootstrap-build-plugins/configure.sh
74
+src/mulle-bootstrap-build-plugins/script.sh
75
+src/mulle-bootstrap-build-plugins/xcodebuild.sh
76
+)
77
+
78
+
69 79
 INSTALL( FILES ${SCRIPTS}
70 80
 PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
71 81
             GROUP_EXECUTE GROUP_READ
... ...
@@ -82,6 +92,12 @@ PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
82 92
             WORLD_EXECUTE WORLD_READ
83 93
 DESTINATION "libexec/mulle-bootstrap")
84 94
 
95
+INSTALL( FILES ${BUILD_PLUGIN_SCRIPTS}
96
+PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
97
+            GROUP_EXECUTE GROUP_READ
98
+            WORLD_EXECUTE WORLD_READ
99
+DESTINATION "libexec/mulle-bootstrap/mulle-bootstrap-build-plugins")
100
+
85 101
 #
86 102
 # CPack and project specific stuff
87 103
 #
... ...
@@ -202,6 +202,13 @@ main()
202 202
       install -v -m "${mode}" "${i}" "${libexec}" || exit 1
203 203
    done
204 204
 
205
+   PLUGIN_DIR="${libexec}/mulle-bootstrap-build-plugins"
206
+   for i in src/mulle-bootstrap-build-plugins/*.sh
207
+   do
208
+      mkdir -p "${PLUGIN_DIR}" 2> /dev/null
209
+      install -v -m "${mode}" "${i}" "${PLUGIN_DIR}" || exit 1
210
+   done
211
+
205 212
    if [ -d "test" ]
206 213
    then
207 214
       # use attractive colors :)
... ...
@@ -263,16 +263,14 @@ bootstrap_libexec_path()
263 263
 
264 264
 bootstrap_init()
265 265
 {
266
-   local libexecpath
267
-
268
-   libexecpath="`bootstrap_libexec_path "$0"`"
269
-   if [ -z "${libexecpath}" ]
266
+   MULLE_BOOTSTRAP_LIBEXEC_PATH="`bootstrap_libexec_path "$0"`"
267
+   if [ -z "${MULLE_BOOTSTRAP_LIBEXEC_PATH}" ]
270 268
    then
271 269
       echo "Fatal Error: Could not find libexec for ${MULLE_EXECUTABLE} ($PWD)" >&2
272 270
       exit 1
273 271
    fi
274 272
 
275
-   PATH="${libexecpath}:$PATH"
273
+   PATH="${MULLE_BOOTSTRAP_LIBEXEC_PATH}:$PATH"
276 274
    export PATH
277 275
 
278 276
    if [ ! -z "${MULLE_BOOTSTRAP_LIBEXEC_TRACE}" ]
... ...
@@ -239,7 +239,7 @@ _bootstrap_auto_create()
239 239
 
240 240
 bootstrap_auto_create()
241 241
 {
242
-   log_debug ":bootstrap_auto_create begin:"
242
+   log_entry ":bootstrap_auto_create begin:" "$@"
243 243
 
244 244
    _bootstrap_auto_create "${BOOTSTRAP_DIR}.auto" "${BOOTSTRAP_DIR}"
245 245
 
... ...
@@ -279,7 +279,7 @@ _bootstrap_merge_expanded_settings_in_front()
279 279
 #
280 280
 _bootstrap_auto_merge_root_settings()
281 281
 {
282
-   log_debug ":_bootstrap_auto_merge_root_settings:"
282
+   log_entry ":_bootstrap_auto_merge_root_settings:" "$@"
283 283
 
284 284
    dst="$1"
285 285
    directory="$2"
286 286
new file mode 100755
... ...
@@ -0,0 +1,378 @@
1
+#! /usr/bin/env bash
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
+#   Redistributions in binary form must reproduce the above copyright notice,
12
+#   this list of conditions and the following disclaimer in the documentation
13
+#   and/or other materials provided with the distribution.
14
+#
15
+#   Neither the name of Mulle kybernetiK nor the names of its contributors
16
+#   may be used to endorse or promote products derived from this software
17
+#   without specific prior written permission.
18
+#
19
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+#   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+#   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
+#   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23
+#   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
+#   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
+#   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
+#   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
+#   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
+#   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
+#   POSSIBILITY OF SUCH DAMAGE.
30
+#
31
+MULLE_BOOTSTRAP_BUILD_PLUGIN_CMAKE_SH="included"
32
+
33
+
34
+find_cmake()
35
+{
36
+   local name="$1"
37
+
38
+   local toolname
39
+
40
+   toolname=`read_build_setting "${name}" "cmake" "cmake"`
41
+   verify_binary "${toolname}" "cmake" "cmake"
42
+}
43
+
44
+
45
+tools_environment_cmake()
46
+{
47
+   local name="$1"
48
+   local srcdir="$2"
49
+
50
+   tools_environment_make "$@"
51
+
52
+   local defaultgenerator
53
+
54
+   defaultgenerator="`platform_cmake_generator "${defaultmake}"`"
55
+   CMAKE="`find_cmake "${name}"`"
56
+   CMAKE_GENERATOR="`read_build_setting "${name}" "cmake_generator" "${defaultgenerator}"`"
57
+}
58
+
59
+
60
+cmake_sdk_parameter()
61
+{
62
+   local sdk="$1"
63
+
64
+   local sdkpath
65
+
66
+   sdkpath=`gcc_sdk_parameter "${sdk}"`
67
+   if [ ! -z "${sdkpath}" ]
68
+   then
69
+      log_fluff "Set cmake -DCMAKE_OSX_SYSROOT to \"${sdkpath}\""
70
+      echo "-DCMAKE_OSX_SYSROOT='${sdkpath}'"
71
+   fi
72
+}
73
+
74
+
75
+build_cmake_flags()
76
+{
77
+   log_entry "build_cmake_flags" "$@"
78
+
79
+   (
80
+      PATH_SEPARATOR=";"
81
+      _build_flags "$@"
82
+   )
83
+}
84
+
85
+#
86
+# remove old builddir, create a new one
87
+# depending on configuration cmake with flags
88
+# build stuff into dependencies
89
+# TODO: cache commandline in a file $ and emit instead of rebuilding it every time
90
+#
91
+build_cmake()
92
+{
93
+   log_entry "build_cmake" "$@"
94
+
95
+   local cmakefile="$1"
96
+   shift
97
+
98
+   local configuration="$1"
99
+   local srcdir="$2"
100
+   local builddir="$3"
101
+   local name="$4"
102
+   local sdk="$5"
103
+
104
+   if [ -z "${CMAKE}" ]
105
+   then
106
+      fail "No cmake available"
107
+   fi
108
+
109
+   if [ -z "${MAKE}" ]
110
+   then
111
+      fail "No make available"
112
+   fi
113
+
114
+   log_info "Let ${C_RESET_BOLD}cmake${C_INFO} do a \
115
+${C_MAGENTA}${C_BOLD}${configuration}${C_INFO} build of \
116
+${C_MAGENTA}${C_BOLD}${name}${C_INFO} for SDK \
117
+${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
118
+
119
+   local sdkparameter
120
+   local local_cmake_flags
121
+   local local_make_flags
122
+
123
+   local_cmake_flags="`read_build_setting "${name}" "CMAKEFLAGS"`"
124
+   sdkparameter="`cmake_sdk_parameter "${sdk}"`"
125
+
126
+   if [ ! -z "${CORES}" ]
127
+   then
128
+      local_make_flags="-j ${CORES}"
129
+   fi
130
+
131
+   local c_compiler_line
132
+   local cxx_compiler_line
133
+
134
+   if [ ! -z "${C_COMPILER}" ]
135
+   then
136
+      c_compiler_line="-DCMAKE_C_COMPILER='${C_COMPILER}'"
137
+   fi
138
+   if [ ! -z "${CXX_COMPILER}" ]
139
+   then
140
+      cxx_compiler_line="-DCMAKE_CXX_COMPILER='${CXX_COMPILER}'"
141
+   fi
142
+
143
+   # linker="`read_build_setting "${name}" "LD"`"
144
+
145
+   # need this now
146
+   mkdir_if_missing "${builddir}"
147
+
148
+   local other_cflags
149
+   local other_cxxflags
150
+   local other_cppflags
151
+   local other_ldflags
152
+
153
+   other_cflags="`gcc_cflags_value "${name}"`"
154
+   other_cxxflags="`gcc_cxxflags_value "${name}"`"
155
+   other_cppflags="`gcc_cppflags_value "${name}"`"
156
+   other_ldflags="`gcc_ldflags_value "${name}"`"
157
+
158
+   local flaglines
159
+   local mapped
160
+
161
+   mapped="`read_build_setting "${name}" "cmake-${configuration}.map" "${configuration}"`"  || exit 1
162
+
163
+   flaglines="`build_cmake_flags "${configuration}" \
164
+                                 "${srcdir}" \
165
+                                 "${builddir}" \
166
+                                 "${name}" \
167
+                                 "${sdk}" \
168
+                                 "${mapped}"`" || exit 1
169
+
170
+   local cppflags
171
+   local ldflags
172
+   local includelines
173
+   local librarylines
174
+   local frameworklines
175
+   local dependenciesdir
176
+
177
+   cppflags="`echo "${flaglines}"        | sed -n '1p'`"
178
+   ldflags="`echo "${flaglines}"         | sed -n '2p'`"
179
+   includelines="`echo "${flaglines}"    | sed -n '6p'`"
180
+   librarylines="`echo "${flaglines}"    | sed -n '7p'`"
181
+   frameworklines="`echo "${flaglines}"  | sed -n '8p'`"
182
+   dependenciesdir="`echo "${flaglines}" | sed -n '9p'`"
183
+
184
+   local addictionsdir
185
+   local binpath
186
+
187
+   addictionsdir="${PWD}/${REFERENCE_ADDICTIONS_DIR}"
188
+   binpath="${dependenciesdir}/bin"
189
+
190
+   # CMAKE_CPP_FLAGS does not exist in cmake
191
+   # so merge into CFLAGS and CXXFLAGS
192
+
193
+   if [ -z "${cppflags}" ]
194
+   then
195
+      other_cppflags="`concat "${other_cppflags}" "${cppflags}"`"
196
+   fi
197
+
198
+   if [ -z "${other_cppflags}" ]
199
+   then
200
+      other_cflags="`concat "${other_cflags}" "${other_cppflags}"`"
201
+      other_cxxflags="`concat "${other_cxxflags}" "${other_cppflags}"`"
202
+   fi
203
+
204
+   if [ -z "${ldflags}" ]
205
+   then
206
+      other_ldflags="`concat "${other_ldflags}" "${ldflags}"`"
207
+   fi
208
+
209
+   local cmake_flags
210
+
211
+   if [ ! -z "${other_cflags}" ]
212
+   then
213
+      cmake_flags="`concat "${cmake_flags}" "-DCMAKE_C_FLAGS='${other_cflags}'"`"
214
+   fi
215
+   if [ ! -z "${other_cxxflags}" ]
216
+   then
217
+      cmake_flags="`concat "${cmake_flags}" "-DCMAKE_CXX_FLAGS='${other_cxxflags}'"`"
218
+   fi
219
+   if [ ! -z "${other_ldflags}" ]
220
+   then
221
+      cmake_flags="`concat "${cmake_flags}" "-DCMAKE_SHARED_LINKER_FLAGS='${other_ldflags}'"`"
222
+      cmake_flags="`concat "${cmake_flags}" "-DCMAKE_EXE_LINKER_FLAGS='${other_ldflags}'"`"
223
+   fi
224
+
225
+   local logfile1
226
+   local logfile2
227
+
228
+   mkdir_if_missing "${BUILDLOGS_DIR}"
229
+
230
+   logfile1="`build_log_name "cmake" "${name}" "${configuration}" "${sdk}"`"
231
+   logfile2="`build_log_name "make" "${name}" "${configuration}" "${sdk}"`"
232
+
233
+#   cmake_keep_builddir="`read_build_setting "${name}" "cmake_keep_builddir" "YES"`"
234
+#   if [ "${cmake_keep_builddir}" != "YES" ]
235
+#   then
236
+#      rmdir_safer "${builddir}"
237
+#   fi
238
+   (
239
+      local owd
240
+      local nativewd
241
+
242
+      owd="${PWD}"
243
+      nativewd="`pwd ${BUILD_PWD_OPTIONS}`"
244
+
245
+      exekutor cd "${builddir}" || fail "failed to enter ${builddir}"
246
+
247
+      # DONT READ CONFIG SETTING IN THIS INDENT
248
+      set -f
249
+
250
+      if [ "$MULLE_FLAG_VERBOSE_BUILD" = "YES" ]
251
+      then
252
+         logfile1="`tty`"
253
+         logfile2="$logfile1"
254
+      fi
255
+      if [ "$MULLE_FLAG_EXEKUTOR_DRY_RUN" = "YES" ]
256
+      then
257
+         logfile1="/dev/null"
258
+         logfile2="/dev/null"
259
+      fi
260
+
261
+      log_verbose "Build logs will be in \"${logfile1}\" and \"${logfile2}\""
262
+
263
+      if [ "${MULLE_FLAG_VERBOSE_BUILD}" = "YES" ]
264
+      then
265
+         local_make_flags="${local_make_flags} VERBOSE=1"
266
+      fi
267
+
268
+      local oldpath
269
+      local rval
270
+
271
+      [ -z "${BUILDPATH}" ] && internal_fail "BUILDPATH not set"
272
+
273
+      oldpath="$PATH"
274
+      PATH="${binpath}:${BUILDPATH}"
275
+
276
+      log_fluff "PATH temporarily set to $PATH"
277
+
278
+      local prefixbuild
279
+
280
+      prefixbuild="`add_cmake_path "${prefixbuild}" "${nativewd}/${BUILD_DEPENDENCIES_DIR}"`"
281
+
282
+      local cmake_dirs
283
+
284
+      if [ ! -z "${dependenciesdir}" ]
285
+      then
286
+         cmake_dirs="-DDEPENDENCIES_DIR='${dependenciesdir}'"
287
+      fi
288
+
289
+      if [ ! -z "${addictionsdir}" ]
290
+      then
291
+         cmake_dirs="`concat "${cmake_dirs}" "-DADDICTIONS_DIR='${addictionsdir}'"`"
292
+      fi
293
+
294
+      #
295
+      # CMAKE_INCLUDE_PATH doesn't really do what one expects it would
296
+      # it's a settinh for the rarely used find_file
297
+      #
298
+      #if [ ! -z "${includelines}" ]
299
+      #then
300
+      #   cmake_dirs="`concat "${cmake_dirs}" "-DCMAKE_INCLUDE_PATH='${includelines}'"`"
301
+      #fi
302
+
303
+      if [ ! -z "${librarylines}" ]
304
+      then
305
+         cmake_dirs="`concat "${cmake_dirs}" "-DCMAKE_LIBRARY_PATH='${librarylines}'"`"
306
+      fi
307
+
308
+      if [ ! -z "${frameworklines}" ]
309
+      then
310
+         cmake_dirs="`concat "${cmake_dirs}" "-DCMAKE_FRAMEWORK_PATH='${frameworklines}'"`"
311
+      fi
312
+
313
+      local relative_srcdir
314
+
315
+      relative_srcdir="`relative_path_between "${owd}/${srcdir}" "${PWD}"`"
316
+      case "${UNAME}" in
317
+         mingw)
318
+            relative_srcdir="`echo "${relative_srcdir}" | tr '/' '\\'  2> /dev/null`"
319
+      esac
320
+
321
+      logging_redirect_eval_exekutor "${logfile1}" "'${CMAKE}'" \
322
+-G "'${CMAKE_GENERATOR}'" \
323
+"-DMULLE_BOOTSTRAP_VERSION=${MULLE_EXECUTABLE_VERSION}" \
324
+"-DCMAKE_BUILD_TYPE='${mapped}'" \
325
+"-DCMAKE_INSTALL_PREFIX:PATH='${prefixbuild}'"  \
326
+"${sdkparameter}" \
327
+"${cmake_dirs}" \
328
+"${cmake_flags}" \
329
+"${c_compiler_line}" \
330
+"${cxx_compiler_line}" \
331
+"${local_cmake_flags}" \
332
+"${CMAKEFLAGS}" \
333
+"'${relative_srcdir}'"
334
+      rval=$?
335
+
336
+      if [ $rval -ne 0 ]
337
+      then
338
+         PATH="${oldpath}"
339
+         build_fail "${logfile1}" "cmake"
340
+      fi
341
+
342
+      logging_redirekt_exekutor "${logfile2}" "${MAKE}" ${MAKE_FLAGS} ${local_make_flags} install
343
+      rval=$?
344
+
345
+      PATH="${oldpath}"
346
+      [ $rval -ne 0 ] && build_fail "${logfile2}" "make"
347
+
348
+      set +f
349
+
350
+   ) || exit 1
351
+}
352
+
353
+
354
+test_cmake()
355
+{
356
+   log_entry "test_cmake" "$@"
357
+
358
+   local configuration="$1"
359
+   local srcdir="$2"
360
+   local builddir="$3"
361
+   local name="$4"
362
+
363
+   if [ ! -f "${srcdir}/CMakeLists.txt" ]
364
+   then
365
+      log_fluff "There is no CMakeLists.txt file in \"${srcdir}\""
366
+      return 1
367
+   fi
368
+
369
+   tools_environment_cmake "${name}" "${srcdir}"
370
+
371
+   if [ -z "${CMAKE}" ]
372
+   then
373
+      log_warning "Found a CMakeLists.txt, but ${C_RESET}${C_BOLD}cmake${C_WARNING} is not installed"
374
+      return 1
375
+   fi
376
+
377
+   return 0
378
+}
0 379
new file mode 100755
... ...
@@ -0,0 +1,262 @@
1
+#! /usr/bin/env bash
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
+#   Redistributions in binary form must reproduce the above copyright notice,
12
+#   this list of conditions and the following disclaimer in the documentation
13
+#   and/or other materials provided with the distribution.
14
+#
15
+#   Neither the name of Mulle kybernetiK nor the names of its contributors
16
+#   may be used to endorse or promote products derived from this software
17
+#   without specific prior written permission.
18
+#
19
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+#   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+#   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
+#   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23
+#   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
+#   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
+#   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
+#   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
+#   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
+#   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
+#   POSSIBILITY OF SUCH DAMAGE.
30
+#
31
+MULLE_BOOTSTRAP_BUILD_PLUGIN_CONFIGURE_SH="included"
32
+
33
+
34
+#
35
+# remove old builddir, create a new one
36
+# depending on configuration cmake with flags
37
+# build stuff into dependencies
38
+#
39
+#
40
+build_configure()
41
+{
42
+   log_debug "build_configure" "$*"
43
+
44
+   local script="$1"
45
+   shift
46
+
47
+   local configuration="$1"
48
+   local srcdir="$2"
49
+   local builddir="$3"
50
+   local name="$4"
51
+   local sdk="$5"
52
+
53
+   if [ -z "${MAKE}" ]
54
+   then
55
+      fail "No make available"
56
+   fi
57
+
58
+   log_info "Let ${C_RESET_BOLD}configure${C_INFO} do a \
59
+${C_MAGENTA}${C_BOLD}${configuration}${C_INFO} build of \
60
+${C_MAGENTA}${C_BOLD}${name}${C_INFO} for SDK \
61
+${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
62
+
63
+   local configure_flags
64
+
65
+   configure_flags="`read_build_setting "${name}" "configure_flags"`"
66
+
67
+#   create_dummy_dirs_against_warnings "${mapped}" "${suffix}"
68
+
69
+   local c_compiler_line
70
+   local cxx_compiler_line
71
+
72
+   if [ ! -z "${C_COMPILER}" ]
73
+   then
74
+      c_compiler_line="CC='${C_COMPILER}'"
75
+   fi
76
+   if [ ! -z "${CXX_COMPILER}" ]
77
+   then
78
+      cxx_compiler_line="CXX='${CXX_COMPILER}'"
79
+   fi
80
+
81
+   mkdir_if_missing "${builddir}"
82
+
83
+   local other_cflags
84
+   local other_cxxflags
85
+   local other_cppflags
86
+   local other_ldflags
87
+
88
+   other_cflags="`gcc_cflags_value "${name}"`"
89
+   other_cxxflags="`gcc_cxxflags_value "${name}"`"
90
+   other_cppflags="`gcc_cppflags_value "${name}"`"
91
+   other_ldflags="`gcc_ldflags_value "${name}"`"
92
+
93
+   local flaglines
94
+   local mapped
95
+
96
+   mapped="`read_build_setting "${name}" "cmake-${configuration}.map" "${configuration}"`"
97
+   flaglines="`build_unix_flags "$@" "${mapped}"`"
98
+
99
+   local cppflags
100
+   local ldflags
101
+   local dependenciesdir
102
+
103
+   cppflags="`echo "${flaglines}" | sed -n '1p'`"
104
+   ldflags="`echo "${flaglines}"  | sed -n '2p'`"
105
+   dependenciesdir="`echo "${flaglines}"  | sed -n '9p'`"
106
+
107
+   local addictionsdir
108
+   local binpath
109
+
110
+   addictionsdir="${nativewd}/${REFERENCE_ADDICTIONS_DIR}"
111
+   binpath="${dependenciesdir}/bin"
112
+
113
+   # CMAKE_CPP_FLAGS does not exist in cmake
114
+   # so merge into CFLAGS and CXXFLAGS
115
+
116
+   if [ -z "${cppflags}" ]
117
+   then
118
+      other_cppflags="`concat "${other_cppflags}" "${cppflags}"`"
119
+   fi
120
+
121
+   if [ -z "${ldflags}" ]
122
+   then
123
+      other_ldflags="`concat "${other_ldflags}" "${ldflags}"`"
124
+   fi
125
+
126
+   local sdkpath
127
+
128
+   sdkpath="`gcc_sdk_parameter "${sdk}"`"
129
+   sdkpath="`echo "${sdkpath}" | sed -e 's/ /\\ /g'`"
130
+
131
+   if [ ! -z "${sdkpath}" ]
132
+   then
133
+      other_cppflags="`concat "-isysroot ${sdkpath}" "${other_cppflags}"`"
134
+      other_ldflags="`concat "-isysroot ${sdkpath}" "${other_ldflags}"`"
135
+   fi
136
+
137
+   local env_flags
138
+
139
+   if [ ! -z "${other_cppflags}" ]
140
+   then
141
+      env_flags="`concat "${cmake_flags}" "CPPFLAGS='${other_cppflags}'"`"
142
+   fi
143
+   if [ ! -z "${other_cflags}" ]
144
+   then
145
+      env_flags="`concat "${cmake_flags}" "CFLAGS='${other_cflags}'"`"
146
+   fi
147
+   if [ ! -z "${other_cxxflags}" ]
148
+   then
149
+      env_flags="`concat "${cmake_flags}" "CXXFLAGS='${other_cxxflags}'"`"
150
+   fi
151
+   if [ ! -z "${other_ldflags}" ]
152
+   then
153
+      env_flags="`concat "${cmake_flags}" "LDFLAGS='${other_ldflags}'"`"
154
+   fi
155
+
156
+   local logfile1
157
+   local logfile2
158
+
159
+   mkdir_if_missing "${BUILDLOGS_DIR}"
160
+
161
+   logfile1="`build_log_name "configure" "${name}" "${configuration}" "${sdk}"`"
162
+   logfile2="`build_log_name "make" "${name}" "${configuration}" "${sdk}"`"
163
+
164
+   (
165
+      local owd
166
+      local nativewd
167
+
168
+      owd="${PWD}"
169
+      nativewd="`pwd ${BUILD_PWD_OPTIONS}`"
170
+
171
+      exekutor cd "${builddir}" || fail "failed to enter ${builddir}"
172
+
173
+      # DONT READ CONFIG SETTING IN THIS INDENT
174
+      set -f
175
+
176
+      if [ "$MULLE_FLAG_VERBOSE_BUILD" = "YES" ]
177
+      then
178
+         logfile1="`tty`"
179
+         logfile2="$logfile1"
180
+      fi
181
+      if [ "$MULLE_FLAG_EXEKUTOR_DRY_RUN" = "YES" ]
182
+      then
183
+         logfile1="/dev/null"
184
+         logfile2="/dev/null"
185
+      fi
186
+
187
+      log_verbose "Build logs will be in \"${logfile1}\" and \"${logfile2}\""
188
+
189
+      local prefixbuild
190
+
191
+      prefixbuild="`add_component "${prefixbuild}" "${nativewd}/${BUILD_DEPENDENCIES_DIR}"`"
192
+
193
+      local oldpath
194
+      local rval
195
+
196
+      oldpath="$PATH"
197
+      PATH="${binpath}:${BUILDPATH}"
198
+
199
+      log_fluff "PATH temporarily set to $PATH"
200
+
201
+       # use absolute paths for configure, safer (and easier to read IMO)
202
+      logging_redirect_eval_exekutor "${logfile1}" \
203
+         DEPENDENCIES_DIR="'${dependenciesdir}'" \
204
+         ADDICTIONS_DIR="'${addictionsdir}'" \
205
+         "${c_compiler_line}" \
206
+         "${cxx_compiler_line}" \
207
+         "${env_flags}" \
208
+         "'${owd}/${script}'" \
209
+         "${configure_flags}" \
210
+         --prefix "'${prefixbuild}'"
211
+      rval=$?
212
+
213
+      if [ $rval -ne 0 ]
214
+      then
215
+         PATH="${oldpath}"
216
+         build_fail "${logfile1}" "configure"
217
+      fi
218
+
219
+      logging_redirekt_exekutor "${logfile2}" "${MAKE}" ${MAKE_FLAGS} install
220
+      rval=$?
221
+
222
+      PATH="${oldpath}"
223
+      [ $rval -ne 0 ] && build_fail "${logfile2}" "make"
224
+
225
+      set +f
226
+
227
+   ) || exit 1
228
+}
229
+
230
+
231
+test_configure()
232
+{
233
+   log_entry "test_configure" "$@"
234
+
235
+   local configuration="$1"
236
+   local srcdir="$2"
237
+   local builddir="$3"
238
+   local name="$4"
239
+
240
+   if [ ! -f "${srcdir}/configure" ]
241
+   then
242
+      log_fluff "No configure script found in \"${srcdir}\""
243
+      return 1
244
+   fi
245
+
246
+   if ! [ -x "${srcdir}/configure" ]
247
+   then
248
+      log_fluff "Configure script in \"${srcdir}\" is not executable"
249
+      return 1
250
+   fi
251
+
252
+   tools_environment_make "${name}" "${srcdir}"
253
+
254
+   if [ -z "${MAKE}" ]
255
+   then
256
+      log_warning "Found a ./configure, but ${C_RESET}${C_BOLD}make${C_WARNING} is not installed"
257
+      return 1
258
+   fi
259
+
260
+   PARAMETER="${srcdir}/configure"
261
+   return 0
262
+}
0 263
new file mode 100755
... ...
@@ -0,0 +1,143 @@
1
+#! /usr/bin/env bash
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
+#   Redistributions in binary form must reproduce the above copyright notice,
12
+#   this list of conditions and the following disclaimer in the documentation
13
+#   and/or other materials provided with the distribution.
14
+#
15
+#   Neither the name of Mulle kybernetiK nor the names of its contributors
16
+#   may be used to endorse or promote products derived from this software
17
+#   without specific prior written permission.
18
+#
19
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+#   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+#   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
+#   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23
+#   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
+#   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
+#   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
+#   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
+#   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
+#   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
+#   POSSIBILITY OF SUCH DAMAGE.
30
+#
31
+MULLE_BOOTSTRAP_BUILD_PLUGIN_SCRIPT_SH="included"
32
+
33
+
34
+
35
+run_log_build_script()
36
+{
37
+   echo "$@"
38
+   run_script "$@"
39
+}
40
+
41
+
42
+build_script()
43
+{
44
+   log_entry "build_script" "$@"
45
+
46
+   local script
47
+
48
+   script="$1"
49
+   shift
50
+
51
+   local configuration="$1"
52
+   local srcdir="$2"
53
+   local builddir="$3"
54
+   local name="$4"
55
+   local sdk="$5"
56
+
57
+   local project
58
+   local schemename
59
+   local targetname
60
+   local logfile
61
+
62
+   mkdir_if_missing "${BUILDLOGS_DIR}"
63
+
64
+   logfile="${BUILDLOGS_DIR}/${name}-${configuration}-${sdk}.script.log"
65
+   logfile="`absolutepath "${logfile}"`"
66
+
67
+   local suffixsubdir
68
+   local binpath
69
+
70
+   suffixsubdir="`determine_dependencies_subdir "${configuration}" "${sdk}" "${OPTION_DISPENSE_STYLE}"`" || exit 1
71
+   binpath="${PWD}/${REFERENCE_DEPENDENCIES_DIR}${suffixsubdir}/bin"
72
+
73
+   log_fluff "Build log will be in: ${C_RESET_BOLD}${logfile}${C_INFO}"
74
+
75
+   mkdir_if_missing "${builddir}"
76
+
77
+   local owd
78
+
79
+   owd=`pwd`
80
+   exekutor cd "${srcdir}" || exit 1
81
+
82
+      if [ "$MULLE_FLAG_VERBOSE_BUILD" = "YES" ]
83
+      then
84
+         logfile="`tty`"
85
+      fi
86
+      if [ "$MULLE_FLAG_EXEKUTOR_DRY_RUN" = "YES" ]
87
+      then
88
+         logfile="/dev/null"
89
+      fi
90
+
91
+      log_info "Let ${C_RESET_BOLD}script${C_INFO} do a \
92
+${C_MAGENTA}${C_BOLD}${configuration}${C_INFO} build of \
93
+${C_MAGENTA}${C_BOLD}${name}${C_INFO} for SDK \
94
+${C_MAGENTA}${C_BOLD}${sdk}${C_INFO}${info} in \
95
+\"${builddir}\" ..."
96
+
97
+      local oldpath
98
+      local rval
99
+
100
+      oldpath="${PATH}"
101
+      PATH="${binpath}:${BUILDPATH}"
102
+
103
+      log_fluff "PATH temporarily set to $PATH"
104
+
105
+      run_log_build_script "${owd}/${script}" \
106
+         "${configuration}" \
107
+         "${owd}/${srcdir}" \
108
+         "${owd}/${builddir}" \
109
+         "${owd}/${BUILD_DEPENDENCIES_DIR}" \
110
+         "${name}" \
111
+         "${sdk}" > "${logfile}"
112
+      rval=$?
113
+
114
+      PATH="${oldpath}"
115
+      [ $rval -ne 0 ] && build_fail "${logfile}" "build.sh"
116
+
117
+   exekutor cd "${owd}"
118
+}
119
+
120
+
121
+
122
+test_script()
123
+{
124
+   log_entry "test_script" "$@"
125
+
126
+   local configuration="$1"
127
+   local srcdir="$2"
128
+   local builddir="$3"
129
+   local name="$4"
130
+
131
+   local script
132
+
133
+   script="`find_build_setting_file "${name}" "bin/build.sh"`"
134
+   if [ ! -x "${script}" ]
135
+   then
136
+      [ ! -e "${script}" ] || fail "script ${script} is not executable"
137
+      log_fluff "There is no build script in \"`build_setting_path "${name}" "bin/build.sh"`\""
138
+      return 1
139
+   fi
140
+
141
+   PARAMETER="${script}"
142
+   return 0
143
+}
0 144
new file mode 100755
... ...
@@ -0,0 +1,484 @@
1
+#! /usr/bin/env bash
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
+#   Redistributions in binary form must reproduce the above copyright notice,
12
+#   this list of conditions and the following disclaimer in the documentation
13
+#   and/or other materials provided with the distribution.
14
+#
15
+#   Neither the name of Mulle kybernetiK nor the names of its contributors
16
+#   may be used to endorse or promote products derived from this software
17
+#   without specific prior written permission.
18
+#
19
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+#   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+#   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
+#   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23
+#   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
+#   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
+#   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
+#   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
+#   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
+#   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
+#   POSSIBILITY OF SUCH DAMAGE.
30
+#
31
+MULLE_BOOTSTRAP_BUILD_PLUGIN_XCODEBUILD_SH="included"
32
+
33
+
34
+find_xcodebuild()
35
+{
36
+   local name="$1"
37
+
38
+   local toolname
39
+
40
+   toolname=`read_build_setting "${name}" "xcodebuild" "xcodebuild"`
41
+   verify_binary "${toolname}" "xcodebuild" "xcodebuild"
42
+}
43
+
44
+
45
+
46
+tools_environment_xcodebuild()
47
+{
48
+   local name="$1"
49
+   local srcdir="$2"
50
+
51
+   tools_environment_common "$@"
52
+
53
+   XCODEBUILD="`find_xcodebuild "${name}"`"
54
+}
55
+
56
+
57
+_xcode_get_setting()
58
+{
59
+   eval_exekutor "xcodebuild -showBuildSettings $*" || fail "failed to read xcode settings"
60
+}
61
+
62
+
63
+xcode_get_setting()
64
+{
65
+   local key=$1; shift
66
+
67
+   _xcode_get_setting "$@" | egrep "^[ ]*${key}" | sed 's/^[^=]*=[ ]*\(.*\)/\1/'
68
+
69
+   return 0
70
+}
71
+
72
+
73
+_build_xcodebuild()
74
+{
75
+   log_entry "_build_xcodebuild" "$@"
76
+
77
+   local project="$1"
78
+   local configuration="$2"
79
+   local srcdir="$3"
80
+   local builddir="$4"
81
+   local name="$5"
82
+   local sdk="$6"
83
+   local schemename="$7"
84
+   local targetname="$8"
85
+
86
+   [ ! -z "${configuration}" ] || internal_fail "configuration is empty"
87
+   [ ! -z "${srcdir}" ]        || internal_fail "srcdir is empty"
88
+   [ ! -z "${builddir}" ]      || internal_fail "builddir is empty"
89
+   [ ! -z "${name}" ]          || internal_fail "name is empty"
90
+   [ ! -z "${sdk}" ]           || internal_fail "sdk is empty"
91
+   [ ! -z "${project}" ]       || internal_fail "project is empty"
92
+
93
+
94
+   local toolname
95
+
96
+   toolname="`read_config_setting "xcodebuild" "xcodebuild"`"
97
+
98
+   local info
99
+
100
+   info=""
101
+   if [ ! -z "${targetname}" ]
102
+   then
103
+      info=" Target ${C_MAGENTA}${C_BOLD}${targetname}${C_INFO}"
104
+   fi
105
+
106
+   if [ ! -z "${schemename}" ]
107
+   then
108
+      info=" Scheme ${C_MAGENTA}${C_BOLD}${schemename}${C_INFO}"
109
+   fi
110
+
111
+   log_info "Let ${C_RESET_BOLD}${toolname}${C_INFO} do a \
112
+${C_MAGENTA}${C_BOLD}${configuration}${C_INFO} build of \
113
+${C_MAGENTA}${C_BOLD}${name}${C_INFO} for SDK \
114
+${C_MAGENTA}${C_BOLD}${sdk}${C_INFO}${info} in \
115
+\"${builddir}\" ..."
116
+
117
+   local projectname
118
+
119
+    # always pass project directly
120
+   projectname=`read_build_setting "${name}" "xcode_project" "${project}"`
121
+
122
+   local mapped
123
+   local fallback
124
+
125
+   fallback="`echo "${OPTION_CONFIGURATIONS}" | tail -1`"
126
+   fallback="`read_build_setting "${name}" "fallback-configuration" "${fallback}"`"
127
+
128
+   mapped=`read_build_setting "${name}" "${configuration}.map" "${configuration}"`
129
+   [ -z "${mapped}" ] && internal_fail "mapped configuration is empty"
130
+
131
+   local hackish
132
+   local targetname
133
+   local suffix
134
+
135
+   suffix="${mapped}"
136
+   if [ "${sdk}" != "Default" ]
137
+   then
138
+      hackish="`echo "${sdk}" | sed 's/^\([a-zA-Z]*\).*$/\1/g'`"
139
+      suffix="${suffix}-${hackish}"
140
+   else
141
+      sdk=
142
+   fi
143
+
144
+#   create_dummy_dirs_against_warnings "${mapped}" "${suffix}"
145
+
146
+   local mappedsubdir
147
+   local fallbacksubdir
148
+   local suffixsubdir
149
+   local binpath
150
+
151
+   suffixsubdir="`determine_dependencies_subdir "${configuration}" "${sdk}" "${OPTION_DISPENSE_STYLE}"`" || exit 1
152
+   mappedsubdir="`determine_dependencies_subdir "${mapped}" "${sdk}" "${OPTION_DISPENSE_STYLE}"`" || exit 1
153
+   fallbacksubdir="`determine_dependencies_subdir "${fallback}" "${sdk}" "${OPTION_DISPENSE_STYLE}"`" || exit 1
154
+   binpath="${PWD}/${REFERENCE_DEPENDENCIES_DIR}${suffixsubdir}/bin"
155
+
156
+   local xcode_proper_skip_install
157
+   local skip_install
158
+
159
+   skip_install=
160
+   xcode_proper_skip_install=`read_build_setting "${name}" "xcode_proper_skip_install" "NO"`
161
+   if [ "$xcode_proper_skip_install" != "YES" ]
162
+   then
163
+      skip_install="SKIP_INSTALL=NO"
164
+   fi
165
+
166
+   #
167
+   # xctool needs schemes, these are often autocreated, which xctool cant do
168
+   # xcodebuild can just use a target
169
+   # xctool is by and large useless fluff IMO
170
+   #
171
+   if [ "${toolname}" = "xctool"  -a "${schemename}" = ""  ]
172
+   then
173
+      if [ ! -z "$targetname" ]
174
+      then
175
+         schemename="${targetname}"
176
+         targetname=
177
+      else
178
+         echo "Please specify a scheme to compile in ${BOOTSTRAP_DIR}/${name}/SCHEME for xctool" >& 2
179
+         echo "and be sure that this scheme exists and is shared." >& 2
180
+         echo "Or just delete ${HOME}/.mulle-bootstrap/xcodebuild and use xcodebuild (preferred)" >& 2
181
+         exit 1
182
+      fi
183
+   fi
184
+
185
+   local key
186
+   local aux
187
+   local value
188
+   local keys
189
+
190
+   aux=
191
+   keys=`all_build_flag_keys "${name}"`
192
+   for key in ${keys}
193
+   do
194
+      value=`read_build_setting "${name}" "${key}"`
195
+      aux="${aux} ${key}=${value}"
196
+   done
197
+
198
+   # now don't load any settings anymoe
199
+   local owd
200
+   local command
201
+
202
+   if [ "${MULLE_FLAG_EXEKUTOR_DRY_RUN}" = "YES" ]
203
+   then
204
+      command=-showBuildSettings
205
+   else
206
+      command=install
207
+   fi
208
+
209
+   #
210
+   # headers are complicated, the preference is to get it uniform into
211
+   # dependencies/include/libraryname/..
212
+   #
213
+
214
+   local public_headers
215
+   local private_headers
216
+   local default
217
+
218
+   default="/include/${name}"
219
+   public_headers="`fixup_header_path "PUBLIC_HEADERS_FOLDER_PATH" "xcode_public_headers" "${name}" "${default}" ${arguments}`"
220
+   default="/include/${name}/private"
221
+   private_headers="`fixup_header_path "PRIVATE_HEADERS_FOLDER_PATH" "xcode_private_headers" "${name}" "${default}" ${arguments}`"
222
+
223
+   local logfile
224
+
225
+   mkdir_if_missing "${BUILDLOGS_DIR}"
226
+
227
+   logfile="`build_log_name "${toolname}" "${name}" "${configuration}" "${targetname}" "${schemename}" "${sdk}"`"
228
+
229
+   set -f
230
+
231
+   arguments=""
232
+   if [ ! -z "${projectname}" ]
233
+   then
234
+      arguments="${arguments} -project \"${projectname}\""
235
+   fi
236
+   if [ ! -z "${sdk}" ]
237
+   then
238
+      arguments="${arguments} -sdk \"${sdk}\""
239
+   fi
240
+   if [ ! -z "${schemename}" ]
241
+   then
242
+      arguments="${arguments} -scheme \"${schemename}\""
243
+   fi
244
+   if [ ! -z "${targetname}" ]
245
+   then
246
+      arguments="${arguments} -target \"${targetname}\""
247
+   fi
248
+   if [ ! -z "${mapped}" ]
249
+   then
250
+      arguments="${arguments} -configuration \"${mapped}\""
251
+   fi
252
+
253
+# an empty xcconfig is nice, because it acts as a reset for
254
+   local xcconfig
255
+
256
+   xcconfig=`read_build_setting "${name}" "xcconfig"`
257
+   if [ ! -z "${xcconfig}" ]
258
+   then
259
+      arguments="${arguments} -xcconfig \"${xcconfig}\""
260
+   fi
261
+
262
+   local other_cflags
263
+   local other_cxxflags
264
+   local other_ldflags
265
+
266
+   other_cflags="`gcc_cflags_value "${name}"`"
267
+   other_cxxflags="`gcc_cxxflags_value "${name}"`"
268
+   other_ldflags="`gcc_ldflags_value "${name}"`"
269
+
270
+   if [ ! -z "${other_cflags}" ]
271
+   then
272
+      other_cflags="OTHER_CFLAGS=${other_cflags}"
273
+   fi
274
+   if [ ! -z "${other_cxxflags}" ]
275
+   then
276
+      other_cxxflags="other_cxxflags=${other_cxxflags}"
277
+   fi
278
+   if [ ! -z "${other_ldflags}" ]
279
+   then
280
+      other_ldflags="OTHER_LDFLAGS=${other_ldflags}"
281
+   fi
282
+
283
+   owd=`pwd`
284
+   exekutor cd "${srcdir}" || exit 1
285
+
286
+      # DONT READ CONFIG SETTING IN THIS INDENT
287
+      if [ "${MULLE_FLAG_VERBOSE_BUILD}" = "YES" ]
288
+      then
289
+         logfile="`tty`"
290
+      fi
291
+      if [ "$MULLE_FLAG_EXEKUTOR_DRY_RUN" = "YES" ]
292
+      then
293
+         logfile="/dev/null"
294
+      fi
295
+
296
+      log_verbose "Build log will be in: ${C_RESET_BOLD}${logfile}${C_VERBOSE}"
297
+
298
+      # manually point xcode to our headers and libs
299
+      # this is like manually doing xcode-setup
300
+      local dependencies_framework_search_path
301
+      local dependencies_header_search_path
302
+      local dependencies_lib_search_path
303
+      local inherited
304
+      local path
305
+      local escaped
306
+
307
+      #
308
+      # TODO: need to figure out the correct mapping here
309
+      #
310
+      inherited="`xcode_get_setting HEADER_SEARCH_PATHS ${arguments}`"
311
+      path=`combined_escaped_search_path \
312
+"${owd}/${REFERENCE_DEPENDENCIES_DIR}/${HEADER_DIR_NAME}" \
313
+"${owd}/${REFERENCE_ADDICTIONS_DIR}/${HEADER_DIR_NAME}"`
314
+      if [ -z "${inherited}" ]
315
+      then
316
+         dependencies_header_search_path="${path}"
317
+      else
318
+         dependencies_header_search_path="${path} ${inherited}"
319
+      fi
320
+
321
+      inherited="`xcode_get_setting LIBRARY_SEARCH_PATHS ${arguments}`"
322
+      path=`combined_escaped_search_path_if_exists \
323
+"${owd}/${REFERENCE_DEPENDENCIES_DIR}${mappedsubdir}/${LIBRARY_DIR_NAME}" \
324
+"${owd}/${REFERENCE_DEPENDENCIES_DIR}${fallbacksubdir}/${LIBRARY_DIR_NAME}" \
325
+"${owd}/${REFERENCE_DEPENDENCIES_DIR}/${LIBRARY_DIR_NAME}" \
326
+"${owd}/${REFERENCE_ADDICTIONS_DIR}/${LIBRARY_DIR_NAME}"`
327
+      if [ ! -z "$sdk" ]
328
+      then
329
+         escaped="`escaped_spaces "${owd}/${REFERENCE_DEPENDENCIES_DIR}${mappedsubdir}/${LIBRARY_DIR_NAME}"'-$(EFFECTIVE_PLATFORM_NAME)'`"
330
+         path="${escaped} ${path}" # prepend
331
+      fi
332
+      if [ -z "${inherited}" ]
333
+      then
334
+         dependencies_lib_search_path="${path}"
335
+      else
336
+         dependencies_lib_search_path="${path} ${inherited}"
337
+      fi
338
+
339
+      if [ "${OPTION_ADD_USR_LOCAL}" = "YES" ]
340
+      then
341
+         dependencies_header_search_path="${path} ${USR_LOCAL_INCLUDE}"
342
+         dependencies_lib_search_path="${path} ${USR_LOCAL_LIB}"
343
+      fi
344
+
345
+      inherited="`xcode_get_setting FRAMEWORK_SEARCH_PATHS ${arguments}`"
346
+      path=`combined_escaped_search_path_if_exists \
347
+"${owd}/${REFERENCE_DEPENDENCIES_DIR}${mappedsubdir}/${FRAMEWORK_DIR_NAME}" \
348
+"${owd}/${REFERENCE_DEPENDENCIES_DIR}${fallbacksubdir}/${FRAMEWORK_DIR_NAME}" \
349
+"${owd}/${REFERENCE_DEPENDENCIES_DIR}/${FRAMEWORK_DIR_NAME}" \
350
+"${owd}/${REFERENCE_ADDICTIONS_DIR}/${FRAMEWORK_DIR_NAME}"`
351
+      if [ ! -z "$sdk" ]
352
+      then
353
+         escaped="`escaped_spaces "${owd}/${REFERENCE_DEPENDENCIES_DIR}${mappedsubdir}/${FRAMEWORK_DIR_NAME}"'-$(EFFECTIVE_PLATFORM_NAME)'`"
354
+         path="${escaped} ${path}" # prepend
355
+      fi
356
+      if [ -z "${inherited}" ]
357
+      then
358
+         dependencies_framework_search_path="${path}"
359
+      else
360
+         dependencies_framework_search_path="${path} ${inherited}"
361
+      fi
362
+
363
+      if [ ! -z "${public_headers}" ]
364
+      then
365
+         arguments="${arguments} PUBLIC_HEADERS_FOLDER_PATH='${public_headers}'"
366
+      fi
367
+      if [ ! -z "${private_headers}" ]
368
+      then
369
+         arguments="${arguments} PRIVATE_HEADERS_FOLDER_PATH='${private_headers}'"
370
+      fi
371
+
372
+      local oldpath
373
+      local rval
374
+
375
+      oldpath="${PATH}"
376
+      PATH="${binpath}:${BUILDPATH}"
377
+
378
+      log_fluff "PATH temporarily set to $PATH"
379
+
380
+      # if it doesn't install, probably SKIP_INSTALL is set
381
+      cmdline="\"${XCODEBUILD}\" \"${command}\" ${arguments} \
382
+ARCHS='${ARCHS:-\${ARCHS_STANDARD_32_64_BIT}}' \
383
+DSTROOT='${owd}/${BUILD_DEPENDENCIES_DIR}' \
384
+SYMROOT='${owd}/${builddir}/' \
385
+OBJROOT='${owd}/${builddir}/obj' \
386
+DEPENDENCIES_DIR='${owd}/${REFERENCE_DEPENDENCIES_DIR}${suffixsubdir}' \
387
+ADDICTIONS_DIR='${owd}/${REFERENCE_ADDICTIONS_DIR}' \
388
+ONLY_ACTIVE_ARCH=${ONLY_ACTIVE_ARCH:-NO} \
389
+${skip_install} \
390
+${other_cflags} \
391
+${other_cxxflags} \
392
+${other_ldflags} \
393
+${XCODEBUILD_FLAGS} \
394
+HEADER_SEARCH_PATHS='${dependencies_header_search_path}' \
395
+LIBRARY_SEARCH_PATHS='${dependencies_lib_search_path}' \
396
+FRAMEWORK_SEARCH_PATHS='${dependencies_framework_search_path}'"
397
+
398
+      logging_redirect_eval_exekutor "${logfile}" "${cmdline}"
399
+      rval=$?
400
+
401
+      PATH="${oldpath}"
402
+      [ $rval -ne 0 ] && build_fail "${logfile}" "${toolname}"
403
+      set +f
404
+
405
+   exekutor cd "${owd}"
406
+}
407
+
408
+
409
+build_xcodebuild()
410
+{
411
+   log_entry "build_xcodebuild" "$@"
412
+
413
+   local project="$1"
414
+   local builddir="$4"
415
+   local name="$5"
416
+
417
+   local scheme
418
+   local schemes
419
+
420
+   schemes=`read_build_setting "${name}" "xcode_schemes"`
421
+
422
+   IFS="
423
+"
424
+   for scheme in $schemes
425
+   do
426
+      IFS="${DEFAULT_IFS}"
427
+      log_fluff "Building scheme \"${scheme}\" of \"${project}\" ..."
428
+      _build_xcodebuild "$@" "${scheme}" ""
429
+   done
430
+   IFS="${DEFAULT_IFS}"
431
+
432
+   local target
433
+   local targets
434
+
435
+   targets=`read_build_setting "${name}" "xcode_targets"`
436
+
437
+   IFS="
438
+"
439
+   for target in $targets
440
+   do
441
+      IFS="${DEFAULT_IFS}"
442
+      log_fluff "Building target \"${target}\" of \"${project}\" ..."
443
+      _build_xcodebuild "$@" "" "${target}"
444
+   done
445
+   IFS="${DEFAULT_IFS}"
446
+
447
+   if [ -z "${targets}" -a -z "${schemes}" ]
448
+   then
449
+      log_fluff "Building project \"${project}\" ..."
450
+      _build_xcodebuild "$@"
451
+   fi
452
+}
453
+
454
+
455
+test_xcodebuild()
456
+{
457
+   log_entry "test_xcodebuild" "$@"
458
+
459
+   local configuration="$1"
460
+   local srcdir="$2"
461
+   local builddir="$3"
462
+   local name="$4"
463
+
464
+   project="`(cd "${srcdir}" ; find_xcodeproj "${name}")`"
465
+   if [ -z "${project}" ]
466
+   then
467
+      log_fluff "There is no Xcode project in \"${srcdir}\""
468
+      return 1
469
+   fi
470
+
471
+   tools_environment_xcodebuild "${name}" "${srcdir}"
472
+
473
+   if [ -z "${XCODEBUILD}" ]
474
+   then
475
+      log_fluff "No xcodebuild found."
476
+      return 1
477
+   fi
478
+
479
+   PARAMETER="${project}"
480
+   WASXCODE="YES"
481
+
482
+   return 0
483
+}
484
+
... ...
@@ -95,17 +95,6 @@ EOF
95 95
 }
96 96
 
97 97
 
98
-find_cmake()
99
-{
100
-   local name="$1"
101
-
102
-   local toolname
103
-
104
-   toolname=`read_build_setting "${name}" "cmake" "cmake"`
105
-   verify_binary "${toolname}" "cmake" "cmake"
106
-}
107
-
108
-
109 98
 find_make()
110 99
 {
111 100
    local name="$1"
... ...
@@ -118,17 +107,6 @@ find_make()
118 107
 }
119 108
 
120 109
 
121
-find_xcodebuild()
122
-{
123
-   local name="$1"
124
-
125
-   local toolname
126
-
127
-   toolname=`read_build_setting "${name}" "xcodebuild" "xcodebuild"`
128
-   verify_binary "${toolname}" "xcodebuild" "xcodebuild"
129
-}
130
-
131
-
132 110
 find_compiler()
133 111
 {
134 112
    local name="$1"
... ...
@@ -184,17 +162,6 @@ tools_environment_common()
184 162
 }
185 163
 
186 164
 
187
-tools_environment_xcodebuild()
188
-{
189
-   local name="$1"
190