mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-06 08:15:39 +08:00
Add phpmicro win32 mode support (#478)
* Add phpmicro win32 mode support * Bump version to 2.2.4 * Add micro win32 build tests for actions * cs-fix and update deps
This commit is contained in:
@@ -460,7 +460,9 @@ abstract class BuilderBase
|
||||
'micro_ext_test' => [
|
||||
'content' => ($this->getOption('without-micro-ext-test') ? '<?php echo "[micro-test-start][micro-test-end]";' : $this->generateMicroExtTests()),
|
||||
'conditions' => [
|
||||
// program success
|
||||
function ($ret) { return $ret === 0; },
|
||||
// program returns expected output
|
||||
function ($ret, $out) {
|
||||
$raw_out = trim(implode('', $out));
|
||||
return str_starts_with($raw_out, '[micro-test-start]') && str_ends_with($raw_out, '[micro-test-end]');
|
||||
@@ -470,6 +472,7 @@ abstract class BuilderBase
|
||||
'micro_zend_bug_test' => [
|
||||
'content' => ($this->getOption('without-micro-ext-test') ? '<?php echo "hello";' : file_get_contents(ROOT_DIR . '/src/globals/common-tests/micro_zend_mm_heap_corrupted.txt')),
|
||||
'conditions' => [
|
||||
// program success
|
||||
function ($ret) { return $ret === 0; },
|
||||
],
|
||||
],
|
||||
|
||||
@@ -96,7 +96,7 @@ abstract class UnixBuilderBase extends BuilderBase
|
||||
$support_lib_list = [];
|
||||
$classes = FileSystem::getClassesPsr4(
|
||||
ROOT_DIR . '/src/SPC/builder/' . osfamily2dir() . '/library',
|
||||
'SPC\\builder\\' . osfamily2dir() . '\\library'
|
||||
'SPC\builder\\' . osfamily2dir() . '\library'
|
||||
);
|
||||
foreach ($classes as $class) {
|
||||
if (defined($class . '::NAME') && $class::NAME !== 'unknown' && Config::getLib($class::NAME) !== null) {
|
||||
|
||||
@@ -102,6 +102,8 @@ class WindowsBuilder extends BuilderBase
|
||||
$micro_logo = '';
|
||||
}
|
||||
|
||||
$micro_w32 = $this->getOption('enable-micro-win32') ? ' --enable-micro-win32=yes' : '';
|
||||
|
||||
cmd()->cd(SOURCE_PATH . '\php-src')
|
||||
->exec(
|
||||
"{$this->sdk_prefix} configure.bat --task-args \"" .
|
||||
@@ -111,7 +113,7 @@ class WindowsBuilder extends BuilderBase
|
||||
'--with-extra-includes=' . BUILD_INCLUDE_PATH . ' ' .
|
||||
'--with-extra-libs=' . BUILD_LIB_PATH . ' ' .
|
||||
($enableCli ? '--enable-cli=yes ' : '--enable-cli=no ') .
|
||||
($enableMicro ? ('--enable-micro=yes ' . $micro_logo) : '--enable-micro=no ') .
|
||||
($enableMicro ? ('--enable-micro=yes ' . $micro_logo . $micro_w32) : '--enable-micro=no ') .
|
||||
($enableEmbed ? '--enable-embed=yes ' : '--enable-embed=no ') .
|
||||
"{$this->makeExtensionArgs()} " .
|
||||
$zts .
|
||||
@@ -132,6 +134,8 @@ class WindowsBuilder extends BuilderBase
|
||||
if ($enableMicro) {
|
||||
logger()->info('building micro');
|
||||
$this->buildMicro();
|
||||
|
||||
SourcePatcher::unpatchMicroWin32();
|
||||
}
|
||||
if ($enableEmbed) {
|
||||
logger()->warning('Windows does not currently support embed SAPI.');
|
||||
@@ -212,8 +216,8 @@ class WindowsBuilder extends BuilderBase
|
||||
// search all supported libs
|
||||
$support_lib_list = [];
|
||||
$classes = FileSystem::getClassesPsr4(
|
||||
ROOT_DIR . '\src\SPC\builder\\' . osfamily2dir() . '\\library',
|
||||
'SPC\\builder\\' . osfamily2dir() . '\\library'
|
||||
ROOT_DIR . '\src\SPC\builder\\' . osfamily2dir() . '\library',
|
||||
'SPC\builder\\' . osfamily2dir() . '\library'
|
||||
);
|
||||
foreach ($classes as $class) {
|
||||
if (defined($class . '::NAME') && $class::NAME !== 'unknown' && Config::getLib($class::NAME) !== null) {
|
||||
|
||||
Reference in New Issue
Block a user