Merge: postgresql_jit.pkgs.postgis: fix build on darwin (#342369)

This commit is contained in:
Maximilian Bosch 2024-09-21 11:53:12 +02:00 committed by GitHub
commit 2795949808
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -47,7 +47,7 @@ let
pname = "postgresql";
stdenv' =
if jitSupport then
if jitSupport && !stdenv.cc.isClang then
overrideCC llvmPackages.stdenv (llvmPackages.stdenv.cc.override {
# LLVM bintools are not used by default, but are needed to make -flto work below.
bintools = llvmPackages.bintools;
@ -126,7 +126,6 @@ let
# and allows splitting them cleanly.
env.CFLAGS = "-fdata-sections -ffunction-sections"
+ (if stdenv'.cc.isClang then " -flto" else " -fmerge-constants -Wl,--gc-sections")
+ lib.optionalString (stdenv'.isDarwin && jitSupport) " -fuse-ld=lld"
# Makes cross-compiling work when xml2-config can't be executed on the host.
# Fixed upstream in https://github.com/postgres/postgres/commit/0bc8cebdb889368abdf224aeac8bc197fe4c9ae6
+ lib.optionalString (olderThan "13") " -I${libxml2.dev}/include/libxml2";