Skip to content

Commit 8c8aba2

Browse files
committed
Fix unixodbc driver config searching path
1 parent 97b18e9 commit 8c8aba2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,29 @@
44

55
namespace SPC\builder\unix\library;
66

7+
use SPC\exception\WrongUsageException;
78
use SPC\util\executor\UnixAutoconfExecutor;
89

910
trait unixodbc
1011
{
1112
protected function build(): void
1213
{
14+
$sysconf_selector = match (PHP_OS_FAMILY) {
15+
'Darwin' => match (GNU_ARCH) {
16+
'x86_64' => '/usr/local/etc',
17+
'aarch64' => '/opt/homebrew/etc',
18+
default => throw new WrongUsageException('Unsupported architecture: ' . GNU_ARCH),
19+
},
20+
'Linux' => '/etc',
21+
default => throw new WrongUsageException('Unsupported OS: ' . PHP_OS_FAMILY),
22+
};
1323
UnixAutoconfExecutor::create($this)
1424
->configure(
1525
'--disable-debug',
1626
'--disable-dependency-tracking',
1727
"--with-libiconv-prefix={$this->getBuildRootPath()}",
1828
'--with-included-ltdl',
29+
"--sysconfdir={$sysconf_selector}",
1930
'--enable-gui=no',
2031
)
2132
->make();

0 commit comments

Comments
 (0)