summary refs log tree commit diff
path: root/pkgs/development/libraries/libfido2
diff options
context:
space:
mode:
authorArtemis Tosini <me@artem.ist>2020-02-23 15:59:41 +0000
committerArtemis Tosini <me@artem.ist>2020-02-23 19:46:14 +0000
commit099359afc72d34255b78cdcc6291b77b2e7ed2f9 (patch)
tree8cde7569e18ccbfc6e8c19098e9468886c6f8a70 /pkgs/development/libraries/libfido2
parentd34aa25b1fd6355f27920fe243df19aa72cbc000 (diff)
downloadnixpkgs-099359afc72d34255b78cdcc6291b77b2e7ed2f9.tar
nixpkgs-099359afc72d34255b78cdcc6291b77b2e7ed2f9.tar.gz
nixpkgs-099359afc72d34255b78cdcc6291b77b2e7ed2f9.tar.bz2
nixpkgs-099359afc72d34255b78cdcc6291b77b2e7ed2f9.tar.lz
nixpkgs-099359afc72d34255b78cdcc6291b77b2e7ed2f9.tar.xz
nixpkgs-099359afc72d34255b78cdcc6291b77b2e7ed2f9.tar.zst
nixpkgs-099359afc72d34255b78cdcc6291b77b2e7ed2f9.zip
libfido2: add macOS support
* pass IOKit to libfido2
* Add a patch so that cmake uses lld flags when linking
* Upgrade from 1.3.0 to 1.3.1 (based off #80781)
* Specify CMAKE_INSTALL_LIBDIR so that the demo binaries link
  correctly on macOS and libfido2.pc specifies correct arguments
Diffstat (limited to 'pkgs/development/libraries/libfido2')
-rw-r--r--pkgs/development/libraries/libfido2/default.nix17
-rw-r--r--pkgs/development/libraries/libfido2/detect_apple_ld.patch11
2 files changed, 22 insertions, 6 deletions
diff --git a/pkgs/development/libraries/libfido2/default.nix b/pkgs/development/libraries/libfido2/default.nix
index 32d19283974..01a73f4a130 100644
--- a/pkgs/development/libraries/libfido2/default.nix
+++ b/pkgs/development/libraries/libfido2/default.nix
@@ -1,17 +1,22 @@
-{ stdenv, fetchurl, cmake, pkgconfig, libcbor, libressl, udev }:
+{ stdenv, fetchurl, cmake, pkgconfig, libcbor, libressl, udev, IOKit }:
 
 stdenv.mkDerivation rec {
   pname = "libfido2";
-  version = "1.3.0";
+  version = "1.3.1";
   src = fetchurl {
     url = "https://developers.yubico.com/${pname}/Releases/${pname}-${version}.tar.gz";
-    sha256 = "1izyl3as9rn7zcxpsvgngjwr55gli5gy822ac3ajzm65qiqkcbhb";
+    sha256 = "0hdgxbmjbnm9kjwc07nrl2zy87qclvb3rzvdwr5iw35n2qhf4dds";
   };
 
   nativeBuildInputs = [ cmake pkgconfig ];
-  buildInputs = [ libcbor libressl ] ++ stdenv.lib.optionals stdenv.isLinux [ udev ];
+  buildInputs = [ libcbor libressl ]
+    ++ stdenv.lib.optionals stdenv.isLinux [ udev ]
+    ++ stdenv.lib.optionals stdenv.isDarwin [ IOKit ];
 
-  cmakeFlags = [ "-DUDEV_RULES_DIR=${placeholder "out"}/etc/udev/rules.d" ];
+  patches = [ ./detect_apple_ld.patch ];
+
+  cmakeFlags = [ "-DUDEV_RULES_DIR=${placeholder "out"}/etc/udev/rules.d"
+                 "-DCMAKE_INSTALL_LIBDIR=lib" ];
 
   meta = with stdenv.lib; {
     description = ''
@@ -20,6 +25,6 @@ stdenv.mkDerivation rec {
     homepage = https://github.com/Yubico/libfido2;
     license = licenses.bsd2;
     maintainers = with maintainers; [ dtzWill ];
-    platforms = platforms.linux;
+    platforms = platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libfido2/detect_apple_ld.patch b/pkgs/development/libraries/libfido2/detect_apple_ld.patch
new file mode 100644
index 00000000000..de972e0f358
--- /dev/null
+++ b/pkgs/development/libraries/libfido2/detect_apple_ld.patch
@@ -0,0 +1,11 @@
+--- a/CMakeLists.txt	2020-02-19 17:21:59.000000000 +0000
++++ b/CMakeLists.txt	2020-02-23 15:57:34.241115306 +0000
+@@ -296,7 +296,7 @@
+ endif()
+ 
+ # export list
+-if(CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
++if(APPLE AND CMAKE_C_COMPILER_ID STREQUAL "Clang" OR CMAKE_C_COMPILER_ID STREQUAL "AppleClang")	
+ 	# clang + lld
+ 	string(CONCAT CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS}
+ 	    " -exported_symbols_list ${CMAKE_CURRENT_SOURCE_DIR}/src/export.llvm")