mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-11 19:05:35 +08:00
fix event build
This commit is contained in:
@@ -38,7 +38,23 @@ class event extends Extension
|
||||
// Prevent event extension compile error on macOS
|
||||
if ($this->builder instanceof MacOSBuilder) {
|
||||
FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/main/php_config.h', '/^#define HAVE_OPENPTY 1$/m', '');
|
||||
return true;
|
||||
$patched = true;
|
||||
}
|
||||
return $this->patchLibeventConstPeer() || $patched;
|
||||
}
|
||||
|
||||
public function patchBeforeSharedMake(): bool
|
||||
{
|
||||
$patched = parent::patchBeforeSharedMake();
|
||||
return $this->patchLibeventConstPeer() || $patched;
|
||||
}
|
||||
|
||||
private function patchLibeventConstPeer(): bool
|
||||
{
|
||||
$patched = false;
|
||||
$file = SOURCE_PATH . '/php-src/ext/event/php8/classes/http_connection.c';
|
||||
if (is_file($file) && FileSystem::replaceFileRegex($file, '/^\tchar \*address;$/m', "\tconst char *address;")) {
|
||||
$patched = true;
|
||||
}
|
||||
return $patched;
|
||||
}
|
||||
|
||||
@@ -175,6 +175,16 @@ class Downloader
|
||||
hooks: [[CurlHook::class, 'setupGithubToken']],
|
||||
retries: self::getRetryAttempts()
|
||||
), true);
|
||||
if (($source['prefer-stable'] ?? false) === true) {
|
||||
$latest = json_decode(self::curlExec(
|
||||
url: "https://api.github.com/repos/{$source['repo']}/releases/latest",
|
||||
hooks: [[CurlHook::class, 'setupGithubToken']],
|
||||
retries: self::getRetryAttempts()
|
||||
), true);
|
||||
if (is_array($latest) && isset($latest['assets'])) {
|
||||
array_unshift($data, $latest);
|
||||
}
|
||||
}
|
||||
$url = null;
|
||||
$filename = null;
|
||||
foreach ($data as $release) {
|
||||
|
||||
Reference in New Issue
Block a user