From 0f8b79d2f6675830a2df173d707470d20a28f009 Mon Sep 17 00:00:00 2001 From: Emily Date: Thu, 14 Nov 2024 02:40:52 +0000 Subject: [PATCH] fizz: split outputs (cherry picked from commit dbb5591b5b267339ac46448b1096f0d457c237b6) (cherry picked from commit 8f709e8f6dd0377efff653a1c7954fe9770f1d81) --- pkgs/by-name/fi/fizz/package.nix | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/pkgs/by-name/fi/fizz/package.nix b/pkgs/by-name/fi/fizz/package.nix index a78218ad8d09..e5927116c456 100644 --- a/pkgs/by-name/fi/fizz/package.nix +++ b/pkgs/by-name/fi/fizz/package.nix @@ -6,6 +6,7 @@ cmake, ninja, + removeReferencesTo, openssl, glog, @@ -27,6 +28,12 @@ stdenv.mkDerivation (finalAttrs: { pname = "fizz"; version = "2024.11.18.00"; + outputs = [ + "bin" + "out" + "dev" + ]; + src = fetchFromGitHub { owner = "facebookincubator"; repo = "fizz"; @@ -37,6 +44,7 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ cmake ninja + removeReferencesTo ]; buildInputs = @@ -67,7 +75,16 @@ stdenv.mkDerivation (finalAttrs: { cmakeFlags = [ (lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic)) + (lib.cmakeBool "BUILD_TESTS" finalAttrs.finalPackage.doCheck) + + (lib.cmakeFeature "BIN_INSTALL_DIR" "${placeholder "bin"}/bin") + (lib.cmakeFeature "INCLUDE_INSTALL_DIR" "${placeholder "dev"}/include") + (lib.cmakeFeature "LIB_INSTALL_DIR" "${placeholder "out"}/lib") + (lib.cmakeFeature "CMAKE_INSTALL_DIR" "${placeholder "dev"}/lib/cmake/fizz") + # Fizz puts test headers into `${CMAKE_INSTALL_PREFIX}/include` + # for other projects to consume. + (lib.cmakeFeature "CMAKE_INSTALL_PREFIX" (placeholder "dev")) ]; __darwinAllowLocalNetworking = true; @@ -85,6 +102,18 @@ stdenv.mkDerivation (finalAttrs: { export GTEST_FILTER="-${lib.concatStringsSep ":" disabledTests}" ''; + 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 + ) + ''; + meta = { description = "C++14 implementation of the TLS-1.3 standard"; homepage = "https://github.com/facebookincubator/fizz";