mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
Feature perfect swoole extension config (#297)
* improve swoole static build config * improve swoole static build config * improve swoole static build config * improve swoole static build config * improve swoole static build config * add cares config * update swoole depend config * update swoole depend config * update cares build config * update workflow tests.yaml config * fix setup-runtime * test with clang build * test with clang build * update cares build config * test * test * test * test * test * test * test * test * test * test * test * test * test * test * update cares license * test build * test build * test build * test build * test add enable libpq * test add enable libpq * test add enable libpq * test add enable libpq * test add enable libpq * test add enable libpq * test add enable libpq * test * test * test * test * test * test * test * test * test * test * test * test * test * test * test * test * test * test * test * test * test * update * update * update * update * update * update * update * update * update * compatible old * fix code format * fix code format * add swoole test case * add swoole test case * add phpstan ignore error * add phpstan ignore error * add phpstan ignore error * add phpstan ignore error * add phpstan ignore error * update phpstan.neon * update swoole extension test case * update swoole test case * adjust config order and depends * revert LinuxBuilder * remove swoole.phpt * re-adjust swoole args * update test-extensions and some PHPDoc * revert: debian and alpine clang doctor install * revert: MacOSBuilder * fix: extract hook for archive not working * revert: build tests * use addon mode to swoole database hook * add hook tests * test minimal * test minimal * sort config --------- Co-authored-by: crazywhalecc <jesse2061@outlook.com>
This commit is contained in:
parent
5c7552f826
commit
31c71f180b
@ -35,7 +35,6 @@ while [ $# -gt 0 ]; do
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
--mirror)
|
--mirror)
|
||||||
mirror="$2"
|
mirror="$2"
|
||||||
shift
|
|
||||||
;;
|
;;
|
||||||
--*)
|
--*)
|
||||||
echo "Illegal option $1"
|
echo "Illegal option $1"
|
||||||
@ -47,7 +46,7 @@ done
|
|||||||
case "$mirror" in
|
case "$mirror" in
|
||||||
china)
|
china)
|
||||||
__PHP_RUNTIME_URL__="https://dl.static-php.dev/static-php-cli/bulk/php-8.2.13-cli-${__OS_FIXED__}-${__ARCH__}.tar.gz"
|
__PHP_RUNTIME_URL__="https://dl.static-php.dev/static-php-cli/bulk/php-8.2.13-cli-${__OS_FIXED__}-${__ARCH__}.tar.gz"
|
||||||
__COMPOSER_URL__="https://mirrors.aliyun.com/composer/composer.phar"
|
__COMPOSER_URL__="https://mirrors.tencent.com/composer/composer.phar"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|||||||
@ -424,17 +424,50 @@
|
|||||||
"source": "swoole",
|
"source": "swoole",
|
||||||
"arg-type": "custom",
|
"arg-type": "custom",
|
||||||
"cpp-extension": true,
|
"cpp-extension": true,
|
||||||
|
"unix-only": true,
|
||||||
"lib-depends": [
|
"lib-depends": [
|
||||||
"openssl"
|
"libcares",
|
||||||
|
"brotli",
|
||||||
|
"nghttp2",
|
||||||
|
"zlib"
|
||||||
],
|
],
|
||||||
"ext-depends": [
|
"ext-depends": [
|
||||||
"openssl"
|
"openssl",
|
||||||
|
"curl"
|
||||||
],
|
],
|
||||||
"ext-suggests": [
|
"ext-suggests": [
|
||||||
"curl",
|
"swoole-hook-pgsql",
|
||||||
"pgsql"
|
"swoole-hook-mysql",
|
||||||
|
"swoole-hook-sqlite"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"swoole-hook-mysql": {
|
||||||
|
"type": "addon",
|
||||||
|
"arg-type": "custom",
|
||||||
|
"ext-depends": [
|
||||||
|
"mysqlnd",
|
||||||
|
"pdo",
|
||||||
|
"pdo_mysql"
|
||||||
],
|
],
|
||||||
"unix-only": true
|
"ext-suggests": [
|
||||||
|
"mysqli"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"swoole-hook-pgsql": {
|
||||||
|
"type": "addon",
|
||||||
|
"arg-type": "custom",
|
||||||
|
"ext-depends": [
|
||||||
|
"pgsql",
|
||||||
|
"pdo"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"swoole-hook-sqlite": {
|
||||||
|
"type": "addon",
|
||||||
|
"arg-type": "custom",
|
||||||
|
"ext-depends": [
|
||||||
|
"sqlite3",
|
||||||
|
"pdo"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"swow": {
|
"swow": {
|
||||||
"type": "external",
|
"type": "external",
|
||||||
|
|||||||
@ -175,6 +175,18 @@
|
|||||||
"libavif.a"
|
"libavif.a"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"libcares": {
|
||||||
|
"source": "libcares",
|
||||||
|
"static-libs-unix": [
|
||||||
|
"libcares.a"
|
||||||
|
],
|
||||||
|
"headers-unix": [
|
||||||
|
"ares.h",
|
||||||
|
"ares_dns.h",
|
||||||
|
"ares_nameser.h",
|
||||||
|
"ares_rules.h"
|
||||||
|
]
|
||||||
|
},
|
||||||
"libevent": {
|
"libevent": {
|
||||||
"source": "libevent",
|
"source": "libevent",
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
|
|||||||
@ -209,6 +209,15 @@
|
|||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"libcares": {
|
||||||
|
"type": "filelist",
|
||||||
|
"url": "https://c-ares.org/download/",
|
||||||
|
"regex": "/href=\"\\/download\\/(?<file>c-ares-(?<version>[^\"]+)\\.tar\\.gz)\"/",
|
||||||
|
"license": {
|
||||||
|
"type": "file",
|
||||||
|
"path": "LICENSE.md"
|
||||||
|
}
|
||||||
|
},
|
||||||
"libevent": {
|
"libevent": {
|
||||||
"type": "ghrel",
|
"type": "ghrel",
|
||||||
"repo": "libevent/libevent",
|
"repo": "libevent/libevent",
|
||||||
|
|||||||
@ -8,5 +8,10 @@ parameters:
|
|||||||
- '#Unsafe usage of new static#'
|
- '#Unsafe usage of new static#'
|
||||||
- '#class Fiber#'
|
- '#class Fiber#'
|
||||||
- '#Attribute class JetBrains\\PhpStorm\\ArrayShape does not exist#'
|
- '#Attribute class JetBrains\\PhpStorm\\ArrayShape does not exist#'
|
||||||
|
- '#Function Swoole\\Coroutine\\run not found.#'
|
||||||
dynamicConstantNames:
|
dynamicConstantNames:
|
||||||
- PHP_OS_FAMILY
|
- PHP_OS_FAMILY
|
||||||
|
excludePaths:
|
||||||
|
analyseAndScan:
|
||||||
|
- ./src/globals/tests/swoole.php
|
||||||
|
- ./src/globals/tests/swoole.phpt
|
||||||
@ -227,7 +227,7 @@ abstract class BuilderBase
|
|||||||
foreach ($this->exts as $ext) {
|
foreach ($this->exts as $ext) {
|
||||||
$ret[] = trim($ext->getConfigureArg());
|
$ret[] = trim($ext->getConfigureArg());
|
||||||
}
|
}
|
||||||
logger()->info('Using configure: ' . implode(' ', $ret));
|
logger()->debug('Using configure: ' . implode(' ', $ret));
|
||||||
return implode(' ', $ret);
|
return implode(' ', $ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,13 +12,31 @@ class swoole extends Extension
|
|||||||
{
|
{
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(): string
|
||||||
{
|
{
|
||||||
|
// enable swoole
|
||||||
$arg = '--enable-swoole';
|
$arg = '--enable-swoole';
|
||||||
// pgsql hook is buggy for static php
|
|
||||||
$arg .= ' --disable-swoole-pgsql';
|
// commonly-used feature: coroutine-time, thread-context
|
||||||
$arg .= $this->builder->getLib('openssl') ? ' --enable-openssl' : ' --disable-openssl --without-openssl';
|
$arg .= ' --enable-swoole-coro-time --enable-thread-context';
|
||||||
$arg .= $this->builder->getLib('brotli') ? (' --enable-brotli --with-brotli-dir=' . BUILD_ROOT_PATH) : ' --disable-brotli';
|
|
||||||
// swoole curl hook is buggy for php 8.0
|
// required feature: curl, openssl (but curl hook is buggy for php 8.0)
|
||||||
$arg .= $this->builder->getExt('curl') && $this->builder->getPHPVersionID() >= 80100 ? ' --enable-swoole-curl' : ' --disable-swoole-curl';
|
$arg .= $this->builder->getPHPVersionID() >= 80100 ? ' --enable-swoole-curl' : ' --disable-swoole-curl';
|
||||||
|
$arg .= ' --enable-openssl';
|
||||||
|
|
||||||
|
// additional feature: c-ares, brotli, nghttp2 (can be disabled, but we enable it by default in config to support full network feature)
|
||||||
|
$arg .= $this->builder->getLib('libcares') ? ' --enable-cares' : '';
|
||||||
|
$arg .= $this->builder->getLib('brotli') ? (' --with-brotli-dir=' . BUILD_ROOT_PATH) : '';
|
||||||
|
$arg .= $this->builder->getLib('nghttp2') ? (' --with-nghttp2-dir=' . BUILD_ROOT_PATH) : '';
|
||||||
|
|
||||||
|
// additional feature: swoole-pgsql, it should depend on lib [postgresql], but it will lack of CFLAGS etc.
|
||||||
|
// so this is a tricky way (enable ext [pgsql,pdo] to add postgresql hook and pdo_pgsql support)
|
||||||
|
$arg .= $this->builder->getExt('swoole-hook-pgsql') ? '' : ' --disable-swoole-pgsql';
|
||||||
|
|
||||||
|
// enable this feature , need remove pdo_sqlite
|
||||||
|
// more info : https://wenda.swoole.com/detail/109023
|
||||||
|
$arg .= $this->builder->getExt('swoole-hook-sqlite') ? '' : ' --disable-swoole-sqlite';
|
||||||
|
|
||||||
|
// enable this feature , need stop pdo_*
|
||||||
|
// $arg .= $this->builder->getLib('unixodbc') ? ' --with-swoole-odbc=unixODBC,' : ' ';
|
||||||
return $arg;
|
return $arg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
36
src/SPC/builder/extension/swoole_hook_mysql.php
Normal file
36
src/SPC/builder/extension/swoole_hook_mysql.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\extension;
|
||||||
|
|
||||||
|
use SPC\builder\Extension;
|
||||||
|
use SPC\exception\RuntimeException;
|
||||||
|
use SPC\util\CustomExt;
|
||||||
|
|
||||||
|
#[CustomExt('swoole-hook-mysql')]
|
||||||
|
class swoole_hook_mysql extends Extension
|
||||||
|
{
|
||||||
|
public function getUnixConfigureArg(): string
|
||||||
|
{
|
||||||
|
// pdo_mysql doesn't need to be disabled
|
||||||
|
// enable swoole-hook-mysql will enable mysqli, pdo, pdo_mysql, we don't need to add any additional options
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function runCliCheck(): void
|
||||||
|
{
|
||||||
|
// skip if not enable swoole
|
||||||
|
if ($this->builder->getExt('swoole') === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
[$ret, $out] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php --ri "swoole"', false);
|
||||||
|
$out = implode('', $out);
|
||||||
|
if ($ret !== 0) {
|
||||||
|
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret);
|
||||||
|
}
|
||||||
|
if (!str_contains($out, 'mysqlnd')) {
|
||||||
|
throw new RuntimeException('swoole mysql hook is not enabled correctly.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
src/SPC/builder/extension/swoole_hook_pgsql.php
Normal file
40
src/SPC/builder/extension/swoole_hook_pgsql.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\extension;
|
||||||
|
|
||||||
|
use SPC\builder\Extension;
|
||||||
|
use SPC\exception\RuntimeException;
|
||||||
|
use SPC\exception\WrongUsageException;
|
||||||
|
use SPC\util\CustomExt;
|
||||||
|
|
||||||
|
#[CustomExt('swoole-hook-pgsql')]
|
||||||
|
class swoole_hook_pgsql extends Extension
|
||||||
|
{
|
||||||
|
public function getUnixConfigureArg(): string
|
||||||
|
{
|
||||||
|
// pdo_pgsql need to be disabled
|
||||||
|
if ($this->builder->getExt('pdo_pgsql') !== null) {
|
||||||
|
throw new WrongUsageException('swoole-hook-pgsql provides pdo_pgsql, if you enable pgsql hook for swoole, you must remove pdo_pgsql extension.');
|
||||||
|
}
|
||||||
|
// enable swoole pgsql hook
|
||||||
|
return '--enable-swoole-pgsql';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function runCliCheck(): void
|
||||||
|
{
|
||||||
|
// skip if not enable swoole
|
||||||
|
if ($this->builder->getExt('swoole') === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
[$ret, $out] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php --ri "swoole"', false);
|
||||||
|
$out = implode('', $out);
|
||||||
|
if ($ret !== 0) {
|
||||||
|
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret);
|
||||||
|
}
|
||||||
|
if (!str_contains($out, 'coroutine_pgsql')) {
|
||||||
|
throw new RuntimeException('swoole pgsql hook is not enabled correctly.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
src/SPC/builder/extension/swoole_hook_sqlite.php
Normal file
40
src/SPC/builder/extension/swoole_hook_sqlite.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\extension;
|
||||||
|
|
||||||
|
use SPC\builder\Extension;
|
||||||
|
use SPC\exception\RuntimeException;
|
||||||
|
use SPC\exception\WrongUsageException;
|
||||||
|
use SPC\util\CustomExt;
|
||||||
|
|
||||||
|
#[CustomExt('swoole-hook-sqlite')]
|
||||||
|
class swoole_hook_sqlite extends Extension
|
||||||
|
{
|
||||||
|
public function getUnixConfigureArg(): string
|
||||||
|
{
|
||||||
|
// pdo_pgsql need to be disabled
|
||||||
|
if ($this->builder->getExt('pdo_sqlite') !== null) {
|
||||||
|
throw new WrongUsageException('swoole-hook-sqlite provides pdo_sqlite, if you enable sqlite hook for swoole, you must remove pdo_sqlite extension.');
|
||||||
|
}
|
||||||
|
// enable swoole pgsql hook
|
||||||
|
return '--enable-swoole-sqlite';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function runCliCheck(): void
|
||||||
|
{
|
||||||
|
// skip if not enable swoole
|
||||||
|
if ($this->builder->getExt('swoole') === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
[$ret, $out] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php --ri "swoole"', false);
|
||||||
|
$out = implode('', $out);
|
||||||
|
if ($ret !== 0) {
|
||||||
|
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret);
|
||||||
|
}
|
||||||
|
if (!str_contains($out, 'coroutine_sqlite')) {
|
||||||
|
throw new RuntimeException('swoole sqlite hook is not enabled correctly.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -138,16 +138,15 @@ class LinuxBuilder extends BuilderBase
|
|||||||
// add libstdc++, some extensions or libraries need it
|
// add libstdc++, some extensions or libraries need it
|
||||||
$extra_libs .= (empty($extra_libs) ? '' : ' ') . ($this->hasCpp() ? '-lstdc++ ' : '');
|
$extra_libs .= (empty($extra_libs) ? '' : ' ') . ($this->hasCpp() ? '-lstdc++ ' : '');
|
||||||
$this->setOption('extra-libs', $extra_libs);
|
$this->setOption('extra-libs', $extra_libs);
|
||||||
|
|
||||||
$cflags = $this->arch_c_flags;
|
$cflags = $this->arch_c_flags;
|
||||||
|
|
||||||
// prepare build php envs
|
// prepare build php envs
|
||||||
$envs_build_php = SystemUtil::makeEnvVarString([
|
$envs_build_php = SystemUtil::makeEnvVarString([
|
||||||
'CFLAGS' => $cflags,
|
'CFLAGS' => $cflags,
|
||||||
'CPPFLAGS' => '-I' . BUILD_INCLUDE_PATH,
|
'CPPFLAGS' => '-I' . BUILD_INCLUDE_PATH,
|
||||||
|
'LDFLAGS' => '-L' . BUILD_LIB_PATH,
|
||||||
'LIBS' => '-ldl -lpthread',
|
'LIBS' => '-ldl -lpthread',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
SourcePatcher::patchBeforeBuildconf($this);
|
SourcePatcher::patchBeforeBuildconf($this);
|
||||||
|
|
||||||
shell()->cd(SOURCE_PATH . '/php-src')->exec('./buildconf --force');
|
shell()->cd(SOURCE_PATH . '/php-src')->exec('./buildconf --force');
|
||||||
@ -190,8 +189,8 @@ class LinuxBuilder extends BuilderBase
|
|||||||
$json_74 .
|
$json_74 .
|
||||||
$zts .
|
$zts .
|
||||||
$maxExecutionTimers .
|
$maxExecutionTimers .
|
||||||
$this->makeExtensionArgs() . ' ' .
|
$this->makeExtensionArgs() .
|
||||||
$envs_build_php
|
' ' . $envs_build_php . ' '
|
||||||
);
|
);
|
||||||
|
|
||||||
SourcePatcher::patchBeforeMake($this);
|
SourcePatcher::patchBeforeMake($this);
|
||||||
@ -323,10 +322,11 @@ class LinuxBuilder extends BuilderBase
|
|||||||
$cflags = isset($input['EXTRA_CFLAGS']) && $input['EXTRA_CFLAGS'] ? " {$input['EXTRA_CFLAGS']}" : '';
|
$cflags = isset($input['EXTRA_CFLAGS']) && $input['EXTRA_CFLAGS'] ? " {$input['EXTRA_CFLAGS']}" : '';
|
||||||
$libs = isset($input['EXTRA_LIBS']) && $input['EXTRA_LIBS'] ? " {$input['EXTRA_LIBS']}" : '';
|
$libs = isset($input['EXTRA_LIBS']) && $input['EXTRA_LIBS'] ? " {$input['EXTRA_LIBS']}" : '';
|
||||||
$ldflags = isset($input['EXTRA_LDFLAGS_PROGRAM']) && $input['EXTRA_LDFLAGS_PROGRAM'] ? " {$input['EXTRA_LDFLAGS_PROGRAM']}" : '';
|
$ldflags = isset($input['EXTRA_LDFLAGS_PROGRAM']) && $input['EXTRA_LDFLAGS_PROGRAM'] ? " {$input['EXTRA_LDFLAGS_PROGRAM']}" : '';
|
||||||
|
$tune_c_flags = implode(' ', array_map(fn ($x) => "-Xcompiler {$x}", $this->tune_c_flags));
|
||||||
return [
|
return [
|
||||||
'EXTRA_CFLAGS' => "{$optimization} -fno-ident -fPIE " . implode(' ', array_map(fn ($x) => "-Xcompiler {$x}", $this->tune_c_flags)) . $cflags,
|
'EXTRA_CFLAGS' => "{$optimization} -fno-ident -fPIE {$tune_c_flags}{$cflags}",
|
||||||
'EXTRA_LIBS' => $this->getOption('extra-libs', '') . $libs,
|
'EXTRA_LIBS' => "{$this->getOption('extra-libs', '')} {$libs}",
|
||||||
'EXTRA_LDFLAGS_PROGRAM' => "{$use_lld} -all-static" . $ldflags,
|
'EXTRA_LDFLAGS_PROGRAM' => "{$use_lld} -all-static{$ldflags}",
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
12
src/SPC/builder/linux/library/libcares.php
Normal file
12
src/SPC/builder/linux/library/libcares.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\linux\library;
|
||||||
|
|
||||||
|
class libcares extends LinuxLibraryBase
|
||||||
|
{
|
||||||
|
use \SPC\builder\unix\library\libcares;
|
||||||
|
|
||||||
|
public const NAME = 'libcares';
|
||||||
|
}
|
||||||
@ -1,72 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* Copyright (c) 2022 Yun Dou <dixyes@gmail.com>
|
|
||||||
*
|
|
||||||
* lwmbs is licensed under Mulan PSL v2. You can use this
|
|
||||||
* software according to the terms and conditions of the
|
|
||||||
* Mulan PSL v2. You may obtain a copy of Mulan PSL v2 at:
|
|
||||||
*
|
|
||||||
* http://license.coscl.org.cn/MulanPSL2
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
|
||||||
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
||||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
|
||||||
* See the Mulan PSL v2 for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace SPC\builder\linux\library;
|
namespace SPC\builder\linux\library;
|
||||||
|
|
||||||
use SPC\exception\FileSystemException;
|
|
||||||
use SPC\exception\RuntimeException;
|
|
||||||
use SPC\exception\WrongUsageException;
|
|
||||||
|
|
||||||
class nghttp2 extends LinuxLibraryBase
|
class nghttp2 extends LinuxLibraryBase
|
||||||
{
|
{
|
||||||
|
use \SPC\builder\unix\library\nghttp2;
|
||||||
|
|
||||||
public const NAME = 'nghttp2';
|
public const NAME = 'nghttp2';
|
||||||
|
|
||||||
/**
|
|
||||||
* @throws FileSystemException
|
|
||||||
* @throws RuntimeException
|
|
||||||
* @throws WrongUsageException
|
|
||||||
*/
|
|
||||||
public function build(): void
|
|
||||||
{
|
|
||||||
$args = $this->builder->makeAutoconfArgs(static::NAME, [
|
|
||||||
'zlib' => null,
|
|
||||||
'openssl' => null,
|
|
||||||
'libxml2' => null,
|
|
||||||
'libev' => null,
|
|
||||||
'libcares' => null,
|
|
||||||
'libngtcp2' => null,
|
|
||||||
'libnghttp3' => null,
|
|
||||||
'libbpf' => null,
|
|
||||||
'libevent-openssl' => null,
|
|
||||||
'jansson' => null,
|
|
||||||
'jemalloc' => null,
|
|
||||||
'systemd' => null,
|
|
||||||
'cunit' => null,
|
|
||||||
]);
|
|
||||||
|
|
||||||
[,,$destdir] = SEPARATED_PATH;
|
|
||||||
|
|
||||||
shell()->cd($this->source_dir)
|
|
||||||
->exec(
|
|
||||||
'./configure ' .
|
|
||||||
'--enable-static ' .
|
|
||||||
'--disable-shared ' .
|
|
||||||
"--host={$this->builder->getOption('gnu-arch')}-unknown-linux " .
|
|
||||||
'--enable-lib-only ' .
|
|
||||||
'--with-boost=no ' .
|
|
||||||
$args . ' ' .
|
|
||||||
'--prefix='
|
|
||||||
)
|
|
||||||
->exec('make clean')
|
|
||||||
->exec("make -j{$this->builder->concurrency}")
|
|
||||||
->exec("make install DESTDIR={$destdir}");
|
|
||||||
$this->patchPkgconfPrefix(['libnghttp2.pc']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -155,6 +155,21 @@ class MacOSBuilder extends BuilderBase
|
|||||||
$enableMicro = ($build_target & BUILD_TARGET_MICRO) === BUILD_TARGET_MICRO;
|
$enableMicro = ($build_target & BUILD_TARGET_MICRO) === BUILD_TARGET_MICRO;
|
||||||
$enableEmbed = ($build_target & BUILD_TARGET_EMBED) === BUILD_TARGET_EMBED;
|
$enableEmbed = ($build_target & BUILD_TARGET_EMBED) === BUILD_TARGET_EMBED;
|
||||||
|
|
||||||
|
// prepare build php envs
|
||||||
|
$envs_build_php = SystemUtil::makeEnvVarString([
|
||||||
|
'CFLAGS' => " {$this->arch_c_flags} -Werror=unknown-warning-option ",
|
||||||
|
'CPPFLAGS' => '-I' . BUILD_INCLUDE_PATH,
|
||||||
|
'LDFLAGS' => '-L' . BUILD_LIB_PATH,
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($this->getLib('postgresql')) {
|
||||||
|
shell()
|
||||||
|
->cd(SOURCE_PATH . '/php-src')
|
||||||
|
->exec(
|
||||||
|
'sed -i.backup "s/ac_cv_func_explicit_bzero\" = xyes/ac_cv_func_explicit_bzero\" = x_fake_yes/" ./configure'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
shell()->cd(SOURCE_PATH . '/php-src')
|
shell()->cd(SOURCE_PATH . '/php-src')
|
||||||
->exec(
|
->exec(
|
||||||
'./configure ' .
|
'./configure ' .
|
||||||
@ -162,8 +177,6 @@ class MacOSBuilder extends BuilderBase
|
|||||||
'--with-valgrind=no ' . // Not detect memory leak
|
'--with-valgrind=no ' . // Not detect memory leak
|
||||||
'--enable-shared=no ' .
|
'--enable-shared=no ' .
|
||||||
'--enable-static=yes ' .
|
'--enable-static=yes ' .
|
||||||
"CFLAGS='{$this->arch_c_flags} -Werror=unknown-warning-option' " .
|
|
||||||
"CPPFLAGS='-I" . BUILD_INCLUDE_PATH . "' " .
|
|
||||||
'--disable-all ' .
|
'--disable-all ' .
|
||||||
'--disable-cgi ' .
|
'--disable-cgi ' .
|
||||||
'--disable-phpdbg ' .
|
'--disable-phpdbg ' .
|
||||||
@ -173,7 +186,8 @@ class MacOSBuilder extends BuilderBase
|
|||||||
($enableMicro ? '--enable-micro ' : '--disable-micro ') .
|
($enableMicro ? '--enable-micro ' : '--disable-micro ') .
|
||||||
$json_74 .
|
$json_74 .
|
||||||
$zts .
|
$zts .
|
||||||
$this->makeExtensionArgs()
|
$this->makeExtensionArgs() . ' ' .
|
||||||
|
$envs_build_php
|
||||||
);
|
);
|
||||||
|
|
||||||
SourcePatcher::patchBeforeMake($this);
|
SourcePatcher::patchBeforeMake($this);
|
||||||
@ -213,10 +227,7 @@ class MacOSBuilder extends BuilderBase
|
|||||||
*/
|
*/
|
||||||
public function buildCli(): void
|
public function buildCli(): void
|
||||||
{
|
{
|
||||||
$vars = SystemUtil::makeEnvVarString([
|
$vars = SystemUtil::makeEnvVarString($this->getBuildVars());
|
||||||
'EXTRA_CFLAGS' => '-g -Os', // with debug information, but optimize for size
|
|
||||||
'EXTRA_LIBS' => "{$this->getOption('extra-libs')} -lresolv", // link resolv library (macOS needs it)
|
|
||||||
]);
|
|
||||||
|
|
||||||
$shell = shell()->cd(SOURCE_PATH . '/php-src');
|
$shell = shell()->cd(SOURCE_PATH . '/php-src');
|
||||||
$shell->exec("make -j{$this->concurrency} {$vars} cli");
|
$shell->exec("make -j{$this->concurrency} {$vars} cli");
|
||||||
@ -247,9 +258,8 @@ class MacOSBuilder extends BuilderBase
|
|||||||
$vars = [
|
$vars = [
|
||||||
// with debug information, optimize for size, remove identifiers, patch fake cli for micro
|
// with debug information, optimize for size, remove identifiers, patch fake cli for micro
|
||||||
'EXTRA_CFLAGS' => '-g -Os -fno-ident' . $enable_fake_cli,
|
'EXTRA_CFLAGS' => '-g -Os -fno-ident' . $enable_fake_cli,
|
||||||
// link resolv library (macOS needs it)
|
|
||||||
'EXTRA_LIBS' => "{$this->getOption('extra-libs')} -lresolv",
|
|
||||||
];
|
];
|
||||||
|
$vars = $this->getBuildVars($vars);
|
||||||
if (!$this->getOption('no-strip', false)) {
|
if (!$this->getOption('no-strip', false)) {
|
||||||
$vars['STRIP'] = 'dsymutil -f ';
|
$vars['STRIP'] = 'dsymutil -f ';
|
||||||
}
|
}
|
||||||
@ -272,10 +282,7 @@ class MacOSBuilder extends BuilderBase
|
|||||||
*/
|
*/
|
||||||
public function buildFpm(): void
|
public function buildFpm(): void
|
||||||
{
|
{
|
||||||
$vars = SystemUtil::makeEnvVarString([
|
$vars = SystemUtil::makeEnvVarString($this->getBuildVars());
|
||||||
'EXTRA_CFLAGS' => '-g -Os', // with debug information, but optimize for size
|
|
||||||
'EXTRA_LIBS' => "{$this->getOption('extra-libs')} -lresolv", // link resolv library (macOS needs it)
|
|
||||||
]);
|
|
||||||
|
|
||||||
$shell = shell()->cd(SOURCE_PATH . '/php-src');
|
$shell = shell()->cd(SOURCE_PATH . '/php-src');
|
||||||
$shell->exec("make -j{$this->concurrency} {$vars} fpm");
|
$shell->exec("make -j{$this->concurrency} {$vars} fpm");
|
||||||
@ -292,10 +299,7 @@ class MacOSBuilder extends BuilderBase
|
|||||||
*/
|
*/
|
||||||
public function buildEmbed(): void
|
public function buildEmbed(): void
|
||||||
{
|
{
|
||||||
$vars = SystemUtil::makeEnvVarString([
|
$vars = SystemUtil::makeEnvVarString($this->getBuildVars());
|
||||||
'EXTRA_CFLAGS' => '-g -Os', // with debug information, but optimize for size
|
|
||||||
'EXTRA_LIBS' => "{$this->getOption('extra-libs')} -lresolv", // link resolv library (macOS needs it)
|
|
||||||
]);
|
|
||||||
|
|
||||||
shell()
|
shell()
|
||||||
->cd(SOURCE_PATH . '/php-src')
|
->cd(SOURCE_PATH . '/php-src')
|
||||||
@ -309,4 +313,15 @@ class MacOSBuilder extends BuilderBase
|
|||||||
->exec('ar rcs ' . BUILD_ROOT_PATH . '/lib/libphp.a *.o')
|
->exec('ar rcs ' . BUILD_ROOT_PATH . '/lib/libphp.a *.o')
|
||||||
->exec('rm -Rf ' . BUILD_ROOT_PATH . '/lib/php-o');
|
->exec('rm -Rf ' . BUILD_ROOT_PATH . '/lib/php-o');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getBuildVars($input = []): array
|
||||||
|
{
|
||||||
|
$optimization = $this->getOption('no-strip', false) ? '-g -O0' : '-g0 -Os';
|
||||||
|
$cflags = isset($input['EXTRA_CFLAGS']) && $input['EXTRA_CFLAGS'] ? " {$input['EXTRA_CFLAGS']}" : '';
|
||||||
|
$libs = isset($input['EXTRA_LIBS']) && $input['EXTRA_LIBS'] ? " {$input['EXTRA_LIBS']}" : '';
|
||||||
|
return [
|
||||||
|
'EXTRA_CFLAGS' => "{$optimization} {$cflags} " . $this->getOption('x-extra-cflags'),
|
||||||
|
'EXTRA_LIBS' => "{$this->getOption('extra-libs')} -lresolv {$libs} " . $this->getOption('x-extra-libs'),
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
12
src/SPC/builder/macos/library/libcares.php
Normal file
12
src/SPC/builder/macos/library/libcares.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\macos\library;
|
||||||
|
|
||||||
|
class libcares extends MacOSLibraryBase
|
||||||
|
{
|
||||||
|
use \SPC\builder\unix\library\libcares;
|
||||||
|
|
||||||
|
public const NAME = 'libcares';
|
||||||
|
}
|
||||||
@ -20,51 +20,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace SPC\builder\macos\library;
|
namespace SPC\builder\macos\library;
|
||||||
|
|
||||||
use SPC\exception\FileSystemException;
|
|
||||||
use SPC\exception\RuntimeException;
|
|
||||||
|
|
||||||
class nghttp2 extends MacOSLibraryBase
|
class nghttp2 extends MacOSLibraryBase
|
||||||
{
|
{
|
||||||
|
use \SPC\builder\unix\library\nghttp2;
|
||||||
|
|
||||||
public const NAME = 'nghttp2';
|
public const NAME = 'nghttp2';
|
||||||
|
|
||||||
/**
|
|
||||||
* @throws FileSystemException
|
|
||||||
* @throws RuntimeException
|
|
||||||
*/
|
|
||||||
protected function build(): void
|
|
||||||
{
|
|
||||||
$args = $this->builder->makeAutoconfArgs(static::NAME, [
|
|
||||||
'zlib' => null,
|
|
||||||
'openssl' => null,
|
|
||||||
'libxml2' => null,
|
|
||||||
'libev' => null,
|
|
||||||
'libcares' => null,
|
|
||||||
'libngtcp2' => null,
|
|
||||||
'libnghttp3' => null,
|
|
||||||
'libbpf' => null,
|
|
||||||
'libevent-openssl' => null,
|
|
||||||
'jansson' => null,
|
|
||||||
'jemalloc' => null,
|
|
||||||
'systemd' => null,
|
|
||||||
'cunit' => null,
|
|
||||||
]);
|
|
||||||
|
|
||||||
[,,$destdir] = SEPARATED_PATH;
|
|
||||||
|
|
||||||
shell()->cd($this->source_dir)
|
|
||||||
->exec(
|
|
||||||
'./configure ' .
|
|
||||||
'--enable-static ' .
|
|
||||||
'--disable-shared ' .
|
|
||||||
"--host={$this->builder->getOption('gnu-arch')}-apple-darwin " .
|
|
||||||
'--enable-lib-only ' .
|
|
||||||
'--with-boost=no ' .
|
|
||||||
$args . ' ' .
|
|
||||||
'--prefix='
|
|
||||||
)
|
|
||||||
->exec('make clean')
|
|
||||||
->exec("make -j{$this->builder->concurrency}")
|
|
||||||
->exec("make install DESTDIR={$destdir}");
|
|
||||||
$this->patchPkgconfPrefix(['libnghttp2.pc']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,9 +28,9 @@ trait brotli
|
|||||||
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
||||||
$this->patchPkgconfPrefix(['libbrotlicommon.pc', 'libbrotlidec.pc', 'libbrotlienc.pc']);
|
$this->patchPkgconfPrefix(['libbrotlicommon.pc', 'libbrotlidec.pc', 'libbrotlienc.pc']);
|
||||||
shell()->cd(BUILD_ROOT_PATH . '/lib')
|
shell()->cd(BUILD_ROOT_PATH . '/lib')
|
||||||
->exec('ln -s libbrotlicommon.a libbrotlicommon-static.a')
|
->exec('ln -sf libbrotlicommon.a libbrotlicommon-static.a')
|
||||||
->exec('ln -s libbrotlidec.a libbrotlidec-static.a')
|
->exec('ln -sf libbrotlidec.a libbrotlidec-static.a')
|
||||||
->exec('ln -s libbrotlienc.a libbrotlienc-static.a');
|
->exec('ln -sf libbrotlienc.a libbrotlienc-static.a');
|
||||||
foreach (FileSystem::scanDirFiles(BUILD_ROOT_PATH . '/lib/', false, true) as $filename) {
|
foreach (FileSystem::scanDirFiles(BUILD_ROOT_PATH . '/lib/', false, true) as $filename) {
|
||||||
if (str_starts_with($filename, 'libbrotli') && (str_contains($filename, '.so') || str_ends_with($filename, '.dylib'))) {
|
if (str_starts_with($filename, 'libbrotli') && (str_contains($filename, '.so') || str_ends_with($filename, '.dylib'))) {
|
||||||
unlink(BUILD_ROOT_PATH . '/lib/' . $filename);
|
unlink(BUILD_ROOT_PATH . '/lib/' . $filename);
|
||||||
|
|||||||
21
src/SPC/builder/unix/library/libcares.php
Normal file
21
src/SPC/builder/unix/library/libcares.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\unix\library;
|
||||||
|
|
||||||
|
use SPC\exception\RuntimeException;
|
||||||
|
|
||||||
|
trait libcares
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @throws RuntimeException
|
||||||
|
*/
|
||||||
|
protected function build(): void
|
||||||
|
{
|
||||||
|
shell()->cd($this->source_dir)
|
||||||
|
->exec('./configure --prefix=' . BUILD_ROOT_PATH . ' --enable-static --disable-shared --disable-tests')
|
||||||
|
->exec("make -j {$this->builder->concurrency}")
|
||||||
|
->exec('make install');
|
||||||
|
}
|
||||||
|
}
|
||||||
53
src/SPC/builder/unix/library/nghttp2.php
Normal file
53
src/SPC/builder/unix/library/nghttp2.php
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\unix\library;
|
||||||
|
|
||||||
|
use SPC\exception\FileSystemException;
|
||||||
|
use SPC\exception\RuntimeException;
|
||||||
|
use SPC\exception\WrongUsageException;
|
||||||
|
|
||||||
|
trait nghttp2
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @throws FileSystemException
|
||||||
|
* @throws RuntimeException
|
||||||
|
* @throws WrongUsageException
|
||||||
|
*/
|
||||||
|
protected function build(): void
|
||||||
|
{
|
||||||
|
$args = $this->builder->makeAutoconfArgs(static::NAME, [
|
||||||
|
'zlib' => null,
|
||||||
|
'openssl' => null,
|
||||||
|
'libxml2' => null,
|
||||||
|
'libev' => null,
|
||||||
|
'libcares' => null,
|
||||||
|
'libngtcp2' => null,
|
||||||
|
'libnghttp3' => null,
|
||||||
|
'libbpf' => null,
|
||||||
|
'libevent-openssl' => null,
|
||||||
|
'jansson' => null,
|
||||||
|
'jemalloc' => null,
|
||||||
|
'systemd' => null,
|
||||||
|
'cunit' => null,
|
||||||
|
]);
|
||||||
|
|
||||||
|
[,,$destdir] = SEPARATED_PATH;
|
||||||
|
|
||||||
|
shell()->cd($this->source_dir)
|
||||||
|
->exec(
|
||||||
|
'./configure ' .
|
||||||
|
'--enable-static ' .
|
||||||
|
'--disable-shared ' .
|
||||||
|
'--enable-lib-only ' .
|
||||||
|
'--with-boost=no ' .
|
||||||
|
$args . ' ' .
|
||||||
|
'--prefix='
|
||||||
|
)
|
||||||
|
->exec('make clean')
|
||||||
|
->exec("make -j{$this->builder->concurrency}")
|
||||||
|
->exec("make install DESTDIR={$destdir}");
|
||||||
|
$this->patchPkgconfPrefix(['libnghttp2.pc']);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -28,9 +28,6 @@ trait postgresql
|
|||||||
'icu' => 'icu-i18n',
|
'icu' => 'icu-i18n',
|
||||||
];
|
];
|
||||||
|
|
||||||
f_putenv('PKG_CONFIG=' . BUILD_ROOT_PATH . '/bin/pkg-config');
|
|
||||||
f_putenv('PKG_CONFIG_PATH=' . BUILD_LIB_PATH . '/pkgconfig');
|
|
||||||
|
|
||||||
foreach ($optional_packages as $lib => $pkg) {
|
foreach ($optional_packages as $lib => $pkg) {
|
||||||
if ($this->getBuilder()->getLib($lib)) {
|
if ($this->getBuilder()->getLib($lib)) {
|
||||||
$packages .= ' ' . $pkg;
|
$packages .= ' ' . $pkg;
|
||||||
|
|||||||
@ -233,6 +233,7 @@ class FileSystem
|
|||||||
throw new FileSystemException("unknown archive format: {$filename}");
|
throw new FileSystemException("unknown archive format: {$filename}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
self::emitSourceExtractHook($name);
|
||||||
} catch (RuntimeException $e) {
|
} catch (RuntimeException $e) {
|
||||||
if (PHP_OS_FAMILY === 'Windows') {
|
if (PHP_OS_FAMILY === 'Windows') {
|
||||||
f_passthru('rmdir /s /q ' . SOURCE_PATH . "/{$name}");
|
f_passthru('rmdir /s /q ' . SOURCE_PATH . "/{$name}");
|
||||||
|
|||||||
@ -16,6 +16,7 @@ class SourcePatcher
|
|||||||
// FileSystem::addSourceExtractHook('swow', [SourcePatcher::class, 'patchSwow']);
|
// FileSystem::addSourceExtractHook('swow', [SourcePatcher::class, 'patchSwow']);
|
||||||
FileSystem::addSourceExtractHook('micro', [SourcePatcher::class, 'patchMicro']);
|
FileSystem::addSourceExtractHook('micro', [SourcePatcher::class, 'patchMicro']);
|
||||||
FileSystem::addSourceExtractHook('openssl', [SourcePatcher::class, 'patchOpenssl11Darwin']);
|
FileSystem::addSourceExtractHook('openssl', [SourcePatcher::class, 'patchOpenssl11Darwin']);
|
||||||
|
FileSystem::addSourceExtractHook('swoole', [SourcePatcher::class, 'patchSwoole']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -159,6 +160,17 @@ class SourcePatcher
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function patchSwoole(): bool
|
||||||
|
{
|
||||||
|
// swoole hook needs pdo/pdo.h
|
||||||
|
FileSystem::replaceFileStr(
|
||||||
|
SOURCE_PATH . '/php-src/ext/swoole/config.m4',
|
||||||
|
'PHP_ADD_INCLUDE([$ext_srcdir])',
|
||||||
|
"PHP_ADD_INCLUDE( [\$ext_srcdir] )\n PHP_ADD_INCLUDE([\$abs_srcdir/ext])"
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws FileSystemException
|
* @throws FileSystemException
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
use SPC\exception\RuntimeException;
|
||||||
use SPC\exception\WrongUsageException;
|
use SPC\exception\WrongUsageException;
|
||||||
use SPC\util\UnixShell;
|
use SPC\util\UnixShell;
|
||||||
use SPC\util\WindowsCmd;
|
use SPC\util\WindowsCmd;
|
||||||
@ -69,7 +70,7 @@ function osfamily2dir(): string
|
|||||||
/**
|
/**
|
||||||
* Execute the shell command, and the output will be directly printed in the terminal. If there is an error, an exception will be thrown
|
* Execute the shell command, and the output will be directly printed in the terminal. If there is an error, an exception will be thrown
|
||||||
*
|
*
|
||||||
* @throws \SPC\exception\RuntimeException
|
* @throws RuntimeException
|
||||||
*/
|
*/
|
||||||
function f_passthru(string $cmd): ?bool
|
function f_passthru(string $cmd): ?bool
|
||||||
{
|
{
|
||||||
@ -87,7 +88,7 @@ function f_passthru(string $cmd): ?bool
|
|||||||
}
|
}
|
||||||
$ret = passthru($cmd, $code);
|
$ret = passthru($cmd, $code);
|
||||||
if ($code !== 0) {
|
if ($code !== 0) {
|
||||||
throw new \SPC\exception\RuntimeException('Command run failed with code[' . $code . ']: ' . $cmd, $code);
|
throw new RuntimeException('Command run failed with code[' . $code . ']: ' . $cmd, $code);
|
||||||
}
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,24 +2,55 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
# Normal test, contains `common` extension.
|
/**
|
||||||
$extensions = 'bcmath,bz2,calendar,ctype,curl,dom,exif,fileinfo,filter,ftp,gd,gmp,iconv,xml,mbstring,mbregex,mysqlnd,openssl,pcntl,pdo,pdo_mysql,pdo_sqlite,phar,posix,redis,session,simplexml,soap,sockets,sqlite3,tokenizer,xmlwriter,xmlreader,zlib,zip';
|
* This is GitHub Actions automatic test extension args generator.
|
||||||
|
* You can edit $extensions, $with_libs and $base_combination.
|
||||||
|
*/
|
||||||
|
|
||||||
# Normal test, contains gd extra libraries.
|
// --------------------------------- edit area ---------------------------------
|
||||||
$additional_libs = 'libwebp,libavif,libjpeg,freetype';
|
|
||||||
|
|
||||||
# If you want to test additional extensions, add them below. (comma start)
|
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
|
||||||
$extensions .= ',xhprof';
|
$extensions = 'swoole,swoole-hook-pgsql,swoole-hook-mysql,swoole-hook-sqlite';
|
||||||
|
|
||||||
# If you want to test additional features for extensions, add libs below. (comma start like extensions)
|
// If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`).
|
||||||
$additional_libs .= '';
|
$with_libs = '';
|
||||||
|
|
||||||
|
// Please change your test base combination. We recommend testing with `common`.
|
||||||
|
// You can use `common`, `bulk`, `minimal` or `none`.
|
||||||
|
$base_combination = 'minimal';
|
||||||
|
|
||||||
|
// -------------------------- code area, do not modify --------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get combination for tests, do not modify it if not necessary.
|
||||||
|
*/
|
||||||
|
function _getCombination(string $type = 'common'): string
|
||||||
|
{
|
||||||
|
return match ($type) {
|
||||||
|
'common' => 'bcmath,bz2,calendar,ctype,curl,dom,exif,fileinfo,filter,ftp,gd,gmp,iconv,xml,mbstring,mbregex,' .
|
||||||
|
'mysqlnd,openssl,pcntl,pdo,pdo_mysql,pdo_sqlite,phar,posix,redis,session,simplexml,soap,sockets,' .
|
||||||
|
'sqlite3,tokenizer,xmlwriter,xmlreader,zlib,zip',
|
||||||
|
'bulk' => 'apcu,bcmath,bz2,calendar,ctype,curl,dba,dom,event,exif,fileinfo,filter,ftp,gd,gmp,iconv,imagick,imap,' .
|
||||||
|
'intl,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pcntl,pdo,pdo_mysql,pdo_pgsql,pdo_sqlite,pgsql,phar,' .
|
||||||
|
'posix,protobuf,readline,redis,session,shmop,simplexml,soap,sockets,sodium,sqlite3,swoole,sysvmsg,sysvsem,' .
|
||||||
|
'sysvshm,tokenizer,xml,xmlreader,xmlwriter,xsl,zip,zlib',
|
||||||
|
'minimal' => 'pcntl,posix,mbstring,tokenizer,phar',
|
||||||
|
default => '', // none
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (!isset($argv[1])) {
|
if (!isset($argv[1])) {
|
||||||
exit("Please use 'extensions', 'cmd' or 'libs' as output type");
|
exit("Please use 'extensions', 'cmd' or 'libs' as output type");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$trim_value = "\r\n \t,";
|
||||||
|
|
||||||
|
$final_extensions = trim(trim($extensions, $trim_value) . ',' . _getCombination($base_combination), $trim_value);
|
||||||
|
$final_libs = trim($with_libs, $trim_value);
|
||||||
|
|
||||||
echo match ($argv[1]) {
|
echo match ($argv[1]) {
|
||||||
'extensions' => $extensions,
|
'extensions' => $final_extensions,
|
||||||
'libs' => $additional_libs,
|
'libs' => $final_libs,
|
||||||
'cmd' => $extensions . ' --with-libs=' . $additional_libs,
|
'cmd' => $final_extensions . ($final_libs === '' ? '' : (' --with-libs=' . $final_libs)),
|
||||||
default => '',
|
default => '',
|
||||||
};
|
};
|
||||||
|
|||||||
12
src/globals/tests/swoole.php
Normal file
12
src/globals/tests/swoole.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
assert(function_exists('swoole_cpu_num'));
|
||||||
|
assert(function_exists('swoole_string'));
|
||||||
|
assert(class_exists('Swoole\Coroutine'));
|
||||||
|
assert(class_exists('Swoole\Coroutine\Http2\Client'));
|
||||||
|
assert(class_exists('Swoole\Coroutine\Redis'));
|
||||||
|
assert(class_exists('Swoole\Coroutine\WaitGroup'));
|
||||||
|
assert(class_exists('Swoole\Http2\Request'));
|
||||||
|
assert(constant('SWOOLE_VERSION'));
|
||||||
Loading…
x
Reference in New Issue
Block a user