mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
don't set unknown linker flags on macos
This commit is contained in:
parent
302cf8345d
commit
b265d6dd56
@ -368,11 +368,16 @@ class Extension
|
|||||||
{
|
{
|
||||||
$config = (new SPCConfigUtil($this->builder))->config([$this->getName()], with_dependencies: true);
|
$config = (new SPCConfigUtil($this->builder))->config([$this->getName()], with_dependencies: true);
|
||||||
[$staticLibString, $sharedLibString] = $this->getStaticAndSharedLibs();
|
[$staticLibString, $sharedLibString] = $this->getStaticAndSharedLibs();
|
||||||
|
|
||||||
|
// macOS ld64 doesn't understand these, while Linux and BSD do
|
||||||
|
// use them to make sure that all symbols are picked up, even if a library has already been visited before
|
||||||
|
$preStatic = PHP_OS_FAMILY !== 'Darwin' ? '-Wl,-Bstatic -Wl,--start-group ' : '';
|
||||||
|
$postStatic = PHP_OS_FAMILY !== 'Darwin' ? ' -Wl,--end-group -Wl,-Bdynamic ' : ' ';
|
||||||
$env = [
|
$env = [
|
||||||
'CFLAGS' => $config['cflags'],
|
'CFLAGS' => $config['cflags'],
|
||||||
'CXXFLAGS' => $config['cflags'],
|
'CXXFLAGS' => $config['cflags'],
|
||||||
'LDFLAGS' => $config['ldflags'],
|
'LDFLAGS' => $config['ldflags'],
|
||||||
'LIBS' => '-Wl,-Bstatic -Wl,--start-group ' . $staticLibString . ' -Wl,--end-group -Wl,-Bdynamic ' . $sharedLibString,
|
'LIBS' => $preStatic . $staticLibString . $postStatic . $sharedLibString,
|
||||||
'LD_LIBRARY_PATH' => BUILD_LIB_PATH,
|
'LD_LIBRARY_PATH' => BUILD_LIB_PATH,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -393,6 +398,7 @@ class Extension
|
|||||||
'--enable-shared --disable-static'
|
'--enable-shared --disable-static'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// some extensions don't define their dependencies well, this patch is only needed for a few
|
||||||
FileSystem::replaceFileRegex(
|
FileSystem::replaceFileRegex(
|
||||||
$this->source_dir . '/Makefile',
|
$this->source_dir . '/Makefile',
|
||||||
'/^(.*_SHARED_LIBADD\s*=.*)$/m',
|
'/^(.*_SHARED_LIBADD\s*=.*)$/m',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user