mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-19 05:14:52 +08:00
Add ext-swow
This commit is contained in:
parent
a24fae7a55
commit
1ee8bc7d34
18
config/pkg/ext/ext-swow.yml
Normal file
18
config/pkg/ext/ext-swow.yml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
ext-swow:
|
||||||
|
type: php-extension
|
||||||
|
artifact:
|
||||||
|
source:
|
||||||
|
extract: php-src/ext/swow-src
|
||||||
|
type: ghtar
|
||||||
|
repo: swow/swow
|
||||||
|
prefer-stable: true
|
||||||
|
metadata:
|
||||||
|
license: Apache-2.0
|
||||||
|
license-files: [LICENSE]
|
||||||
|
suggests:
|
||||||
|
- openssl
|
||||||
|
- curl
|
||||||
|
- ext-openssl
|
||||||
|
- ext-curl
|
||||||
|
php-extension:
|
||||||
|
arg-type: custom
|
||||||
44
src/Package/Extension/swow.php
Normal file
44
src/Package/Extension/swow.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Package\Extension;
|
||||||
|
|
||||||
|
use Package\Target\php;
|
||||||
|
use StaticPHP\Attribute\Package\BeforeStage;
|
||||||
|
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
|
||||||
|
use StaticPHP\Attribute\Package\Extension;
|
||||||
|
use StaticPHP\Package\PackageInstaller;
|
||||||
|
use StaticPHP\Package\PhpExtensionPackage;
|
||||||
|
use StaticPHP\Util\FileSystem;
|
||||||
|
|
||||||
|
#[Extension('swow')]
|
||||||
|
class swow extends PhpExtensionPackage
|
||||||
|
{
|
||||||
|
#[CustomPhpConfigureArg('Darwin')]
|
||||||
|
#[CustomPhpConfigureArg('Linux')]
|
||||||
|
public function configureArg(PackageInstaller $installer): string
|
||||||
|
{
|
||||||
|
$arg = '--enable-swow';
|
||||||
|
$arg .= $installer->getLibraryPackage('openssl') ? ' --enable-swow-ssl' : ' --disable-swow-ssl';
|
||||||
|
$arg .= $installer->getLibraryPackage('curl') ? ' --enable-swow-curl' : ' --disable-swow-curl';
|
||||||
|
return $arg;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-swow')]
|
||||||
|
#[BeforeStage('php', [php::class, 'buildconfForWindows'], 'ext-swow')]
|
||||||
|
public function patchBeforeBuildconf(PackageInstaller $installer): bool
|
||||||
|
{
|
||||||
|
$php_src = $installer->getTargetPackage('php')->getSourceDir();
|
||||||
|
if (php::getPHPVersionID() >= 80000 && !is_link("{$php_src}/ext/swow")) {
|
||||||
|
if (PHP_OS_FAMILY === 'Windows') {
|
||||||
|
f_passthru("cd {$php_src}/ext && mklink /D swow swow-src\\ext");
|
||||||
|
} else {
|
||||||
|
f_passthru("cd {$php_src}/ext && ln -s swow-src/ext swow");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// replace AC_DEFUN([SWOW_PKG_CHECK_MODULES] to AC_DEFUN([SWOW_PKG_CHECK_MODULES_STATIC]
|
||||||
|
FileSystem::replaceFileStr($this->getSourceDir() . '/ext/config.m4', 'AC_DEFUN([SWOW_PKG_CHECK_MODULES]', 'AC_DEFUN([SWOW_PKG_CHECK_MODULES_STATIC]');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user