2023-11-16 04:20:00 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2024-10-11 05:15:48 +00:00
|
|
|
, fetchFromGitHub
|
2023-11-16 04:20:00 +00:00
|
|
|
, openssl
|
|
|
|
}:
|
2024-01-13 08:15:51 +00:00
|
|
|
let
|
|
|
|
makefile =
|
2024-09-26 11:04:55 +00:00
|
|
|
if stdenv.hostPlatform.isDarwin
|
2024-01-13 08:15:51 +00:00
|
|
|
then "makefile.mac"
|
|
|
|
else "makefile";
|
|
|
|
in
|
2020-04-24 23:36:52 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "ibm-sw-tpm2";
|
2024-10-11 05:15:48 +00:00
|
|
|
version = "1682-unstable-2024-08-02";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-10-11 05:15:48 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "kgoldman";
|
|
|
|
repo = "ibmswtpm2";
|
|
|
|
rev = "rev183-2024-08-02";
|
|
|
|
hash = "sha256-D2GAkiePBow2iixYMOOeJrnh5hk2lO07dV++lK4X8qE=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [ openssl ];
|
|
|
|
|
2024-10-11 05:15:48 +00:00
|
|
|
sourceRoot = "${src.name}/src";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
inherit makefile;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
prePatch = ''
|
|
|
|
# Fix hardcoded path to GCC.
|
2024-01-13 08:15:51 +00:00
|
|
|
substituteInPlace ${makefile} --replace /usr/bin/gcc "${stdenv.cc}/bin/cc"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# Remove problematic default CFLAGS.
|
2024-01-13 08:15:51 +00:00
|
|
|
substituteInPlace ${makefile} \
|
2020-04-24 23:36:52 +00:00
|
|
|
--replace -Werror "" \
|
|
|
|
--replace -O0 "" \
|
|
|
|
--replace -ggdb ""
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp tpm_server $out/bin
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "IBM's Software TPM 2.0, an implementation of the TCG TPM 2.0 specification";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "tpm_server";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://sourceforge.net/projects/ibmswtpm2/";
|
2024-01-13 08:15:51 +00:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
2024-05-15 15:35:15 +00:00
|
|
|
maintainers = with maintainers; [ tomfitzhenry ];
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.bsd3;
|
|
|
|
};
|
|
|
|
}
|