aboutsummaryrefslogtreecommitdiffstats
path: root/SoftHSMv2/testing/build-softhsm2.sh
blob: ec4f43c5971d16cd002c600d37792c31410fc8f7 (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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/usr/bin/env bash
source `dirname "$0"`/lib.sh && init || exit 1

require botan

check_if_built softhsm2 && exit 0
start_build softhsm2

build_ok=0
case "$DISTRIBUTION" in
	openbsd )
		export AUTOCONF_VERSION="2.68"
		export AUTOMAKE_VERSION="1.11"
		append_ldflags "-L/usr/local/lib"
		;;
esac
case "$DISTRIBUTION" in
	centos | \
	redhat | \
	fedora | \
	sl | \
	slackware | \
	debian | \
	ubuntu | \
	opensuse )
		(
			sh autogen.sh &&
			mkdir -p build &&
			cd build &&
			../configure --prefix="$INSTALL_ROOT" \
				--disable-non-paged-memory \
				--with-p11-kit="$INSTALL_ROOT/usr/local/share/p11-kit/modules" \
				--with-migrate \
				--with-crypto-backend=botan \
				--with-botan="$INSTALL_ROOT" &&
			$MAKE &&
			$MAKE check &&
			$MAKE install &&
			cp "src/lib/common/softhsm2.conf" "$INSTALL_ROOT/etc/softhsm2.conf.build"
		) &&
		build_ok=1
		;;
	netbsd )
		(
			sh autogen.sh &&
			mkdir -p build &&
			cd build &&
			../configure --prefix="$INSTALL_ROOT" \
				--disable-non-paged-memory \
				--with-p11-kit="$INSTALL_ROOT/usr/local/share/p11-kit/modules" \
				--with-migrate \
				--with-crypto-backend=botan \
				--with-botan="$INSTALL_ROOT" \
				--with-sqlite3=/usr/pkg &&
			$MAKE &&
			$MAKE check &&
			$MAKE install &&
			cp "src/lib/common/softhsm2.conf" "$INSTALL_ROOT/etc/softhsm2.conf.build"
		) &&
		build_ok=1
		;;
	freebsd | \
	openbsd )
		(
			sh autogen.sh &&
			mkdir -p build &&
			cd build &&
			../configure --prefix="$INSTALL_ROOT" \
				--disable-non-paged-memory \
				--with-p11-kit="$INSTALL_ROOT/usr/local/share/p11-kit/modules" \
				--with-migrate \
				--with-crypto-backend=botan \
				--with-botan="$INSTALL_ROOT" \
				--with-sqlite3=/usr/local &&
			$MAKE &&
			$MAKE check &&
			$MAKE install &&
			cp "src/lib/common/softhsm2.conf" "$INSTALL_ROOT/etc/softhsm2.conf.build"
		) &&
		build_ok=1
		;;
	sunos | \
	suse )
		(
			sh autogen.sh &&
			mkdir -p build &&
			cd build &&
			../configure --prefix="$INSTALL_ROOT" \
				--disable-non-paged-memory \
				--with-p11-kit="$INSTALL_ROOT/usr/local/share/p11-kit/modules" \
				--with-migrate \
				--with-crypto-backend=botan \
				--with-botan="$INSTALL_ROOT" &&
			$MAKE &&
			$MAKE check &&
			$MAKE install &&
			cp "src/lib/common/softhsm2.conf" "$INSTALL_ROOT/etc/softhsm2.conf.build"
		) &&
		build_ok=1
		;;
esac

finish

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

exit 1