Skip to content

Commit

Permalink
Merge: postgresql: fix build if pythonSupport is enabled (#372655)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ma27 authored Jan 18, 2025
2 parents c631603 + b6773ad commit 2c7d7d1
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions pkgs/servers/sql/postgresql/generic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,11 @@ let
# flags will remove unused sections from all shared libraries and binaries - including
# those paths. This avoids a lot of circular dependency problems with different outputs,
# and allows splitting them cleanly.
env.CFLAGS =
"-fdata-sections -ffunction-sections"
+ (if stdenv'.cc.isClang then " -flto" else " -fmerge-constants -Wl,--gc-sections");
env = {
CFLAGS =
"-fdata-sections -ffunction-sections"
+ (if stdenv'.cc.isClang then " -flto" else " -fmerge-constants -Wl,--gc-sections");
} // lib.optionalAttrs pythonSupport { PYTHON = "${python3}/bin/python"; };

configureFlags =
let
Expand Down Expand Up @@ -378,10 +380,14 @@ let
--replace-fail '-bundle_loader $(bindir)/postgres' "-bundle_loader $out/bin/postgres"
'';

postFixup = lib.optionalString stdenv'.hostPlatform.isGnu ''
# initdb needs access to "locale" command from glibc.
wrapProgram $out/bin/initdb --prefix PATH ":" ${glibc.bin}/bin
'';
postFixup =
lib.optionalString stdenv'.hostPlatform.isGnu ''
# initdb needs access to "locale" command from glibc.
wrapProgram $out/bin/initdb --prefix PATH ":" ${glibc.bin}/bin
''
+ lib.optionalString pythonSupport ''
wrapProgram "$out/bin/postgres" --set PYTHONPATH "${python3}/${python3.sitePackages}"
'';

# Running tests as "install check" to work around SIP issue on macOS:
# https://www.postgresql.org/message-id/flat/4D8E1BC5-BBCF-4B19-8226-359201EA8305%40gmail.com
Expand Down

0 comments on commit 2c7d7d1

Please sign in to comment.