diff options
author | Maximilian Bosch <maximilian@mbosch.me> | 2023-06-07 18:30:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-07 18:30:16 +0200 |
commit | c92f3af69d81f2ed8682cb06a9d64ccf6fd687b6 (patch) | |
tree | 6e2da690ed77479dbc954648f385ad0de6a487ed | |
parent | 4715513f7b2acaaff798495a6134692c1d25d43c (diff) | |
parent | 8d4a81b1851be7823e23d26bd02abcfb902d2bef (diff) |
Merge pull request #228349 from yu-re-ka/musl-postgresql
pkgsMusl.postgresql: fix build
-rw-r--r-- | pkgs/servers/sql/postgresql/default.nix | 22 | ||||
-rw-r--r-- | pkgs/servers/sql/postgresql/locale-binary-path.patch | 13 |
2 files changed, 33 insertions, 2 deletions
diff --git a/pkgs/servers/sql/postgresql/default.nix b/pkgs/servers/sql/postgresql/default.nix index 0df5b97cf3cf7..307c9f5f4e328 100644 --- a/pkgs/servers/sql/postgresql/default.nix +++ b/pkgs/servers/sql/postgresql/default.nix @@ -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) ]; diff --git a/pkgs/servers/sql/postgresql/locale-binary-path.patch b/pkgs/servers/sql/postgresql/locale-binary-path.patch new file mode 100644 index 0000000000000..08e90bce750ca --- /dev/null +++ b/pkgs/servers/sql/postgresql/locale-binary-path.patch @@ -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(), |