From 3bdc69269d392026f6c25ad136f709e12e8d1a8c Mon Sep 17 00:00:00 2001 From: Emily Date: Wed, 13 Nov 2024 19:41:11 +0000 Subject: [PATCH] fbthrift: condition shared libraries on platform setting --- pkgs/by-name/fb/fbthrift/package.nix | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pkgs/by-name/fb/fbthrift/package.nix b/pkgs/by-name/fb/fbthrift/package.nix index 801c1b1dc588..fcfc8d8ffdf3 100644 --- a/pkgs/by-name/fb/fbthrift/package.nix +++ b/pkgs/by-name/fb/fbthrift/package.nix @@ -55,11 +55,17 @@ stdenv.mkDerivation (finalAttrs: { (darwinMinVersionHook "11.0") ]; - cmakeFlags = [ - "-DBUILD_SHARED_LIBS=${if stdenv.hostPlatform.isDarwin then "OFF" else "ON"}" + cmakeFlags = + [ + (lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic)) - (lib.cmakeBool "thriftpy" false) - ]; + (lib.cmakeBool "thriftpy" false) + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + # Homebrew sets this, and the shared library build fails without + # it. I don‘t know, either. It scares me. + (lib.cmakeFeature "CMAKE_SHARED_LINKER_FLAGS" "-Wl,-undefined,dynamic_lookup") + ]; meta = { description = "Facebook's branch of Apache Thrift";