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
|
#!/bin/bash
# This installs all packages needed to build Shasta or to run
# the dynamic executable. The static executable has no prerequisites.
minimalInstall=false
for arg in "$@"
do
case $arg in
--minimal)
minimalInstall=true
shift
;;
*)
echo "Usage: /path/to/InstallPrerequisites-Ubuntu.sh [--minimal]"
exit 1
;;
esac
done
ubuntuPrettyName=$(cat /etc/os-release | grep PRETTY_NAME | cut -f2 -d'=')
ubuntuVersion=$(cat /etc/os-release | grep VERSION_ID | cut -f2 -d'=')
arch=$(uname -p)
echo "Detected $ubuntuPrettyName running on $arch."
isLatestOS=true
if [ $ubuntuVersion \< "\"20.04\"" ] ; then
isLatestOS=false
fi
isX86=false
isArm=false
if [ $arch == "aarch64" ]; then
isArm=true
fi
if [ $arch == "x86_64" ]; then
isX86=true
fi
if [[ "$isX86" == false && "$isArm" == false ]]; then
echo "Unsupported architecture. Only 'x86_64' and 'aarch64' are supported."
exit 1
fi
if [ "$isLatestOS" == false ]; then
echo "Unsupported OS. Building Shasta requires Ubuntu 20.04 LTS or later."
exit 1
fi
apt-get update
apt-get install --yes \
git \
g++ \
make \
cmake \
curl \
libboost-system-dev \
libboost-program-options-dev \
libboost-graph-dev \
libboost-chrono-dev \
libpng-dev \
libblas-dev \
liblapack-dev \
gfortran \
libseqan2-dev
if [ "$minimalInstall" == false ]; then
# Install packages required for the HTTP server and Python-C++ bindings.
apt-get install --yes \
ncbi-blast+ \
graphviz \
gnuplot \
python3-dev \
python3-pip
pip3 install pybind11==2.8.1
fi
# The spoa library is available in the stable Ubuntu repository, but
# without the static version.
# So we have to build it from source.
# Create a temporary directory.
tmpDirectoryName=$(mktemp --directory --tmpdir)
echo $tmpDirectoryName
cd $tmpDirectoryName
# Get the code.
curl -L https://github.com/rvaser/spoa/archive/refs/tags/4.0.8.tar.gz \
-o 4.0.8.tar.gz
tar -xvf 4.0.8.tar.gz
# The spoa dispatcher feature selects code at run time based on available hardware features,
# which can improve performance.
# However, in spoa v4.0.8 it introduces two additional dependencies:
# - USCiLab/cereal
# - google/cpu_features
# To avoid these additional dependencies, we turn off the dispatcher feature for now.
# We could turn it back on if we see significant performance degradation in this area.
spoaBuildFlags="-Dspoa_generate_dispatch=ON"
# Per the above comment, turn off the dispatcher feature for now.
spoaBuildFlags="-DCMAKE_BUILD_TYPE=Release -Dspoa_optimize_for_portability=ON"
if [[ "$isArm" == true ]]; then
spoaBuildFlags="-DCMAKE_BUILD_TYPE=Release -Dspoa_build_tests=OFF"
fi
# Build the shared library.
mkdir build
cd build
cmake ../spoa-4.0.8 -DBUILD_SHARED_LIBS=ON $spoaBuildFlags
make -j all
make install
# Build the static library.
cd ..
mkdir build-static
cd build-static
cmake ../spoa-4.0.8 -DBUILD_SHARED_LIBS=OFF $spoaBuildFlags
make -j all
make install
cd
rm -rf $tmpDirectoryName
echo "=============================="
echo " Relevant software versions"
echo "=============================="
if [ "$minimalInstall" == false ]; then
echo "$(apt list git g++ cmake curl libseqan2-dev libboost-system-dev libpng-dev graphviz gnuplot ncbi-blast+ python3 python3-pip 2>/dev/null)"
else
echo "$(apt list git g++ cmake curl libseqan2-dev libboost-system-dev 2>/dev/null)"
fi
echo "=============================="
# Make sure the newly created libraries are immediately visible to the loader.
ldconfig
|