Merge pull request #228349 from yu-re-ka/musl-postgresql

pkgsMusl.postgresql: fix build
This commit is contained in:
Maximilian Bosch 2023-06-07 18:30:16 +02:00 committed by GitHub
commit c92f3af69d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 2 deletions

View file

@ -2,9 +2,9 @@ let
generic =
# dependencies
{ stdenv, lib, fetchurl, makeWrapper
{ stdenv, lib, fetchurl, makeWrapper, fetchpatch
, glibc, zlib, readline, openssl, icu, lz4, zstd, systemd, libossp_uuid
, pkg-config, libxml2, tzdata, libkrb5
, pkg-config, libxml2, tzdata, libkrb5, substituteAll, darwin
# This is important to obtain a version of `libpq` that does not depend on systemd.
, enableSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd && !stdenv.hostPlatform.isStatic
@ -103,6 +103,24 @@ let
./patches/hardcode-pgxs-path.patch
./patches/specify_pkglibdir_at_runtime.patch
./patches/findstring.patch
(substituteAll {
src = ./locale-binary-path.patch;
locale = "${if stdenv.isDarwin then darwin.adv_cmds else lib.getBin stdenv.cc.libc}/bin/locale";
})
] ++ lib.optionals stdenv'.hostPlatform.isMusl [
# Fixes for musl libc
# These patches are not properly guarded and should NOT be enabled everywhere
(fetchpatch {
url = "https://git.alpinelinux.org/aports/plain/main/postgresql14/disable-test-collate.icu.utf8.patch?id=56999e6d0265ceff5c5239f85fdd33e146f06cb7";
hash = "sha256-pnl+wM3/IUyq5iJzk+h278MDA9R0GQXQX8d4wJcB2z4=";
})
(fetchpatch {
url = "https://git.alpinelinux.org/aports/plain/main/postgresql14/icu-collations-hack.patch?id=56999e6d0265ceff5c5239f85fdd33e146f06cb7";
hash = "sha256-Yb6lMBDqeVP/BLMyIr5rmR6OkaVzo68cV/+cL2LOe/M=";
})
] ++ lib.optionals stdenv'.isLinux [
(if atLeast "13" then ./patches/socketdir-in-run-13.patch else ./patches/socketdir-in-run.patch)
];

View file

@ -0,0 +1,13 @@
diff --git a/src/backend/commands/collationcmds.c b/src/backend/commands/collationcmds.c
index fcfc02d..d011394 100644
--- a/src/backend/commands/collationcmds.c
+++ b/src/backend/commands/collationcmds.c
@@ -611,7 +611,7 @@ pg_import_system_collations(PG_FUNCTION_ARGS)
aliases = (CollAliasData *) palloc(maxaliases * sizeof(CollAliasData));
naliases = 0;
- locale_a_handle = OpenPipeStream("locale -a", "r");
+ locale_a_handle = OpenPipeStream("@locale@ -a", "r");
if (locale_a_handle == NULL)
ereport(ERROR,
(errcode_for_file_access(),