summaryrefslogtreecommitdiffstats
path: root/SoftHSMv2/testing/build-botan.sh
blob: fc312173f8a3bda83f560658d1aa39a61c276e3e (plain)
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
#!/usr/bin/env bash
source `dirname "$0"`/lib.sh && init || exit 1

BOTAN="Botan-2.4.0"
BOTAN_URL="https://botan.randombit.net/releases/$BOTAN.tgz"
BOTAN_FILENAME="$BOTAN.tgz"
BOTAN_HASH_TYPE="sha1"
BOTAN_HASH="212587ae2458d51052c496fbcc79dc4162d33349"

check_if_built botan && exit 0
start_build botan

BOTAN_SRC=`fetch_src "$BOTAN_URL" "$BOTAN_FILENAME" "$BOTAN_HASH_TYPE" "$BOTAN_HASH"`

build_ok=0
case "$DISTRIBUTION" in
	centos | \
	redhat | \
	fedora | \
	sl | \
	slackware | \
	ubuntu | \
	debian | \
	opensuse | \
	suse )
		(
			gunzip -c "$BOTAN_SRC" | tar xf - &&
			cd "$BOTAN" &&
			./configure.py --prefix="$INSTALL_ROOT" &&
			$MAKE &&
			$MAKE install
		) &&
		build_ok=1
		;;
	freebsd | \
	netbsd | \
	openbsd )
		opt=""
		if uname -a 2>/dev/null | grep -q "FreeBSD 10" 2>/dev/null; then
			opt="--cc=clang"
		fi
		(
			gunzip -c "$BOTAN_SRC" | tar xf - &&
			cd "$BOTAN" &&
			python2.7 ./configure.py --prefix="$INSTALL_ROOT" $opt &&
			$MAKE &&
			$MAKE install
		) &&
		build_ok=1
		;;
	sunos )
		platform=`uname -p`
		opt=""
		case "$platform" in
			i386)
				opt="--cpu=i686"
				;;

			sparc)
				opt="--cpu=sparc64"
				;;

			*)
				exit 1
				;;
		esac
		(
			gunzip -c "$BOTAN_SRC" | tar xf - &&
			cd "$BOTAN" &&
			./configure.py --prefix="$INSTALL_ROOT" $opt &&
			$MAKE &&
			$MAKE install
		) &&
		build_ok=1
		;;
esac

finish

if [ "$build_ok" -eq 1 ]; then
	set_build_ok botan || exit 1
	exit 0
fi

exit 1