From ee1e828c2731ec81cc11c03b7f7eb23c3d02b5e3 Mon Sep 17 00:00:00 2001 From: Emily Date: Thu, 14 Nov 2024 02:08:57 +0000 Subject: [PATCH] mvfst: condition shared libraries on platform setting --- pkgs/by-name/mv/mvfst/package.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pkgs/by-name/mv/mvfst/package.nix b/pkgs/by-name/mv/mvfst/package.nix index d78431ff91e4..379f292bcfb6 100644 --- a/pkgs/by-name/mv/mvfst/package.nix +++ b/pkgs/by-name/mv/mvfst/package.nix @@ -43,6 +43,24 @@ stdenv.mkDerivation (finalAttrs: { (darwinMinVersionHook "11.0") ]; + cmakeFlags = + [ + (lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic)) + + (lib.cmakeBool "CMAKE_INSTALL_RPATH_USE_LINK_PATH" true) + ] + ++ 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") + ]; + + postPatch = '' + # Make sure the libraries the `tperf` binary uses are installed. + printf 'install(TARGETS mvfst_test_utils)\n' >> quic/common/test/CMakeLists.txt + printf 'install(TARGETS mvfst_dsr_backend)\n' >> quic/dsr/CMakeLists.txt + ''; + meta = { description = "Implementation of the QUIC transport protocol"; homepage = "https://github.com/facebook/mvfst";