This repository has been archived by the owner on Jan 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 266
/
Copy pathsetup.sh
executable file
·74 lines (60 loc) · 1.83 KB
/
setup.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
#!/bin/bash
# Exit on errors.
set -e
echo "========================================================================="
echo "Set up SLING development environment"
echo "========================================================================="
# Install packages.
echo
echo "=== Install SLING dependencies"
PYVER=3.5
PYPKGS="python${PYVER} python${PYVER}-dev python3-pip"
PKGS="pkg-config zip g++ zlib1g-dev unzip lbzip2 ${PYPKGS}"
sudo apt-get install ${PKGS}
# Install bazel.
BAZELVER=1.0.0
BAZELSH=bazel-${BAZELVER}-installer-linux-x86_64.sh
BAZELREPO=https://github.com/bazelbuild/bazel
BAZELURL=${BAZELREPO}/releases/download/${BAZELVER}/${BAZELSH}
if [[ $UPGRADE_BAZEL = "1" ]]; then
echo "=== Forcing reinstall of Bazel"
sudo rm $(which bazel)
fi
if ! which bazel > /dev/null; then
echo
echo "=== Install Bazel build system"
wget -P /tmp ${BAZELURL}
chmod +x /tmp/${BAZELSH}
sudo /tmp/${BAZELSH}
rm /tmp/${BAZELSH}
fi
# Build SLING.
echo
echo "=== Build SLING"
tools/buildall.sh
# Install SLING Python API.
echo
echo "=== Set up SLING Python API"
SLINGPKG=/usr/lib/python3/dist-packages/sling
PIP="sudo -H pip3 --disable-pip-version-check"
if [[ -L "/usr/lib/python2.7/dist-packages/sling" ]]; then
echo "Removing deprecated SLING Python 2.7 package"
sudo rm /usr/lib/python2.7/dist-packages/sling
fi
if [[ -L "/usr/local/lib/python2.7/dist-packages/sling" ]]; then
echo "Removing deprecated SLING Python 2.7 local package"
sudo rm /usr/local/lib/python2.7/dist-packages/sling
fi
if [[ $(${PIP} freeze | grep "sling==") ]]; then
echo "Removing existing SLING pip package"
${PIP} uninstall sling
fi
if [[ -x "${SLINGPKG}" ]]; then
echo "SLING Python package already installed"
else
echo "Adding link for SLING Python package"
sudo ln -s $(realpath python) ${SLINGPKG}
fi
# Done.
echo
echo "=== SLING is now set up."