diff options
Diffstat (limited to 'pkgs/development/libraries/tpm2-tss/default.nix')
-rw-r--r-- | pkgs/development/libraries/tpm2-tss/default.nix | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/pkgs/development/libraries/tpm2-tss/default.nix b/pkgs/development/libraries/tpm2-tss/default.nix index 6d3a29c28ba7..bea611224444 100644 --- a/pkgs/development/libraries/tpm2-tss/default.nix +++ b/pkgs/development/libraries/tpm2-tss/default.nix @@ -1,8 +1,8 @@ { stdenv, lib, fetchFromGitHub , autoreconfHook, autoconf-archive, pkg-config, doxygen, perl , openssl, json_c, curl, libgcrypt -, cmocka, uthash, ibm-sw-tpm2, iproute2, procps, which -, libuuid +, cmocka, uthash, swtpm, iproute2, procps, which +, libuuid, libtpms }: let # Avoid a circular dependency on Linux systems (systemd depends on tpm2-tss, @@ -10,7 +10,7 @@ let # 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; + procps_pkg = if stdenv.hostPlatform.isLinux then procpsWithoutSystemd else procps; in stdenv.mkDerivation rec { @@ -31,7 +31,7 @@ stdenv.mkDerivation rec { ]; buildInputs = [ - openssl json_c curl libgcrypt uthash libuuid + openssl json_c curl libgcrypt uthash libuuid libtpms ] # cmocka is checked in the configure script # when unit and/or integration testing is enabled @@ -40,7 +40,7 @@ stdenv.mkDerivation rec { ++ lib.optional doInstallCheck cmocka; nativeInstallCheckInputs = [ - cmocka which openssl procps_pkg iproute2 ibm-sw-tpm2 + cmocka which openssl procps_pkg iproute2 swtpm ]; strictDeps = true; @@ -68,11 +68,16 @@ stdenv.mkDerivation rec { postPatch = '' patchShebangs script substituteInPlace src/tss2-tcti/tctildr-dl.c \ - --replace '@PREFIX@' $out/lib/ + --replace-fail '@PREFIX@' $out/lib/ substituteInPlace ./test/unit/tctildr-dl.c \ - --replace '@PREFIX@' $out/lib/ + --replace-fail '@PREFIX@' $out/lib/ substituteInPlace ./bootstrap \ - --replace 'git describe --tags --always --dirty' 'echo "${version}"' + --replace-fail 'git describe --tags --always --dirty' 'echo "${version}"' + for src in src/tss2-tcti/tcti-libtpms.c test/unit/tcti-libtpms.c; do + substituteInPlace "$src" \ + --replace-fail '"libtpms.so"' '"${libtpms.out}/lib/libtpms.so"' \ + --replace-fail '"libtpms.so.0"' '"${libtpms.out}/lib/libtpms.so.0"' + done ''; configureFlags = lib.optionals doInstallCheck [ @@ -87,7 +92,7 @@ stdenv.mkDerivation rec { ''; doCheck = false; - doInstallCheck = stdenv.buildPlatform == stdenv.hostPlatform; + doInstallCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; # 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, so we make turn checkPhase into installCheckPhase |