forked from cvmfs/cvmfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
executable file
·112 lines (88 loc) · 2.83 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
#!/bin/sh
set -e
CARES_VERSION=1.10.0
CURL_VERSION=7.39.0
PACPARSER_VERSION=1.3.1
ZLIB_VERSION=1.2.8
SPARSEHASH_VERSION=1.12
LEVELDB_VERSION=1.18
GOOGLETEST_VERSION=1.7.0
TBB_VERSION=4.3-1
LIBGEOIP_VERSION=1.6.0
PYTHON_GEOIP_VERSION=1.3.1
if [ $# -ne 1 ]; then
echo "Usage: $0 <decompress location>"
exit 1
fi
externals_build_dir="$1"
repo_root=$(pwd)
externals_dir="$repo_root/externals"
# check if bootstrapping already happened
if [ -f "$externals_build_dir/.decompressionDone" ]; then
exit 0
fi
print_hint() {
local msg="$1"
echo "--> $msg"
}
get_destination_dir() {
local library_name="$1"
echo "$externals_build_dir/build_$library_name"
}
do_extract() {
local library_name="$1"
local library_archive="$2"
local library_dir="$externals_dir/$library_name"
local dest_dir=$(get_destination_dir $library_name)
local cdir=$(pwd)
local library_decompressed_dir=$(basename $library_archive .tar.gz)
print_hint "Extracting $library_archive"
cd $externals_build_dir
tar xvfz "$library_dir/$library_archive"
mv $library_decompressed_dir $dest_dir
cd $cdir
cp $library_dir/src/* $dest_dir
}
do_copy() {
local library_name="$1"
local library_dir="$externals_dir/$library_name"
local dest_dir=$(get_destination_dir $library_name)
print_hint "Copying $library_name"
mkdir -p $dest_dir
cp $library_dir/src/* $dest_dir
}
patch_external() {
local library_name="$1"
shift 1
local cdir=$(pwd)
print_hint "Patching $library_name"
cd $(get_destination_dir $library_name)
while [ $# -gt 0 ]; do
patch -p0 < $1
shift 1
done
cd $cdir
}
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
mkdir -p $externals_build_dir
do_extract "c-ares" "c-ares-${CARES_VERSION}.tar.gz"
do_extract "libcurl" "curl-${CURL_VERSION}.tar.gz"
do_extract "pacparser" "pacparser-${PACPARSER_VERSION}.tar.gz"
do_extract "zlib" "zlib-${ZLIB_VERSION}.tar.gz"
do_extract "sparsehash" "sparsehash-${SPARSEHASH_VERSION}.tar.gz"
do_extract "leveldb" "leveldb-${LEVELDB_VERSION}.tar.gz"
do_extract "googletest" "gtest-${GOOGLETEST_VERSION}.tar.gz"
do_extract "libgeoip" "GeoIP-${LIBGEOIP_VERSION}.tar.gz"
do_extract "python-geoip" "GeoIP-${PYTHON_GEOIP_VERSION}.tar.gz"
do_extract "tbb" "tbb-${TBB_VERSION}.tar.gz"
do_copy "sqlite3"
do_copy "vjson"
patch_external "leveldb" "dont_search_snappy.patch" \
"dont_search_tcmalloc.patch"
patch_external "tbb" "custom_library_suffix.patch" \
"symlink_to_build_directories.patch" \
"32bit_mock.patch"
patch_external "vjson" "missing_include.patch"
patch_external "sparsehash" "fix_sl4_compilation.patch"
# create a hint that bootstrapping is already done
touch "$externals_build_dir/.decompressionDone"