2020-06-16 14:14:42 +01:00
|
|
|
{ stdenv, lib, fetchFromGitHub
|
|
|
|
, autoreconfHook, autoconf-archive, pkg-config, doxygen, perl
|
|
|
|
, openssl, json_c, curl, libgcrypt
|
|
|
|
, cmocka, uthash, ibm-sw-tpm2, iproute, procps, which
|
2020-01-08 15:38:28 +00:00
|
|
|
}:
|
2019-02-14 04:17:13 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "tpm2-tss";
|
2020-11-26 23:23:59 +00:00
|
|
|
version = "3.0.3";
|
2019-02-14 04:17:13 +00:00
|
|
|
|
2020-06-16 14:14:42 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "tpm2-software";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2020-11-26 23:23:59 +00:00
|
|
|
sha256 = "106yhsjwjadxsl9dqxywg287mdwsksman02hdalhav18vcnvnlpj";
|
2019-02-14 04:17:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2020-06-16 17:23:01 +01:00
|
|
|
autoreconfHook autoconf-archive pkg-config doxygen perl
|
2020-06-16 12:47:34 +01:00
|
|
|
];
|
2020-06-16 14:14:42 +01:00
|
|
|
buildInputs = [ openssl json_c curl libgcrypt ];
|
2020-06-16 12:47:34 +01:00
|
|
|
checkInputs = [
|
|
|
|
cmocka uthash ibm-sw-tpm2 iproute procps which
|
2019-02-14 04:17:13 +00:00
|
|
|
];
|
|
|
|
|
2020-06-16 14:14:42 +01:00
|
|
|
preAutoreconf = "./bootstrap";
|
|
|
|
|
2020-06-16 12:00:02 +01:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-02-23 07:42:56 +00:00
|
|
|
patches = [
|
|
|
|
# Do not rely on dynamic loader path
|
|
|
|
# TCTI loader relies on dlopen(), this patch prefixes all calls with the output directory
|
|
|
|
./no-dynamic-loader-path.patch
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
patchShebangs script
|
|
|
|
substituteInPlace src/tss2-tcti/tctildr-dl.c \
|
|
|
|
--replace '@PREFIX@' $out/lib/
|
|
|
|
substituteInPlace ./test/unit/tctildr-dl.c \
|
|
|
|
--replace ', "libtss2' ", \"$out/lib/libtss2" \
|
|
|
|
--replace ', "foo' ", \"$out/lib/foo" \
|
|
|
|
--replace ', TEST_TCTI_NAME' ", \"$out/lib/\"TEST_TCTI_NAME"
|
|
|
|
'';
|
2019-02-14 04:17:13 +00:00
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--enable-unit"
|
|
|
|
"--enable-integration"
|
|
|
|
];
|
|
|
|
|
|
|
|
doCheck = true;
|
2021-02-23 07:42:56 +00:00
|
|
|
preCheck = ''
|
|
|
|
# Since we rewrote the load path in the dynamic loader for the TCTI
|
|
|
|
# The various tcti implementation should be placed in their target directory
|
|
|
|
# before we could run tests
|
|
|
|
installPhase
|
|
|
|
# install already done, dont need another one
|
|
|
|
dontInstall=1
|
|
|
|
'';
|
2019-02-14 04:17:13 +00:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
# Do not install the upstream udev rules, they rely on specific
|
|
|
|
# users/groups which aren't guaranteed to exist on the system.
|
|
|
|
rm -R $out/lib/udev
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "OSS implementation of the TCG TPM2 Software Stack (TSS2)";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/tpm2-software/tpm2-tss";
|
2019-02-14 04:17:13 +00:00
|
|
|
license = licenses.bsd2;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ delroth ];
|
|
|
|
};
|
|
|
|
}
|