-
Notifications
You must be signed in to change notification settings - Fork 1
/
build-deps.sh
executable file
·38 lines (33 loc) · 1.43 KB
/
build-deps.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
#!/bin/sh
# Builds necessary dependencies from source
set -e
[ -z "$VERSION" ] && VERSION=stable
[ -z "$PREFIX" ] && [ -n "$1" ] && PREFIX=$1
[ -z "$PREFIX" ] && PREFIX=/usr/local
if [ "$VERSION" = "stable" ]; then
echo "------------------------------------------------------------------------">&2
echo " Building latest stable release of main dependencies from source.">&2
echo "------------------------------------------------------------------------">&2
else
echo "------------------------------------------------------------------------">&2
echo " Building development versions of main dependencie from source.">&2
echo " (This is experimental and may contain bugs! DO NOT PUBLISH!)">&2
echo "-----------------------------------------------------------------------">&2
fi
PWD="$(pwd)"
BUILDDIR="$(mktemp -dt "build-deps.XXXXXX")"
cd "$BUILDDIR"
BUILD_SOURCES="LanguageMachines/ticcutils LanguageMachines/timbl"
for SUFFIX in $BUILD_SOURCES; do \
NAME="$(basename "$SUFFIX")"
git clone "https://github.com/$SUFFIX"
cd "$NAME"
REF=$(git tag -l | grep -E "^v?[0-9]+(\.[0-9])*" | sort -t. -k 1.2,1n -k 2,2n -k 3,3n -k 4,4n | tail -n 1)
if [ "$VERSION" = "stable" ] && [ -n "$REF" ]; then
git -c advice.detachedHead=false checkout "$REF"
fi
sh ./bootstrap.sh && ./configure --prefix "$PREFIX" && make && make install
cd ..
done
cd "$PWD"
[ -n "$BUILDDIR" ] && rm -Rf "$BUILDDIR"