Browse code

2.5.0 ===

* Improve usage for `mulle-bootstrap init`
* Reduce verbosity for PATH to fluff
* The --no-recursion flag has been fixed, the old behaviour is now available
as --no-embedded.
* Use eval exekutor for cmake to better inherit CMAKE_FLAGS and protect paths
with spaces.
* build now acknowledges --check-usr-local-include also
* With --prefix you can change /usr/local on the commandline for build and fetch

Nat! authored on 17-11-2016 17:02:41
Showing 9 changed files
... ...
@@ -1,3 +1,16 @@
1
+2.5.0
2
+===
3
+
4
+* Improve usage for `mulle-bootstrap init`
5
+* Reduce verbosity for PATH to fluff
6
+* The --no-recursion flag has been fixed, the  old behaviour is now available
7
+as --no-embedded.
8
+* Use eval exekutor for cmake to better inherit CMAKE_FLAGS and protect paths
9
+with spaces.
10
+* build now acknowledges --check-usr-local-include also
11
+* With --prefix you can change /usr/local on the commandline for build and fetch
12
+
13
+
1 14
 2.4.2
2 15
 ===
3 16
 
... ...
@@ -19,7 +19,7 @@ then
19 19
    #
20 20
    # restore colors if stuff gets wonky
21 21
    #
22
-   trap 'printf "${C_RESET}"' TERM EXIT
22
+   trap 'printf "${C_RESET} >&2 ; exit 1"' TERM INT
23 23
 fi
24 24
 
25 25
 
... ...
@@ -29,8 +29,8 @@
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
 MULLE_BOOTSTRAP_VERSION_MAJOR=2
32
-MULLE_BOOTSTRAP_VERSION_MINOR=4
33
-MULLE_BOOTSTRAP_VERSION_PATCH=2
32
+MULLE_BOOTSTRAP_VERSION_MINOR=5
33
+MULLE_BOOTSTRAP_VERSION_PATCH=0
34 34
 
35 35
 MULLE_BOOTSTRAP_VERSION="${MULLE_BOOTSTRAP_VERSION_MAJOR}.${MULLE_BOOTSTRAP_VERSION_MINOR}.${MULLE_BOOTSTRAP_VERSION_PATCH}"
36 36
 MULLE_BOOTSTRAP_FAIL_PREFIX="mulle-bootstrap"
... ...
@@ -393,7 +393,7 @@ bootstrap_main()
393 393
    PATH="`make_executable_search_path "$PATH"`"
394 394
    export PATH
395 395
 
396
-   log_verbose "PATH set to: $PATH"
396
+   log_fluff "PATH set to: $PATH"
397 397
 
398 398
    #
399 399
    # some commands only run when we have a .bootstrap folder
... ...
@@ -50,9 +50,10 @@ build_usage()
50 50
 usage:
51 51
    mulle-bootstrap build [-ck] [repos]*
52 52
 
53
-   -k         :  don't clean before building $defk
54
-   -K         :  always clean before building $defkk
55
-   -c <name>  :  configurations to build ($defc), separate with comma
53
+   -k             :  don't clean before building $defk
54
+   -K             :  always clean before building $defkk
55
+   -c <name>      :  configurations to build ($defc), separate with comma
56
+   --prefix <dir> :  use <dir> instead of /usr/local
56 57
 EOF
57 58
 
58 59
    case "${UNAME}" in
... ...
@@ -369,10 +370,10 @@ cmake_sdk_parameter()
369 370
    local sdkpath
370 371
 
371 372
    sdkpath=`gcc_sdk_parameter "${sdk}"`
372
-   if [ "${sdkpath}" != "" ]
373
+   if [ ! -z "${sdkpath}" ]
373 374
    then
374 375
       log_fluff "Set cmake -DCMAKE_OSX_SYSROOT to \"${sdkpath}\""
375
-      echo '-DCMAKE_OSX_SYSROOT='"${sdkpath}"
376
+      echo "-DCMAKE_OSX_SYSROOT='${sdkpath}'"
376 377
    fi
377 378
 }
378 379
 
... ...
@@ -717,11 +718,11 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
717 718
 
718 719
    if [ ! -z "${C_COMPILER}" ]
719 720
    then
720
-      c_compiler_line="-DCMAKE_C_COMPILER=${C_COMPILER}"
721
+      c_compiler_line="-DCMAKE_C_COMPILER='${C_COMPILER}'"
721 722
    fi
722 723
    if [ ! -z "${CXX_COMPILER}" ]
723 724
    then
724
-      cxx_compiler_line="-DCMAKE_CXX_COMPILER=${CXX_COMPILER}"
725
+      cxx_compiler_line="-DCMAKE_CXX_COMPILER='${CXX_COMPILER}'"
725 726
    fi
726 727
 
727 728
    # linker="`read_build_setting "${name}" "LD"`"
... ...
@@ -817,7 +818,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
817 818
       frameworklines="`add_cmake_path "${frameworklines}" "${nativewd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}"`"
818 819
       frameworklines="`add_cmake_path "${frameworklines}" "${nativewd}/${REFERENCE_ADDICTION_SUBDIR}/${FRAMEWORK_DIR_NAME}"`"
819 820
 
820
-      if [ "${CHECK_USR_LOCAL_INCLUDE}" = "YES" ]
821
+      if [ "${ADD_USR_LOCAL}" = "YES" ]
821 822
       then
822 823
          includelines="`add_cmake_path "${includelines}" "${USR_LOCAL_INCLUDE}"`"
823 824
          librarylines="`add_cmake_path "${librarylines}" "${USR_LOCAL_LIB}"`"
... ...
@@ -924,24 +925,25 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
924 925
       oldpath="$PATH"
925 926
       PATH="${BUILDPATH}"
926 927
 
927
-      logging_redirekt_exekutor "${logfile1}" "${CMAKE}" -G "${CMAKE_GENERATOR}" \
928
-"-DCMAKE_BUILD_TYPE=${mapped}" \
929
-"-DDEPENDENCIES_DIR=${dependenciesdir}" \
930
-"-DADDICTIONS_DIR=${addictionsdir}" \
931
-"-DCMAKE_INSTALL_PREFIX:PATH=${prefixbuild}"  \
932
-"-DCMAKE_INCLUDE_PATH=${includelines}" \
933
-"-DCMAKE_LIBRARY_PATH=${librarylines}" \
934
-"-DCMAKE_FRAMEWORK_PATH=${frameworklines}" \
935
-"-DCMAKE_C_FLAGS=${other_cflags}" \
936
-"-DCMAKE_CXX_FLAGS=${other_cxxflags}" \
937
-"-DCMAKE_EXE_LINKER_FLAGS=${other_ldflags}" \
938
-"-DCMAKE_SHARED_LINKER_FLAGS=${other_ldflags}" \
928
+      logging_redirect_eval_exekutor "${logfile1}" "'${CMAKE}'" \
929
+-G "'${CMAKE_GENERATOR}'" \
930
+"-DCMAKE_BUILD_TYPE='${mapped}'" \
931
+"-DDEPENDENCIES_DIR='${dependenciesdir}'" \
932
+"-DADDICTIONS_DIR='${addictionsdir}'" \
933
+"-DCMAKE_INSTALL_PREFIX:PATH='${prefixbuild}'"  \
934
+"-DCMAKE_INCLUDE_PATH='${includelines}'" \
935
+"-DCMAKE_LIBRARY_PATH='${librarylines}'" \
936
+"-DCMAKE_FRAMEWORK_PATH='${frameworklines}'" \
937
+"-DCMAKE_C_FLAGS='${other_cflags}'" \
938
+"-DCMAKE_CXX_FLAGS='${other_cxxflags}'" \
939
+"-DCMAKE_EXE_LINKER_FLAGS='${other_ldflags}'" \
940
+"-DCMAKE_SHARED_LINKER_FLAGS='${other_ldflags}'" \
939 941
 "${sdkparameter}" \
940 942
 "${c_compiler_line}" \
941 943
 "${cxx_compiler_line}" \
942
-${localcmakeflags} \
943
-${CMAKE_FLAGS} \
944
-"${relative_srcdir}"
944
+"${localcmakeflags}" \
945
+"${CMAKE_FLAGS}" \
946
+"'${relative_srcdir}'"
945 947
       rval=$?
946 948
 
947 949
       if [ $rval -ne 0 ]
... ...
@@ -1105,7 +1107,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
1105 1107
       frameworklines="`add_path "${frameworklines}" "${nativewd}/${REFERENCE_DEPENDENCY_SUBDIR}/${FRAMEWORK_DIR_NAME}"`"
1106 1108
       frameworklines="`add_path "${frameworklines}" "${nativewd}/${REFERENCE_ADDICTION_SUBDIR}/${FRAMEWORK_DIR_NAME}"`"
1107 1109
 
1108
-      if [ "${CHECK_USR_LOCAL_INCLUDE}" = "YES" ]
1110
+      if [ "${ADD_USR_LOCAL}" = "YES" ]
1109 1111
       then
1110 1112
          includelines="`add_path "${includelines}" "${USR_LOCAL_INCLUDE}"`"
1111 1113
          librarylines="`add_path "${librarylines}" "${USR_LOCAL_LIB}"`"
... ...
@@ -1156,6 +1158,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
1156 1158
          other_ldflags="`concat "${other_ldflags}" "${frameworkprefix}${path}"`"
1157 1159
       done
1158 1160
 
1161
+      other_cxxflags"`concat "${other_cflags}" "${other_cxxflags}"`"
1159 1162
       IFS="${DEFAULT_IFS}"
1160 1163
 
1161 1164
       local oldpath
... ...
@@ -1165,15 +1168,17 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
1165 1168
       PATH="${BUILDPATH}"
1166 1169
 
1167 1170
       # use absolute paths for configure, safer (and easier to read IMO)
1168
-      DEPENDENCIES_DIR="'${dependenciesdir}'" \
1169
-      ADDICTIONS_DIR="'${addictionsdir}'" \
1170
-      CC="${C_COMPILER:-${CC}}" \
1171
-      CXX="${CXX_COMPILER:-${CXX}}" \
1172
-      CFLAGS="${other_cflags}" \
1173
-      CXXFLAGS="${other_cflags} ${other_cxxflags}" \
1174
-      LDFLAGS="${other_ldflags}" \
1175
-      logging_redirekt_exekutor "${logfile1}" "${owd}/${srcdir}/configure" ${configureflags} \
1176
-          --prefix "${prefixbuild}"
1171
+      logging_eval_redirekt_exekutor "${logfile1}" \
1172
+         DEPENDENCIES_DIR="'${dependenciesdir}'" \
1173
+         ADDICTIONS_DIR="'${addictionsdir}'" \
1174
+         CC="'${C_COMPILER:-${CC}}'" \
1175
+         CXX="'${CXX_COMPILER:-${CXX}}'" \
1176
+         CFLAGS="'${other_cflags}'" \
1177
+         CXXFLAGS="'${other_cxxflags}'" \
1178
+         LDFLAGS="'${other_ldflags}'" \
1179
+         "'${owd}/${srcdir}/configure'" \
1180
+            "${configureflags}" \
1181
+             --prefix "'${prefixbuild}'"
1177 1182
       rval=$?
1178 1183
 
1179 1184
       if [ $rval -ne 0 ]
... ...
@@ -1580,7 +1585,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO}${info} in \
1580 1585
          dependencies_lib_search_path="${path} ${inherited}"
1581 1586
       fi
1582 1587
 
1583
-      if [ "${CHECK_USR_LOCAL_INCLUDE}" = "YES" ]
1588
+      if [ "${ADD_USR_LOCAL}" = "YES" ]
1584 1589
       then
1585 1590
          dependencies_header_search_path="${path} ${USR_LOCAL_INCLUDE}"
1586 1591
          dependencies_lib_search_path="${path} ${USR_LOCAL_LIB}"
... ...
@@ -2164,11 +2169,11 @@ build_clones()
2164 2169
             then
2165 2170
                build_if_alive "${name}" "${srcdir}" || exit  1
2166 2171
             else
2167
-               if [ "${CHECK_USR_LOCAL_INCLUDE}" = "YES" ] && has_usr_local_include "${name}"
2172
+               if [ "${check_usr_local_include}" = "YES" ] && has_usr_local_include "${name}"
2168 2173
                then
2169 2174
                   :
2170 2175
                else
2171
-                  fail "build failed for repository \"${clone}\": not found in (\"${srcdir}\") ($PWD)"
2176
+                  fail "build failed for repository \"${name}\": not found in (\"${srcdir}\") ($PWD)"
2172 2177
                fi
2173 2178
             fi
2174 2179
          done
... ...
@@ -2182,7 +2187,7 @@ build_clones()
2182 2187
          then
2183 2188
             build_if_alive "${name}" "${srcdir}"|| exit 1
2184 2189
          else
2185
-            if [ "${CHECK_USR_LOCAL_INCLUDE}" = "YES" ] && has_usr_local_include "${name}"
2190
+            if [ "${check_usr_local_include}" = "YES" ] && has_usr_local_include "${name}"
2186 2191
             then
2187 2192
                :
2188 2193
             else
... ...
@@ -2260,6 +2265,15 @@ build_main()
2260 2265
             CLEAN_BEFORE_BUILD=
2261 2266
          ;;
2262 2267
 
2268
+         --prefix)
2269
+            shift
2270
+            [ $# -ne 0 ] || fail "prefix missing"
2271
+
2272
+            USR_LOCAL_INCLUDE="$1/include"
2273
+            USR_LOCAL_LIB="$1/lib"
2274
+         ;;
2275
+
2276
+
2263 2277
          -j|--cores)
2264 2278
             case "${UNAME}" in
2265 2279
                mingw)
... ...
@@ -2280,8 +2294,18 @@ build_main()
2280 2294
             CONFIGURATIONS="`printf "%s" "$1" | tr ',' '\012'`"
2281 2295
             ;;
2282 2296
 
2297
+         -cs|--check-usr-local-include)
2298
+            # set environment to be picked up by config
2299
+            MULLE_BOOTSTRAP_CHECK_USR_LOCAL_INCLUDE="YES"
2300
+            export MULLE_BOOTSTRAP_CHECK_USR_LOCAL_INCLUDE
2301
+         ;;
2302
+
2303
+         --use-prefix-libraries)
2304
+            ADD_USR_LOCAL=YES
2305
+         ;;
2306
+
2283 2307
          # fetch options, are just ignored
2284
-         -i|--ignore-branch|-fc|--force-checkout|-cs|--check-usr-local-include|-nr|--no-recursion|-e|--embedded-only|-es|--embedded-symlink|-u|--update-symlinks)
2308
+         -i|--ignore-branch|-fc|--force-checkout|-nr|--no-recursion|-e|--embedded-only|-es|--embedded-symlink|-u|--update-symlinks)
2285 2309
             :
2286 2310
          ;;
2287 2311
 
... ...
@@ -2315,7 +2339,7 @@ build_main()
2315 2339
    [ -z "${MULLE_BOOTSTRAP_REPOSITORIES_SH}" ] && . mulle-bootstrap-repositories.sh
2316 2340
    [ -z "${MULLE_BOOTSTRAP_SCRIPTS_SH}" ] && . mulle-bootstrap-scripts.sh
2317 2341
 
2318
-   CHECK_USR_LOCAL_INCLUDE="`read_config_setting "check_usr_local_include" "NO"`"
2342
+   check_usr_local_include="`read_config_setting "check_usr_local_include" "NO"`"
2319 2343
 
2320 2344
    remove_file_if_present "${CLONESFETCH_SUBDIR}/.build_done"
2321 2345
 
... ...
@@ -457,7 +457,6 @@ checkout()
457 457
    fi
458 458
    name2="`basename -- "${url}"`"  # only works for git really
459 459
 
460
-
461 460
    local operation
462 461
    local map
463 462
    local scmflagsdefault
... ...
@@ -599,7 +598,7 @@ ensure_clone_branch_is_correct()
599 598
 
600 599
    local actual
601 600
 
602
-   if [ ! -z "${branch}" -a -z "${MULLE_BOOTSTRAP_IGNORE_BRANCH}" ]
601
+   if [ ! -z "${branch}" -a -z "${IGNORE_BRANCH}" ]
603 602
    then
604 603
       actual="`git_get_branch "${dstdir}"`"
605 604
       if [ "${actual}" != "${branch}" ]
... ...
@@ -687,9 +686,12 @@ checkout_repository()
687 686
          checkout "$@"
688 687
          run_script=0  # yes, run it
689 688
 
690
-         if bootstrap_auto_update "${name}" "${url}" "${dstdir}"
689
+         if [ -z "${DONT_RECURSE}" ]
691 690
          then
692
-            stop=0
691
+            if bootstrap_auto_update "${name}" "${url}" "${dstdir}"
692
+            then
693
+               stop=0
694
+            fi
693 695
          fi
694 696
       fi
695 697
    fi
... ...
@@ -698,7 +700,7 @@ checkout_repository()
698 700
    # If we symlinked the repositiory, we don't embed
699 701
    # repos into it, unless the user is really crazy
700 702
    #
701
-   if [ "${COMMAND}" = "fetch" -a "${DONT_RECURSE}" = "" ]
703
+   if [ "${COMMAND}" = "fetch" -a "${DONT_RECURSE_EMBEDDED}" = "" ]
702 704
    then
703 705
       if [ ! -L "${dstdir}" -o "${MULLE_BOOTSTRAP_UPDATE_SYMLINKS}" = "YES" ]
704 706
       then
... ...
@@ -957,7 +959,7 @@ update_repository()
957 959
    rval=$?
958 960
    #update will return 1 if repo is symlinked
959 961
 
960
-   if [ "${DONT_RECURSE}" = "" ]
962
+   if [ -z "${DONT_RECURSE_EMBEDDED}" ]
961 963
    then
962 964
       if [ $rval -eq 0 -o $rval -eq 2 ]
963 965
       then
... ...
@@ -1413,9 +1415,14 @@ _common_main()
1413 1415
             DONT_RECURSE="YES"
1414 1416
          ;;
1415 1417
 
1418
+         -ne|--ne-embedded)
1419
+            DONT_RECURSE_EMBEDDED="YES"
1420
+         ;;
1421
+
1416 1422
          -cs|--check-usr-local-include)
1417 1423
             MULLE_BOOTSTRAP_CHECK_USR_LOCAL_INCLUDE="YES"
1418
-         ;;
1424
+            export MULLE_BOOTSTRAP_CHECK_USR_LOCAL_INCLUDE
1425
+            ;;
1419 1426
 
1420 1427
          -e|--embedded-only)
1421 1428
             EMBEDDED_ONLY="YES"
... ...
@@ -1426,7 +1433,7 @@ _common_main()
1426 1433
          ;;
1427 1434
 
1428 1435
          -i|--ignore-branch)
1429
-            MULLE_BOOTSTRAP_IGNORE_BRANCH="YES"
1436
+            IGNORE_BRANCH="YES"
1430 1437
          ;;
1431 1438
 
1432 1439
          -u|--update-symlinks)
... ...
@@ -1434,7 +1441,7 @@ _common_main()
1434 1441
          ;;
1435 1442
 
1436 1443
          # build options with no parameters
1437
-         -K|--clean|-k|--no-clean)
1444
+         -K|--clean|-k|--no-clean|--use-prefix-libraries)
1438 1445
             if [ -z "${MULLE_BOOTSTRAP_WILL_BUILD}" ]
1439 1446
             then
1440 1447
                log_error "${MULLE_BOOTSTRAP_FAIL_PREFIX}: Unknown fetch option $1"
... ...
@@ -1442,8 +1449,8 @@ _common_main()
1442 1449
             fi
1443 1450
          ;;
1444 1451
 
1445
-         # build options with no parameters
1446
-         -j|--cores|-c|--configuration)
1452
+         # build options with one parameter
1453
+         -j|--cores|-c|--configuration|--prefix)
1447 1454
             if [ -z "${MULLE_BOOTSTRAP_WILL_BUILD}" ]
1448 1455
             then
1449 1456
                log_error "${MULLE_BOOTSTRAP_FAIL_PREFIX}: Unknown fetch option $1"
... ...
@@ -1501,7 +1508,7 @@ _common_main()
1501 1508
    then
1502 1509
       if [ $# -ne 0 ]
1503 1510
       then
1504
-         log_error "Additional parameters not allowed for install"
1511
+         log_error "Additional parameters not allowed for fetch ($@)"
1505 1512
          ${USAGE}
1506 1513
       fi
1507 1514
    fi
... ...
@@ -1023,7 +1023,7 @@ has_usr_local_include()
1023 1023
    local name
1024 1024
 
1025 1025
    name="$1"
1026
-   if [ -d "/usr/local/include/${name}" ]
1026
+   if [ -d "${USR_LOCAL_INCLUDE}/${name}" ]
1027 1027
    then
1028 1028
       return 0
1029 1029
    fi
... ...
@@ -1032,7 +1032,7 @@ has_usr_local_include()
1032 1032
 
1033 1033
    include_name="`echo "${name}" | tr '-' '_'`"
1034 1034
 
1035
-   [ -d "/usr/local/include/${include_name}" ]
1035
+   [ -d "${USR_LOCAL_INCLUDE}/${include_name}" ]
1036 1036
 }
1037 1037
 
1038 1038
 
... ...
@@ -38,8 +38,9 @@ usage:
38 38
   mulle-bootstrap init [options]
39 39
 
40 40
   Options
41
-    -n :  don't ask for editor
41
+    -d :  don't create default files
42 42
     -e :  create example files
43
+    -n :  don't ask for editor
43 44
 EOF
44 45
   exit 1
45 46
 }
... ...
@@ -246,7 +247,7 @@ EOF
246 247
 
247 248
    fi
248 249
 
249
-   log_info "\"${BOOTSTRAP_SUBDIR}\" folder has been set up."
250
+   log_verbose "\"${BOOTSTRAP_SUBDIR}\" folder has been set up."
250 251
 
251 252
    local open
252 253
 
... ...
@@ -286,14 +286,39 @@ install_main()
286 286
    CONFIGURATIONS="`read_config_setting "configurations" "Release"`"
287 287
    N_CONFIGURATIONS="`echo "${CONFIGURATIONS}" | wc -l | awk '{ print $1 }'`"
288 288
 
289
-   while :
289
+   while [ $# -ne 0 ]
290 290
    do
291
-      if [ "$1" = "-h" -o "$1" = "--help" ]
292
-      then
293
-         install_usage
294
-      fi
291
+      case "$1" in
292
+         -h|--help)
293
+            install_usage
294
+         ;;
295
+
296
+         --prefix)
297
+            shift
298
+            [ $# -ne 0 ] || fail "prefix missing"
299
+
300
+            DEFAULT_PREFIX="$1"
301
+         ;;
302
+
303
+         --framework-prefix)
304
+            shift
305
+            [ $# -ne 0 ] || fail "prefix missing"
306
+
307
+            DEFAULT_FRAMEWORK_PREFIX="$1"
308
+         ;;
309
+
310
+         -*)
311
+            log_error "${MULLE_BOOTSTRAP_FAIL_PREFIX}: Unknown build option $1"
312
+            install_usage
313
+         ;;
314
+
315
+         ""|*)
316
+            break
317
+         ;;
318
+      esac
295 319
 
296
-      break
320
+      shift
321
+      continue
297 322
    done
298 323
 
299 324
 
... ...
@@ -184,7 +184,7 @@ logging_initialize()
184 184
             C_FAINT="\033[2m"
185 185
 
186 186
             C_RESET_BOLD="${C_RESET}${C_BOLD}"
187
-            trap 'printf "${C_RESET}"' TERM EXIT
187
+            trap 'printf "${C_RESET} >&2 ; exit 1"' TERM INT
188 188
             ;;
189 189
       esac
190 190
    fi