Skip to content

Commit 781260f

Browse files
committed
attempt fix for aarch64
1 parent 6c43fa5 commit 781260f

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,23 @@
77
use SPC\builder\linux\library\LinuxLibraryBase;
88
use SPC\exception\BuildFailureException;
99
use SPC\store\FileSystem;
10+
use SPC\util\SPCTarget;
1011

1112
trait postgresql
1213
{
14+
public function patchBeforeBuild(): bool
15+
{
16+
if (SPCTarget::getLibcVersion() === '2.17' && GNU_ARCH === 'aarch64') {
17+
FileSystem::replaceFileStr(
18+
$this->source_dir . '/src/port/pg_crc32c_armv8_choose.c',
19+
'#if defined(__linux__) && !defined(__aarch64__) && !defined(HWCAP2_CRC32)',
20+
'#if defined(__linux__) && !defined(HWCAP_CRC32)',
21+
);
22+
return true;
23+
}
24+
return false;
25+
}
26+
1327
protected function build(): void
1428
{
1529
$builddir = BUILD_ROOT_PATH;
@@ -55,7 +69,7 @@ protected function build(): void
5569
if ($this->builder->getLib('icu')) {
5670
$libcpp = $this instanceof LinuxLibraryBase ? ' -lstdc++' : ' -lc++';
5771
}
58-
$envs .= " LIBS=\"{$libs} {$libs}{$libcpp}\" "; // macOS doesn't understand how to link properly
72+
$envs .= " LIBS=\"{$libs}{$libcpp}\" ";
5973
}
6074
if ($error_exec_cnt > 0) {
6175
throw new BuildFailureException('Failed to get pkg-config information!');

0 commit comments

Comments
 (0)