1SUMMARY="An implementation of a cryptographic store"
2DESCRIPTION="SoftHSM is an implementation of a cryptographic store accessible \
3through a PKCS #11 interface. You can use it to explore PKCS #11 without \
4having a Hardware Security Module. It is being developed as a part of the \
5OpenDNSSEC project. SoftHSM uses Botan for its cryptographic operations."
6HOMEPAGE="https://www.opendnssec.org/softhsm/"
7COPYRIGHT="2010 .SE, The Internet Infrastructure Foundation
8	2010 SURFnet bv"
9LICENSE="BSD (2-clause)"
10REVISION="3"
11SOURCE_URI="https://dist.opendnssec.org/source/softhsm-$portVersion.tar.gz"
12CHECKSUM_SHA256="92aa56cf45e25892326e98b851c44de9cac8559e208720e579bf8e2cd1c132b2"
13SOURCE_DIR="softhsm-$portVersion"
14PATCHES="softhsm-$portVersion.patchset"
15
16ARCHITECTURES="all !x86_gcc2 ?x86"
17SECONDARY_ARCHITECTURES="x86"
18
19commandBinDir=$binDir
20commandSuffix=$secondaryArchSuffix
21if [ "$targetArchitecture" = x86_gcc2 ]
22then
23	commandBinDir=$prefix/bin
24	commandSuffix=
25fi
26
27majorVersion="${portVersion%%.*}"
28
29GLOBAL_WRITABLE_FILES="
30	settings/softhsm$majorVersion.conf keep-old
31	var/lib/softhsm directory keep-old
32	"
33USER_SETTINGS_FILES="
34	settings/softhsm$majorVersion.conf template data/softhsm/softhsm$majorVersion.conf.sample
35	"
36
37PROVIDES="
38	softhsm$majorVersion$secondaryArchSuffix = $portVersion
39	cmd:softhsm${majorVersion}_dump_file$commandSuffix = $portVersion
40	cmd:softhsm${majorVersion}_keyconv$commandSuffix = $portVersion
41	cmd:softhsm${majorVersion}_util$commandSuffix = $portVersion
42	lib:libsofthsm$majorVersion$secondaryArchSuffix
43	"
44REQUIRES="
45	haiku$secondaryArchSuffix
46	cmd:botan$commandSuffix
47#	lib:libbotan_2$secondaryArchSuffix
48	lib:libssl$secondaryArchSuffix
49	"
50
51BUILD_REQUIRES="
52	haiku${secondaryArchSuffix}_devel
53	devel:libbotan_2$secondaryArchSuffix
54	devel:libcppunit$secondaryArchSuffix
55	devel:libssl$secondaryArchSuffix
56	"
57BUILD_PREREQUIRES="
58	cmd:awk
59	cmd:diff
60	cmd:find
61	cmd:g++$secondaryArchSuffix
62	cmd:gcc$secondaryArchSuffix
63	cmd:ld$secondaryArchSuffix
64	cmd:make
65	cmd:makeinfo
66	cmd:pkg_config$secondaryArchSuffix
67	"
68
69defineDebugInfoPackage softhsm$majorVersion$secondaryArchSuffix \
70	"$commandBinDir"/softhsm$majorVersion-dump-file \
71	"$commandBinDir"/softhsm$majorVersion-keyconv \
72	"$commandBinDir"/softhsm$majorVersion-util \
73	"$libDir"/softhsm/libsofthsm$majorVersion.so
74
75PATCH()
76{
77	sed -i \
78		-e "/^objstoretest_LDFLAGS/ s/ -pthread//;" \
79		-e "/^sessionmgrtest_LDFLAGS/ s/ -pthread//;" \
80		-e "/^slotmgrtest_LDFLAGS/ s/ -pthread//;" \
81		-e "/^p11test_LDFLAGS/ s/ -pthread//;" \
82		src/lib/object_store/test/Makefile.* \
83		src/lib/session_mgr/test/Makefile.* \
84		src/lib/slot_mgr/test/Makefile.* \
85		src/lib/test/Makefile.* \
86
87}
88
89BUILD()
90{
91	runConfigure --omit-dirs binDir ./configure \
92		--bindir="$commandBinDir" \
93		--disable-gost
94	make $jobArgs
95}
96
97INSTALL()
98{
99	make install
100
101	sed -i -e "/^directories\.tokendir/ \
102			s|$prefix/|`finddir B_SYSTEM_DIRECTORY`/|;" \
103		"$settingsDir"/softhsm$majorVersion.conf \
104		"$settingsDir"/softhsm$majorVersion.conf.sample
105
106	rm -f "$libDir"/softhsm/*.la
107
108	mkdir -p "$dataDir"/softhsm
109	mv "$settingsDir"/softhsm$majorVersion.conf.sample "$dataDir"/softhsm
110}
111
112TEST()
113{
114	make check
115}
116