mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
Add ext-event
This commit is contained in:
parent
8cc5877f3c
commit
a678d908d5
19
config/pkg/ext/ext-event.yml
Normal file
19
config/pkg/ext/ext-event.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
ext-event:
|
||||||
|
type: php-extension
|
||||||
|
artifact:
|
||||||
|
source:
|
||||||
|
type: url
|
||||||
|
url: 'https://bitbucket.org/osmanov/pecl-event/get/3.1.4.tar.gz'
|
||||||
|
extract: php-src/ext/event
|
||||||
|
metadata:
|
||||||
|
license-files: [LICENSE]
|
||||||
|
license: PHP-3.01
|
||||||
|
depends:
|
||||||
|
- libevent
|
||||||
|
- ext-openssl
|
||||||
|
suggests:
|
||||||
|
- ext-sockets
|
||||||
|
php-extension:
|
||||||
|
support:
|
||||||
|
Windows: wip
|
||||||
|
arg-type: custom
|
||||||
46
src/Package/Extension/event.php
Normal file
46
src/Package/Extension/event.php
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?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\Attribute\PatchDescription;
|
||||||
|
use StaticPHP\Package\PackageInstaller;
|
||||||
|
use StaticPHP\Package\PhpExtensionPackage;
|
||||||
|
use StaticPHP\Runtime\SystemTarget;
|
||||||
|
use StaticPHP\Util\FileSystem;
|
||||||
|
|
||||||
|
#[Extension('event')]
|
||||||
|
class event extends PhpExtensionPackage
|
||||||
|
{
|
||||||
|
#[CustomPhpConfigureArg('Darwin')]
|
||||||
|
#[CustomPhpConfigureArg('Linux')]
|
||||||
|
public function getUnixConfigureArg(PackageInstaller $installer): string
|
||||||
|
{
|
||||||
|
$arg = "--with-event-core --with-event-extra --with-event-libevent-dir={$this->getBuilder()->getBuildRootPath()}";
|
||||||
|
if ($installer->getLibraryPackage('openssl')) {
|
||||||
|
$arg .= " --with-event-openssl={$this->getBuilder()->getBuildRootPath()}";
|
||||||
|
}
|
||||||
|
if ($installer->getPhpExtensionPackage('ext-sockets')) {
|
||||||
|
$arg .= ' --enable-event-sockets';
|
||||||
|
} else {
|
||||||
|
$arg .= ' --disable-event-sockets';
|
||||||
|
}
|
||||||
|
return $arg;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[BeforeStage('php', [php::class, 'makeForUnix'], 'ext-event')]
|
||||||
|
#[PatchDescription('Prevent event extension compile error on macOS')]
|
||||||
|
public function patchBeforeMake(PackageInstaller $installer): void
|
||||||
|
{
|
||||||
|
// Prevent event extension compile error on macOS
|
||||||
|
if (SystemTarget::getTargetOS() === 'Darwin') {
|
||||||
|
$php_src = $installer->getTargetPackage('php')->getSourceDir();
|
||||||
|
FileSystem::replaceFileRegex("{$php_src}/main/php_config.h", '/^#define HAVE_OPENPTY 1$/m', '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user