From 3966bd5f0ae90119335c4ea23a773dbe14136e2e Mon Sep 17 00:00:00 2001 From: henderkes Date: Mon, 6 Oct 2025 20:06:37 +0200 Subject: [PATCH] update pgsql version to 18.0 --- config/source.json | 2 +- src/SPC/builder/unix/library/postgresql.php | 39 +++++++-------------- 2 files changed, 13 insertions(+), 28 deletions(-) diff --git a/config/source.json b/config/source.json index 4a0e0fdb..450b7b3c 100644 --- a/config/source.json +++ b/config/source.json @@ -880,7 +880,7 @@ "postgresql": { "type": "ghtagtar", "repo": "postgres/postgres", - "match": "REL_16_\\d+", + "match": "REL_18_\\d+", "license": { "type": "file", "path": "COPYRIGHT" diff --git a/src/SPC/builder/unix/library/postgresql.php b/src/SPC/builder/unix/library/postgresql.php index 3bc6835d..0a3489a1 100644 --- a/src/SPC/builder/unix/library/postgresql.php +++ b/src/SPC/builder/unix/library/postgresql.php @@ -6,7 +6,6 @@ namespace SPC\builder\unix\library; use SPC\builder\linux\library\LinuxLibraryBase; use SPC\exception\BuildFailureException; -use SPC\exception\FileSystemException; use SPC\store\FileSystem; use SPC\util\SPCTarget; @@ -65,17 +64,18 @@ trait postgresql FileSystem::resetDir($this->source_dir . '/build'); - $version = $this->getVersion(); - // 16.1 workaround - if (version_compare($version, '16.1') >= 0) { - # 有静态链接配置 参考文件: src/interfaces/libpq/Makefile - shell()->cd($this->source_dir . '/build') - ->exec('sed -i.backup "s/invokes exit\'; exit 1;/invokes exit\';/" ../src/interfaces/libpq/Makefile') - ->exec('sed -i.backup "278 s/^/# /" ../src/Makefile.shlib') - ->exec('sed -i.backup "402 s/^/# /" ../src/Makefile.shlib'); - } else { - throw new BuildFailureException('Unsupported version for postgresql: ' . $version . ' !'); - } + # 有静态链接配置 参考文件: src/interfaces/libpq/Makefile + shell()->cd($this->source_dir . '/build') + ->exec('sed -i.backup "s/invokes exit\'; exit 1;/invokes exit\';/" ../src/interfaces/libpq/Makefile') + ->exec('sed -i.backup "278 s/^/# /" ../src/Makefile.shlib') + ->exec('sed -i.backup "402 s/^/# /" ../src/Makefile.shlib'); + + // php source relies on the non-private encoding functions in libpgcommon.a + FileSystem::replaceFileStr( + $this->source_dir . '/src/common/Makefile', + '$(OBJS_FRONTEND): CPPFLAGS += -DUSE_PRIVATE_ENCODING_FUNCS', + '$(OBJS_FRONTEND): CPPFLAGS += -UUSE_PRIVATE_ENCODING_FUNCS', + ); // configure shell()->cd($this->source_dir . '/build')->initializeEnv($this) @@ -83,14 +83,12 @@ trait postgresql ->exec( "{$envs} ../configure " . "--prefix={$builddir} " . - ($this->builder->getOption('enable-zts') ? '--enable-thread-safety ' : '--disable-thread-safety ') . '--enable-coverage=no ' . '--with-ssl=openssl ' . '--with-readline ' . '--with-libxml ' . ($this->builder->getLib('icu') ? '--with-icu ' : '--without-icu ') . ($this->builder->getLib('ldap') ? '--with-ldap ' : '--without-ldap ') . - // '--without-ldap ' . ($this->builder->getLib('libxslt') ? '--with-libxslt ' : '--without-libxslt ') . ($this->builder->getLib('zstd') ? '--with-zstd ' : '--without-zstd ') . '--without-lz4 ' . @@ -114,17 +112,4 @@ trait postgresql FileSystem::replaceFileStr(BUILD_LIB_PATH . '/pkgconfig/libpq.pc', '-lldap', '-lldap -llber'); } - - private function getVersion(): string - { - try { - $file = FileSystem::readFile($this->source_dir . '/meson.build'); - if (preg_match("/^\\s+version:\\s?'(.*)'/m", $file, $match)) { - return $match[1]; - } - return 'unknown'; - } catch (FileSystemException) { - return 'unknown'; - } - } }