Merge pull request #163569 from willcohen/swtpm-darwin

This commit is contained in:
Sandro 2022-03-13 18:43:41 +01:00 committed by GitHub
commit 218f367564
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,35 +16,40 @@
stdenv.mkDerivation rec {
pname = "swtpm";
version = "0.7.1";
version = "0.7.2";
src = fetchFromGitHub {
owner = "stefanberger";
repo = "swtpm";
rev = "v${version}";
sha256 = "sha256-LJQF8PlRkhCJ8rjZzDetg1BFuTb7GBJ8lW6u5hO134k=";
sha256 = "sha256-qeyPCJTNnwuaCosHzqnrQc0JNznGBfDTLsuDmuKREjU=";
};
nativeBuildInputs = [
pkg-config unixtools.netstat expect socat
perl # for pod2man
python3
autoreconfHook
];
checkInputs = [
python3 which
which
];
buildInputs = [
libtpms
openssl libtasn1 libseccomp
fuse glib json-glib
openssl libtasn1
glib json-glib
gnutls
] ++ lib.optionals stdenv.isLinux [
fuse
libseccomp
];
configureFlags = [
"--with-cuse"
"--localstatedir=/var"
] ++ lib.optionals stdenv.isLinux [
"--with-cuse"
];
postPatch = ''
@ -56,9 +61,31 @@ stdenv.mkDerivation rec {
# Use the correct path to the certtool binary
# instead of relying on it being in the environment
substituteInPlace src/swtpm_localca/swtpm_localca.c --replace \
substituteInPlace src/swtpm_localca/swtpm_localca.c \
--replace \
'# define CERTTOOL_NAME "gnutls-certtool"' \
'# define CERTTOOL_NAME "${gnutls}/bin/certtool"' \
--replace \
'# define CERTTOOL_NAME "certtool"' \
'# define CERTTOOL_NAME "${gnutls}/bin/certtool"'
substituteInPlace tests/common --replace \
'CERTTOOL=gnutls-certtool;;' \
'CERTTOOL=certtool;;'
# Fix error on macOS:
# stat: invalid option -- '%'
# This is caused by the stat program not being the BSD version,
# as is expected by the test
substituteInPlace tests/common --replace \
'if [[ "$(uname -s)" =~ (Linux|CYGWIN_NT-) ]]; then' \
'if [[ "$(uname -s)" =~ (Linux|Darwin|CYGWIN_NT-) ]]; then'
# Otherwise certtool seems to pick up the system language on macOS,
# which might cause a test to fail
substituteInPlace tests/test_swtpm_setup_create_cert --replace \
'$CERTTOOL' \
'LC_ALL=C.UTF-8 $CERTTOOL'
'';
doCheck = true;