From cd85a62bc257b4177823359a20986deddaa4dc0b Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Mon, 16 Sep 2024 20:45:30 +0200 Subject: [PATCH] postgresql_jit.pkgs.postgis: fix build on darwin We introduced LTO in #294504. At that time, we still needed to use LLVM / lld to make this work on darwin. For this to work for extensions, they would need to set CFLAGS=-fuse-ld=lld, too. However, since #307880 landed, we don't need to do this anymore in the first place, LTO just works out of the box on darwin. Resolves #342362 --- pkgs/servers/sql/postgresql/generic.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkgs/servers/sql/postgresql/generic.nix b/pkgs/servers/sql/postgresql/generic.nix index dcb286dd3077b..474ca2563ba1d 100644 --- a/pkgs/servers/sql/postgresql/generic.nix +++ b/pkgs/servers/sql/postgresql/generic.nix @@ -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";