mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-09 01:45:36 +08:00
macos? 2
This commit is contained in:
@@ -70,11 +70,17 @@ abstract class UnixBuilderBase extends BuilderBase
|
|||||||
|
|
||||||
$exportList = BUILD_LIB_PATH . '/export-dynamic.list';
|
$exportList = BUILD_LIB_PATH . '/export-dynamic.list';
|
||||||
$lines = [];
|
$lines = [];
|
||||||
$lines[] = '{';
|
if (SPCTarget::getTargetOS() === 'Linux') {
|
||||||
foreach ($defined as $sym) {
|
$lines[] = '{';
|
||||||
$lines[] = " {$sym};";
|
foreach ($defined as $sym) {
|
||||||
|
$lines[] = " {$sym};";
|
||||||
|
}
|
||||||
|
$lines[] = '};';
|
||||||
|
} else {
|
||||||
|
foreach ($defined as $sym) {
|
||||||
|
$lines[] = "_{$sym}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$lines[] = '};';
|
|
||||||
file_put_contents($exportList, implode("\n", $lines) . "\n");
|
file_put_contents($exportList, implode("\n", $lines) . "\n");
|
||||||
|
|
||||||
$this->dynamic_export_list = $exportList;
|
$this->dynamic_export_list = $exportList;
|
||||||
@@ -202,8 +208,14 @@ abstract class UnixBuilderBase extends BuilderBase
|
|||||||
foreach (glob(BUILD_LIB_PATH . "/libphp*.{$suffix}") as $file) {
|
foreach (glob(BUILD_LIB_PATH . "/libphp*.{$suffix}") as $file) {
|
||||||
unlink($file);
|
unlink($file);
|
||||||
}
|
}
|
||||||
$symbolList = $this->getDynamicExportSymbolsFile();
|
|
||||||
$dynamic_exports = $symbolList ? (' -Wl,--dynamic-list' . (SPCTarget::getTargetOS() === 'Darwin' ? '-file' : '') . '=' . $symbolList) : '';
|
if ($symbolList = $this->getDynamicExportSymbolsFile()) {
|
||||||
|
if (SPCTarget::getTargetOS() === 'Linux') {
|
||||||
|
$dynamic_exports = ' -Wl,--dynamic-list=' . $symbolList;
|
||||||
|
} else {
|
||||||
|
$dynamic_exports = ' -Wl,-exported_symbols_list,' . $symbolList;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
[$ret, $out] = shell()->cd($sample_file_path)->execWithResult(getenv('CC') . ' -o embed embed.c ' . $lens . ' ' . $dynamic_exports);
|
[$ret, $out] = shell()->cd($sample_file_path)->execWithResult(getenv('CC') . ' -o embed embed.c ' . $lens . ' ' . $dynamic_exports);
|
||||||
if ($ret !== 0) {
|
if ($ret !== 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user