From bc978ecbde78ff02a36952d4a53fb8ace4963382 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sat, 22 Jul 2023 15:07:53 +0800 Subject: [PATCH] add macOS support for pgsql --- src/SPC/builder/unix/library/postgresql.php | 4 +++- src/SPC/store/SourcePatcher.php | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/SPC/builder/unix/library/postgresql.php b/src/SPC/builder/unix/library/postgresql.php index e370a394..09d1e25b 100644 --- a/src/SPC/builder/unix/library/postgresql.php +++ b/src/SPC/builder/unix/library/postgresql.php @@ -4,6 +4,8 @@ declare(strict_types=1); namespace SPC\builder\unix\library; +use SPC\builder\linux\library\LinuxLibraryBase; +use SPC\builder\macos\library\MacOSLibraryBase; use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; use SPC\store\FileSystem; @@ -30,7 +32,7 @@ trait postgresql $output = shell()->execWithResult($env . ' pkg-config --libs-only-L --static ' . $packages); if (!empty($output[1][0])) { $ldflags = $output[1][0]; - $envs .= " LDFLAGS=\"{$ldflags} -static\" "; + $envs .= $this instanceof MacOSLibraryBase ? " LDFLAGS=\"{$ldflags}\" " : " LDFLAGS=\"{$ldflags} -static\" "; } $output = shell()->execWithResult($env . ' pkg-config --libs-only-l --static ' . $packages); if (!empty($output[1][0])) { diff --git a/src/SPC/store/SourcePatcher.php b/src/SPC/store/SourcePatcher.php index aba47b92..dfefae54 100644 --- a/src/SPC/store/SourcePatcher.php +++ b/src/SPC/store/SourcePatcher.php @@ -88,6 +88,9 @@ class SourcePatcher if ($ssh2 = $builder->getExt('ssh2')) { $patch[] = ['ssh2 patch', '/-lssh2/', $ssh2->getLibFilesString()]; } + if ($pgsql = $builder->getExt('pgsql')) { + $patch[] = ['pgsql patch', '/-lpq/', $pgsql->getLibFilesString()]; + } $patch[] = ['disable capstone', '/have_capstone="yes"/', 'have_capstone="no"']; foreach ($patch as $item) { logger()->info('Patching configure: ' . $item[0]);