mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 12:54:52 +08:00
Refactor PKG_CHECK_MODULES replacement and reuse make vars for configure
This commit is contained in:
parent
19d6d669c0
commit
2676875ccd
@ -48,7 +48,9 @@ trait unix
|
|||||||
// let php m4 tools use static pkg-config
|
// let php m4 tools use static pkg-config
|
||||||
FileSystem::replaceFileStr("{$package->getSourceDir()}/build/php.m4", 'PKG_CHECK_MODULES(', 'PKG_CHECK_MODULES_STATIC(');
|
FileSystem::replaceFileStr("{$package->getSourceDir()}/build/php.m4", 'PKG_CHECK_MODULES(', 'PKG_CHECK_MODULES_STATIC(');
|
||||||
// also patch extension config.m4 files (they call PKG_CHECK_MODULES directly, not via php.m4)
|
// also patch extension config.m4 files (they call PKG_CHECK_MODULES directly, not via php.m4)
|
||||||
shell()->cd($package->getSourceDir())->exec("grep -rl 'PKG_CHECK_MODULES(' ext/ | xargs sed -i 's/PKG_CHECK_MODULES(/PKG_CHECK_MODULES_STATIC(/g' || true");
|
foreach (glob("{$package->getSourceDir()}/ext/*/*.m4") as $m4file) {
|
||||||
|
FileSystem::replaceFileStr($m4file, 'PKG_CHECK_MODULES(', 'PKG_CHECK_MODULES_STATIC(');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Stage]
|
#[Stage]
|
||||||
@ -110,11 +112,15 @@ trait unix
|
|||||||
|
|
||||||
$static_extension_str = $this->makeStaticExtensionString($installer);
|
$static_extension_str = $this->makeStaticExtensionString($installer);
|
||||||
|
|
||||||
|
// reuse the same make vars so configure conftest links use the same LIBS (incl. -framework flags)
|
||||||
|
$vars = $this->makeVars($installer);
|
||||||
|
|
||||||
// run ./configure with args
|
// run ./configure with args
|
||||||
$this->seekPhpSrcLogFileOnException(fn () => shell()->cd($package->getSourceDir())->setEnv([
|
$this->seekPhpSrcLogFileOnException(fn () => shell()->cd($package->getSourceDir())->setEnv([
|
||||||
'CFLAGS' => getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS'),
|
'CFLAGS' => getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS'),
|
||||||
'CPPFLAGS' => "-I{$package->getIncludeDir()}",
|
'CPPFLAGS' => "-I{$package->getIncludeDir()}",
|
||||||
'LDFLAGS' => "-L{$package->getLibDir()} " . getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS'),
|
'LDFLAGS' => "-L{$package->getLibDir()} " . getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS'),
|
||||||
|
'LIBS' => $vars['EXTRA_LIBS'] ?? '',
|
||||||
])->exec("{$cmd} {$args} {$static_extension_str}"), $package->getSourceDir());
|
])->exec("{$cmd} {$args} {$static_extension_str}"), $package->getSourceDir());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user