-
Notifications
You must be signed in to change notification settings - Fork 90
Expand file tree
/
Copy pathinstall-boost.sh
More file actions
executable file
·48 lines (37 loc) · 996 Bytes
/
install-boost.sh
File metadata and controls
executable file
·48 lines (37 loc) · 996 Bytes
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
#!/usr/bin/env bash
# Exit on error
set -e
cUsage="Usage: ${BASH_SOURCE[0]} <version>"
if [ "$#" -lt 1 ] ; then
echo $cUsage
exit
fi
version=$1
version_with_underscores=${version//./_}
echo "Checking for elevated privileges..."
if [ ${EUID:-$(id -u)} -ne 0 ] ; then
sudo echo "Script can elevate privileges."
fi
# Get number of cpu cores
num_cpus=$(grep -c ^processor /proc/cpuinfo)
package_name=boost
# Create temp dir for installation
temp_dir=/tmp/${package_name}-installation
mkdir -p $temp_dir
cd $temp_dir
# Download source
tar_filename=boost_${version_with_underscores}.tar.gz
curl -fsSL https://archives.boost.io/release/${version}/source/${tar_filename} -o ${tar_filename}
tar xzf ${tar_filename}
cd boost_${version_with_underscores}
# Build
./bootstrap.sh --with-libraries=filesystem,iostreams,program_options,regex,system,url
./b2 -j${num_cpus}
# Install
if [ ${EUID:-$(id -u)} -ne 0 ] ; then
sudo ./b2 install
else
./b2 install
fi
# Clean up
rm -rf $temp_dir