From 90ee16016ccf826fcfc80201f306b6621906f9d6 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sat, 9 Dec 2023 08:26:58 +0100 Subject: [PATCH] ibm-sw-tpm2: add Darwin support The upstream sources ship with a dedicated Makefile for macOS. This commit conditionally uses the macOS makefile if build on Darwin. --- pkgs/tools/security/ibm-sw-tpm2/default.nix | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pkgs/tools/security/ibm-sw-tpm2/default.nix b/pkgs/tools/security/ibm-sw-tpm2/default.nix index de260e068249..9a13c2103016 100644 --- a/pkgs/tools/security/ibm-sw-tpm2/default.nix +++ b/pkgs/tools/security/ibm-sw-tpm2/default.nix @@ -4,7 +4,12 @@ , fetchpatch , openssl }: - +let + makefile = + if stdenv.isDarwin + then "makefile.mac" + else "makefile"; +in stdenv.mkDerivation rec { pname = "ibm-sw-tpm2"; version = "1682"; @@ -30,12 +35,14 @@ stdenv.mkDerivation rec { sourceRoot = "src"; + inherit makefile; + prePatch = '' # Fix hardcoded path to GCC. - substituteInPlace makefile --replace /usr/bin/gcc "${stdenv.cc}/bin/cc" + substituteInPlace ${makefile} --replace /usr/bin/gcc "${stdenv.cc}/bin/cc" # Remove problematic default CFLAGS. - substituteInPlace makefile \ + substituteInPlace ${makefile} \ --replace -Werror "" \ --replace -O0 "" \ --replace -ggdb "" @@ -49,7 +56,7 @@ stdenv.mkDerivation rec { meta = with lib; { description = "IBM's Software TPM 2.0, an implementation of the TCG TPM 2.0 specification"; homepage = "https://sourceforge.net/projects/ibmswtpm2/"; - platforms = platforms.linux; + platforms = platforms.linux ++ platforms.darwin; maintainers = with maintainers; [ delroth ]; license = licenses.bsd3; };