Add patch for SPC_MICRO_PATCHES and update configure.ac handling

This commit is contained in:
crazywhalecc 2026-03-12 16:54:01 +08:00
parent 32bdacd5a5
commit cbc8feebfd
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680

View File

@ -32,10 +32,14 @@ use ZM\Logger\ConsoleColor;
trait unix trait unix
{ {
#[BeforeStage('php', [self::class, 'buildconfForUnix'], 'php')] #[BeforeStage('php', [self::class, 'buildconfForUnix'], 'php')]
#[PatchDescription('Patch SPC_MICRO_PATCHES defined patches (e.g. cli_checks, disable_huge_page)')]
#[PatchDescription('Patch configure.ac for musl and musl-toolchain')] #[PatchDescription('Patch configure.ac for musl and musl-toolchain')]
#[PatchDescription('Let php m4 tools use static pkg-config')] #[PatchDescription('Let php m4 tools use static pkg-config')]
public function patchBeforeBuildconf(TargetPackage $package): void public function patchBeforeBuildconf(TargetPackage $package): void
{ {
// php-src patches from micro (reads SPC_MICRO_PATCHES env var)
SourcePatcher::patchPhpSrc();
// patch configure.ac for musl and musl-toolchain // patch configure.ac for musl and musl-toolchain
$musl = SystemTarget::getTargetOS() === 'Linux' && SystemTarget::getLibc() === 'musl'; $musl = SystemTarget::getTargetOS() === 'Linux' && SystemTarget::getLibc() === 'musl';
FileSystem::backupFile(SOURCE_PATH . '/php-src/configure.ac'); FileSystem::backupFile(SOURCE_PATH . '/php-src/configure.ac');
@ -47,6 +51,7 @@ 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)
foreach (glob("{$package->getSourceDir()}/ext/*/*.m4") as $m4file) { foreach (glob("{$package->getSourceDir()}/ext/*/*.m4") as $m4file) {
FileSystem::replaceFileStr($m4file, 'PKG_CHECK_MODULES(', 'PKG_CHECK_MODULES_STATIC('); FileSystem::replaceFileStr($m4file, 'PKG_CHECK_MODULES(', 'PKG_CHECK_MODULES_STATIC(');