-
Notifications
You must be signed in to change notification settings - Fork 13
/
install_dependencies.sh
94 lines (74 loc) · 1.89 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
#!/bin/bash
set -x
set -e
start_dir=$(pwd)
GENOMETOOLS_VERSION="1.5.5"
GENOMETOOLS_DOWNLOAD_URL="https://github.com/genometools/genometools/archive/v${GENOMETOOLS_VERSION}.tar.gz"
# 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 $GENOMETOOLS_DOWNLOAD_URL "genometools-${GENOMETOOLS_VERSION}.tgz"
# Update dependencies
if [ "$TRAVIS" = 'true' ]; then
echo "Using Travis's apt plugin"
else
sudo apt-get update -q
sudo apt-get install -y -q g++ \
python-dev
fi
# Build all the things
cd $build_dir
## GenomeTools
genometools_dir=$(pwd)/genometools-${GENOMETOOLS_VERSION}
if [ ! -d $genometools_dir ]; then
tar xzf genometools-${GENOMETOOLS_VERSION}.tgz
fi
cd $genometools_dir
if [ -e "${genometools_dir}/bin/gt" ]; then
echo "Already built GenomeTools; skipping build"
else
make cairo=no
fi
cd $build_dir
# Setup environment variables
update_path () {
new_dir=$1
export PATH=${PATH:-$new_dir}
if [[ ! "$PATH" =~ (^|:)"${new_dir}"(:|$) ]]; then
export PATH=${new_dir}:${PATH}
fi
}
update_path ${genometools_dir}/bin
update_python_path () {
new_dir=$1
export PYTHONPATH=${PYTHONPATH:-$new_dir}
if [[ ! "$PYTHONPATH" =~ (^|:)"${new_dir}"(:|$) ]]; then
export PYTHONPATH=${new_dir}:${PYTHONPATH}
fi
}
update_python_path ${genometools_dir}/gtpython
update_ld_path () {
new_dir=$1
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:-$new_dir}
if [[ ! "$LD_LIBRARY_PATH" =~ (^|:)"${new_dir}"(:|$) ]]; then
export LD_LIBRARY_PATH=${new_dir}:${LD_LIBRARY_PATH}
fi
}
update_ld_path ${genometools_dir}/lib
cd $start_dir
set +x
set +e