dev-libs/softhsm: new recipe (#2112)

This commit is contained in:
Xiang Fan
2018-01-16 20:18:56 +08:00
committed by fbrosson
parent 9148a13f4c
commit 3b67975757
2 changed files with 139 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
From 9cf4a32fb96810e2760db3649322f864e0913606 Mon Sep 17 00:00:00 2001
From: sfanxiang <sfanxiang@gmail.com>
Date: Sat, 13 Jan 2018 12:06:33 +0000
Subject: port to Haiku
diff --git a/src/bin/common/getpw.cpp b/src/bin/common/getpw.cpp
index 938abd5..584ce40 100644
--- a/src/bin/common/getpw.cpp
+++ b/src/bin/common/getpw.cpp
@@ -86,6 +86,8 @@ int getpin(const char* prompt, char* buffer, size_t size)
// Update the mode flags
new_attr.c_lflag &= ~ICANON;
new_attr.c_lflag &= ~ECHO;
+ new_attr.c_cc[VMIN] = 1;
+ new_attr.c_cc[VTIME] = 0;
// Handle the SIGINT signal
signo = 0;
@@ -100,7 +102,7 @@ int getpin(const char* prompt, char* buffer, size_t size)
}
// Set the new terminal attributes
- if (tcsetattr(STDIN_FILENO, 0, &new_attr) < 0)
+ if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &new_attr) < 0)
return -1;
#endif
@@ -126,7 +128,7 @@ int getpin(const char* prompt, char* buffer, size_t size)
return -1;
#else
// Restore terminal
- if (tcsetattr(STDIN_FILENO, 0, &old_attr) < 0)
+ if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &old_attr) < 0)
return -1;
// Restore the signal
--
2.15.0

View File

@@ -0,0 +1,99 @@
SUMMARY="An implementation of a cryptographic store"
DESCRIPTION="SoftHSM is an implementation of a cryptographic store accessible \
through a PKCS #11 interface. You can use it to explore PKCS #11 without \
having a Hardware Security Module. It is being developed as a part of the \
OpenDNSSEC project. SoftHSM uses Botan for its cryptographic operations."
HOMEPAGE="https://www.opendnssec.org/softhsm/"
COPYRIGHT="2010 .SE, The Internet Infrastructure Foundation
2010 SURFnet bv"
LICENSE="BSD (2-clause)"
REVISION="1"
SOURCE_URI="https://dist.opendnssec.org/source/softhsm-$portVersion.tar.gz"
CHECKSUM_SHA256="5ed604c89a3a6ef9d7d1ee92c28a2c4b3cd1f86f302c808e2d12c8f39aa2c127"
SOURCE_DIR="softhsm-$portVersion"
PATCHES="softhsm-$portVersion.patchset"
ARCHITECTURES="!x86_gcc2 ?x86 x86_64"
SECONDARY_ARCHITECTURES="x86"
commandBinDir=$binDir
commandSuffix=$secondaryArchSuffix
if [ "$targetArchitecture" = x86_gcc2 ]
then
commandBinDir=$prefix/bin
commandSuffix=
fi
majorVersion="${portVersion%%.*}"
PROVIDES="
softhsm$majorVersion$secondaryArchSuffix = $portVersion
cmd:softhsm${majorVersion}_dump_file$commandSuffix = $portVersion
cmd:softhsm${majorVersion}_keyconv$commandSuffix = $portVersion
cmd:softhsm${majorVersion}_util$commandSuffix = $portVersion
lib:libsofthsm$majorVersion$secondaryArchSuffix
"
REQUIRES="
haiku$secondaryArchSuffix
cmd:botan$commandSuffix
# lib:libbotan_2$secondaryArchSuffix
lib:libssl$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libbotan_2$secondaryArchSuffix
devel:libssl$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:awk
cmd:diff
cmd:find
cmd:g++$secondaryArchSuffix
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:make
cmd:makeinfo
cmd:pkg_config$secondaryArchSuffix
"
USER_SETTINGS_FILES="
settings/softhsm${majorVersion}.conf template data/softhsm/softhsm${majorVersion}.conf.sample
"
GLOBAL_WRITABLE_FILES="
settings/softhsm${majorVersion}.conf keep-old
var/lib/softhsm directory keep-old
"
defineDebugInfoPackage softhsm${majorVersion}$secondaryArchSuffix \
$commandBinDir/softhsm${majorVersion}-dump-file \
$commandBinDir/softhsm${majorVersion}-keyconv \
$commandBinDir/softhsm${majorVersion}-util \
$libDir/softhsm/libsofthsm${majorVersion}.so
BUILD()
{
runConfigure --omit-dirs binDir ./configure --bindir=$commandBinDir
make $jobArgs
}
INSTALL()
{
make install
sed -i -e "/^directories\.tokendir/ \
s|$prefix/|`finddir B_SYSTEM_DIRECTORY`/|;" \
$settingsDir/softhsm${majorVersion}.conf \
$settingsDir/softhsm${majorVersion}.conf.sample
rm -f $libDir/softhsm/*.la
mkdir -p $dataDir/softhsm
mv $settingsDir/softhsm${majorVersion}.conf.sample $dataDir/softhsm
}
TEST()
{
make check
}