Skip to content

Commit

Permalink
libnfc: Support static builds
Browse files Browse the repository at this point in the history
nixpkgs upstreaming PR: NixOS#243328
  • Loading branch information
nh2 committed Jul 13, 2023
1 parent 40d2db0 commit 9e49f8f
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions pkgs/development/libraries/libnfc/default.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, libusb-compat-0_1
, readline
, cmake
, pkg-config
, static ? false
}:

stdenv.mkDerivation rec {
Expand All @@ -18,6 +20,15 @@ stdenv.mkDerivation rec {
sha256 = "5gMv/HajPrUL/vkegEqHgN2d6Yzf01dTMrx4l34KMrQ=";
};

patches = [
# From: https://github.com/nfc-tools/libnfc/pull/595
(fetchpatch {
name = "libnfc-Enable-selection-of-static-vs-shared-builds.patch";
url = "https://github.com/kino-dome/libnfc/commit/992f1c56ca7663357911c24843834a88ef98d8dc.patch";
hash = "sha256:1q74nylxpmbw3iqxdi24kra4bfx7gjx1v0i0nzb1jkpp15580hp1";
})
];

nativeBuildInputs = [
cmake
pkg-config
Expand All @@ -32,9 +43,12 @@ stdenv.mkDerivation rec {
"sysconfdir=/etc"
];

cmakeFlags = lib.optionals stdenv.isDarwin [
"-DLIBNFC_DRIVER_PN532_I2C=OFF"
"-DLIBNFC_DRIVER_PN532_SPI=OFF"
cmakeFlags = lib.concatLists [
(lib.optionals stdenv.isDarwin [
"-DLIBNFC_DRIVER_PN532_I2C=OFF"
"-DLIBNFC_DRIVER_PN532_SPI=OFF"
])
(lib.optional (!static) "-DBUILD_SHARED_LIBS:BOOL=ON")
];

meta = with lib; {
Expand Down

0 comments on commit 9e49f8f

Please sign in to comment.