mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 21:04:52 +08:00
add event support
This commit is contained in:
parent
893fa5bfd6
commit
cac3ffc7d7
@ -35,6 +35,20 @@
|
|||||||
"zlib"
|
"zlib"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"event": {
|
||||||
|
"type": "external",
|
||||||
|
"source": "ext-event",
|
||||||
|
"arg-type": "custom",
|
||||||
|
"lib-depends": [
|
||||||
|
"libevent"
|
||||||
|
],
|
||||||
|
"ext-depends": [
|
||||||
|
"openssl"
|
||||||
|
],
|
||||||
|
"ext-suggests": [
|
||||||
|
"sockets"
|
||||||
|
]
|
||||||
|
},
|
||||||
"exif": {
|
"exif": {
|
||||||
"type": "builtin"
|
"type": "builtin"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -102,6 +102,18 @@
|
|||||||
"libavif.a"
|
"libavif.a"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"libevent": {
|
||||||
|
"source": "libevent",
|
||||||
|
"static-libs-unix": [
|
||||||
|
"libevent.a",
|
||||||
|
"libevent_core.a",
|
||||||
|
"libevent_extra.a",
|
||||||
|
"libevent_openssl.a"
|
||||||
|
],
|
||||||
|
"lib-depends": [
|
||||||
|
"openssl"
|
||||||
|
]
|
||||||
|
},
|
||||||
"libffi": {
|
"libffi": {
|
||||||
"source": "libffi",
|
"source": "libffi",
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
|
|||||||
@ -32,6 +32,15 @@
|
|||||||
"path": "COPYING"
|
"path": "COPYING"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"ext-event": {
|
||||||
|
"type": "url",
|
||||||
|
"url": "https://bitbucket.org/osmanov/pecl-event/get/3.0.8.tar.gz",
|
||||||
|
"path": "php-src/ext/event",
|
||||||
|
"license": {
|
||||||
|
"type": "file",
|
||||||
|
"path": "LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
"ext-zstd": {
|
"ext-zstd": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"path": "php-src/ext/zstd",
|
"path": "php-src/ext/zstd",
|
||||||
@ -78,6 +87,15 @@
|
|||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"libevent": {
|
||||||
|
"type": "ghrel",
|
||||||
|
"repo": "libevent/libevent",
|
||||||
|
"match": "libevent.+\\.tar\\.gz",
|
||||||
|
"license": {
|
||||||
|
"type": "file",
|
||||||
|
"path": "LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
"libffi": {
|
"libffi": {
|
||||||
"type": "ghrel",
|
"type": "ghrel",
|
||||||
"repo": "libffi/libffi",
|
"repo": "libffi/libffi",
|
||||||
@ -139,14 +157,6 @@
|
|||||||
"path": "COPYING"
|
"path": "COPYING"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"libuv": {
|
|
||||||
"type": "ghtar",
|
|
||||||
"repo": "libuv/libuv",
|
|
||||||
"license": {
|
|
||||||
"type": "file",
|
|
||||||
"path": "LICENSE"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"libwebp": {
|
"libwebp": {
|
||||||
"type": "ghtagtar",
|
"type": "ghtagtar",
|
||||||
"repo": "webmproject/libwebp",
|
"repo": "webmproject/libwebp",
|
||||||
|
|||||||
26
src/SPC/builder/extension/event.php
Normal file
26
src/SPC/builder/extension/event.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\extension;
|
||||||
|
|
||||||
|
use SPC\builder\Extension;
|
||||||
|
use SPC\util\CustomExt;
|
||||||
|
|
||||||
|
#[CustomExt('event')]
|
||||||
|
class event extends Extension
|
||||||
|
{
|
||||||
|
public function getUnixConfigureArg(): string
|
||||||
|
{
|
||||||
|
$arg = '--with-event-core --with-event-extra --with-event-libevent-dir=' . BUILD_ROOT_PATH;
|
||||||
|
if ($this->builder->getLib('openssl')) {
|
||||||
|
$arg .= ' --with-event-openssl=' . BUILD_ROOT_PATH;
|
||||||
|
}
|
||||||
|
if ($this->builder->getExt('sockets')) {
|
||||||
|
$arg .= ' --enable-event-sockets';
|
||||||
|
} else {
|
||||||
|
$arg .= ' --disable-event-sockets';
|
||||||
|
}
|
||||||
|
return $arg;
|
||||||
|
}
|
||||||
|
}
|
||||||
12
src/SPC/builder/linux/library/libevent.php
Normal file
12
src/SPC/builder/linux/library/libevent.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\linux\library;
|
||||||
|
|
||||||
|
class libevent extends LinuxLibraryBase
|
||||||
|
{
|
||||||
|
use \SPC\builder\unix\library\libevent;
|
||||||
|
|
||||||
|
public const NAME = 'libevent';
|
||||||
|
}
|
||||||
12
src/SPC/builder/macos/library/libevent.php
Normal file
12
src/SPC/builder/macos/library/libevent.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\macos\library;
|
||||||
|
|
||||||
|
class libevent extends MacOSLibraryBase
|
||||||
|
{
|
||||||
|
use \SPC\builder\unix\library\libevent;
|
||||||
|
|
||||||
|
public const NAME = 'libevent';
|
||||||
|
}
|
||||||
33
src/SPC/builder/unix/library/libevent.php
Normal file
33
src/SPC/builder/unix/library/libevent.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\unix\library;
|
||||||
|
|
||||||
|
use SPC\store\FileSystem;
|
||||||
|
|
||||||
|
trait libevent
|
||||||
|
{
|
||||||
|
protected function build()
|
||||||
|
{
|
||||||
|
// CMake needs a clean build directory
|
||||||
|
FileSystem::resetDir($this->source_dir . '/build');
|
||||||
|
// Start build
|
||||||
|
shell()->cd($this->source_dir . '/build')
|
||||||
|
->exec(
|
||||||
|
"{$this->builder->configure_env} cmake " .
|
||||||
|
'-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' .
|
||||||
|
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
||||||
|
'-DCMAKE_BUILD_TYPE=Release ' .
|
||||||
|
'-DEVENT__LIBRARY_TYPE=STATIC ' .
|
||||||
|
'-DEVENT__DISABLE_BENCHMARK=ON ' .
|
||||||
|
'-DEVENT__DISABLE_THREAD_SUPPORT=ON ' .
|
||||||
|
'-DEVENT__DISABLE_TESTS=ON ' .
|
||||||
|
'-DEVENT__DISABLE_SAMPLES=ON ' .
|
||||||
|
'..'
|
||||||
|
)
|
||||||
|
->exec("cmake --build . -j {$this->builder->concurrency}")
|
||||||
|
->exec('make install');
|
||||||
|
// patch pkgconfig
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -79,6 +79,9 @@ class SourcePatcher
|
|||||||
if ($pdo_sqlite = $builder->getExt('pdo_sqlite')) {
|
if ($pdo_sqlite = $builder->getExt('pdo_sqlite')) {
|
||||||
$patch[] = ['pdo_sqlite linking', '/sqlite3_column_table_name=yes/', 'sqlite3_column_table_name=no'];
|
$patch[] = ['pdo_sqlite linking', '/sqlite3_column_table_name=yes/', 'sqlite3_column_table_name=no'];
|
||||||
}
|
}
|
||||||
|
if ($event = $builder->getExt('event')) {
|
||||||
|
$patch[] = ['event check', '/-levent_openssl/', $event->getLibFilesString()];
|
||||||
|
}
|
||||||
$patch[] = ['disable capstone', '/have_capstone="yes"/', 'have_capstone="no"'];
|
$patch[] = ['disable capstone', '/have_capstone="yes"/', 'have_capstone="no"'];
|
||||||
foreach ($patch as $item) {
|
foreach ($patch as $item) {
|
||||||
logger()->info('Patching configure: ' . $item[0]);
|
logger()->info('Patching configure: ' . $item[0]);
|
||||||
@ -208,5 +211,6 @@ class SourcePatcher
|
|||||||
FileSystem::replaceFile(SOURCE_PATH . '/php-src/main/php_config.h', REPLACE_FILE_PREG, '/^#define HAVE_STRLCPY 1$/m', '');
|
FileSystem::replaceFile(SOURCE_PATH . '/php-src/main/php_config.h', REPLACE_FILE_PREG, '/^#define HAVE_STRLCPY 1$/m', '');
|
||||||
FileSystem::replaceFile(SOURCE_PATH . '/php-src/main/php_config.h', REPLACE_FILE_PREG, '/^#define HAVE_STRLCAT 1$/m', '');
|
FileSystem::replaceFile(SOURCE_PATH . '/php-src/main/php_config.h', REPLACE_FILE_PREG, '/^#define HAVE_STRLCAT 1$/m', '');
|
||||||
}
|
}
|
||||||
|
FileSystem::replaceFile(SOURCE_PATH . '/php-src/main/php_config.h', REPLACE_FILE_PREG, '/^#define HAVE_OPENPTY 1$/m', '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user