1 | #!/bin/bash |
---|
2 | # |
---|
3 | # Installs Bio-Conda and all dependencies |
---|
4 | # - adds miniconda PATH to bashrc (for CircleCI) |
---|
5 | # - manages a tarball if file `LOCAL` present (for ./cicleci build) |
---|
6 | # - creates conda_state.txt for caching with circleci "{{checksum}}" |
---|
7 | # - updates packages with every run |
---|
8 | # - needs BASH_ENV to point to the bashrc |
---|
9 | # - needs MINICONDA to point to the miniconda install path |
---|
10 | |
---|
11 | CONDA_PACKAGES="autoconf automake libtool pkg-config boost arb-bio-devel lcov" |
---|
12 | CONDA_PACKAGES="$CONDA_PACKAGES git tbb tbb-devel glib libiconv bc sed sphinx nomkl" |
---|
13 | |
---|
14 | CONDA_BASEURL=https://repo.anaconda.com/miniconda |
---|
15 | |
---|
16 | # expand '~' in MINICONDA path (alternatives to eval are too long) |
---|
17 | eval MINICONDA=$MINICONDA |
---|
18 | export MINICONDA |
---|
19 | |
---|
20 | case "$(uname)" in |
---|
21 | Linux) |
---|
22 | CONDA_OSNAME=Linux |
---|
23 | CONDA_PACKAGES="$CONDA_PACKAGES gxx_linux-64 patchelf coreutils" |
---|
24 | ;; |
---|
25 | Darwin) |
---|
26 | CONDA_OSNAME=MacOSX |
---|
27 | CONDA_PACKAGES="$CONDA_PACKAGES clangxx_osx-64" |
---|
28 | ;; |
---|
29 | esac |
---|
30 | |
---|
31 | # Install Miniconda if missing |
---|
32 | if test -d $MINICONDA; then |
---|
33 | echo "Found conda install" |
---|
34 | else |
---|
35 | echo "Downloading Miniconda" |
---|
36 | curl $CONDA_BASEURL/Miniconda3-latest-$CONDA_OSNAME-x86_64.sh -o miniconda.sh |
---|
37 | echo "Installing Miniconda" |
---|
38 | bash miniconda.sh -b -p $MINICONDA |
---|
39 | source $MINICONDA/etc/profile.d/conda.sh |
---|
40 | |
---|
41 | $MINICONDA/bin/conda config --system --set always_yes yes --set changeps1 no |
---|
42 | $MINICONDA/bin/conda config --system --add channels defaults |
---|
43 | $MINICONDA/bin/conda config --system --add channels bioconda |
---|
44 | $MINICONDA/bin/conda config --system --add channels conda-forge |
---|
45 | $MINICONDA/bin/conda update -q conda |
---|
46 | fi |
---|
47 | |
---|
48 | # Setup Conda |
---|
49 | if test -z "$BASH_ENV"; then |
---|
50 | BASH_ENV="/tmp/bash_env" |
---|
51 | fi |
---|
52 | cat >>$BASH_ENV <<EOF |
---|
53 | export MINICONDA=$MINICONDA |
---|
54 | source \$MINICONDA/etc/profile.d/conda.sh |
---|
55 | conda activate base |
---|
56 | export CPPFLAGS="\$CPPFLAGS -I\$CONDA_PREFIX/include" |
---|
57 | export LDFLAGS="\$LDFLAGS -L\$CONDA_PREFIX/lib" |
---|
58 | export CXXFLAGS="\$CXXFLAGS -std=c++14" |
---|
59 | EOF |
---|
60 | |
---|
61 | cat $BASH_ENV |
---|
62 | source $BASH_ENV |
---|
63 | |
---|
64 | # Install/update package |
---|
65 | conda install -q conda $CONDA_PACKAGES |
---|
66 | conda update -q conda $CONDA_PACKAGES |
---|
67 | conda info |
---|
68 | conda clean --yes --all |
---|
69 | |
---|
70 | # Dump status |
---|
71 | mkdir -p conda |
---|
72 | conda info > conda/info.txt |
---|
73 | conda list > conda/root.txt |
---|
74 | ls -1 $MINICONDA/pkgs > conda/pkgs.txt |
---|
75 | |
---|
76 | ## Fix for as yet incomplete removal of .la files by conda-forge |
---|
77 | find $MINICONDA/lib -name \*.la -delete |
---|
78 | |
---|
79 | |
---|
80 | |
---|