mvfst: condition shared libraries on platform setting

This commit is contained in:
Emily 2024-11-14 02:08:57 +00:00
parent 5b08d09834
commit ee1e828c27

View File

@ -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 dont 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";