mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-09 01:45:36 +08:00
Forward-port #1056 on v3
This commit is contained in:
@@ -20,8 +20,6 @@ class UnixAutoconfExecutor extends Executor
|
||||
|
||||
protected array $configure_args = [];
|
||||
|
||||
protected array $ignore_args = [];
|
||||
|
||||
protected PackageInstaller $installer;
|
||||
|
||||
public function __construct(protected LibraryPackage $package, ?PackageInstaller $installer = null)
|
||||
@@ -40,6 +38,8 @@ class UnixAutoconfExecutor extends Executor
|
||||
if (!$this->package->hasStage('build')) {
|
||||
throw new SPCInternalException("Package {$this->package->getName()} does not have a build stage defined.");
|
||||
}
|
||||
|
||||
$this->configure_args = $this->getDefaultConfigureArgs();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,18 +48,12 @@ class UnixAutoconfExecutor extends Executor
|
||||
public function configure(...$args): static
|
||||
{
|
||||
// remove all the ignored args
|
||||
$args = array_merge($args, $this->getDefaultConfigureArgs(), $this->configure_args);
|
||||
$args = array_diff($args, $this->ignore_args);
|
||||
$args = array_merge($args, $this->configure_args);
|
||||
$configure_args = implode(' ', $args);
|
||||
InteractiveTerm::setMessage('Building package: ' . ConsoleColor::yellow($this->package->getName()) . ' (./configure)');
|
||||
return $this->seekLogFileOnException(fn () => $this->shell->exec("./configure {$configure_args}"));
|
||||
}
|
||||
|
||||
public function getConfigureArgsString(): string
|
||||
{
|
||||
return implode(' ', array_merge($this->getDefaultConfigureArgs(), $this->configure_args));
|
||||
}
|
||||
|
||||
/**
|
||||
* Run make
|
||||
*
|
||||
@@ -134,7 +128,7 @@ class UnixAutoconfExecutor extends Executor
|
||||
*/
|
||||
public function removeConfigureArgs(...$args): static
|
||||
{
|
||||
$this->ignore_args = [...$this->ignore_args, ...$args];
|
||||
$this->configure_args = array_diff($this->configure_args, $args);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,11 @@ abstract class UnixUtil
|
||||
throw new SPCInternalException("The symbol file {$symbol_file} does not exist, please check if nm command is available.");
|
||||
}
|
||||
// https://github.com/ziglang/zig/issues/24662
|
||||
if (SystemTarget::getTargetOS() !== 'Linux' || ApplicationContext::get(ToolchainInterface::class) instanceof ZigToolchain) {
|
||||
$toolchain = ApplicationContext::get(ToolchainInterface::class);
|
||||
if ($toolchain instanceof ZigToolchain) {
|
||||
return '-Wl,--export-dynamic'; // needs release 0.16, can be removed then
|
||||
}
|
||||
if (SystemTarget::getTargetOS() !== 'Linux') {
|
||||
return "-Wl,-exported_symbols_list,{$symbol_file}";
|
||||
}
|
||||
return "-Wl,--dynamic-list={$symbol_file}";
|
||||
|
||||
Reference in New Issue
Block a user