From 49ad47893e80628afe3e08fc847929503da1de9b Mon Sep 17 00:00:00 2001 From: Emily Date: Thu, 14 Nov 2024 02:59:42 +0000 Subject: [PATCH] mvfst: split outputs --- pkgs/by-name/mv/mvfst/package.nix | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/pkgs/by-name/mv/mvfst/package.nix b/pkgs/by-name/mv/mvfst/package.nix index 8bbc024263e8..f01f1be5a817 100644 --- a/pkgs/by-name/mv/mvfst/package.nix +++ b/pkgs/by-name/mv/mvfst/package.nix @@ -6,6 +6,7 @@ cmake, ninja, + removeReferencesTo, folly, gflags, @@ -22,6 +23,12 @@ stdenv.mkDerivation (finalAttrs: { pname = "mvfst"; version = "2024.11.18.00"; + outputs = [ + "bin" + "out" + "dev" + ]; + src = fetchFromGitHub { owner = "facebook"; repo = "mvfst"; @@ -32,6 +39,7 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ cmake ninja + removeReferencesTo ]; buildInputs = @@ -60,6 +68,8 @@ stdenv.mkDerivation (finalAttrs: { (lib.cmakeBool "CMAKE_INSTALL_RPATH_USE_LINK_PATH" true) (lib.cmakeBool "BUILD_TESTS" finalAttrs.finalPackage.doCheck) + + (lib.cmakeFeature "CMAKE_INSTALL_PREFIX" (placeholder "dev")) ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ # Homebrew sets this, and the shared library build fails without @@ -107,6 +117,21 @@ stdenv.mkDerivation (finalAttrs: { runHook postCheck ''; + postFixup = '' + # Sanitize header paths to avoid runtime dependencies leaking in + # through `__FILE__`. + ( + shopt -s globstar + for header in "$dev/include"/**/*.h; do + sed -i "1i#line 1 \"$header\"" "$header" + remove-references-to -t "$dev" "$header" + done + ) + + # TODO: Do this in `gtest` rather than downstream. + remove-references-to -t ${gtest.dev} $out/lib/* + ''; + meta = { description = "Implementation of the QUIC transport protocol"; homepage = "https://github.com/facebook/mvfst";