Skip to content

Commit 0aca4a2

Browse files
committed
rdkafka: fix static build
1 parent e9c57f8 commit 0aca4a2

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

pkgs/by-name/rd/rdkafka/package.nix

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,30 @@ stdenv.mkDerivation (finalAttrs: {
3838
curl
3939
];
4040

41-
# some tests don't build on darwin
41+
# examples and tests don't build on darwin statically
4242
cmakeFlags = [
43-
(lib.cmakeBool "RDKAFKA_BUILD_TESTS" (!stdenv.hostPlatform.isDarwin))
44-
(lib.cmakeBool "RDKAFKA_BUILD_EXAMPLES" (!stdenv.hostPlatform.isDarwin))
43+
(lib.cmakeBool "RDKAFKA_BUILD_STATIC" stdenv.hostPlatform.isStatic)
44+
(lib.cmakeBool "RDKAFKA_BUILD_TESTS" (
45+
!stdenv.hostPlatform.isDarwin && !stdenv.hostPlatform.isStatic
46+
))
47+
(lib.cmakeBool "RDKAFKA_BUILD_EXAMPLES" (
48+
!stdenv.hostPlatform.isDarwin && !stdenv.hostPlatform.isStatic
49+
))
4550
(lib.cmakeFeature "CMAKE_C_FLAGS" "-Wno-error=strict-overflow")
4651
];
4752

4853
postPatch = ''
4954
patchShebangs .
5055
'';
5156

57+
postFixup = lib.optionalString stdenv.hostPlatform.isStatic ''
58+
# rdkafka changes the library names for static libraries but users in pkgsStatic aren't likely to be aware of this
59+
# make sure the libraries are findable with both names
60+
for pc in rdkafka{,++}; do
61+
ln -s $dev/lib/pkgconfig/$pc{-static,}.pc
62+
done
63+
'';
64+
5265
enableParallelBuilding = true;
5366

5467
meta = with lib; {

0 commit comments

Comments
 (0)