mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
Merge branch 'main' of https://github.com/crazywhalecc/static-php-cli into grpc
This commit is contained in:
commit
848c30547c
@ -317,26 +317,26 @@ abstract class LibraryBase
|
||||
protected function install(): void
|
||||
{
|
||||
// replace placeholders if BUILD_ROOT_PATH/.spc-extract-placeholder.json exists
|
||||
$placeholder_file = BUILD_ROOT_PATH . '/.spc-extract-placeholder.json';
|
||||
if (!file_exists($placeholder_file)) {
|
||||
$replace_item_file = BUILD_ROOT_PATH . '/.spc-extract-placeholder.json';
|
||||
if (!file_exists($replace_item_file)) {
|
||||
return;
|
||||
}
|
||||
$placeholder = json_decode(file_get_contents($placeholder_file), true);
|
||||
if (!is_array($placeholder)) {
|
||||
throw new RuntimeException('Invalid placeholder file: ' . $placeholder_file);
|
||||
$replace_items = json_decode(file_get_contents($replace_item_file), true);
|
||||
if (!is_array($replace_items)) {
|
||||
throw new RuntimeException('Invalid placeholder file: ' . $replace_item_file);
|
||||
}
|
||||
$placeholder = get_pack_placehoder();
|
||||
$placeholders = get_pack_replace();
|
||||
// replace placeholders in BUILD_ROOT_PATH
|
||||
foreach ($placeholder as $item) {
|
||||
foreach ($replace_items as $item) {
|
||||
$filepath = BUILD_ROOT_PATH . "/{$item}";
|
||||
FileSystem::replaceFileStr(
|
||||
$filepath,
|
||||
array_values($placeholder),
|
||||
array_keys($placeholder),
|
||||
array_values($placeholders),
|
||||
array_keys($placeholders),
|
||||
);
|
||||
}
|
||||
// remove placeholder file
|
||||
unlink($placeholder_file);
|
||||
unlink($replace_item_file);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -53,7 +53,7 @@ class PackLibCommand extends BuildCommand
|
||||
|
||||
$origin_files = [];
|
||||
// get pack placehoder defines
|
||||
$placehoder = get_pack_placehoder();
|
||||
$placehoder = get_pack_replace();
|
||||
|
||||
foreach ($builder->getLibs() as $lib) {
|
||||
if ($lib->getName() !== $lib_name) {
|
||||
|
||||
@ -233,7 +233,7 @@ function ac_with_args(string $arg_name, bool $use_value = false): array
|
||||
return $use_value ? ["--with-{$arg_name}=yes", "--with-{$arg_name}=no"] : ["--with-{$arg_name}", "--without-{$arg_name}"];
|
||||
}
|
||||
|
||||
function get_pack_placehoder(): array
|
||||
function get_pack_replace(): array
|
||||
{
|
||||
return [
|
||||
BUILD_LIB_PATH => '@build_lib_path@',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user