about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/security/yubihsm-shell/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/security/yubihsm-shell/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/security/yubihsm-shell/default.nix31
1 files changed, 22 insertions, 9 deletions
diff --git a/nixpkgs/pkgs/tools/security/yubihsm-shell/default.nix b/nixpkgs/pkgs/tools/security/yubihsm-shell/default.nix
index 83c2e535403d..77b6b86ffd6e 100644
--- a/nixpkgs/pkgs/tools/security/yubihsm-shell/default.nix
+++ b/nixpkgs/pkgs/tools/security/yubihsm-shell/default.nix
@@ -10,19 +10,31 @@
 , pkg-config
 , pcsclite
 , help2man
+, darwin
+, libiconv
 }:
 
 stdenv.mkDerivation rec {
   pname = "yubihsm-shell";
-  version = "2.3.2";
+  version = "2.4.0";
 
   src = fetchFromGitHub {
     owner = "Yubico";
     repo = "yubihsm-shell";
     rev = version;
-    sha256 = "sha256-rSIdI6ECLte+dEbT8NOUqS8jkozRhbo+eqFrdhTIKpY=";
+    hash = "sha256-zWhvECPdZnrbSAVPDVZk54SWHVkd/HEQxS3FgXoqXHY=";
   };
 
+  postPatch = ''
+    # Can't find libyubihsm at runtime because of dlopen() in C code
+    substituteInPlace lib/yubihsm.c \
+      --replace "libyubihsm_usb.so" "$out/lib/libyubihsm_usb.so" \
+      --replace "libyubihsm_http.so" "$out/lib/libyubihsm_http.so"
+    # ld: unknown option: -z
+    substituteInPlace CMakeLists.txt cmake/SecurityFlags.cmake \
+      --replace "AppleClang" "Clang"
+  '';
+
   nativeBuildInputs = [
     pkg-config
     cmake
@@ -34,16 +46,17 @@ stdenv.mkDerivation rec {
     libusb1
     libedit
     curl
-    pcsclite
     openssl
+  ] ++ lib.optionals stdenv.isLinux [
+    pcsclite
+  ] ++ lib.optionals stdenv.isDarwin [
+    darwin.apple_sdk.frameworks.PCSC
+    libiconv
   ];
 
-  postPatch = ''
-    # Can't find libyubihsm at runtime because of dlopen() in C code
-    substituteInPlace lib/yubihsm.c \
-      --replace "libyubihsm_usb.so" "$out/lib/libyubihsm_usb.so" \
-      --replace "libyubihsm_http.so" "$out/lib/libyubihsm_http.so"
-  '';
+  cmakeFlags = lib.optionals stdenv.isDarwin [
+    "-DDISABLE_LTO=ON"
+  ];
 
   meta = with lib; {
     description = "yubihsm-shell and libyubihsm";