postgresqlPackages.omnigres: fix build with cmake4

This commit is contained in:
Sigmanificient
2026-01-03 19:42:59 +01:00
parent e86053f926
commit 738a650ff5
+24 -9
View File
@@ -30,15 +30,30 @@ postgresqlBuildExtension (finalAttrs: {
hash = "sha256-RrdtUtrs0Mh1VyMbF89qJhr2fnCVcQy2l1/85/mJ/4Y=";
};
# This matches postInstall of PostgreSQL's generic.nix, which does this for the PGXS Makefile.
# Since omnigres uses a CMake file, which tries to replicate the things that PGXS does, we need
# to apply the same fix for darwin.
# The reason we need to do this is, because PG_BINARY will point at the postgres wrapper of
# postgresql.withPackages, which does not contain the same symbols as the original file, ofc.
postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace "cmake/PostgreSQLExtension.cmake" \
--replace-fail '-bundle_loader ''${PG_BINARY}' "-bundle_loader ${postgresql}/bin/postgres"
'';
postPatch = ''
substituteInPlace deps/libfyaml/CMakeLists.txt \
--replace-fail "cmake_minimum_required(VERSION 3.0)" "cmake_minimum_required(VERSION 3.10)"
substituteInPlace deps/STC/CMakeLists.txt \
--replace-fail "cmake_minimum_required(VERSION 3.1)" "cmake_minimum_required(VERSION 3.10)"
substituteInPlace deps/wslay/{,lib/}CMakeLists.txt \
--replace-fail "cmake_minimum_required(VERSION 2.8)" "cmake_minimum_required(VERSION 3.10)"
substituteInPlace deps/h2o/CMakeLists.txt \
--replace-fail "CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)" "cmake_minimum_required(VERSION 3.10)"
substituteInPlace deps/uriparser/CMakeLists.txt \
--replace-fail "cmake_minimum_required(VERSION 3.3)" "cmake_minimum_required(VERSION 3.10)"
substituteInPlace deps/metalang99/CMakeLists.txt \
--replace-fail "cmake_minimum_required(VERSION 3.0.2)" "cmake_minimum_required(VERSION 3.10)"
''
+
# This matches postInstall of PostgreSQL's generic.nix, which does this for the PGXS Makefile.
# Since omnigres uses a CMake file, which tries to replicate the things that PGXS does, we need
# to apply the same fix for darwin.
# The reason we need to do this is, because PG_BINARY will point at the postgres wrapper of
# postgresql.withPackages, which does not contain the same symbols as the original file, ofc.
lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace "cmake/PostgreSQLExtension.cmake" \
--replace-fail '-bundle_loader ''${PG_BINARY}' "-bundle_loader ${postgresql}/bin/postgres"
'';
strictDeps = true;