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