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
+
+
+**[JetBrains](https://github.com/JetBrains)** provides core contributors with OSS Development Licenses
+
## Open-Source License
This project itself is licensed under MIT.
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"
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;"));
}
}
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}");
}
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;
- }
-}