From c8e4f38984d9194d939bf8b3c31010974f560be4 Mon Sep 17 00:00:00 2001 From: Robert Date: Wed, 2 Nov 2022 08:25:07 +0100 Subject: [PATCH] feat: Build against libpq 15 Signed-off-by: Wolfgang Walther Co-authored-by: Wolfgang Walther --- default.nix | 2 +- nix/overlays/postgresql-default.nix | 7 +++++-- nix/patches/default.nix | 2 ++ nix/patches/postgresql-atexit.patch | 11 +++++++++++ nix/static-haskell-package.nix | 2 +- 5 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 nix/patches/postgresql-atexit.patch diff --git a/default.nix b/default.nix index 9f4367a9d..eb1268d12 100644 --- a/default.nix +++ b/default.nix @@ -37,7 +37,7 @@ let allOverlays.checked-shell-script allOverlays.gitignore allOverlays.postgis - allOverlays.postgresql-default + (allOverlays.postgresql-default { inherit patches; }) allOverlays.postgresql-legacy allOverlays.postgresql-future (allOverlays.haskell-packages { inherit compiler; }) diff --git a/nix/overlays/postgresql-default.nix b/nix/overlays/postgresql-default.nix index f337bf34b..1e38b8fea 100644 --- a/nix/overlays/postgresql-default.nix +++ b/nix/overlays/postgresql-default.nix @@ -1,5 +1,8 @@ -self: super: +{ patches }: self: super: # Overlay that sets the default version of PostgreSQL. +with patches; { - postgresql = super.postgresql_14; + postgresql = super.postgresql_15.overrideAttrs ({ patches ? [ ], ... }: { + patches = patches ++ [ postgresql-atexit ]; + }); } diff --git a/nix/patches/default.nix b/nix/patches/default.nix index c262f0c4b..e3c5a9745 100644 --- a/nix/patches/default.nix +++ b/nix/patches/default.nix @@ -24,4 +24,6 @@ ./static-haskell-nix-ghc-bignum.patch; static-haskell-nix-openssl = ./static-haskell-nix-openssl.patch; + postgresql-atexit = + ./postgresql-atexit.patch; } diff --git a/nix/patches/postgresql-atexit.patch b/nix/patches/postgresql-atexit.patch new file mode 100644 index 000000000..3c1111914 --- /dev/null +++ b/nix/patches/postgresql-atexit.patch @@ -0,0 +1,11 @@ +--- a/src/interfaces/libpq/Makefile ++++ b/src/interfaces/libpq/Makefile +@@ -118,7 +118,7 @@ backend_src = $(top_srcdir)/src/backend + libpq-refs-stamp: $(shlib) + ifneq ($(enable_coverage), yes) + ifeq (,$(filter aix solaris,$(PORTNAME))) +- @if nm -A -u $< 2>/dev/null | grep -v __cxa_atexit | grep exit; then \ ++ @if nm -A -u $< 2>/dev/null | grep " exit"; then \ + echo 'libpq must not be calling any function which invokes exit'; exit 1; \ + fi + endif diff --git a/nix/static-haskell-package.nix b/nix/static-haskell-package.nix index 747d15c36..551e13318 100644 --- a/nix/static-haskell-package.nix +++ b/nix/static-haskell-package.nix @@ -35,7 +35,7 @@ let overlays = [ allOverlays.postgresql-future - allOverlays.postgresql-default + (allOverlays.postgresql-default { inherit patches; }) (allOverlays.haskell-packages { inherit compiler extraOverrides; }) # Disable failing tests for postgresql on musl that should have no impact # on the libpq that we need (collate.icu.utf8 and foreign regression