-
Notifications
You must be signed in to change notification settings - Fork 46
/
tox-install.sh
executable file
·60 lines (52 loc) · 1.46 KB
/
tox-install.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
#!/bin/sh
# Copyright (c) 2020 Robin Jarry
# SPDX-License-Identifier: MIT
set -e
venv="$1"
shift 1
download()
{
url="$1"
branch="$2"
dir="$3"
if which git >/dev/null 2>&1; then
git clone --single-branch --branch "$branch" --depth 1 \
"$url.git" "$dir"
elif which curl >/dev/null 2>&1; then
mkdir -p "$dir"
curl -L "$url/archive/$branch.tar.gz" | \
tar --strip-components=1 -zx -C "$dir"
elif which wget >/dev/null 2>&1; then
mkdir -p "$dir"
wget -O - "$url/archive/$branch.tar.gz" | \
tar --strip-components=1 -zx -C "$dir"
else
echo "ERROR: neither git nor curl nor wget are available" >&2
exit 1
fi
}
# build and install libyang into the virtualenv
src="${LIBYANG_SRC:-$venv/.src}"
if ! [ -d "$src" ]; then
libyang_branch="${LIBYANG_BRANCH:-master}"
download "https://github.com/CESNET/libyang" "$libyang_branch" "$src"
fi
prefix="$venv/.ly"
build="$venv/.build"
mkdir -p "$build"
cmake -DCMAKE_BUILD_TYPE=debug \
-DENABLE_BUILD_TESTS=OFF \
-DENABLE_VALGRIND_TESTS=OFF \
-DENABLE_CALGRIND_TESTS=OFF \
-DENABLE_BUILD_FUZZ_TARGETS=OFF \
-DCMAKE_INSTALL_PREFIX="$prefix" \
-DCMAKE_INSTALL_LIBDIR=lib \
-DGEN_LANGUAGE_BINDINGS=OFF \
-H"$src" -B"$build"
make --no-print-directory -C "$build" -j`nproc`
make --no-print-directory -C "$build" install
prefix=$(readlink -ve $prefix)
LIBYANG_HEADERS="$prefix/include" \
LIBYANG_LIBRARIES="$prefix/lib" \
LIBYANG_EXTRA_LDFLAGS="-Wl,--enable-new-dtags,-rpath=$prefix/lib" \
python -m pip install "$@"