From 5a0fd40dc49ffca1a5889f0bed98105e1fc843de Mon Sep 17 00:00:00 2001 From: Marc Date: Mon, 1 Dec 2025 09:55:46 +0100 Subject: [PATCH 01/21] update libwebp and libxml2 --- config/source.json | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/config/source.json b/config/source.json index 9a80cd059..689594a76 100644 --- a/config/source.json +++ b/config/source.json @@ -771,8 +771,9 @@ ] }, "libwebp": { - "type": "url", - "url": "https://github.com/webmproject/libwebp/archive/refs/tags/v1.3.2.tar.gz", + "type": "ghtagtar", + "repo": "webmproject/libwebp", + "match": "v1\\.\\d+\\.\\d+$", "provide-pre-built": true, "license": { "type": "file", @@ -780,8 +781,10 @@ } }, "libxml2": { - "type": "url", - "url": "https://github.com/GNOME/libxml2/archive/refs/tags/v2.12.5.tar.gz", + "type": "ghtagtar", + "repo": "GNOME/libxml2", + "match": "v2\\.\\d+\\.\\d+$", + "provide-pre-built": false, "license": { "type": "file", "path": "Copyright" From 7204d277b4f3e92b3b3dd9fe030b1ae7bc9b7cb5 Mon Sep 17 00:00:00 2001 From: Marc Date: Mon, 1 Dec 2025 11:39:56 +0100 Subject: [PATCH 02/21] Update PHP extensions for Linux and Darwin --- src/globals/test-extensions.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index f44914ece..8a30b008e 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -50,14 +50,14 @@ // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'bcmath', + 'Linux', 'Darwin' => 'bcmath,xsl,xml', 'Windows' => 'bcmath', }; // If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`). $shared_extensions = match (PHP_OS_FAMILY) { - 'Linux' => 'pcov', - 'Darwin' => 'pcov', + 'Linux' => '', + 'Darwin' => '', 'Windows' => '', }; From 14b822a185379b62c9daae3259bccd320942fcd7 Mon Sep 17 00:00:00 2001 From: henderkes Date: Mon, 1 Dec 2025 16:55:52 +0100 Subject: [PATCH 03/21] don't build avx2 if we don't have it --- src/SPC/builder/unix/library/libjxl.php | 18 +++++++++++------- src/SPC/builder/unix/library/libwebp.php | 7 ++++++- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/SPC/builder/unix/library/libjxl.php b/src/SPC/builder/unix/library/libjxl.php index 13f8481b1..4c922d9df 100644 --- a/src/SPC/builder/unix/library/libjxl.php +++ b/src/SPC/builder/unix/library/libjxl.php @@ -29,13 +29,17 @@ protected function build(): void ); if (ToolchainManager::getToolchainClass() === ZigToolchain::class) { - $cmake->addConfigureArgs( - '-DCXX_MAVX512F_SUPPORTED:BOOL=FALSE', - '-DCXX_MAVX512DQ_SUPPORTED:BOOL=FALSE', - '-DCXX_MAVX512CD_SUPPORTED:BOOL=FALSE', - '-DCXX_MAVX512BW_SUPPORTED:BOOL=FALSE', - '-DCXX_MAVX512VL_SUPPORTED:BOOL=FALSE' - ); + $cflags = getenv('SPC_DEFAULT_C_FLAGS') ?: getenv('CFLAGS') ?: ''; + $has_avx512 = str_contains($cflags, '-mavx512') || str_contains($cflags, '-march=x86-64-v4'); + if (!$has_avx512) { + $cmake->addConfigureArgs( + '-DCXX_MAVX512F_SUPPORTED:BOOL=FALSE', + '-DCXX_MAVX512DQ_SUPPORTED:BOOL=FALSE', + '-DCXX_MAVX512CD_SUPPORTED:BOOL=FALSE', + '-DCXX_MAVX512BW_SUPPORTED:BOOL=FALSE', + '-DCXX_MAVX512VL_SUPPORTED:BOOL=FALSE' + ); + } } $cmake->build(); diff --git a/src/SPC/builder/unix/library/libwebp.php b/src/SPC/builder/unix/library/libwebp.php index 46a88af49..788d069fb 100644 --- a/src/SPC/builder/unix/library/libwebp.php +++ b/src/SPC/builder/unix/library/libwebp.php @@ -10,8 +10,13 @@ trait libwebp { protected function build(): void { + $cflags = getenv('SPC_DEFAULT_C_FLAGS') ?: getenv('CFLAGS') ?: ''; + $has_avx2 = str_contains($cflags, '-mavx2') || str_contains($cflags, '-march=x86-64-v2') || str_contains($cflags, '-march=x86-64-v3'); UnixCMakeExecutor::create($this) - ->addConfigureArgs('-DWEBP_BUILD_EXTRAS=ON') + ->addConfigureArgs( + '-DWEBP_BUILD_EXTRAS=ON', + '-DWEBP_ENABLE_SIMD=' . ($has_avx2 ? 'ON' : 'OFF'), + ) ->build(); // patch pkgconfig $this->patchPkgconfPrefix(patch_option: PKGCONF_PATCH_PREFIX | PKGCONF_PATCH_LIBDIR); From d1041c57dcc12adef278fe592ba7e1edb5b998bd Mon Sep 17 00:00:00 2001 From: henderkes Date: Mon, 1 Dec 2025 17:05:50 +0100 Subject: [PATCH 04/21] remove openssl source/test dir (4.1gb?!) --- src/SPC/builder/linux/library/openssl.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SPC/builder/linux/library/openssl.php b/src/SPC/builder/linux/library/openssl.php index d9e04b323..7a4681976 100644 --- a/src/SPC/builder/linux/library/openssl.php +++ b/src/SPC/builder/linux/library/openssl.php @@ -80,5 +80,6 @@ public function build(): void } FileSystem::replaceFileRegex(BUILD_LIB_PATH . '/pkgconfig/libcrypto.pc', '/Libs.private:.*/m', 'Requires.private: zlib'); FileSystem::replaceFileRegex(BUILD_LIB_PATH . '/cmake/OpenSSL/OpenSSLConfig.cmake', '/set\(OPENSSL_LIBCRYPTO_DEPENDENCIES .*\)/m', 'set(OPENSSL_LIBCRYPTO_DEPENDENCIES "${OPENSSL_LIBRARY_DIR}/libz.a")'); + FileSystem::removeDir($this->source_dir . '/test'); } } From 7f863d182f80811792da2eac9edf4f43eaed7677 Mon Sep 17 00:00:00 2001 From: henderkes Date: Mon, 1 Dec 2025 17:10:56 +0100 Subject: [PATCH 05/21] don't remove dir, just don't build tests --- src/SPC/builder/linux/library/openssl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/linux/library/openssl.php b/src/SPC/builder/linux/library/openssl.php index 7a4681976..a78b6a642 100644 --- a/src/SPC/builder/linux/library/openssl.php +++ b/src/SPC/builder/linux/library/openssl.php @@ -62,6 +62,7 @@ public function build(): void "{$zlib_extra}" . 'enable-pie ' . 'no-legacy ' . + 'no-tests ' . "linux-{$arch}" ) ->exec('make clean') @@ -80,6 +81,5 @@ public function build(): void } FileSystem::replaceFileRegex(BUILD_LIB_PATH . '/pkgconfig/libcrypto.pc', '/Libs.private:.*/m', 'Requires.private: zlib'); FileSystem::replaceFileRegex(BUILD_LIB_PATH . '/cmake/OpenSSL/OpenSSLConfig.cmake', '/set\(OPENSSL_LIBCRYPTO_DEPENDENCIES .*\)/m', 'set(OPENSSL_LIBCRYPTO_DEPENDENCIES "${OPENSSL_LIBRARY_DIR}/libz.a")'); - FileSystem::removeDir($this->source_dir . '/test'); } } From b965ffcd820cfc3c319b7f41ae6170fe7ca82616 Mon Sep 17 00:00:00 2001 From: henderkes Date: Mon, 1 Dec 2025 17:16:59 +0100 Subject: [PATCH 06/21] don't build extra programs --- src/SPC/builder/unix/library/libwebp.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/unix/library/libwebp.php b/src/SPC/builder/unix/library/libwebp.php index 788d069fb..2ad616e0b 100644 --- a/src/SPC/builder/unix/library/libwebp.php +++ b/src/SPC/builder/unix/library/libwebp.php @@ -14,7 +14,7 @@ protected function build(): void $has_avx2 = str_contains($cflags, '-mavx2') || str_contains($cflags, '-march=x86-64-v2') || str_contains($cflags, '-march=x86-64-v3'); UnixCMakeExecutor::create($this) ->addConfigureArgs( - '-DWEBP_BUILD_EXTRAS=ON', + '-DWEBP_BUILD_EXTRAS=OFF', '-DWEBP_ENABLE_SIMD=' . ($has_avx2 ? 'ON' : 'OFF'), ) ->build(); From c051a48d56ee79e855ebc188bf2550167c28e374 Mon Sep 17 00:00:00 2001 From: henderkes Date: Mon, 1 Dec 2025 17:28:59 +0100 Subject: [PATCH 07/21] don't add -l:libstdc++.a if we're not actually using gcc/clang --- src/SPC/builder/extension/imagick.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/SPC/builder/extension/imagick.php b/src/SPC/builder/extension/imagick.php index bef772ee6..0fda41ea8 100644 --- a/src/SPC/builder/extension/imagick.php +++ b/src/SPC/builder/extension/imagick.php @@ -5,6 +5,8 @@ namespace SPC\builder\extension; use SPC\builder\Extension; +use SPC\toolchain\ToolchainManager; +use SPC\toolchain\ZigToolchain; use SPC\util\CustomExt; #[CustomExt('imagick')] @@ -19,7 +21,7 @@ public function getUnixConfigureArg(bool $shared = false): string protected function splitLibsIntoStaticAndShared(string $allLibs): array { [$static, $shared] = parent::splitLibsIntoStaticAndShared($allLibs); - if (str_contains(getenv('PATH'), 'rh/devtoolset') || str_contains(getenv('PATH'), 'rh/gcc-toolset')) { + if (ToolchainManager::getToolchainClass() !== ZigToolchain::class && str_contains(getenv('PATH'), 'rh/devtoolset') || str_contains(getenv('PATH'), 'rh/gcc-toolset')) { $static .= ' -l:libstdc++.a'; $shared = str_replace('-lstdc++', '', $shared); } From 150d866c1504a3a8928b1b763f980f672ea826a5 Mon Sep 17 00:00:00 2001 From: henderkes Date: Mon, 1 Dec 2025 19:12:43 +0100 Subject: [PATCH 08/21] revert turning off sse for libwebp, need to check why debian fails building --- src/SPC/builder/extension/imagick.php | 4 +++- src/SPC/builder/unix/library/libwebp.php | 5 +---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/SPC/builder/extension/imagick.php b/src/SPC/builder/extension/imagick.php index 0fda41ea8..a548a8a3d 100644 --- a/src/SPC/builder/extension/imagick.php +++ b/src/SPC/builder/extension/imagick.php @@ -21,7 +21,9 @@ public function getUnixConfigureArg(bool $shared = false): string protected function splitLibsIntoStaticAndShared(string $allLibs): array { [$static, $shared] = parent::splitLibsIntoStaticAndShared($allLibs); - if (ToolchainManager::getToolchainClass() !== ZigToolchain::class && str_contains(getenv('PATH'), 'rh/devtoolset') || str_contains(getenv('PATH'), 'rh/gcc-toolset')) { + if (ToolchainManager::getToolchainClass() !== ZigToolchain::class && + (str_contains(getenv('PATH'), 'rh/devtoolset') || str_contains(getenv('PATH'), 'rh/gcc-toolset')) + ) { $static .= ' -l:libstdc++.a'; $shared = str_replace('-lstdc++', '', $shared); } diff --git a/src/SPC/builder/unix/library/libwebp.php b/src/SPC/builder/unix/library/libwebp.php index 2ad616e0b..88a07f8c3 100644 --- a/src/SPC/builder/unix/library/libwebp.php +++ b/src/SPC/builder/unix/library/libwebp.php @@ -10,12 +10,9 @@ trait libwebp { protected function build(): void { - $cflags = getenv('SPC_DEFAULT_C_FLAGS') ?: getenv('CFLAGS') ?: ''; - $has_avx2 = str_contains($cflags, '-mavx2') || str_contains($cflags, '-march=x86-64-v2') || str_contains($cflags, '-march=x86-64-v3'); UnixCMakeExecutor::create($this) ->addConfigureArgs( - '-DWEBP_BUILD_EXTRAS=OFF', - '-DWEBP_ENABLE_SIMD=' . ($has_avx2 ? 'ON' : 'OFF'), + '-DWEBP_BUILD_EXTRAS=OFF' ) ->build(); // patch pkgconfig From 22d263c0a85ccb5e99a8a19dfcae7e8532a7ac63 Mon Sep 17 00:00:00 2001 From: henderkes Date: Mon, 1 Dec 2025 19:27:44 +0100 Subject: [PATCH 09/21] maybe explicit mavx2?! --- src/SPC/builder/unix/library/libwebp.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/SPC/builder/unix/library/libwebp.php b/src/SPC/builder/unix/library/libwebp.php index 88a07f8c3..ad00259a6 100644 --- a/src/SPC/builder/unix/library/libwebp.php +++ b/src/SPC/builder/unix/library/libwebp.php @@ -11,6 +11,9 @@ trait libwebp protected function build(): void { UnixCMakeExecutor::create($this) + ->appendEnv([ + 'CFLAGS' => GNU_ARCH === 'x86_64' ? '-mavx2' : '', + ]) ->addConfigureArgs( '-DWEBP_BUILD_EXTRAS=OFF' ) From 5b4f4f8e55d4716cc222652376d42c3522f7b3df Mon Sep 17 00:00:00 2001 From: henderkes Date: Mon, 1 Dec 2025 19:55:51 +0100 Subject: [PATCH 10/21] maybe? --- src/SPC/builder/unix/library/libwebp.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/SPC/builder/unix/library/libwebp.php b/src/SPC/builder/unix/library/libwebp.php index ad00259a6..54f9e7847 100644 --- a/src/SPC/builder/unix/library/libwebp.php +++ b/src/SPC/builder/unix/library/libwebp.php @@ -5,17 +5,25 @@ namespace SPC\builder\unix\library; use SPC\util\executor\UnixCMakeExecutor; +use SPC\util\SPCTarget; trait libwebp { protected function build(): void { UnixCMakeExecutor::create($this) - ->appendEnv([ - 'CFLAGS' => GNU_ARCH === 'x86_64' ? '-mavx2' : '', - ]) ->addConfigureArgs( - '-DWEBP_BUILD_EXTRAS=OFF' + '-DWEBP_BUILD_EXTRAS=OFF', + '-DWEBP_BUILD_ANIM_UTILS=OFF', + '-DWEBP_BUILD_CWEBP=OFF', + '-DWEBP_BUILD_DWEBP=OFF', + '-DWEBP_BUILD_GIF2WEBP=OFF', + '-DWEBP_BUILD_IMG2WEBP=OFF', + '-DWEBP_BUILD_VWEBP=OFF', + '-DWEBP_BUILD_WEBPINFO=OFF', + '-DWEBP_BUILD_WEBPMUX=OFF', + '-DWEBP_BUILD_FUZZTEST=OFF', + SPCTarget::getLibcVersion() === '2.31' && GNU_ARCH === 'x86_64' ? '-DWEBP_ENABLE_SIMD=OFF' : '' // fix an edge bug for debian 11 with gcc 10 ) ->build(); // patch pkgconfig From b8444070eea11ca75bd29764a5dfd159580e01d8 Mon Sep 17 00:00:00 2001 From: henderkes Date: Mon, 1 Dec 2025 20:41:58 +0100 Subject: [PATCH 11/21] update go-xcaddy version automatically --- src/SPC/store/pkg/GoXcaddy.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SPC/store/pkg/GoXcaddy.php b/src/SPC/store/pkg/GoXcaddy.php index 0c1c6f8c6..93821aaa9 100644 --- a/src/SPC/store/pkg/GoXcaddy.php +++ b/src/SPC/store/pkg/GoXcaddy.php @@ -48,10 +48,10 @@ public function fetch(string $name, bool $force = false, ?array $config = null): 'macos' => 'darwin', default => throw new \InvalidArgumentException('Unsupported OS: ' . $name), }; - $go_version = '1.25.0'; + [$go_version] = explode("\n", Downloader::curlExec('https://go.dev/VERSION?m=text')); $config = [ 'type' => 'url', - 'url' => "https://go.dev/dl/go{$go_version}.{$os}-{$arch}.tar.gz", + 'url' => "https://go.dev/dl/{$go_version}.{$os}-{$arch}.tar.gz", ]; Downloader::downloadPackage($name, $config, $force); } From 719d818fd1e75be83a9b34c90551c7b1ed0bb0a8 Mon Sep 17 00:00:00 2001 From: henderkes Date: Tue, 2 Dec 2025 21:34:32 +0100 Subject: [PATCH 12/21] we need to check for structure of pdo_sqlsrv extension --- src/SPC/builder/extension/pdo_sqlsrv.php | 26 ++++++++ src/SPC/store/FileSystem.php | 76 ++++++++++++------------ 2 files changed, 64 insertions(+), 38 deletions(-) create mode 100644 src/SPC/builder/extension/pdo_sqlsrv.php diff --git a/src/SPC/builder/extension/pdo_sqlsrv.php b/src/SPC/builder/extension/pdo_sqlsrv.php new file mode 100644 index 000000000..32697b169 --- /dev/null +++ b/src/SPC/builder/extension/pdo_sqlsrv.php @@ -0,0 +1,26 @@ +source_dir . '/config.m4') && is_dir($this->source_dir . '/source/pdo_sqlsrv')) { + FileSystem::moveFileOrDir($this->source_dir . '/LICENSE', $this->source_dir . '/source/pdo_sqlsrv/LICENSE'); + FileSystem::moveFileOrDir($this->source_dir . '/source/shared', $this->source_dir . '/source/pdo_sqlsrv/shared'); + FileSystem::moveFileOrDir($this->source_dir . '/source/pdo_sqlsrv', SOURCE_PATH . '/pdo_sqlsrv'); + FileSystem::removeDir($this->source_dir); + FileSystem::moveFileOrDir(SOURCE_PATH . '/pdo_sqlsrv', $this->source_dir); + return true; + } + return false; + } +} diff --git a/src/SPC/store/FileSystem.php b/src/SPC/store/FileSystem.php index 3b88a2bce..f6c538bdf 100644 --- a/src/SPC/store/FileSystem.php +++ b/src/SPC/store/FileSystem.php @@ -572,6 +572,44 @@ public static function replaceFileLineContainsString(string $file, string $find, return file_put_contents($file, implode('', $lines)); } + /** + * Move file or directory, handling cross-device scenarios + * Uses rename() if possible, falls back to copy+delete for cross-device moves + * + * @param string $source Source path + * @param string $dest Destination path + */ + public static function moveFileOrDir(string $source, string $dest): void + { + $source = self::convertPath($source); + $dest = self::convertPath($dest); + + // Check if source and dest are on the same device to avoid cross-device rename errors + $source_stat = @stat($source); + $dest_parent = dirname($dest); + $dest_stat = @stat($dest_parent); + + // Only use rename if on same device + if ($source_stat !== false && $dest_stat !== false && $source_stat['dev'] === $dest_stat['dev']) { + if (@rename($source, $dest)) { + return; + } + } + + // Fall back to copy + delete for cross-device moves or if rename failed + if (is_dir($source)) { + self::copyDir($source, $dest); + self::removeDir($source); + } else { + if (!copy($source, $dest)) { + throw new FileSystemException("Failed to copy file from {$source} to {$dest}"); + } + if (!unlink($source)) { + throw new FileSystemException("Failed to remove source file: {$source}"); + } + } + } + private static function extractArchive(string $filename, string $target): void { // Create base dir @@ -648,44 +686,6 @@ private static function extractWithType(string $source_type, string $filename, s }; } - /** - * Move file or directory, handling cross-device scenarios - * Uses rename() if possible, falls back to copy+delete for cross-device moves - * - * @param string $source Source path - * @param string $dest Destination path - */ - private static function moveFileOrDir(string $source, string $dest): void - { - $source = self::convertPath($source); - $dest = self::convertPath($dest); - - // Check if source and dest are on the same device to avoid cross-device rename errors - $source_stat = @stat($source); - $dest_parent = dirname($dest); - $dest_stat = @stat($dest_parent); - - // Only use rename if on same device - if ($source_stat !== false && $dest_stat !== false && $source_stat['dev'] === $dest_stat['dev']) { - if (@rename($source, $dest)) { - return; - } - } - - // Fall back to copy + delete for cross-device moves or if rename failed - if (is_dir($source)) { - self::copyDir($source, $dest); - self::removeDir($source); - } else { - if (!copy($source, $dest)) { - throw new FileSystemException("Failed to copy file from {$source} to {$dest}"); - } - if (!unlink($source)) { - throw new FileSystemException("Failed to remove source file: {$source}"); - } - } - } - /** * Unzip file with stripping top-level directory */ From 98773ee5a6fab2c7366cf9e8c4024ff7043ca92e Mon Sep 17 00:00:00 2001 From: henderkes Date: Wed, 3 Dec 2025 15:02:14 +0100 Subject: [PATCH 13/21] zig toolchain can always use libc --- src/SPC/builder/linux/library/liburing.php | 23 +++++++++------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/SPC/builder/linux/library/liburing.php b/src/SPC/builder/linux/library/liburing.php index 82249cf80..9a67f50c4 100644 --- a/src/SPC/builder/linux/library/liburing.php +++ b/src/SPC/builder/linux/library/liburing.php @@ -6,6 +6,8 @@ use SPC\builder\linux\SystemUtil; use SPC\store\FileSystem; +use SPC\toolchain\GccNativeToolchain; +use SPC\toolchain\ToolchainManager; use SPC\util\executor\UnixAutoconfExecutor; use SPC\util\SPCTarget; @@ -15,26 +17,19 @@ class liburing extends LinuxLibraryBase public function patchBeforeBuild(): bool { - if (!SystemUtil::isMuslDist()) { - return false; + if (SystemUtil::isMuslDist()) { + FileSystem::replaceFileStr($this->source_dir . '/configure', 'realpath -s', 'realpath'); + return true; } - FileSystem::replaceFileStr($this->source_dir . '/configure', 'realpath -s', 'realpath'); - return true; + return false; } protected function build(): void { - $use_libc = SPCTarget::getLibc() !== 'glibc' || version_compare(SPCTarget::getLibcVersion(), '2.30', '>='); + $use_libc = ToolchainManager::getToolchainClass() !== GccNativeToolchain::class || version_compare(SPCTarget::getLibcVersion(), '2.30', '>='); $make = UnixAutoconfExecutor::create($this); - if (!$use_libc) { - $make->appendEnv([ - 'CC' => 'gcc', // libc-less version fails to compile with clang or zig - 'CXX' => 'g++', - 'AR' => 'ar', - 'LD' => 'ld', - ]); - } else { + if ($use_libc) { $make->appendEnv([ 'CFLAGS' => '-D_GNU_SOURCE', ]); @@ -51,7 +46,7 @@ protected function build(): void $use_libc ? '--use-libc' : '', ) ->configure() - ->make('library', 'install ENABLE_SHARED=0', with_clean: false); + ->make('library ENABLE_SHARED=0', 'install ENABLE_SHARED=0', with_clean: false); $this->patchPkgconfPrefix(); } From 66840a8eed896b8d3769861394198ff336d7336e Mon Sep 17 00:00:00 2001 From: henderkes Date: Fri, 5 Dec 2025 09:15:22 +0100 Subject: [PATCH 14/21] update xdebug to use pie sources --- config/source.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/config/source.json b/config/source.json index 689594a76..c96822d6b 100644 --- a/config/source.json +++ b/config/source.json @@ -1172,9 +1172,8 @@ } }, "xdebug": { - "type": "url", - "url": "https://pecl.php.net/get/xdebug", - "filename": "xdebug.tgz", + "type": "pie", + "repo": "xdebug/xdebug", "license": { "type": "file", "path": "LICENSE" From 7bdcda1d626fa6c1b935168c3741079908630230 Mon Sep 17 00:00:00 2001 From: henderkes Date: Fri, 5 Dec 2025 11:37:35 +0100 Subject: [PATCH 15/21] gmp can't build with std=c23 (default with gcc 15) --- src/SPC/builder/unix/library/gmp.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/SPC/builder/unix/library/gmp.php b/src/SPC/builder/unix/library/gmp.php index f09976d8c..cb5d76f9c 100644 --- a/src/SPC/builder/unix/library/gmp.php +++ b/src/SPC/builder/unix/library/gmp.php @@ -10,7 +10,12 @@ trait gmp { protected function build(): void { - UnixAutoconfExecutor::create($this)->configure()->make(); + UnixAutoconfExecutor::create($this) + ->appendEnv([ + 'CFLAGS' => '-std=gnu99', + ]) + ->configure() + ->make(); $this->patchPkgconfPrefix(['gmp.pc']); } } From 6b5f7027196a6e36e9ca1c755177fe71282a2638 Mon Sep 17 00:00:00 2001 From: henderkes Date: Fri, 5 Dec 2025 11:43:51 +0100 Subject: [PATCH 16/21] ncurses can't build with std=c23 (default with gcc 15) --- src/SPC/builder/unix/library/ncurses.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SPC/builder/unix/library/ncurses.php b/src/SPC/builder/unix/library/ncurses.php index 27725c3d5..31e61b1e7 100644 --- a/src/SPC/builder/unix/library/ncurses.php +++ b/src/SPC/builder/unix/library/ncurses.php @@ -16,6 +16,7 @@ protected function build(): void UnixAutoconfExecutor::create($this) ->appendEnv([ + 'CFLAGS' => '-std=gnu99', 'LDFLAGS' => SPCTarget::isStatic() ? '-static' : '', ]) ->configure( From 1d5aec037b6f4bae508a2a679cf25c4eb0076023 Mon Sep 17 00:00:00 2001 From: henderkes Date: Fri, 5 Dec 2025 12:14:57 +0100 Subject: [PATCH 17/21] c17 instead --- src/SPC/builder/extension/mongodb.php | 5 +++++ src/SPC/builder/unix/library/gmp.php | 2 +- src/SPC/builder/unix/library/ncurses.php | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/SPC/builder/extension/mongodb.php b/src/SPC/builder/extension/mongodb.php index 745417bb1..1c22f2899 100644 --- a/src/SPC/builder/extension/mongodb.php +++ b/src/SPC/builder/extension/mongodb.php @@ -24,4 +24,9 @@ public function getUnixConfigureArg(bool $shared = false): string $arg .= $this->builder->getLib('zlib') ? ' --with-mongodb-zlib=yes ' : ' --with-mongodb-zlib=bundled '; return clean_spaces($arg); } + + protected function getExtraEnv(): array + { + return ['CFLAGS' => '-std=c17']; + } } diff --git a/src/SPC/builder/unix/library/gmp.php b/src/SPC/builder/unix/library/gmp.php index cb5d76f9c..f625274f6 100644 --- a/src/SPC/builder/unix/library/gmp.php +++ b/src/SPC/builder/unix/library/gmp.php @@ -12,7 +12,7 @@ protected function build(): void { UnixAutoconfExecutor::create($this) ->appendEnv([ - 'CFLAGS' => '-std=gnu99', + 'CFLAGS' => '-std=c17', ]) ->configure() ->make(); diff --git a/src/SPC/builder/unix/library/ncurses.php b/src/SPC/builder/unix/library/ncurses.php index 31e61b1e7..2859f556d 100644 --- a/src/SPC/builder/unix/library/ncurses.php +++ b/src/SPC/builder/unix/library/ncurses.php @@ -16,7 +16,7 @@ protected function build(): void UnixAutoconfExecutor::create($this) ->appendEnv([ - 'CFLAGS' => '-std=gnu99', + 'CFLAGS' => '-std=c17', 'LDFLAGS' => SPCTarget::isStatic() ? '-static' : '', ]) ->configure( From b2182b4fe1d0278c1efcdbfce7a5b0268fb4aae0 Mon Sep 17 00:00:00 2001 From: henderkes Date: Fri, 5 Dec 2025 12:20:14 +0100 Subject: [PATCH 18/21] use source extract hook for pdo_sqlsrv --- src/SPC/builder/extension/pdo_sqlsrv.php | 26 ------------------------ src/SPC/store/SourcePatcher.php | 18 ++++++++++++++++ 2 files changed, 18 insertions(+), 26 deletions(-) delete mode 100644 src/SPC/builder/extension/pdo_sqlsrv.php diff --git a/src/SPC/builder/extension/pdo_sqlsrv.php b/src/SPC/builder/extension/pdo_sqlsrv.php deleted file mode 100644 index 32697b169..000000000 --- a/src/SPC/builder/extension/pdo_sqlsrv.php +++ /dev/null @@ -1,26 +0,0 @@ -source_dir . '/config.m4') && is_dir($this->source_dir . '/source/pdo_sqlsrv')) { - FileSystem::moveFileOrDir($this->source_dir . '/LICENSE', $this->source_dir . '/source/pdo_sqlsrv/LICENSE'); - FileSystem::moveFileOrDir($this->source_dir . '/source/shared', $this->source_dir . '/source/pdo_sqlsrv/shared'); - FileSystem::moveFileOrDir($this->source_dir . '/source/pdo_sqlsrv', SOURCE_PATH . '/pdo_sqlsrv'); - FileSystem::removeDir($this->source_dir); - FileSystem::moveFileOrDir(SOURCE_PATH . '/pdo_sqlsrv', $this->source_dir); - return true; - } - return false; - } -} diff --git a/src/SPC/store/SourcePatcher.php b/src/SPC/store/SourcePatcher.php index f628544fe..0068f53e3 100644 --- a/src/SPC/store/SourcePatcher.php +++ b/src/SPC/store/SourcePatcher.php @@ -25,6 +25,7 @@ public static function init(): void FileSystem::addSourceExtractHook('php-src', [__CLASS__, 'patchFfiCentos7FixO3strncmp']); FileSystem::addSourceExtractHook('sqlsrv', [__CLASS__, 'patchSQLSRVWin32']); FileSystem::addSourceExtractHook('pdo_sqlsrv', [__CLASS__, 'patchSQLSRVWin32']); + FileSystem::addSourceExtractHook('pdo_sqlsrv', [__CLASS__, 'patchSQLSRVPhp85']); FileSystem::addSourceExtractHook('yaml', [__CLASS__, 'patchYamlWin32']); FileSystem::addSourceExtractHook('libyaml', [__CLASS__, 'patchLibYaml']); FileSystem::addSourceExtractHook('php-src', [__CLASS__, 'patchImapLicense']); @@ -432,6 +433,23 @@ public static function patchSQLSRVWin32(string $source_name): bool return false; } + /** + * Fix the compilation issue of pdo_sqlsrv with php 8.5 + */ + public static function patchSQLSRVPhp85(): bool + { + $source_dir = SOURCE_PATH . '/php-src/ext/pdo_sqlsrv'; + if (!file_exists($source_dir . '/config.m4') && is_dir($source_dir . '/source/pdo_sqlsrv')) { + FileSystem::moveFileOrDir($source_dir . '/LICENSE', $source_dir . '/source/pdo_sqlsrv/LICENSE'); + FileSystem::moveFileOrDir($source_dir . '/source/shared', $source_dir . '/source/pdo_sqlsrv/shared'); + FileSystem::moveFileOrDir($source_dir . '/source/pdo_sqlsrv', SOURCE_PATH . '/pdo_sqlsrv'); + FileSystem::removeDir($source_dir); + FileSystem::moveFileOrDir(SOURCE_PATH . '/pdo_sqlsrv', $source_dir); + return true; + } + return false; + } + public static function patchYamlWin32(): bool { FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/yaml/config.w32', "lib.substr(lib.length - 6, 6) == '_a.lib'", "lib.substr(lib.length - 6, 6) == '_a.lib' || 'yes' == 'yes'"); From 47ab5d7584f68f1963d9fd8996e103040b65af85 Mon Sep 17 00:00:00 2001 From: henderkes Date: Fri, 5 Dec 2025 13:57:28 +0100 Subject: [PATCH 19/21] use c17 for extensions as well? --- src/SPC/builder/Extension.php | 2 +- src/SPC/builder/extension/mongodb.php | 5 ----- src/SPC/builder/extension/pgsql.php | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 08b403e61..57ed9dd38 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -576,7 +576,7 @@ protected function addExtensionDependency(string $name, bool $optional = false): protected function getExtraEnv(): array { - return []; + return ['CFLAGS' => '-std=c17']; } /** diff --git a/src/SPC/builder/extension/mongodb.php b/src/SPC/builder/extension/mongodb.php index 1c22f2899..745417bb1 100644 --- a/src/SPC/builder/extension/mongodb.php +++ b/src/SPC/builder/extension/mongodb.php @@ -24,9 +24,4 @@ public function getUnixConfigureArg(bool $shared = false): string $arg .= $this->builder->getLib('zlib') ? ' --with-mongodb-zlib=yes ' : ' --with-mongodb-zlib=bundled '; return clean_spaces($arg); } - - protected function getExtraEnv(): array - { - return ['CFLAGS' => '-std=c17']; - } } diff --git a/src/SPC/builder/extension/pgsql.php b/src/SPC/builder/extension/pgsql.php index f22f7ba68..06efa8b13 100644 --- a/src/SPC/builder/extension/pgsql.php +++ b/src/SPC/builder/extension/pgsql.php @@ -45,7 +45,7 @@ public function getWindowsConfigureArg(bool $shared = false): string protected function getExtraEnv(): array { return [ - 'CFLAGS' => '-Wno-int-conversion', + 'CFLAGS' => '-std=c17 -Wno-int-conversion', ]; } } From dce63d3c87ae88dce86731a61b68b525f4c2a535 Mon Sep 17 00:00:00 2001 From: henderkes Date: Sat, 6 Dec 2025 11:18:10 +0100 Subject: [PATCH 20/21] we need extensions to explicitly tell which c std they need --- src/SPC/builder/Extension.php | 2 +- src/SPC/builder/extension/mongodb.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 57ed9dd38..bc475d115 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -576,7 +576,7 @@ protected function addExtensionDependency(string $name, bool $optional = false): protected function getExtraEnv(): array { - return ['CFLAGS' => '-std=c17']; + return ['CFLAGS' => '']; } /** diff --git a/src/SPC/builder/extension/mongodb.php b/src/SPC/builder/extension/mongodb.php index 745417bb1..08861e4ef 100644 --- a/src/SPC/builder/extension/mongodb.php +++ b/src/SPC/builder/extension/mongodb.php @@ -24,4 +24,9 @@ public function getUnixConfigureArg(bool $shared = false): string $arg .= $this->builder->getLib('zlib') ? ' --with-mongodb-zlib=yes ' : ' --with-mongodb-zlib=bundled '; return clean_spaces($arg); } + + public function getExtraEnv(): array + { + return ['CFLAGS' => '-std=c17']; + } } From a54021bf1966bd9bd92014916c0cb88cc4dd5a1d Mon Sep 17 00:00:00 2001 From: Marc Date: Wed, 10 Dec 2025 08:42:28 +0100 Subject: [PATCH 21/21] Apply suggestion from @henderkes --- src/SPC/builder/Extension.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index bc475d115..08b403e61 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -576,7 +576,7 @@ protected function addExtensionDependency(string $name, bool $optional = false): protected function getExtraEnv(): array { - return ['CFLAGS' => '']; + return []; } /**