| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
set -e |
| 4 |
set -u |
| 5 |
|
| 6 |
myself=`echo "$0" | sed 's,.*/,,'` |
| 7 |
|
| 8 |
say() |
| 9 |
{ |
| 10 |
echo "$myself: $@." |
| 11 |
} |
| 12 |
|
| 13 |
die() |
| 14 |
{ |
| 15 |
echo >&2 "$myself: $@." |
| 16 |
exit 1 |
| 17 |
} |
| 18 |
|
| 19 |
if [ $# -eq 1 ] |
| 20 |
then |
| 21 |
version=$1 |
| 22 |
else |
| 23 |
version=3.2.2 |
| 24 |
fi |
| 25 |
|
| 26 |
if [ ! -f lib/system.h ] |
| 27 |
then |
| 28 |
if [ -f ../lib/system.h ] |
| 29 |
then |
| 30 |
cd .. |
| 31 |
else |
| 32 |
die 'Please call me from the NSCA-ng source directory' |
| 33 |
fi |
| 34 |
fi |
| 35 |
|
| 36 |
install_dir=`pwd`/lib/confuse |
| 37 |
tarball="confuse-$version.tar.gz" |
| 38 |
|
| 39 |
if [ ! -f "$tarball" ] |
| 40 |
then |
| 41 |
if type curl >/dev/null 2>&1 |
| 42 |
then |
| 43 |
get="curl -L -o $tarball" |
| 44 |
elif type wget >/dev/null 2>&1 |
| 45 |
then |
| 46 |
get=wget |
| 47 |
else |
| 48 |
say 'Cannot find an HTTP client' |
| 49 |
die "Please download '$tarball' into `pwd`" |
| 50 |
fi |
| 51 |
|
| 52 |
$get "https://github.com/martinh/libconfuse/releases/download/v$version/$tarball" |
| 53 |
test -f "$tarball" || die "Downloading '$tarball' failed" |
| 54 |
fi |
| 55 |
|
| 56 |
gzip -c -d "$tarball" | tar xf - |
| 57 |
cd `expr "$tarball" : '\(.*\)\.tar\.gz$'` |
| 58 |
|
| 59 |
./configure --prefix="$install_dir" --enable-static --disable-shared |
| 60 |
make |
| 61 |
make install |
| 62 |
|
| 63 |
say 'Success' |
| 64 |
|
| 65 |
# vim:set joinspaces noexpandtab textwidth=80: |