forked from Ensembl/WiggleTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
easy_install.sh
executable file
·247 lines (220 loc) · 5.34 KB
/
easy_install.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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
#!/bin/bash -Ee
prompt_download() {
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo "About to install $1"
echo "I will download from $2"
read -p "OK? (Yes/abort)" yn
case $yn in
[Aa]* ) exit;;
esac
}
confirmed_download() {
prompt_download $1 $2
curl -L ${2} > tmp.tgz
tar -xvzpf tmp.tgz
rm -f tmp.tgz
}
install_mysql () {
echo "Installing mysql...."
if [ -x "$(which apt-get)" ]; then
apt-get install mysql-server mysql-client
elif [ -x "$(which brew)" ]; then
brew install mysql
else
if [ ! -x "$(which cmake)" ];
then
echo "Installing cmake..."
rm -Rf cmake*
confirmed_download 'cmake' 'http://www.cmake.org/files/v3.0/cmake-3.0.0.tar.gz'
cd cmake-3.0.0
./configure
make
sudo make install
cd ..
export PATH=$PATH
fi
rm -Rf mysql*
confirmed_download 'mysql' 'http://sourceforge.net/projects/mysql.mirror/files/MySQL%205.6.19/mysql-5.6.19.tar.gz/download'
cd mysql*
cmake .
make
sudo make install
cd ..
fi
}
install_zlib () {
if [ -x "$(which apt-get)" ]; then
apt-get install libgcrypt11-dev zlib1g-dev
elif [ -x "$(which brew)" ]; then
brew install zlib
else
rm -Rf zlib*
confirmed_download 'Zlib' 'http://zlib.net/zlib-1.2.8.tar.gz'
cd zlib*
./configure
sudo make install
cd ..
fi
}
install_ssl () {
if [ -x "$(which apt-get)" ]; then
apt-get install openssl
elif [ -x "$(which brew)" ]; then
brew install openssl
else
rm -Rf openssl*
confirmed_download 'OpenSSl' 'ftp://ftp.openssl.org/source/openssl-1.0.1h.tar.gz'
cd openssl*
./config
make
sudo make install
cd ..
fi
}
install_png () {
if [ -x "$(which apt-get)" ]; then
apt-get install libpng-dev
elif [ -x "$(which brew)" ]; then
brew install libpng
else
rm -Rf libpng*
confirmed_download 'libpng' 'http://prdownloads.sourceforge.net/libpng/libpng-1.6.12.tar.gz?download'
cd libpng
./configure
make
sudo make install
cd ..
fi
}
install_gsl() {
if [ -x "$(which apt-get)" ]; then
apt-get install libgsl0 libgsl0-dev
elif [ -x "$(which brew)" ]; then
brew install gsl
else
rm -Rf gsl*
confirmed_download 'GSL' 'ftp://www.mirrorservice.org/sites/ftp.gnu.org/gnu/gsl/gsl-latest.tar.gz'
echo "Installing GNU Scientific library..."
cd gsl*
./configure
make
sudo make install
cd ..
fi
}
install_brew() {
prompt_download "HomeBrew" "https://raw.github.com/Homebrew/homebrew/go/install"
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
}
install_git() {
if [ -x "$(which apt-get)" ]; then
apt-get install git
elif [ -x "$(which brew)" ]; then
brew install git
else
prompt_download "Git" "https://github.com/git/git/archive/master.zip"
curl -L "https://github.com/git/git/archive/master.zip" > tmp.zip
unzip -j master.zip -d git
rm master.zip
cd git*
make prefix=/usr/local all
make prefix=/usr/local install
cd ..
fi
export PATH=$PATH
}
install_tabix() {
prompt_download 'Tabix' 'https://github.com/samtools/tabix.git'
echo "Installing Tabix..."
rm -Rf tabix
git clone https://github.com/samtools/tabix.git
export TABIX_SRC=$PWD/tabix
cd tabix
make
cd ..
}
install_kent() {
prompt_download 'Kent userApps' 'genome-source.cse.ucsc.edu/kent.git'
echo "Installing Kent source..."
rm -Rf userApps
git archive --format=zip -9 --remote=git://genome-source.cse.ucsc.edu/kent.git beta src/userApps > userApps.zip
unzip -d userApps -j userApps.zip
rm userApps.zip
cd userApps
make fetchSource
make libs
export KENT_SRC=$PWD/kent/src
mkdir bin
cd kent/src/utils/bigWigCat
make
cd ../../../..
cd ..
}
#######################
## Brew
#######################
(uname -a | grep Darwin &> /dev/null) && [ ! -x "$(which brew)" ] && install_brew
#######################
## Zlib
#######################
echo "Checking for Zlib..."
echo '#include <zlib.h>' > tmp.c
echo 'int main(int c, char **v) {&deflate;}' >> tmp.c
(gcc tmp.c -o tmp.a &> tmp.o) || install_zlib
#######################
## SSL
#######################
echo "Checking for OpenSSL..."
echo '#include <openssl/ssl.h>' > tmp.c
echo 'int main(int c, char **v) {&SSL_CIPHER_description;}' >> tmp.c
(gcc tmp.c -o tmp.a &> tmp.o) || install_ssl
#######################
## png
#######################
echo "Checking for libpng..."
echo '#include <png.h>' > tmp.c
echo 'int main(int c, char **v) {&png_sig_cmp;}' >> tmp.c
(gcc tmp.c -o tmp.a &> tmp.o) || install_png
#######################
## MySQL
#######################
echo "Checking for mysql..."
echo "#include <mysql/mysql.h>" > tmp.c
echo 'int main(int c, char **v) {&mysql_server_init;}' >> tmp.c
(gcc tmp.c -o tmp.a &> tmp.o) || install_mysql
#######################
## GSL
#######################
echo "Checking for GSL..."
echo "#include <gsl/gsl_sf_bessel.h>" > tmp.c
echo 'int main(int c, char **v) {&gsl_sf_bessel_J0;}' >> tmp.c
(gcc tmp.c -o tmp.a &> tmp.o) || install_gsl
#######################
## Git
#######################
echo "Checking for Git..."
if [ ! -x "$(which git)" ]; then
install_git
fi
#######################
## Tabix
#######################
echo "Checking for tabix..."
if [ -z "$TABIX_SRC" ];
then
install_tabix
fi
#######################
## Kent
#######################
echo "Checking for Kent src..."
if [ -z "$KENT_SRC" ];
then
install_kent
fi
#######################
## WiggleTools
#######################
echo "Compiling WiggleTools"
make
rm tmp*