mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-19 13:24:51 +08:00
Add ext-mbstring,ext-mbregex,onig
This commit is contained in:
parent
0652d4aa03
commit
3fa2d69813
9
config/pkg/ext/ext-mbregex.yml
Normal file
9
config/pkg/ext/ext-mbregex.yml
Normal file
@ -0,0 +1,9 @@
|
||||
ext-mbregex:
|
||||
type: php-extension
|
||||
depends:
|
||||
- onig
|
||||
- ext-mbstring
|
||||
php-extension:
|
||||
arg-type: custom
|
||||
build-shared: false
|
||||
build-static: true
|
||||
4
config/pkg/ext/ext-mbstring.yml
Normal file
4
config/pkg/ext/ext-mbstring.yml
Normal file
@ -0,0 +1,4 @@
|
||||
ext-mbstring:
|
||||
type: php-extension
|
||||
php-extension:
|
||||
arg-type: custom
|
||||
15
config/pkg/lib/onig.yml
Normal file
15
config/pkg/lib/onig.yml
Normal file
@ -0,0 +1,15 @@
|
||||
onig:
|
||||
type: library
|
||||
artifact:
|
||||
source:
|
||||
type: ghrel
|
||||
repo: kkos/oniguruma
|
||||
match: onig-.+\.tar\.gz
|
||||
metadata:
|
||||
license-files: [COPYING]
|
||||
license: Custom
|
||||
headers:
|
||||
- oniggnu.h
|
||||
- oniguruma.h
|
||||
static-libs@unix:
|
||||
- libonig.a
|
||||
19
src/Package/Extension/mbregex.php
Normal file
19
src/Package/Extension/mbregex.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
|
||||
#[Extension('mbregex')]
|
||||
class mbregex
|
||||
{
|
||||
#[CustomPhpConfigureArg('Linux')]
|
||||
#[CustomPhpConfigureArg('Darwin')]
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
22
src/Package/Extension/mbstring.php
Normal file
22
src/Package/Extension/mbstring.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Package\PackageInstaller;
|
||||
|
||||
#[Extension('mbstring')]
|
||||
class mbstring
|
||||
{
|
||||
#[CustomPhpConfigureArg('Linux')]
|
||||
#[CustomPhpConfigureArg('Darwin')]
|
||||
public function getUnixConfigureArg(bool $shared, PackageInstaller $installer): string
|
||||
{
|
||||
$arg = '--enable-mbstring' . ($shared ? '=shared' : '');
|
||||
$arg .= $installer->isPackageResolved('ext-mbregex') === false ? ' --disable-mbregex' : ' --enable-mbregex';
|
||||
return $arg;
|
||||
}
|
||||
}
|
||||
@ -7,6 +7,7 @@ namespace Package\Library;
|
||||
use StaticPHP\Attribute\Package\BuildFor;
|
||||
use StaticPHP\Attribute\Package\Library;
|
||||
use StaticPHP\Package\LibraryPackage;
|
||||
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
||||
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
|
||||
@ -21,4 +22,12 @@ class onig
|
||||
->build();
|
||||
FileSystem::copy("{$package->getLibDir()}\\onig.lib", "{$package->getLibDir()}\\onig_a.lib");
|
||||
}
|
||||
|
||||
#[BuildFor('Linux')]
|
||||
#[BuildFor('Darwin')]
|
||||
public function buildUnix(LibraryPackage $lib): void
|
||||
{
|
||||
UnixAutoconfExecutor::create($lib)->configure()->make();
|
||||
$lib->patchPkgconfPrefix(['oniguruma.pc']);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user