2020-06-18 07:06:33 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub
|
|
|
|
, autoreconfHook, autoconf-archive, pkg-config, doxygen, perl
|
|
|
|
, openssl, json_c, curl, libgcrypt
|
2021-04-05 15:23:46 +00:00
|
|
|
, cmocka, uthash, ibm-sw-tpm2, iproute2, procps, which
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
2021-09-26 12:46:18 +00:00
|
|
|
let
|
|
|
|
# Avoid a circular dependency on Linux systems (systemd depends on tpm2-tss,
|
|
|
|
# tpm2-tss tests depend on procps, procps depends on systemd by default). This
|
|
|
|
# needs to be conditional based on isLinux because procps for other systems
|
|
|
|
# might not support the withSystemd option.
|
|
|
|
procpsWithoutSystemd = procps.override { withSystemd = false; };
|
|
|
|
procps_pkg = if stdenv.isLinux then procpsWithoutSystemd else procps;
|
|
|
|
in
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "tpm2-tss";
|
2020-11-30 08:33:03 +00:00
|
|
|
version = "3.0.3";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-06-18 07:06:33 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "tpm2-software";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2020-11-30 08:33:03 +00:00
|
|
|
sha256 = "106yhsjwjadxsl9dqxywg287mdwsksman02hdalhav18vcnvnlpj";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2020-06-18 07:06:33 +00:00
|
|
|
autoreconfHook autoconf-archive pkg-config doxygen perl
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
2020-06-18 07:06:33 +00:00
|
|
|
buildInputs = [ openssl json_c curl libgcrypt ];
|
|
|
|
checkInputs = [
|
2021-09-26 12:46:18 +00:00
|
|
|
cmocka uthash ibm-sw-tpm2 iproute2 procps_pkg which
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2020-06-18 07:06:33 +00:00
|
|
|
preAutoreconf = "./bootstrap";
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-03-09 03:18:52 +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 \
|
2021-09-18 10:52:07 +00:00
|
|
|
--replace '@PREFIX@' $out/lib
|
2021-03-09 03:18:52 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--enable-unit"
|
|
|
|
"--enable-integration"
|
|
|
|
];
|
|
|
|
|
|
|
|
doCheck = true;
|
2021-03-09 03:18:52 +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
|
|
|
|
'';
|
2020-04-24 23:36:52 +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)";
|
|
|
|
homepage = "https://github.com/tpm2-software/tpm2-tss";
|
|
|
|
license = licenses.bsd2;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ delroth ];
|
|
|
|
};
|
|
|
|
}
|