-
Notifications
You must be signed in to change notification settings - Fork 2
/
build-boost.sh
executable file
·103 lines (90 loc) · 3.77 KB
/
build-boost.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
#!/usr/bin/env bash
set -ex
: ${SOURCE_ROOT:?} ${INSTALL_ROOT:?} ${GCC_VERSION:?} ${CXX:?} \
${BOOST_VERSION:?} ${BOOST_BUILD_TYPE:?} ${POWERTIGER_ROOT:?}
if [[ -d "/etc/opt/cray/release/" ]]; then
flag1="cxxflags=$CXXFLAGS"
flag2="threading=multi link=shared"
else
flag1=""
flag2=""
fi
DIR_SRC=${SOURCE_ROOT}/boost
#DIR_BUILD=${INSTALL_ROOT}/boost/build
DIR_INSTALL=${INSTALL_ROOT}/boost
FILE_MODULE=${INSTALL_ROOT}/modules/boost/${BOOST_VERSION}-${BOOST_BUILD_TYPE}
#DOWNLOAD_URL="http://downloads.sourceforge.net/project/boost/boost/${BOOST_VERSION}/boost_${BOOST_VERSION//./_}.tar.bz2"
if [[ ! -d ${DIR_SRC} ]]; then
(
# Get from sourceforge
#mkdir -p ${DIR_SRC}
#cd ${DIR_SRC}
# When using the sourceforge link
#wget -O- ${DOWNLOAD_URL} | tar xj --strip-components=1
# Get super repository variant 1 (get entire super project)
#cd ${SOURCE_ROOT}
#git clone https://github.com/boostorg/boost boost
#cd boost
# Get correct version before getting the submodules
#git checkout boost-${BOOST_VERSION}
# NOTE: Rerun all submodule inits when switchting the version using this variant...
# Get super repository variant 2 (get only the correct commit)
cd ${SOURCE_ROOT}
git clone --depth 1 --branch boost-${BOOST_VERSION} https://github.com/boostorg/boost boost
cd boost
# Just checkout everything
git submodule update --init --recursive --depth=1 -j 8
# # checkout required tools
# git submodule update --init --recursive --depth=1 tools/build/
# git submodule update --init --recursive --depth=1 tools/boost_install/
# # checkout basic lib submodules
# git submodule update --init --recursive --depth=1 libs/core/
# git submodule update --init --recursive --depth=1 libs/headers/
# git submodule update --init --recursive --depth=1 libs/config/
# git submodule update --init --recursive --depth=1 libs/io/
# # checkout actual compoments that we want
# git submodule update --init --recursive --depth=1 libs/thread/
# git submodule update --init --recursive --depth=1 libs/iostreams/
# git submodule update --init --recursive --depth=1 libs/date_time/
# git submodule update --init --recursive --depth=1 libs/chrono/
# git submodule update --init --recursive --depth=1 libs/system/
# git submodule update --init --recursive --depth=1 libs/regex/
# git submodule update --init --recursive --depth=1 libs/program_options/
# git submodule update --init --recursive --depth=1 libs/filesystem/
# git submodule update --init --recursive --depth=1 libs/atomic/
# git submodule update --init --recursive --depth=1 libs/spirit/
# # Adapt as needed for other stuff
echo "using gcc : : $CXX ; " >tools/build/src/user-config.jam
)
fi
#if [[ -d "boost_${BOOST_VERSION//./_}" ]]; then
# rm -rf boost_${BOOST_VERSION//./_}
#fi
(
cd ${DIR_SRC}
if [[ "${OCT_WITH_CLANG}" == "ON" ]]; then
./bootstrap.sh --prefix=${DIR_INSTALL} --with-toolset=clang
else
./bootstrap.sh --prefix=${DIR_INSTALL} --with-toolset=gcc
fi
./b2 -j${PARALLEL_BUILD} "${flag1}" ${flag2} --with-atomic --with-filesystem --with-program_options --with-regex --with-system --with-chrono --with-date_time --with-thread --with-iostreams ${BOOST_BUILD_TYPE} install
)
# Patch Boost 1.69 - HPX 1.2 compatibility issue
cp ${POWERTIGER_ROOT}/sign.hpp ${DIR_INSTALL}/include/boost/spirit/home/support/detail/
mkdir -p $(dirname ${FILE_MODULE})
cat >${FILE_MODULE} <<EOF
#%Module
proc ModulesHelp { } {
puts stderr {boost}
}
module-whatis {boost}
set root ${DIR_INSTALL}
conflict boost
module load gcc/${GCC_VERSION}
prereq gcc/${GCC_VERSION}
prepend-path CPATH \$root
prepend-path LD_LIBRARY_PATH \$root/lib
prepend-path LIBRARY_PATH \$root/lib
setenv BOOST_ROOT \$root
setenv BOOST_VERSION ${BOOST_VERSION}
EOF