This commit is contained in:
crazywhalecc 2025-08-03 01:12:28 +08:00
parent c3e9a2816b
commit e6cf05ddff
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680
3 changed files with 15 additions and 5 deletions

View File

@ -97,10 +97,10 @@ class LinuxBuilder extends UnixBuilderBase
$enableFrankenphp = ($build_target & BUILD_TARGET_FRANKENPHP) === BUILD_TARGET_FRANKENPHP;
// prepare build php envs
$musl_flag = SPCTarget::getLibc() === 'musl' ? ' -D__MUSL__' : ' -U__MUSL__';
// $musl_flag = SPCTarget::getLibc() === 'musl' ? ' -D__MUSL__' : ' -U__MUSL__';
$php_configure_env = SystemUtil::makeEnvVarString([
'CFLAGS' => getenv('SPC_CMD_VAR_PHP_CONFIGURE_CFLAGS'),
'CPPFLAGS' => '-I' . BUILD_INCLUDE_PATH . $musl_flag,
'CPPFLAGS' => '-I' . BUILD_INCLUDE_PATH, // . $musl_flag,
'LDFLAGS' => '-L' . BUILD_LIB_PATH,
// 'LIBS' => SPCTarget::getRuntimeLibs(), // do not pass static libraries here yet, they may contain polyfills for libc functions!
]);
@ -359,7 +359,7 @@ class LinuxBuilder extends UnixBuilderBase
$static = SPCTarget::isStatic() ? '-all-static' : '';
$lib = BUILD_LIB_PATH;
return [
'CPPFLAGS' => SPCTarget::getLibc() === 'musl' ? '-D__MUSL__' : '-U__MUSL__',
// 'CPPFLAGS' => SPCTarget::getLibc() === 'musl' ? '-D__MUSL__' : '-U__MUSL__',
'EXTRA_CFLAGS' => getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS'),
'EXTRA_LIBS' => $config['libs'],
'EXTRA_LDFLAGS' => getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS'),

View File

@ -86,6 +86,16 @@ class SourcePatcher
);
}
// patch configure.ac
FileSystem::replaceFileStr(
SOURCE_PATH . '/php-src/configure.ac',
'if command -v ldd >/dev/null && ldd --version 2>&1 | grep ^musl >/dev/null 2>&1',
'if [ "$SPC_LIBC" = "musl" ];'
);
if (getenv('SPC_LIBC') === false && ($libc = SPCTarget::getLibc()) !== null) {
putenv("SPC_LIBC={$libc}");
}
// patch php-src/build/php.m4 PKG_CHECK_MODULES -> PKG_CHECK_MODULES_STATIC
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/build/php.m4', 'PKG_CHECK_MODULES(', 'PKG_CHECK_MODULES_STATIC(');

View File

@ -18,7 +18,7 @@ $test_php_version = [
// '8.3',
'8.4',
// '8.5',
// 'git',
'git',
];
// test os (macos-13, macos-14, macos-15, ubuntu-latest, windows-latest are available)
@ -28,7 +28,7 @@ $test_os = [
// 'macos-15', // bin/spc for arm64
'ubuntu-latest', // bin/spc-alpine-docker for x86_64
// 'ubuntu-22.04', // bin/spc-gnu-docker for x86_64
// 'ubuntu-24.04', // bin/spc for x86_64
'ubuntu-24.04', // bin/spc for x86_64
'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64
'ubuntu-24.04-arm', // bin/spc for arm64
// 'windows-latest', // .\bin\spc.ps1