Skip to content

Commit 9e49f8f

Browse files
committed
libnfc: Support static builds
nixpkgs upstreaming PR: NixOS#243328
1 parent 40d2db0 commit 9e49f8f

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

pkgs/development/libraries/libnfc/default.nix

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
{ lib
22
, stdenv
33
, fetchFromGitHub
4+
, fetchpatch
45
, libusb-compat-0_1
56
, readline
67
, cmake
78
, pkg-config
9+
, static ? false
810
}:
911

1012
stdenv.mkDerivation rec {
@@ -18,6 +20,15 @@ stdenv.mkDerivation rec {
1820
sha256 = "5gMv/HajPrUL/vkegEqHgN2d6Yzf01dTMrx4l34KMrQ=";
1921
};
2022

23+
patches = [
24+
# From: https://github.com/nfc-tools/libnfc/pull/595
25+
(fetchpatch {
26+
name = "libnfc-Enable-selection-of-static-vs-shared-builds.patch";
27+
url = "https://github.com/kino-dome/libnfc/commit/992f1c56ca7663357911c24843834a88ef98d8dc.patch";
28+
hash = "sha256:1q74nylxpmbw3iqxdi24kra4bfx7gjx1v0i0nzb1jkpp15580hp1";
29+
})
30+
];
31+
2132
nativeBuildInputs = [
2233
cmake
2334
pkg-config
@@ -32,9 +43,12 @@ stdenv.mkDerivation rec {
3243
"sysconfdir=/etc"
3344
];
3445

35-
cmakeFlags = lib.optionals stdenv.isDarwin [
36-
"-DLIBNFC_DRIVER_PN532_I2C=OFF"
37-
"-DLIBNFC_DRIVER_PN532_SPI=OFF"
46+
cmakeFlags = lib.concatLists [
47+
(lib.optionals stdenv.isDarwin [
48+
"-DLIBNFC_DRIVER_PN532_I2C=OFF"
49+
"-DLIBNFC_DRIVER_PN532_SPI=OFF"
50+
])
51+
(lib.optional (!static) "-DBUILD_SHARED_LIBS:BOOL=ON")
3852
];
3953

4054
meta = with lib; {

0 commit comments

Comments
 (0)