mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-26 02:15:35 +08:00
forward-port feat/pgo fixes
Forward-port the genuinely-new fixes from feat/pgo (2026-06-09 .. 07-09) into v3's reorganized layout: - zig-cc.sh: prefix runtime-lib appends with `-x none` so the profile/crt/ cpu_model archives don't poison the following files as `-x c` sources - ZigToolchain: set ax_cv_have_func_attribute_ifunc=no under -flto (an ifunc in LTO bitcode crashes zig 0.16's lld during thin-link) - php configure: add --with-sysconfdir option; strip build-time env vars from phpinfo's "Configure Command" - ext-brotli / ext-zstd: switch to stable release/tag tarballs; brotli configures with --with-libbrotli - ext-event: patch libevent http_connection.c to use a const peer address (both static and shared builds) - ghrel downloader: prefer GitHub's /releases/latest (the semantically latest stable release) over publish-order iteration, so a newer-tagged prerelease (e.g. libevent 2.2.x-alpha) can't win over 2.1.x-stable Commits already present in v3 were skipped: protobuf-latest + libaom ENABLE_*=OFF (9398a667), the clang runtime -target flag (2adedc09), the runtime-bits fail-hard half of3823631a, and github prefer-stable's prerelease skip (incl. the ghtar /releases/latest path, already in v3).
This commit is contained in:
@@ -57,6 +57,16 @@ class GitHubRelease implements DownloadTypeInterface, ValidatorInterface, CheckU
|
||||
if (!is_array($data)) {
|
||||
throw new DownloaderException("Failed to get GitHub release API info for {$repo} from {$url}");
|
||||
}
|
||||
// GitHub's /releases list is ordered by publish date, so a newer-tagged prerelease
|
||||
// (e.g. 2.2.x-alpha) can precede the latest stable (2.1.x-stable). /releases/latest
|
||||
// returns the semantically latest stable release regardless of order; check it first.
|
||||
if ($prefer_stable) {
|
||||
$latest_url = str_replace('{repo}', $repo, self::API_URL) . '/latest';
|
||||
$latest = json_decode(default_shell()->executeCurl($latest_url, headers: $headers, retries: $retries) ?: '', true);
|
||||
if (is_array($latest) && isset($latest['assets'])) {
|
||||
array_unshift($data, $latest);
|
||||
}
|
||||
}
|
||||
foreach ($data as $release) {
|
||||
if ($prefer_stable && $release['prerelease'] === true) {
|
||||
continue;
|
||||
|
||||
@@ -75,6 +75,16 @@ class ZigToolchain implements UnixToolchainInterface
|
||||
$extra_vars = getenv('SPC_EXTRA_PHP_VARS') ?: '';
|
||||
GlobalEnvManager::putenv("SPC_EXTRA_PHP_VARS=ac_cv_func_strlcpy=no ac_cv_func_strlcat=no {$extra_vars}");
|
||||
|
||||
// An __attribute__((ifunc)) in LTO bitcode crashes zig 0.16's lld (LLVM 21)
|
||||
// during thin-link symbol resolution
|
||||
$all_flags = $cflags . ' ' . (getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS') ?: '') . ' ' . (getenv('SPC_DEFAULT_LD_FLAGS') ?: '');
|
||||
if (str_contains($all_flags, '-flto')) {
|
||||
$extra_vars = getenv('SPC_EXTRA_PHP_VARS') ?: '';
|
||||
if (!str_contains($extra_vars, 'ax_cv_have_func_attribute_ifunc')) {
|
||||
GlobalEnvManager::putenv("SPC_EXTRA_PHP_VARS={$extra_vars} ax_cv_have_func_attribute_ifunc=no");
|
||||
}
|
||||
}
|
||||
|
||||
$this->ensureCompilerRt();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user