mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-06 16:25:39 +08:00
fix micro build and change deploy command args
This commit is contained in:
@@ -30,6 +30,9 @@ abstract class BuilderBase
|
||||
/** @var array<string, Extension> 要编译的扩展列表 */
|
||||
protected array $exts = [];
|
||||
|
||||
/** @var array<int, string> 要编译的扩展列表(仅名字列表,用于最后生成编译的扩展列表给 micro) */
|
||||
protected array $plain_extensions = [];
|
||||
|
||||
/** @var bool 本次编译是否只编译 libs,不编译 PHP */
|
||||
protected bool $libs_only = false;
|
||||
|
||||
@@ -149,10 +152,6 @@ abstract class BuilderBase
|
||||
*/
|
||||
public function proveExts(array $extensions): void
|
||||
{
|
||||
if (defined('BUILD_ALL_STATIC') && BUILD_ALL_STATIC) {
|
||||
$k = array_search('ffi', $extensions, true);
|
||||
$k !== false && array_splice($extensions, $k, 1);
|
||||
}
|
||||
foreach ($extensions as $extension) {
|
||||
$ext = new Extension($extension, $this);
|
||||
$this->addExt($ext);
|
||||
@@ -162,6 +161,8 @@ abstract class BuilderBase
|
||||
// 检查下依赖就行了,作用是导入依赖给 Extension 对象,今后可以对库依赖进行选择性处理
|
||||
$ext->checkDependency();
|
||||
}
|
||||
|
||||
$this->plain_extensions = $extensions;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -215,6 +215,8 @@ class LinuxBuilder extends BuilderBase
|
||||
if ($this->phar_patched) {
|
||||
shell()->cd(SOURCE_PATH . '/php-src')->exec('patch -p1 -R < sapi/micro/patches/phar.patch');
|
||||
}
|
||||
|
||||
file_put_contents(SOURCE_PATH . '/php-src/.extensions.json', json_encode($this->plain_extensions, JSON_PRETTY_PRINT));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -265,11 +267,7 @@ class LinuxBuilder extends BuilderBase
|
||||
'micro'
|
||||
);
|
||||
|
||||
shell()->cd(SOURCE_PATH . '/php-src/sapi/micro')
|
||||
->exec("{$this->cross_compile_prefix}objcopy --only-keep-debug micro.sfx micro.sfx.debug")
|
||||
->exec('elfedit --output-osabi linux micro.sfx')
|
||||
->exec("{$this->cross_compile_prefix}strip --strip-all micro.sfx")
|
||||
->exec("{$this->cross_compile_prefix}objcopy --update-section .comment=/tmp/comment --add-gnu-debuglink=micro.sfx.debug --remove-section=.note micro.sfx'");
|
||||
shell()->cd(SOURCE_PATH . '/php-src/sapi/micro')->exec("{$this->cross_compile_prefix}strip --strip-all micro.sfx");
|
||||
|
||||
$this->deployBinary(BUILD_TYPE_MICRO);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user