From 55697ce801d1b245410ee68d75731ae9a3eff025 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Thu, 16 Jul 2026 14:59:36 +0800 Subject: [PATCH 1/5] Remove LinuxMuslCheck --- src/StaticPHP/Doctor/Item/LinuxMuslCheck.php | 123 ------------------- 1 file changed, 123 deletions(-) delete mode 100644 src/StaticPHP/Doctor/Item/LinuxMuslCheck.php diff --git a/src/StaticPHP/Doctor/Item/LinuxMuslCheck.php b/src/StaticPHP/Doctor/Item/LinuxMuslCheck.php deleted file mode 100644 index 2d871f0c..00000000 --- a/src/StaticPHP/Doctor/Item/LinuxMuslCheck.php +++ /dev/null @@ -1,123 +0,0 @@ -isStatic() - ) - ); - } - - /** @noinspection PhpUnused */ - #[CheckItem('if musl-wrapper is installed', limit_os: 'Linux', level: 800)] - public function checkMusl(): ?CheckResult - { - $musl_wrapper_lib = sprintf('/lib/ld-musl-%s.so.1', php_uname('m')); - if (file_exists($musl_wrapper_lib) && (file_exists('/usr/local/musl/lib/libc.a') || getenv('SPC_TOOLCHAIN') === ZigToolchain::class)) { - return null; - } - return CheckResult::fail('musl-wrapper is not installed on your system', 'fix-musl-wrapper'); - } - - #[CheckItem('if musl-cross-make is installed', limit_os: 'Linux', level: 799)] - public function checkMuslCrossMake(): ?CheckResult - { - if (getenv('SPC_TOOLCHAIN') === ZigToolchain::class && !LinuxUtil::isMuslDist()) { - return null; - } - $arch = arch2gnu(php_uname('m')); - $cross_compile_lib = "/usr/local/musl/{$arch}-linux-musl/lib/libc.a"; - $cross_compile_gcc = "/usr/local/musl/bin/{$arch}-linux-musl-gcc"; - if (file_exists($cross_compile_lib) && file_exists($cross_compile_gcc)) { - return CheckResult::ok(); - } - return CheckResult::fail('musl-cross-make is not installed on your system', 'fix-musl-cross-make'); - } - - #[FixItem('fix-musl-wrapper')] - public function fixMusl(): bool - { - $downloader = new ArtifactDownloader(interactive: false); - $downloader->add('musl-wrapper')->download(); - $extractor = new ArtifactExtractor(ApplicationContext::get(ArtifactCache::class)); - $extractor->extract('musl-wrapper'); - - // Apply CVE-2025-26519 patch and install musl wrapper - SourcePatcher::patchFile('musl-1.2.5_CVE-2025-26519_0001.patch', SOURCE_PATH . '/musl-wrapper'); - SourcePatcher::patchFile('musl-1.2.5_CVE-2025-26519_0002.patch', SOURCE_PATH . '/musl-wrapper'); - - $prefix = ''; - if (get_current_user() !== 'root') { - $prefix = 'sudo '; - logger()->warning('Current user is not root, using sudo for running command'); - } - $sysEnv = ['CC' => 'gcc', 'CXX' => 'g++', 'AR' => 'ar', 'LD' => 'ld', 'RANLIB' => 'ranlib']; - $envFlags = ''; - foreach ($sysEnv as $k => $v) { - $envFlags .= "{$k}={$v} "; - } - $envFlags = rtrim($envFlags); - $shell = shell()->cd(SOURCE_PATH . '/musl-wrapper') - ->setEnv($sysEnv) - ->exec('./configure --disable-gcc-wrapper') - ->exec('make -j'); - if ($prefix !== '') { - f_passthru('cd ' . SOURCE_PATH . "/musl-wrapper && {$envFlags} {$prefix}make install"); - } else { - $shell->exec("{$prefix}make install"); - } - return true; - } - - #[FixItem('fix-musl-cross-make')] - public function fixMuslCrossMake(): bool - { - // sudo - $prefix = ''; - if (get_current_user() !== 'root') { - $prefix = 'sudo '; - logger()->warning('Current user is not root, using sudo for running command'); - } - Shell::passthruCallback(function () { - InteractiveTerm::advance(); - }); - $downloader = new ArtifactDownloader(interactive: false); - $extractor = new ArtifactExtractor(ApplicationContext::get(ArtifactCache::class)); - $downloader->add('musl-toolchain')->download(); - $extractor->extract('musl-toolchain'); - $pkg_root = PKG_ROOT_PATH . '/musl-toolchain'; - f_passthru("{$prefix}cp -rf {$pkg_root}/* /usr/local/musl"); - FileSystem::removeDir($pkg_root); - return true; - } -} From 3a3602214dc8f6ba56f7ae62b3daa30660451d74 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Thu, 16 Jul 2026 14:59:53 +0800 Subject: [PATCH 2/5] Revert RANLIB in env.ini --- config/env.ini | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/env.ini b/config/env.ini index f9cde5a0..cec79915 100644 --- a/config/env.ini +++ b/config/env.ini @@ -100,7 +100,6 @@ SPC_TARGET=${GNU_ARCH}-linux-musl CC=${SPC_DEFAULT_CC} CXX=${SPC_DEFAULT_CXX} AR=${SPC_DEFAULT_AR} -RANLIB=${SPC_DEFAULT_RANLIB} LD=${SPC_DEFAULT_LD} ; default compiler flags, used in CMake toolchain file, openssl and pkg-config build SPC_DEFAULT_CFLAGS="-fPIC -O3 -pipe -fno-plt -fno-semantic-interposition -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffunction-sections -fdata-sections -Wno-unused-command-line-argument" @@ -143,7 +142,6 @@ SPC_USE_LLVM=system CC=${SPC_DEFAULT_CC} CXX=${SPC_DEFAULT_CXX} AR=${SPC_DEFAULT_AR} -RANLIB=${SPC_DEFAULT_RANLIB} LD=${SPC_DEFAULT_LD} ; default compiler flags, used in CMake toolchain file, openssl and pkg-config build SPC_DEFAULT_CFLAGS="--target=${MAC_ARCH}-apple-darwin -O3 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffunction-sections -fdata-sections" From 77a13fb02b08dbd7a18adf39f0bef88048cd0c2e Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Thu, 16 Jul 2026 15:00:18 +0800 Subject: [PATCH 3/5] Revert "Apply event changes in feat/pgo-v3" This reverts commit 977ea4a8f800dff5fa6c47bac05ded454d7e0b76. --- src/Package/Extension/event.php | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/src/Package/Extension/event.php b/src/Package/Extension/event.php index 2b9515cf..db119274 100644 --- a/src/Package/Extension/event.php +++ b/src/Package/Extension/event.php @@ -35,37 +35,12 @@ class event extends PhpExtensionPackage #[BeforeStage('php', [php::class, 'makeForUnix'], 'ext-event')] #[PatchDescription('Prevent event extension compile error on macOS')] - #[PatchDescription('Patch libevent http_connection.c to use a const peer address')] public function patchBeforeMake(PackageInstaller $installer): void { - $php_src = $installer->getTargetPackage('php')->getSourceDir(); // Prevent event extension compile error on macOS if (SystemTarget::getTargetOS() === 'Darwin') { + $php_src = $installer->getTargetPackage('php')->getSourceDir(); FileSystem::replaceFileRegex("{$php_src}/main/php_config.h", '/^#define HAVE_OPENPTY 1$/m', ''); } - $this->patchLibeventConstPeer("{$php_src}/ext/event"); - } - - #[BeforeStage('ext-event', [PhpExtensionPackage::class, 'makeForUnix'])] - #[PatchDescription('Patch libevent http_connection.c to use a const peer address')] - public function patchBeforeSharedMake(PhpExtensionPackage $pkg): void - { - $this->patchLibeventConstPeer($pkg->getSourceDir()); - } - - private function patchLibeventConstPeer(string $event_source_dir): bool - { - $file = "{$event_source_dir}/php8/classes/http_connection.c"; - if (!is_file($file)) { - return false; - } - // libevent >= 2.2 changed evhttp_connection_get_peer()'s - // address arg to `const char **` - $header = $this->getBuilder()->getBuildRootPath() . '/include/event2/http.h'; - $isConst = is_file($header) - && preg_match('/evhttp_connection_get_peer\s*\([^;]*\bconst\s+char\s*\*\*\s*address/s', file_get_contents($header)) === 1; - return (bool) ($isConst - ? FileSystem::replaceFileRegex($file, '/^\tchar \*address;$/m', "\tconst char *address;") - : FileSystem::replaceFileRegex($file, '/^\tconst char \*address;$/m', "\tchar *address;")); } } From 6c52febf5f5cd4d5dc614034253ab792b33e77ae Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Thu, 16 Jul 2026 15:02:58 +0800 Subject: [PATCH 4/5] Apply suggestion --- src/Package/Library/bzip2.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Package/Library/bzip2.php b/src/Package/Library/bzip2.php index 7f99c22b..09b418a2 100644 --- a/src/Package/Library/bzip2.php +++ b/src/Package/Library/bzip2.php @@ -17,8 +17,8 @@ class bzip2 #[PatchBeforeBuild] public function patchBeforeBuild(LibraryPackage $lib): void { - // Makefile pins -O2 -fPIC; inject SPC_DEFAULT_CFLAGS - $extra = deduplicate_flags(trim((string) getenv('SPC_DEFAULT_CFLAGS')) . ' -fPIC -Wall'); + // Inject SPC_DEFAULT_CFLAGS into the Makefile + $extra = deduplicate_flags(trim((string) getenv('SPC_DEFAULT_CFLAGS')) . ' -Wall'); FileSystem::replaceFileStr($lib->getSourceDir() . '/Makefile', 'CFLAGS=-Wall', "CFLAGS={$extra}"); } From 9cb3ee46976d91752e3a1a12f3d379290aeb2787 Mon Sep 17 00:00:00 2001 From: Marc Date: Tue, 21 Jul 2026 09:35:13 +0700 Subject: [PATCH 5/5] Add JetBrains logo and OSS license information Added JetBrains logo and information about OSS Development Licenses. --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 2c4df622..1617737e 100755 --- a/README.md +++ b/README.md @@ -146,6 +146,10 @@ You can sponsor me or my project from [GitHub Sponsor](https://github.com/crazyw NativePHP Logo +JetBrains Logo + +**[JetBrains](https://github.com/JetBrains)** provides core contributors with OSS Development Licenses + ## Open-Source License This project itself is licensed under MIT.