From 5dfd85b1b982b16c43e8bd048893ead6d5bf2983 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Tue, 26 Aug 2025 22:25:49 -0400 Subject: [PATCH] firefox-beta: fix darwin build Recent firefox started using fileport.h API. This API was exposed in SDK 15.4, but we are still running on 15.2. XNU source headers contain the header for some time, so we can pull it from there instead. --- pkgs/build-support/build-mozilla-mach/default.nix | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/build-mozilla-mach/default.nix b/pkgs/build-support/build-mozilla-mach/default.nix index 790ca307cdb1..8dc3dd3b9e40 100644 --- a/pkgs/build-support/build-mozilla-mach/default.nix +++ b/pkgs/build-support/build-mozilla-mach/default.nix @@ -444,7 +444,20 @@ buildStdenv.mkDerivation { # linking firefox hits the vm.max_map_count kernel limit with the default musl allocator # TODO: Default vm.max_map_count has been increased, retest without this export LD_PRELOAD=${mimalloc}/lib/libmimalloc.so - ''; + '' + + + # fileport.h was exposed in SDK 15.4 but we have only 15.2 in nixpkgs so far. + lib.optionalString + ( + stdenv.hostPlatform.isDarwin + && lib.versionAtLeast version "143" + && lib.versionOlder apple-sdk_15.version "15.4" + ) + '' + mkdir -p xnu/sys + cp ${apple-sdk_15.sourceRelease "xnu"}/bsd/sys/fileport.h xnu/sys + export CXXFLAGS="-isystem $(pwd)/xnu" + ''; # firefox has a different definition of configurePlatforms from nixpkgs, see configureFlags configurePlatforms = [ ];