mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
Add unixodbc
This commit is contained in:
parent
a5f8402703
commit
b6d8bf5639
13
config/pkg/lib/unixodbc.yml
Normal file
13
config/pkg/lib/unixodbc.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
unixodbc:
|
||||||
|
type: library
|
||||||
|
artifact:
|
||||||
|
source: 'https://www.unixodbc.org/unixODBC-2.3.12.tar.gz'
|
||||||
|
metadata:
|
||||||
|
license-files: [COPYING]
|
||||||
|
license: LGPL-2.1-only
|
||||||
|
depends:
|
||||||
|
- libiconv
|
||||||
|
static-libs@unix:
|
||||||
|
- libodbc.a
|
||||||
|
- libodbccr.a
|
||||||
|
- libodbcinst.a
|
||||||
43
src/Package/Library/unixodbc.php
Normal file
43
src/Package/Library/unixodbc.php
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Package\Library;
|
||||||
|
|
||||||
|
use StaticPHP\Attribute\Package\BuildFor;
|
||||||
|
use StaticPHP\Attribute\Package\Library;
|
||||||
|
use StaticPHP\Exception\WrongUsageException;
|
||||||
|
use StaticPHP\Package\LibraryPackage;
|
||||||
|
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
||||||
|
use StaticPHP\Runtime\SystemTarget;
|
||||||
|
|
||||||
|
#[Library('unixodbc')]
|
||||||
|
class unixodbc extends LibraryPackage
|
||||||
|
{
|
||||||
|
#[BuildFor('Darwin')]
|
||||||
|
#[BuildFor('Linux')]
|
||||||
|
public function buildUnix(): void
|
||||||
|
{
|
||||||
|
$sysconf_selector = match ($os = SystemTarget::getTargetOS()) {
|
||||||
|
'Darwin' => match (SystemTarget::getTargetArch()) {
|
||||||
|
'x86_64' => '/usr/local/etc',
|
||||||
|
'aarch64' => '/opt/homebrew/etc',
|
||||||
|
default => throw new WrongUsageException('Unsupported architecture: ' . GNU_ARCH),
|
||||||
|
},
|
||||||
|
'Linux' => '/etc',
|
||||||
|
default => throw new WrongUsageException("Unsupported OS: {$os}"),
|
||||||
|
};
|
||||||
|
UnixAutoconfExecutor::create($this)
|
||||||
|
->configure(
|
||||||
|
'--disable-debug',
|
||||||
|
'--disable-dependency-tracking',
|
||||||
|
"--with-libiconv-prefix={$this->getBuildRootPath()}",
|
||||||
|
'--with-included-ltdl',
|
||||||
|
"--sysconfdir={$sysconf_selector}",
|
||||||
|
'--enable-gui=no',
|
||||||
|
)
|
||||||
|
->make();
|
||||||
|
$this->patchPkgconfPrefix(['odbc.pc', 'odbccr.pc', 'odbcinst.pc']);
|
||||||
|
$this->patchLaDependencyPrefix();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user