Skip to content

Commit 0114700

Browse files
committed
Fix PostgreSQL build compatibility for aarch64 on glibc 2.17 and update test configurations
1 parent ec9364d commit 0114700

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

src/SPC/builder/unix/library/postgresql.php

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace SPC\builder\unix\library;
66

7+
use SPC\exception\FileSystemException;
78
use SPC\store\FileSystem;
89
use SPC\util\PkgConfigUtil;
910
use SPC\util\SPCConfigUtil;
@@ -13,17 +14,18 @@ trait postgresql
1314
{
1415
public function patchBeforeBuild(): bool
1516
{
17+
// fix aarch64 build on glibc 2.17 (e.g. CentOS 7)
1618
if (SPCTarget::getLibcVersion() === '2.17' && GNU_ARCH === 'aarch64') {
17-
FileSystem::replaceFileStr(
18-
$this->source_dir . '/src/port/pg_popcount_aarch64.c',
19-
'HWCAP_SVE',
20-
'0',
21-
);
22-
FileSystem::replaceFileStr(
23-
$this->source_dir . '/src/port/pg_crc32c_armv8_choose.c',
24-
'#if defined(__linux__) && !defined(__aarch64__) && !defined(HWCAP2_CRC32)',
25-
'#if defined(__linux__) && !defined(HWCAP_CRC32)',
26-
);
19+
try {
20+
FileSystem::replaceFileStr("{$this->source_dir}/src/port/pg_popcount_aarch64.c", 'HWCAP_SVE', '0');
21+
FileSystem::replaceFileStr(
22+
"{$this->source_dir}/src/port/pg_crc32c_armv8_choose.c",
23+
'#if defined(__linux__) && !defined(__aarch64__) && !defined(HWCAP2_CRC32)',
24+
'#if defined(__linux__) && !defined(HWCAP_CRC32)'
25+
);
26+
} catch (FileSystemException) {
27+
// allow file not-existence to make it compatible with old and new version
28+
}
2729
}
2830
// skip the test on platforms where libpq infrastructure may be provided by statically-linked libraries
2931
FileSystem::replaceFileStr("{$this->source_dir}/src/interfaces/libpq/Makefile", 'invokes exit\'; exit 1;', 'invokes exit\';');
@@ -47,7 +49,7 @@ protected function build(): void
4749
$spc = new SPCConfigUtil($this->getBuilder(), ['no_php' => true, 'libs_only_deps' => true]);
4850
$config = $spc->config(libraries: $libs, include_suggest_lib: $this->builder->getOption('with-suggested-libs'));
4951

50-
$macos_15_bug_cflags = PHP_OS_FAMILY === 'Darwin' ? ' -Wno-unguarded-availability-new' : '';
52+
$macos_15_bug_cflags = PHP_OS_FAMILY === 'Darwin' ? '' : '';
5153

5254
$env_vars = [
5355
'CFLAGS' => "{$config['cflags']} -fno-ident{$macos_15_bug_cflags}",

src/globals/test-extensions.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313

1414
// test php version (8.1 ~ 8.4 available, multiple for matrix)
1515
$test_php_version = [
16-
'8.1',
17-
'8.2',
18-
'8.3',
16+
// '8.1',
17+
// '8.2',
18+
// '8.3',
1919
'8.4',
2020
// '8.5',
2121
// 'git',
@@ -49,7 +49,7 @@
4949

5050
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
5151
$extensions = match (PHP_OS_FAMILY) {
52-
'Linux', 'Darwin' => 'pgsql',
52+
'Linux', 'Darwin' => 'pdo_pgsql',
5353
'Windows' => 'bcmath,bz2,calendar,ctype,curl,dom,exif,fileinfo,filter,ftp,iconv,xml,mbstring,mbregex,mysqlnd,openssl,pdo,pdo_mysql,pdo_sqlite,phar,session,simplexml,soap,sockets,sqlite3,tokenizer,xmlwriter,xmlreader,zlib,zip',
5454
};
5555

@@ -73,7 +73,7 @@
7373
// You can use `common`, `bulk`, `minimal` or `none`.
7474
// note: combination is only available for *nix platform. Windows must use `none` combination
7575
$base_combination = match (PHP_OS_FAMILY) {
76-
'Linux', 'Darwin' => 'common',
76+
'Linux', 'Darwin' => 'none',
7777
'Windows' => 'none',
7878
};
7979

0 commit comments

Comments
 (0)