-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_boost
executable file
·66 lines (52 loc) · 1.56 KB
/
install_boost
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
#!/bin/sh
#
# Download and bootstrap the indicated version of the Boost C++
# Libraries.
set -u
set -e
if [ $# -ne 1 ]; then
printf "usage: %s <version>\n" "$(basename "$0")" 1>&2
exit 1
fi
version="$1"
version_name="$(printf "%s" "${version}" | sed 's/\./_/g')"
root="${HOME}"/opt/local/src/boost
directory=boost_"${version_name}"
filename="${directory}".tar.gz
if [ ! -d "${root}" ]; then
printf "error: %s does not exist.\n" "${root}" 1>&2
exit 1
fi
if [ -d "${root}"/"${directory}" ]; then
printf "error: %s already exists.\n" "${root}/${directory}" 1>&2
exit 1
fi
if [ -e "${root}"/"${filename}" ]; then
printf "error: %s already exists.\n" "${root}/${filename} " 1>&2
exit 1
fi
url=https://boostorg.jfrog.io/artifactory/main/release/"${version}"/source/"${filename}"
curl --no-clobber --location --remote-name --output-dir "${root}" "${url}"
if [ ! -e "${root}"/"${filename}" ]; then
printf "error: %s does not exist.\n" "${root}/${filename}" 1>&2
exit 1
fi
tar -x -z -f "${root}"/"${filename}" -C "${root}"
if [ ! -d "${root}"/"${directory}" ]; then
printf "error: %s does not exist.\n" "${root}/${directory} " 1>&2
exit 1
fi
cwd="$(pwd)"
cd "${root}"/"${directory}"
./bootstrap.sh
cd "${cwd}"
cat > "${root}"/b2_"${version_name}".sh <<EOF
#!/bin/sh
if [ -n "\${BOOST_BUILD_PATH}" ]; then
export BOOST_BUILD_PATH="\${BOOST_BUILD_PATH}":"${root}"/"${directory}"/tools/build
else
export BOOST_BUILD_PATH="${root}"/"${directory}"/tools/build
fi
"${root}"/"${directory}"/b2 "\$@"
EOF
chmod a+x "${root}"/b2_"${version_name}".sh