forked from EBIvariation/vcf-validator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_dependencies.sh
executable file
·202 lines (170 loc) · 6.38 KB
/
install_dependencies.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
#!/bin/bash
# stop the script if any command fails
set -e
# keep track of the last executed command
trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG
# echo an error message before exiting
trap 'if [ $? -ne 0 ]; then echo "******ERROR******: \"${last_command}\" command failed with exit code $?." && echo "Installation of dependencies failed!"; fi' EXIT
help_install_dependencies="Usage:
./install_dependencies.sh [os_name] default OS is linux
./install_dependencies.sh --help displays help
os_name can be:
- linux
- osx
it installs the given dependencies:
- odb compiler odb-2.4.0
- odb common runtime library libodb-2.4.0
- odb sqlite runtime library libodb-sqlite-2.4.0
- bzip library bzip2-1.0.6
- zlib library zlib-1.2.11
- curl library curl-7.62.0
- openssl library openssl-1.1.1f
- c-ares library c-ares-1.15.0
- boost library boost-1.72.0
for linux:
./install_dependencies.sh linux
for mac os:
./install_dependencies.sh osx
"
if [ "$#" -eq 0 ]
then
OS_NAME="linux"
elif [ "$#" -eq 1 ]
then
if [[ "$1" == "--help" ]]
then
echo "$help_install_dependencies"
exit
elif [[ "$1" == "linux" ]]
then
OS_NAME="linux"
elif [[ "$1" == "osx" ]]
then
OS_NAME="osx"
else
echo "$help_install_dependencies"
exit
fi
else
echo "requires 1 argument at max"
echo "$help_install_dependencies"
exit
fi
dependencies_dir=$OS_NAME"_dependencies"
#check for already downloaded files
if [ "$(ls -A $dependencies_dir)" ]; then
echo "ERROR: Found non-empty directory of a previous installation: \"$dependencies_dir\". Please remove the folder before running this script. Current contents:"
ls $dependencies_dir
exit 0
fi
# Download ODB runtime library, sqlite DB plugin for ODB, libbz2 and libz.
echo "creating directory $dependencies_dir"
mkdir -p $dependencies_dir && cd $dependencies_dir
echo "installing libodb"
wget http://codesynthesis.com/download/odb/2.4/libodb-2.4.0.tar.bz2 -O ./libodb.tar.bz2
tar jxf ./libodb.tar.bz2
cd libodb-2.4.0 && ./configure && make
cd ..
echo "installing libodb-sqlite"
wget http://codesynthesis.com/download/odb/2.4/libodb-sqlite-2.4.0.tar.bz2 -O ./libodb-sqlite.tar.bz2
tar jxf ./libodb-sqlite.tar.bz2
cd libodb-sqlite-2.4.0 && ./configure --with-libodb=../libodb-2.4.0 && make
cd ..
echo "installing libbz2"
# This is commented till the bzip.org site is recovered.
# wget http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz -O ./libbz2.tar.gz
# tar zxf ./libbz2.tar.gz
# Till then we can trust ubuntu archives.
wget http://archive.ubuntu.com/ubuntu/pool/main/b/bzip2/bzip2_1.0.6.orig.tar.bz2 -O ./libbz2.tar.bz2
tar jxf ./libbz2.tar.bz2
cd bzip2-1.0.6 && make
cd ..
echo "installing libz"
wget http://prdownloads.sourceforge.net/libpng/zlib-1.2.11.tar.gz?download -O ./libz.tar.gz
tar zxf ./libz.tar.gz
cd zlib-1.2.11 && cmake . && make
cd ..
dependencies_dir_abs_path=`pwd`
echo "installing openssl"
mkdir openssl
wget https://www.openssl.org/source/openssl-1.1.1f.tar.gz -O ./openssl-1.1.1f.tar.gz
tar xzf ./openssl-1.1.1f.tar.gz
cd openssl-1.1.1f
LIBS="-lcrypto -ldl" \
./config -fPIC no-shared no-threads \
--prefix=$dependencies_dir_abs_path/openssl \
--openssldir=$dependencies_dir_abs_path/openssl
make && make install_sw
cd ..
echo "installing c-ares"
mkdir c-ares
wget https://c-ares.haxx.se/download/c-ares-1.15.0.tar.gz -O ./c-ares-1.15.0.tar.gz
tar xzf ./c-ares-1.15.0.tar.gz
cd c-ares-1.15.0
./configure --prefix=$dependencies_dir_abs_path/c-ares
make && make install
cd ..
echo "installing libcurl"
mkdir curl
wget https://curl.haxx.se/download/curl-7.62.0.tar.gz -O ./curl-7.62.0.tar.gz
tar zxf ./curl-7.62.0.tar.gz
cd curl-7.62.0
LDFLAGS="-L$dependencies_dir_abs_path/openssl/lib -L$dependencies_dir_abs_path/c-ares/lib" \
CPPFLAGS="-I$dependencies_dir_abs_path/openssl/include -I$dependencies_dir_abs_path/c-ares/include" \
./configure --disable-shared \
--enable-static \
--without-librtmp \
--without-ca-bundle \
--disable-ldap \
--without-zlib \
--without-libidn2 \
--without-nss \
--enable-ares=$dependencies_dir_abs_path/c-ares \
--with-ssl=$dependencies_dir_abs_path/openssl \
--prefix=$dependencies_dir_abs_path/curl
make && make install
cd ..
if [[ "$OS_NAME" == "linux" ]]
then
echo "installing boost"
wget https://dl.bintray.com/boostorg/release/1.72.0/source/boost_1_72_0.tar.gz -O ./boost.tar.gz
tar zxf ./boost.tar.gz
mv boost_1_72_0 boost && cd boost
# If there's some error like "undefined reference to bzip2_base", then boost didn't compile everything for iostreams.
# The boost iostreams compilation was ok if this command finds some lines "nm libboost_iostreams.a | grep bzip2_base".
# The next user-config.jam should fix that.
# Documentation on building iostreams: https://www.boost.org/doc/libs/1_72_0/libs/iostreams/doc/index.html
# Documentation on specifying zlib and bzip2: https://boostorg.github.io/build/manual/master/index.html#bbv2.reference.tools.libraries.zlib
echo "
using zlib : 1.2.11 : <include>${dependencies_dir_abs_path}/zlib-1.2.11 <search>${dependencies_dir_abs_path}/ ;
using bzip2 : 1.0.6 : <include>${dependencies_dir_abs_path}/bzip2-1.0.6 <search>${dependencies_dir_abs_path}/ ;
" > tools/build/src/user-config.jam
./bootstrap.sh --with-libraries=filesystem,iostreams,log,program_options,regex && ./b2 link=static
cd ..
fi
# Make easier to find the static libraries
cp libodb-2.4.0/odb/.libs/libodb.a .
cp libodb-sqlite-2.4.0/odb/sqlite/.libs/libodb-sqlite.a .
cp bzip2-1.0.6/libbz2.a .
cp zlib-1.2.11/libz.a .
# copy headers
cp -r libodb-2.4.0/odb ./
cp -r libodb-sqlite-2.4.0/odb/sqlite ./odb/
# Download odb compiler
if [[ "$OS_NAME" == "linux" ]]
then
wget http://codesynthesis.com/download/odb/2.4/odb-2.4.0-x86_64-linux-gnu.tar.bz2 -O ./odb.tar.bz2
tar jxf ./odb.tar.bz2
elif [[ "$OS_NAME" == "osx" ]]
then
wget http://codesynthesis.com/download/odb/2.4/odb-2.4.0-i686-macosx.tar.bz2 -O ./odb.tar.bz2
tar jxf ./odb.tar.bz2
else
echo "Invalid OS name"
echo "$help_install_dependencies"
exit
fi
cd ..
echo "Dependencies folder:"
ls $dependencies_dir
echo -e "\nAutomatic installation completed successfully."