Browse code

Fix some bugs, make some stuff more convenient.

Nat! authored on 03-05-2016 12:54:47
Showing 9 changed files
... ...
@@ -1,3 +1,17 @@
1
+0.23
2
+===
3
+*  Added -k options to build, to control cleaning before build.
4
+   You can now specify the default configurations to build with -c.
5
+   e.g. `mulle-bootstrap -c "Debug"
6
+*  Improved library and frameworks searchpath generation.
7
+*  You can pass build a "-j <cores>" flag, for cmake/make to parallelize
8
+   the build.
9
+*  Specify `ARCHS='${NATIVE_ARCH_ACTUAL}' mulle-bootstrap build`, when you
10
+   want to override the ARCHS setting for an Xcode build. Kinda hackish.
11
+*  xcodebuild routine does not overwrite `INSTALL_PATH anymore.
12
+*  `clean has **output** as the new default
13
+*  Fix accidental IFS overwrite problem, resulting in git calls failing
14
+
1 15
 0.22
2 16
 ===
3 17
 *  Fix repository order when merging. You should know, that the
... ...
@@ -1,5 +1,6 @@
1
-Use different build dir than just build.
2
-Write "doctor" command to find common problems.
3
-XCodebuild somehow resolves the symbolic link, which makes it use the wrong
4
-dependency library. MUST use absolute paths.
5
-Changes in .repositories should not need to make clean.
6 1
\ No newline at end of file
2
+* Use common dependencies dir
3
+* cmake use local mulle-configuration of subrepo. WRONG!
4
+* Use different build dir than just build.
5
+* Write "doctor" command to find common problems.
6
+* XCodebuild somehow resolves the symbolic link, which makes it use the wrong
7
+  dependency library. MUST use absolute paths.
... ...
@@ -29,7 +29,7 @@
29 29
 #   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 30
 #   POSSIBILITY OF SUCH DAMAGE.
31 31
 
32
-VERSION=0.22
32
+VERSION=0.23
33 33
 
34 34
 #
35 35
 # This is the main user interface to mulle-bootstrap
... ...
@@ -91,6 +91,7 @@ bootstrap_auto_update()
91 91
       for i in $settings
92 92
       do
93 93
          IFS="${old}"
94
+
94 95
          if [ -f "${BOOTSTRAP_SUBDIR}.local/${i}" ]
95 96
          then
96 97
             exekutor cp "${BOOTSTRAP_SUBDIR}.local/${i}" "${BOOTSTRAP_SUBDIR}.tmp/${i}" || exit 1
... ...
@@ -127,7 +128,8 @@ bootstrap_auto_update()
127 128
 "
128 129
    for i in $settings
129 130
    do
130
-      IFS="{old}"
131
+      IFS="${old}"
132
+
131 133
       srcfile="${directory}/.bootstrap/${i}"
132 134
       dstfile="${BOOTSTRAP_SUBDIR}.auto/${i}"
133 135
       settingname="`basename -- "${i}"`"
... ...
@@ -153,7 +155,7 @@ bootstrap_auto_update()
153 155
          log_fluff "Setting \"${settingname}\" is not specified, so not inherited"
154 156
       fi
155 157
    done
156
-   IFS="{old}"
158
+   IFS="${old}"
157 159
 
158 160
    # link scm files over, that we find
159 161
    local relative
... ...
@@ -34,10 +34,38 @@
34 34
 . mulle-bootstrap-scripts.sh
35 35
 
36 36
 
37
+
38
+CLEAN_BEFORE_BUILD=`read_config_setting "clean_before_build" "YES"`
39
+CONFIGURATIONS="`read_build_root_setting "configurations" "Debug
40
+Release"`"
41
+
42
+# get number of cores, use 50% more for make -j
43
+CORES="`get_core_count`"
44
+CORES="`expr $CORES + $CORES / 2`"
45
+
37 46
 check_and_usage_and_help()
38 47
 {
48
+   local defk
49
+   local defc
50
+   local defkk
51
+
52
+   defc="`printf "$CONFIGURATIONS" | tr '\012' ','`"
53
+   if [ "${CLEAN_BEFORE_BUILD}" = "YES" ]
54
+   then
55
+      defk=""
56
+      defkk="(default)"
57
+   else
58
+      defk="(default)"
59
+      defkk=""
60
+   fi
61
+
39 62
    cat <<EOF
40
-usage: build [repos]*
63
+usage: build [-ck] [repos]*
64
+
65
+   -k         :  don't clean before building $defk
66
+   -K         :  always clean before building $defkk
67
+   -c <name>  :  configurations to build ($defc)
68
+   -j         :  number of cores parameter for make (${CORES})
41 69
 
42 70
    You can optionally specify the names of the repositories to build.
43 71
    Currently available names are:
... ...
@@ -46,6 +74,7 @@ EOF
46 74
 }
47 75
 
48 76
 
77
+
49 78
 if [ "$1" = "-h" -o "$1" = "--help" ]
50 79
 then
51 80
    check_and_usage_and_help >&2
... ...
@@ -54,7 +83,53 @@ fi
54 83
 
55 84
 
56 85
 
57
-CLEAN_BEFORE_BUILD=`read_config_setting "clean_before_build" "YES"`
86
+while :
87
+do
88
+   if [ "$1" = "-K" ]
89
+   then
90
+      CLEAN_BEFORE_BUILD="YES"
91
+      [ $# -eq 0 ] || shift
92
+      continue
93
+   fi
94
+
95
+   if [ "$1" = "-k" ]
96
+   then
97
+      CLEAN_BEFORE_BUILD=
98
+      [ $# -eq 0 ] || shift
99
+      continue
100
+   fi
101
+
102
+   if [ "$1" = "-j" ]
103
+   then
104
+      if [ $# -eq 0 ]
105
+      then
106
+         fail "core count missing"
107
+      fi
108
+      shift
109
+
110
+      CORES="$1"
111
+      [ $# -eq 0 ] || shift
112
+      continue
113
+   fi
114
+
115
+   #
116
+   # specify configuration to build
117
+   #
118
+   if [ "$1" = "-c"  ]
119
+   then
120
+      if [ $# -eq 0 ]
121
+      then
122
+         fail "configuration name missing"
123
+      fi
124
+      shift
125
+
126
+      CONFIGURATIONS="`printf "%s" "$1" | tr ',' '\012'`"
127
+      [ $# -eq 0 ] || shift
128
+      continue
129
+   fi
130
+
131
+   break
132
+done
58 133
 
59 134
 #
60 135
 # move stuff produced my cmake and configure to places
... ...
@@ -190,24 +265,27 @@ collect_and_dispense_product()
190 265
 
191 266
       src="${BUILD_DEPENDENCY_SUBDIR}/Frameworks${subdir}"
192 267
       dispense_binaries "${name}" "${src}" "d" "/${FRAMEWORK_DIR_NAME}"
193
-   else
194
-      log_fluff "Choosing cmake/configure dispense path"
195 268
 
196
-      src="${BUILD_DEPENDENCY_SUBDIR}/usr/local/include"
197
-      dispense_headers "${name}" "${src}"
198
-
199
-      src="${BUILD_DEPENDENCY_SUBDIR}/usr/local/lib"
200
-      dispense_binaries "${name}" "${src}" "f" "/${LIBRARY_DIR_NAME}"
269
+      src="${BUILD_DEPENDENCY_SUBDIR}${subdir}/Library/Frameworks"
270
+      dispense_binaries "${name}" "${src}" "d" "/${FRAMEWORK_DIR_NAME}"
201 271
 
202
-      # coming from Cmake and configure ?
203
-      src="${BUILD_DEPENDENCY_SUBDIR}/usr/local/Frameworks"
272
+      src="${BUILD_DEPENDENCY_SUBDIR}${subdir}/Frameworks"
204 273
       dispense_binaries "${name}" "${src}" "d" "/${FRAMEWORK_DIR_NAME}"
205 274
 
275
+
206 276
       src="${BUILD_DEPENDENCY_SUBDIR}/Library/Frameworks"
207 277
       dispense_binaries "${name}" "${src}" "d" "/${FRAMEWORK_DIR_NAME}"
208 278
 
209 279
       src="${BUILD_DEPENDENCY_SUBDIR}/Frameworks"
210 280
       dispense_binaries "${name}" "${src}" "d" "/${FRAMEWORK_DIR_NAME}"
281
+   else
282
+      log_fluff "Choosing cmake/configure dispense path"
283
+
284
+      src="${BUILD_DEPENDENCY_SUBDIR}/usr/local/include"
285
+      dispense_headers "${name}" "${src}"
286
+
287
+      src="${BUILD_DEPENDENCY_SUBDIR}/usr/local/lib"
288
+      dispense_binaries "${name}" "${src}" "f" "/${LIBRARY_DIR_NAME}"
211 289
    fi
212 290
 
213 291
    #
... ...
@@ -431,7 +509,10 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
431 509
    local sdkparameter
432 510
    local suffix
433 511
    local mapped
512
+   local fallback
434 513
 
514
+   fallback="`echo "${CONFIGURATIONS}" | tail -1`"
515
+   fallback="`read_build_setting "$name" "fallback-configuration" "${fallback}"`"
435 516
    mapped="`read_build_setting "$name" "cmake-${configuration}.map" "${configuration}"`"
436 517
    suffix="`determine_suffix "${configuration}" "${sdk}"`"
437 518
    sdkparameter="`cmake_sdk_parameter "${sdk}"`"
... ...
@@ -456,6 +537,10 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
456 537
 
457 538
    log_fluff "Build logs will be in \"${logfile1}\" and \"${logfile2}\""
458 539
 
540
+   local   local_make_flags
541
+
542
+   local_make_flags="${MAKE_FLAGS} -j ${CORES}"
543
+
459 544
    owd="${PWD}"
460 545
 
461 546
 #   cmake_keep_builddir="`read_build_setting "$name" "cmake_keep_builddir" "YES"`"
... ...
@@ -488,34 +573,39 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
488 573
 
489 574
       logging_exekutor cmake "-DCMAKE_BUILD_TYPE=${mapped}" \
490 575
 "${sdkparameter}" \
576
+"-DCMAKE_C_FLAGS_DEBUG=-DDEBUG -g -O0" \
491 577
 "-DDEPENDENCIES_DIR=${owd}/${REFERENCE_DEPENDENCY_SUBDIR}" \
492 578
 "-DCMAKE_INSTALL_PREFIX:PATH=${owd}/${BUILD_DEPENDENCY_SUBDIR}/usr/local"  \
493 579
 "-DCMAKE_C_FLAGS=\
494 580
 -I${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${HEADER_DIR_NAME} \
495 581
 -F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}${suffix} \
496
--F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}/${configuration} \
582
+-F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}/${mapped} \
583
+-F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}/${fallback} \
497 584
 -F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME} \
498 585
 ${other_cflags}" \
499 586
 "-DCMAKE_CXX_FLAGS=\
500 587
 -I${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${HEADER_DIR_NAME} \
501 588
 -F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}${suffix} \
502
--F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}/${configuration} \
589
+-F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}/${mapped} \
590
+-F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}/${fallback} \
503 591
 -F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME} \
504 592
 ${other_cppflags}" \
505 593
 "-DCMAKE_EXE_LINKER_FLAGS=\
506 594
 -L${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${LIBRARY_DIR_NAME}${suffix} \
507
--L${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${LIBRARY_DIR_NAME}/${configuration} \
595
+-L${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${LIBRARY_DIR_NAME}/${mapped} \
596
+-L${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${LIBRARY_DIR_NAME}/${fallback} \
508 597
 -L${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${LIBRARY_DIR_NAME} \
509 598
 ${other_ldflags}" \
510 599
 "-DCMAKE_SHARED_LINKER_FLAGS=\
511 600
 -L${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${LIBRARY_DIR_NAME}${suffix} \
512
--L${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${LIBRARY_DIR_NAME}/${configuration} \
601
+-L${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${LIBRARY_DIR_NAME}/${mapped} \
602
+-L${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${LIBRARY_DIR_NAME}/${fallback} \
513 603
 -L${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${LIBRARY_DIR_NAME} \
514 604
 ${other_ldflags}" \
515 605
 ${CMAKE_FLAGS} \
516 606
 "${relative}/${srcdir}" > "${logfile1}" || build_fail "${logfile1}" "cmake"
517 607
 
518
-      logging_exekutor make ${MAKE_FLAGS} VERBOSE=1 install > "${logfile2}" || build_fail "${logfile2}" "make"
608
+      logging_exekutor make ${local_make_flags} VERBOSE=1 install > "${logfile2}" || build_fail "${logfile2}" "make"
519 609
 
520 610
       set +f
521 611
 
... ...
@@ -539,7 +629,6 @@ build_configure()
539 629
    local relative
540 630
    local name
541 631
    local sdk
542
-   local mapped
543 632
 
544 633
    configuration="$1"
545 634
    srcdir="$2"
... ...
@@ -556,6 +645,13 @@ ${C_MAGENTA}${C_BOLD}${name}${C_INFO} for SDK \
556 645
 ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
557 646
 
558 647
    local sdkpath
648
+   local fallback
649
+   local mapped
650
+   local suffix
651
+   local fallback
652
+
653
+   fallback="`echo "${CONFIGURATIONS}" | tail -1`"
654
+   fallback="`read_build_setting "$name" "fallback-configuration" "${fallback}"`"
559 655
 
560 656
    mapped="`read_build_setting "$name" "configure-${configuration}.map" "${configuration}"`"
561 657
    suffix="`determine_suffix "${configuration}" "${sdk}"`"
... ...
@@ -608,6 +704,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
608 704
 -I${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${HEADER_DIR_NAME} \
609 705
 -F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}${suffix} \
610 706
 -F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}/${configuration} \
707
+-F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}/${fallback} \
611 708
 -F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME} \
612 709
 ${other_cflags} \
613 710
 -isysroot ${sdkpath}\" \
... ...
@@ -615,15 +712,18 @@ ${other_cflags} \
615 712
 -I${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${HEADER_DIR_NAME} \
616 713
 -F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}${suffix} \
617 714
 -F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}/${configuration} \
715
+-F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}/${fallback} \
618 716
 -F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME} \
619 717
 ${other_cppflags} \
620 718
 -isysroot ${sdkpath}\" \
621 719
       LDFLAGS=\"\
622 720
 -F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}${suffix} \
623 721
 -F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}/${configuration} \
722
+-F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}/${fallback} \
624 723
 -F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME} \
625 724
 -L${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${LIBRARY_DIR_NAME}${suffix} \
626 725
 -L${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${LIBRARY_DIR_NAME}/${configuration} \
726
+-L${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${LIBRARY_DIR_NAME}/${fallback} \
627 727
 -L${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${LIBRARY_DIR_NAME} \
628 728
 ${other_ldflags} \
629 729
 -isysroot ${sdkpath}\"" > "${logfile1}"
... ...
@@ -633,23 +733,27 @@ ${other_ldflags} \
633 733
        CFLAGS="\
634 734
 -I${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${HEADER_DIR_NAME} \
635 735
 -F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}${suffix} \
636
--F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}/${configuration} \
736
+-F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}/${mapped} \
737
+-F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}/${fallback} \
637 738
 -F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME} \
638 739
 ${other_cflags} \
639 740
 -isysroot ${sdkpath}" \
640 741
       CPPFLAGS="\
641 742
 -I${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${HEADER_DIR_NAME} \
642 743
 -F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}${suffix} \
643
--F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}/${configuration} \
744
+-F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}/${mapped} \
745
+-F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}/${fallback} \
644 746
 -F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME} \
645 747
 ${other_cppflags} \
646 748
 -isysroot ${sdkpath}" \
647 749
       LDFLAGS="\
648 750
 -F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}${suffix} \
649
--F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}/${configuration} \
751
+-F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}/${mapped} \
752
+-F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}/${fallback} \
650 753
 -F${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME} \
651 754
 -L${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${LIBRARY_DIR_NAME}${suffix} \
652
--L${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${LIBRARY_DIR_NAME}/${configuration} \
755
+-L${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${LIBRARY_DIR_NAME}/${mapped} \
756
+-L${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${LIBRARY_DIR_NAME}/${fallback} \
653 757
 -L${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${LIBRARY_DIR_NAME} \
654 758
 ${other_ldflags} \
655 759
 -isysroot ${sdkpath}" \
... ...
@@ -831,6 +935,10 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO}${info} in \
831 935
    projectname=`read_repo_setting "${name}" "project" "${project}"`
832 936
 
833 937
    local mapped
938
+   local fallback
939
+
940
+   fallback="`echo "${CONFIGURATIONS}" | tail -1`"
941
+   fallback="`read_build_setting "$name" "fallback-configuration" "${fallback}"`"
834 942
 
835 943
    mapped=`read_build_setting "${name}" "${configuration}.map" "${configuration}"`
836 944
    [ -z "${mapped}" ] && internal_fail "mapped configuration is empty"
... ...
@@ -1033,6 +1141,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO}${info} in \
1033 1141
       inherited="`xcode_get_setting LIBRARY_SEARCH_PATHS ${arguments}`" || exit 1
1034 1142
       path=`combined_escaped_search_path \
1035 1143
 "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${LIBRARY_DIR_NAME}/${mapped}" \
1144
+"${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${LIBRARY_DIR_NAME}/${fallback}" \
1036 1145
 "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${LIBRARY_DIR_NAME}" \
1037 1146
 "/usr/local/lib"`
1038 1147
       if [ ! -z "$sdk" ]
... ...
@@ -1050,6 +1159,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO}${info} in \
1050 1159
       inherited="`xcode_get_setting FRAMEWORK_SEARCH_PATHS ${arguments}`" || exit 1
1051 1160
       path=`combined_escaped_search_path \
1052 1161
 "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}/${mapped}" \
1162
+"${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}/${fallback}" \
1053 1163
 "${owd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}"`
1054 1164
       if [ ! -z "$sdk" ]
1055 1165
       then
... ...
@@ -1074,13 +1184,12 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO}${info} in \
1074 1184
 
1075 1185
       # if it doesn't install, probably SKIP_INSTALL is set
1076 1186
       cmdline="\"${xcodebuild}\" \"${command}\" ${arguments} \
1077
-ARCHS='\${ARCHS_STANDARD_32_64_BIT}' \
1187
+ARCHS='${ARCHS:-\${ARCHS_STANDARD_32_64_BIT\}}' \
1078 1188
 DSTROOT='${owd}/${BUILD_DEPENDENCY_SUBDIR}' \
1079
-INSTALL_PATH='/${LIBRARY_DIR_NAME}${suffix}' \
1080 1189
 SYMROOT='${owd}/${builddir}/' \
1081 1190
 OBJROOT='${owd}/${builddir}/obj' \
1082 1191
 DEPENDENCIES_DIR='${owd}/${REFERENCE_DEPENDENCY_SUBDIR}' \
1083
-ONLY_ACTIVE_ARCH=NO \
1192
+ONLY_ACTIVE_ARCH=${ONLY_ACTIVE_ARCH:-NO} \
1084 1193
 ${skip_install} \
1085 1194
 ${other_cflags} \
1086 1195
 ${other_cppflags} \
... ...
@@ -1288,11 +1397,6 @@ configure"`"
1288 1397
       fi
1289 1398
    fi
1290 1399
 
1291
-   local configurations
1292
-
1293
-   configurations="`read_build_root_setting "configurations" "Debug
1294
-Release"`"
1295
-
1296 1400
    local xcodebuild
1297 1401
    local cmake
1298 1402
 
... ...
@@ -1311,6 +1415,10 @@ Release"`"
1311 1415
    local hasbuilt
1312 1416
    local configuration
1313 1417
    local preference
1418
+   local configurations
1419
+
1420
+   # settings can override the commandline default
1421
+   configurations="`read_build_setting "${name}" "configurations" "${CONFIGURATIONS}"`"
1314 1422
 
1315 1423
    for sdk in ${sdks}
1316 1424
    do
... ...
@@ -50,12 +50,19 @@ embedded_repositories()
50 50
    clones="`read_fetch_setting "embedded_repositories"`"
51 51
    if [ "${clones}" != "" ]
52 52
    then
53
+      local old
54
+
55
+      old="${IFS:-" "}"
56
+      IFS="
57
+"
53 58
       for clone in ${clones}
54 59
       do
60
+         IFS="${old}"
55 61
          name="`canonical_name_from_clone "${clone}"`"
56 62
          dir="${name}"
57 63
          echo "${dir}"
58 64
       done
65
+      IFS="${old}"
59 66
    fi
60 67
 }
61 68
 
... ...
@@ -69,12 +76,12 @@ usage()
69 76
    cat <<EOF
70 77
 clean [build|output|dist]
71 78
 
72
-   build   : is the default, it cleans
79
+   build   : it cleans
73 80
 ---
74 81
 ${BUILD_CLEANABLE_SUBDIRS}
75 82
 ---
76 83
 
77
-   output  : cleans additionaly
84
+   output  : is the default, it cleans additionaly
78 85
 ---
79 86
 ${OUTPUT_CLEANABLE_SUBDIRS}
80 87
 ---
... ...
@@ -95,7 +102,6 @@ check_and_usage_and_help()
95 102
       dist)
96 103
       ;;
97 104
       build)
98
-      COMMAND="build"
99 105
       ;;
100 106
       *)
101 107
       usage >&2
... ...
@@ -105,7 +111,7 @@ check_and_usage_and_help()
105 111
 }
106 112
 
107 113
 
108
-COMMAND=${1:-"build"}
114
+COMMAND=${1:-"output"}
109 115
 [ $# -eq 0 ] || shift
110 116
 
111 117
 check_and_usage_and_help
... ...
@@ -102,17 +102,16 @@ install_taps()
102 102
 {
103 103
    local tap
104 104
    local taps
105
-   local old
106 105
 
107 106
    log_fluff "Looking for taps"
108 107
 
109 108
    taps=`read_fetch_setting "taps" | sort | sort -u`
110 109
    if [ "${taps}" != "" ]
111 110
    then
112
-      local old
113
-
114 111
       fetch_brew_if_needed
115 112
 
113
+      local old
114
+
116 115
       old="${IFS:-" "}"
117 116
       IFS="
118 117
 "
... ...
@@ -627,13 +626,13 @@ checkout_repository()
627 626
 
628 627
       if [ "${COMMAND}" = "install" -a "${DONT_RECURSE}" = "" ]
629 628
       then
630
-         local old
629
+         local old_bootstrap
631 630
 
632
-         old="${BOOTSTRAP_SUBDIR}"
631
+         old_bootstrap="${BOOTSTRAP_SUBDIR}"
633 632
 
634 633
          BOOTSTRAP_SUBDIR="${dstdir}/.bootstrap"
635 634
          install_embedded_repositories "${dstdir}/"
636
-         BOOTSTRAP_SUBDIR="${old}"
635
+         BOOTSTRAP_SUBDIR="${old_bootstrap}"
637 636
 
638 637
          bootstrap_auto_update "${name}" "${url}" "${dstdir}"
639 638
          flag=$?
... ...
@@ -713,7 +712,6 @@ clone_repositories()
713 712
    local branch
714 713
 
715 714
    old="${IFS:-" "}"
716
-
717 715
    fetched=""
718 716
 
719 717
    stop=0
... ...
@@ -762,6 +760,7 @@ ${clone}"
762 760
    for clone in ${fetched}
763 761
    do
764 762
       IFS="${old}"
763
+
765 764
       name="`canonical_name_from_clone "${clone}"`"
766 765
       url="`url_from_clone "${clone}"`"
767 766
       did_clone_repository "${name}" "${url}" "${branch}"
... ...
@@ -798,6 +797,7 @@ install_embedded_repositories()
798 797
       for clone in ${clones}
799 798
       do
800 799
          IFS="${old}"
800
+
801 801
          name="`canonical_name_from_clone "${clone}"`"
802 802
          url="`url_from_clone "${clone}"`"
803 803
          branch="`branch_from_clone "${clone}"`"
... ...
@@ -811,13 +811,13 @@ install_embedded_repositories()
811 811
             #
812 812
             # embedded_repositories are just cloned, no symlinks,
813 813
             #
814
-            local old
814
+            local old_forbidden
815 815
 
816
-            old="${SYMLINK_FORBIDDEN}"
816
+            old_forbidden="${SYMLINK_FORBIDDEN}"
817 817
 
818 818
             SYMLINK_FORBIDDEN="YES"
819 819
             checkout "${name}" "${url}" "${dstdir}" "${branch}" "${tag}"
820
-            SYMLINK_FORBIDDEN="$old"
820
+            SYMLINK_FORBIDDEN="$old_forbidden"
821 821
 
822 822
             if read_yes_no_config_setting "update_gitignore" "YES"
823 823
             then
... ...
@@ -942,19 +942,19 @@ update_repository()
942 942
 
943 943
    if [ $? -eq 0 -a "${DONT_RECURSE}" = "" ]
944 944
    then
945
-      local old
946
-      local oldfetch
945
+      local old_bootstrap
946
+#      local old_fetch
947 947
 
948
-      old="${BOOTSTRAP_SUBDIR}"
949
-      oldfetch="${CLONESFETCH_SUBDIR}"
948
+      old_bootstrap="${BOOTSTRAP_SUBDIR}"
949
+#      old_fetch="${CLONESFETCH_SUBDIR}"
950 950
 
951 951
       BOOTSTRAP_SUBDIR="${dstdir}/.bootstrap"
952 952
 #      CLONESFETCH_SUBDIR="${dstdir}/.repos"
953 953
 
954 954
       update_embedded_repositories "${dstdir}/"
955 955
 
956
-      BOOTSTRAP_SUBDIR="${old}"
957
-#      CLONESFETCH_SUBDIR="${oldfetch}"
956
+      BOOTSTRAP_SUBDIR="${old_bootstrap}"
957
+#      CLONESFETCH_SUBDIR="${old_fetch}"
958 958
    fi
959 959
 
960 960
    ensure_clone_branch_is_correct "${dstdir}" "${branch}"
... ...
@@ -412,6 +412,74 @@ remove_file_if_present()
412 412
 
413 413
 
414 414
 
415
+simplify_path()
416
+{
417
+   local file
418
+
419
+   file="${1}"
420
+
421
+   local modification
422
+
423
+   # foo/ -> foo
424
+   modification="`echo "${1}" | sed 's|^\(.*\)/$|\1|'`"
425
+   if  [ "${modification}" != "${file}" ]
426
+   then
427
+      simplify_path "${modification}"
428
+      return
429
+   fi
430
+
431
+   # ./foo -> foo
432
+   modification="`echo "${1}" | sed 's|^\./\(.*\)$|\1|'`"
433
+   if  [ "${modification}" != "${file}" ]
434
+   then
435
+      simplify_path "${modification}"
436
+      return
437
+   fi
438
+
439
+   # foo/. -> foo
440
+   modification="`echo "${1}" | sed 's|^\(.*\)/\.$|\1|'`"
441
+   if  [ "${modification}" != "${file}" ]
442
+   then
443
+      simplify_path "${modification}"
444
+      return
445
+   fi
446
+
447
+   # bar/./foo -> bar/foo
448
+   modification="`echo "${1}" | sed 's|^\(.*\)/\./\(.*\)$|\1/\2|'`"
449
+   if  [ "${modification}" != "${file}" ]
450
+   then
451
+      simplify_path "${modification}"
452
+      return
453
+   fi
454
+
455
+   # bar/.. -> ""
456
+   modification="`echo "${1}" | sed 's|^\([^/]*\)/\.\.$||'`"
457
+   if  [ "${modification}" != "${file}" ]
458
+   then
459
+      simplify_path "${modification}"
460
+      return
461
+   fi
462
+
463
+   # bar/../foo -> foo
464
+   modification="`echo "${1}" | sed 's|^\([^/]*\)/\.\./\(.*\)$|\2|'`"
465
+   if  [ "${modification}" != "${file}" ]
466
+   then
467
+      simplify_path "${modification}"
468
+      return
469
+   fi
470
+
471
+   # bar/baz/../foo -> bar/foo
472
+   modification="`echo "${1}" | sed 's|^\(.*\)/\([^/]*\)/\.\./\(.*\)$|\1/\3|'`"
473
+   if  [ "${modification}" != "${file}" ]
474
+   then
475
+      simplify_path "${modification}"
476
+      return
477
+   fi
478
+
479
+   echo "${modification}"
480
+}
481
+
482
+
415 483
 #
416 484
 # consider . .. ~ or absolute paths as unsafe
417 485
 # anything starting with a $ is probably also bad
... ...
@@ -419,9 +487,19 @@ remove_file_if_present()
419 487
 #
420 488
 assert_sane_subdir_path()
421 489
 {
422
-   case "$1"  in
423
-      \$*|~/.|..|./|../|/*)
424
-         log_error "refuse unsafe path \"$1\""
490
+   local file
491
+
492
+   file="`simplify_path "${1}"`"
493
+
494
+   if [ -z "${file}" ]
495
+   then
496
+         log_error "refuse unsafe subdirectory path \"$1\""
497
+         exit 1
498
+   fi
499
+
500
+   case "$file"  in
501
+      \$*|~|..|.|/*)
502
+         log_error "refuse unsafe subdirectory path \"$1\""
425 503
          exit 1
426 504
       ;;
427 505
    esac
... ...
@@ -430,8 +508,18 @@ assert_sane_subdir_path()
430 508
 
431 509
 assert_sane_path()
432 510
 {
433
-   case "$1"  in
434
-      \$*|~/*|..|.|/|./|../*)
511
+   local file
512
+
513
+   file="`simplify_path "${1}"`"
514
+
515
+   if [ -z "${file}" ]
516
+   then
517
+         log_error "refuse unsafe path \"$1\""
518
+         exit 1
519
+   fi
520
+
521
+   case "$file"  in
522
+      \$*|~|${HOME}|..|.|/)
435 523
          log_error "refuse unsafe path \"$1\""
436 524
          exit 1
437 525
       ;;
... ...
@@ -687,9 +775,26 @@ Suggested resolution:
687 775
     ${C_RESET_BOLD}mulle-bootstrap clean dist${C_ERROR}
688 776
     ${C_RESET_BOLD}mulle-bootstrap${C_ERROR}
689 777
 
690
-Or do you feel lucky ? ${C_RESET_BOLD}rm ${CLONESFETCH_SUBDIR}/.fetch_update_started${C_ERROR}
778
+Or do you feel lucky ?
779
+   ${C_RESET_BOLD}rm ${CLONESFETCH_SUBDIR}/.fetch_update_started${C_ERROR}
691 780
 and try again. But you've gotta ask yourself one question: Do I feel lucky ?
692 781
 Well, do ya, punk? "
693 782
       exit 1
694 783
    fi
695 784
 }
785
+
786
+
787
+get_core_count()
788
+{
789
+    count="`nproc 2> /dev/null`"
790
+    if [ -z "$count" ]
791
+    then
792
+       count="`sysctl -n hw.ncpu 2> /dev/null`"
793
+    fi
794
+
795
+    if [ -z "$count" ]
796
+    then
797
+       count=2
798
+    fi
799
+    echo $count
800
+}
... ...
@@ -74,8 +74,12 @@ fi
74 74
 # can't rename this because of embedded reposiories
75 75
 CLONES_SUBDIR=.repos
76 76
 
77
-CLONESBUILD_SUBDIR=`read_sane_config_path_setting "build_foldername" "build/.repos"`
78
-DEPENDENCY_SUBDIR=`read_sane_config_path_setting "output_foldername" "dependencies"`
77
+# future: shared dependencies folder for many projects
78
+
79
+RELATIVE_ROOT=""
80
+
81
+CLONESBUILD_SUBDIR=`read_sane_config_path_setting "build_foldername" "${RELATIVE_ROOT}build/.repos"`
82
+DEPENDENCY_SUBDIR=`read_sane_config_path_setting "output_foldername" "${RELATIVE_ROOT}dependencies"`
79 83
 BUILDLOG_SUBDIR=`read_sane_config_path_setting "build_log_foldername" "${CLONESBUILD_SUBDIR}/.logs"`
80 84
 
81 85