forked from nickjcroucher/gubbins
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall_dependencies.sh
executable file
·93 lines (76 loc) · 2 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
#!/bin/bash
set -x
set -e
start_dir=$(pwd)
RAXML_VERSION="8.1.21"
FASTTREE_VERSION="2.1.9"
RAXML_DOWNLOAD_URL="https://github.com/stamatak/standard-RAxML/archive/v${RAXML_VERSION}.tar.gz"
FASTTREE_DOWNLOAD_URL="http://www.microbesonline.org/fasttree/FastTree-${FASTTREE_VERSION}.c"
# Make an install location
if [ ! -d 'build' ]; then
mkdir build
fi
cd build
build_dir=$(pwd)
# DOWNLOAD ALL THE THINGS
download () {
url=$1
download_location=$2
if [ -e $download_location ]; then
echo "Skipping download of $url, $download_location already exists"
else
echo "Downloading $url to $download_location"
wget $url -O $download_location
fi
}
download $RAXML_DOWNLOAD_URL "raxml-${RAXML_VERSION}.tgz"
download $FASTTREE_DOWNLOAD_URL "fasttree-${FASTTREE_VERSION}.c"
# Update dependencies
if [ "$TRAVIS" = 'true' ]; then
echo "Using Travis's apt plugin"
else
sudo apt-get update -q
sudo apt-get install -y -q autoconf \
check \
g++ \
libtool \
pkg-config \
python-dev
fi
# Build all the things
cd $build_dir
## RAxML
raxml_dir=$(pwd)/"standard-RAxML-${RAXML_VERSION}"
if [ ! -d $raxml_dir ]; then
tar xzf raxml-${RAXML_VERSION}.tgz
fi
cd $raxml_dir
if [ -e "${raxml_dir}/raxmlHPC" ]; then
echo "Already build RAxML; skipping build"
else
make -f Makefile.gcc
fi
cd $build_dir
## FastTree
fasttree_dir=${build_dir}/fasttree-${FASTTREE_VERSION}
if [ ! -d $fasttree_dir ]; then
mkdir $fasttree_dir
fi
cd $fasttree_dir
if [ -e "${fasttree_dir}/FastTree" ]; then
echo "Skipping, FastTree already exists"
else
gcc -O3 -finline-functions -funroll-loops -Wall -o FastTree ${build_dir}/fasttree-${FASTTREE_VERSION}.c -lm
fi
# Setup environment variables
update_path () {
new_dir=$1
if [[ ! "$PATH" =~ (^|:)"${new_dir}"(:|$) ]]; then
export PATH=${new_dir}:${PATH}
fi
}
update_path ${raxml_dir}
update_path ${fasttree_dir}
cd $start_dir
set +x
set +e