]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #!/bin/sh |
2 | # Copyright (C) 2005, 2006 Douglas Gregor. | |
3 | # Copyright (C) 2006 The Trustees of Indiana University | |
4 | # Copyright (C) 2010 Bryce Lelbach | |
5 | # | |
6 | # Distributed under the Boost Software License, Version 1.0. | |
7 | # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) | |
8 | ||
9 | # boostinspect:notab - Tabs are required for the Makefile. | |
10 | ||
11 | B2="" | |
12 | TOOLSET="" | |
13 | B2_CONFIG="" | |
14 | ||
15 | for option | |
16 | do | |
17 | case $option in | |
18 | ||
19 | -help | --help | -h) | |
20 | want_help=yes ;; | |
21 | ||
22 | -with-toolset=* | --with-toolset=* ) | |
23 | TOOLSET=`expr "x$option" : "x-*with-toolset=\(.*\)"` | |
24 | ;; | |
25 | ||
26 | -*) | |
27 | { echo "error: unrecognized option: $option | |
28 | Try \`$0 --help' for more information." >&2 | |
29 | { (exit 1); exit 1; }; } | |
30 | ;; | |
31 | ||
32 | esac | |
33 | done | |
34 | ||
35 | if test "x$want_help" = xyes; then | |
36 | cat <<EOF | |
37 | \`./bootstrap.sh' creates minimal Boost.Build, which can install itself. | |
38 | ||
39 | Usage: $0 [OPTION]... | |
40 | ||
41 | Defaults for the options are specified in brackets. | |
42 | ||
43 | Configuration: | |
44 | -h, --help display this help and exit | |
45 | --with-b2=B2 use existing Boost.Build executable (b2) | |
46 | [automatically built] | |
47 | --with-toolset=TOOLSET use specific Boost.Build toolset | |
48 | [automatically detected] | |
49 | EOF | |
50 | fi | |
51 | test -n "$want_help" && exit 0 | |
52 | ||
53 | # TBD: Determine where the script is located | |
54 | my_dir="." | |
55 | ||
56 | # Determine the toolset, if not already decided | |
57 | if test "x$TOOLSET" = x; then | |
58 | guessed_toolset=`$my_dir/src/engine/build.sh --guess-toolset` | |
59 | case $guessed_toolset in | |
60 | acc | darwin | gcc | como | mipspro | pathscale | pgi | qcc | vacpp | xlcpp | clang ) | |
61 | TOOLSET=$guessed_toolset | |
62 | ;; | |
63 | ||
64 | intel-* ) | |
65 | TOOLSET=intel | |
66 | ;; | |
67 | ||
68 | mingw ) | |
69 | TOOLSET=gcc | |
70 | ;; | |
71 | ||
72 | clang* ) | |
73 | TOOLSET=clang | |
74 | ;; | |
75 | ||
76 | sun* ) | |
77 | TOOLSET=sun | |
78 | ;; | |
79 | ||
80 | * ) | |
81 | # Not supported by Boost.Build | |
82 | ;; | |
83 | esac | |
84 | fi | |
85 | ||
86 | case $TOOLSET in | |
87 | clang*) | |
88 | TOOLSET=clang | |
89 | ;; | |
90 | esac | |
91 | ||
92 | ||
93 | rm -f config.log | |
94 | ||
95 | # Build b2 | |
96 | if test "x$B2" = x; then | |
97 | echo -n "Bootstrapping the build engine with toolset $TOOLSET... " | |
98 | pwd=`pwd` | |
99 | (cd "$my_dir/src/engine" && ./build.sh "$TOOLSET") > bootstrap.log 2>&1 | |
100 | if [ $? -ne 0 ]; then | |
101 | echo | |
102 | echo "Failed to bootstrap the build engine" | |
103 | echo "Consult 'bootstrap.log' for more details" | |
104 | exit 1 | |
105 | fi | |
106 | cd "$pwd" | |
107 | arch=`cd $my_dir/src/engine && ./bootstrap/jam0 -d0 -f build.jam --toolset=$TOOLSET --toolset-root= --show-locate-target && cd ..` | |
108 | B2="$my_dir/src/engine/$arch/b2" | |
109 | echo "engine/$arch/b2" | |
110 | cp "$B2" . | |
111 | cp "$my_dir/src/engine/$arch/bjam" . | |
112 | fi | |
113 | ||
114 | cat << EOF | |
115 | ||
116 | Bootstrapping is done. To build and install, run: | |
117 | ||
118 | ./b2 install --prefix=<DIR> | |
119 | ||
120 | EOF |