Compare commits

...

96 Commits

Author SHA1 Message Date
Jerry Ma
f2b2af774c pin zstd, proper fix: https://github.com/kjdev/php-ext-zstd/pull/100 (#1195) 2026-06-25 19:06:00 +08:00
henderkes
a78e6fa5f8 pin zstd, proper fix: https://github.com/kjdev/php-ext-zstd/pull/100 2026-06-25 15:39:18 +07:00
Marc
5d9e4e2c81 Revert "fix(xlswriter): fix macOS build with modern Clang (C23)" (#1122) 2026-06-04 09:45:26 +07:00
Marc
eb97711347 fix libheif (#1153) 2026-05-22 16:20:10 +07:00
henderkes
5c8ec7a56d fix libheif 2026-05-22 15:28:36 +07:00
Marc
e85cd55dba add pgo to frankenphp (default as of 1.12.3) (#1142) 2026-05-16 22:04:04 +07:00
Marc
f9f4ca9a01 fix openssl check for password-argon2 (#1140) 2026-05-16 22:03:41 +07:00
henderkes
fd882ce03e forward port #1138 2026-05-16 19:11:35 +07:00
henderkes
99a512c4a4 fix openssl check for password-argon2 2026-05-15 14:35:25 +07:00
Marc
8d038f435d Update rdkafka repository reference in source.json (#1134) 2026-05-09 10:44:43 +07:00
Marc
134186c94f Update rdkafka repository reference in source.json 2026-05-09 07:27:19 +07:00
Marc
ef95e4f857 fix centos 7 gd build (#1132) 2026-05-07 17:13:46 +07:00
Marc
fd4f70d526 oops 2026-05-07 16:51:56 +07:00
henderkes
c7738749e2 run tests 2026-05-07 16:33:39 +07:00
henderkes
44f9cb1ffd fix centos 7 gd build 2026-05-07 16:27:26 +07:00
Jerry Ma
970343b143 Fix old PHP extension with newer C standard bug (#1089) 2026-05-06 14:38:34 +08:00
Marc
e21bb528c0 Apply suggestion from @henderkes 2026-05-06 12:52:50 +07:00
Jerry Ma
5b5861c366 Let ghtar always use latest version by default & mongodb bugfix (#1125) 2026-04-30 12:41:07 +08:00
crazywhalecc
7a71a40824 Test 2026-04-30 11:22:56 +08:00
crazywhalecc
a9e1327a80 Fix phpunit mock data 2026-04-30 11:22:19 +08:00
crazywhalecc
93a227bc6d Fix mongodb 2.3.0 introduced in-tree build bug 2026-04-30 11:14:01 +08:00
crazywhalecc
4eaeeb8230 Make swoole using 6.2.0 2026-04-30 11:06:08 +08:00
crazywhalecc
0588401ee3 Improve GitHub source retrieval by using latest release endpoint and enhancing version handling 2026-04-30 11:05:49 +08:00
Marc
75856e361e Revert "fix(xlswriter): fix macOS build with modern Clang (C23)" 2026-04-25 21:08:08 +07:00
Marc
abfdae256a Add 'date', 'lexbor', 'random', and 'uri' to extensions (#1120) 2026-04-23 19:05:19 +07:00
Marc
450e0e1ecb Add 'date', 'lexbor', 'random', and 'uri' to extensions 2026-04-23 18:55:35 +07:00
Jerry Ma
a373df2444 Fix libde265 on arm64 macOS asm build bug (#1117) 2026-04-22 15:59:03 +08:00
Marc
95a4b4d738 patch 8.3 src to use avx512 cache vars (#1115) 2026-04-21 00:06:41 +07:00
Jerry Ma
4e9edf6c9d Update src/SPC/builder/unix/library/libde265.php 2026-04-21 00:21:52 +08:00
crazywhalecc
14fc3f8d87 Fix libde265 on arm64 macOS asm build bug 2026-04-20 23:55:00 +08:00
henderkes
f52e8ad449 patch 8.3 src to use avx512 cache vars 2026-04-20 07:32:13 +00:00
Jerry Ma
4318ef8fa3 fix aarch64 shared extensions segfault with zig 0.16.0 (#1110) 2026-04-18 11:41:59 +08:00
Marc
8630fd57e2 Merge branch 'main' into feat/decimal 2026-04-17 17:59:55 +07:00
henderkes
0a3c56ba49 set lcompiler_rt only when building shared extensions 2026-04-17 17:04:57 +07:00
Alex Rock Ancelet
b1a77b01e2 Add linux mint to ubuntu/debian variants 2026-04-17 17:04:57 +07:00
henderkes
f39d77dde0 lint 2026-04-17 14:19:29 +07:00
henderkes
cc7a22922c add -lcompiler_rt to SPC_COMPILER_EXTRA instead 2026-04-17 14:17:39 +07:00
henderkes
1a395a2b0f fix zig 0.16.0 2026-04-17 01:51:01 +07:00
Jerry Ma
bfe4a012b8 Add linux mint to ubuntu/debian variants (#1109) 2026-04-16 21:13:30 +08:00
henderkes
ab17fbe288 zig version 0.15.2 for now 2026-04-16 20:02:54 +07:00
Alex Rock Ancelet
7a65135c68 Add linux mint to ubuntu/debian variants 2026-04-16 14:12:07 +02:00
henderkes
f57986ccbf minify embed script 2026-04-16 18:06:27 +07:00
Marc
9bcb809117 fix libkrb5 and decimal shard build (#1107) 2026-04-16 17:40:47 +07:00
henderkes
2073652744 fix macOS 2026-04-16 14:29:13 +07:00
Marc
1440f104bb Merge branch 'main' into feat/decimal 2026-04-16 13:53:57 +07:00
henderkes
834cc4d16e fix lint 2026-04-16 13:50:52 +07:00
henderkes
a9c16b74d7 fix libkrb5 and decimal shard build 2026-04-16 13:46:12 +07:00
Marc
c532b9e893 remove workaround for zig < 0.16 (#1105) 2026-04-15 11:47:08 +07:00
henderkes
73dd885342 pin openssl to 3.x 2026-04-15 10:59:13 +07:00
henderkes
be24fd9467 remove workaround for zig < 0.16 2026-04-14 23:05:08 +07:00
Marc
bf1f54a091 Fix paths for PostgreSQL library and header file copying on Windows (#1102) 2026-04-14 13:36:32 +07:00
crazywhalecc
1c3dc91845 Fix paths for PostgreSQL library and header file copying on Windows 2026-04-14 11:25:15 +08:00
Marc
565ff27b71 add ext-decimal (#1095) 2026-04-12 17:44:50 +07:00
Marc
f48961c72d Remove unused import in libmpdec.php
Removed unused import of FileSystem.
2026-04-12 16:09:55 +07:00
henderkes
a0c2fefd24 fix windows crash 2026-04-12 15:55:57 +07:00
henderkes
f585cc446a attempt 2026-04-12 13:30:22 +07:00
henderkes
f43e915341 don't scan the test 2026-04-12 12:44:21 +07:00
henderkes
93f68b209f fix merge 2026-04-12 12:32:26 +07:00
Marc
3fb68f3989 Merge branch 'main' into feat/decimal 2026-04-12 12:31:00 +07:00
henderkes
4f27d2d9d1 add ext-decimal 2026-04-12 12:28:27 +07:00
Marc
562fbf2a9c add "deepclone" extension (#1094) 2026-04-12 11:47:47 +07:00
henderkes
cbf1ed7662 full test suite 2026-04-12 10:57:25 +07:00
henderkes
4bba584e88 add "deepclone" extension 2026-04-12 10:55:24 +07:00
crazywhalecc
0ed1bbc74a Fix typo 2026-04-11 01:01:21 +08:00
crazywhalecc
1272acd07e Fix bcmath with c23 bug 2026-04-11 01:00:30 +08:00
Jerry Ma
6e354b4c6a fix: icu-static-win, ext-swoole, krb5, sqlsrv with grpc (#1087) 2026-04-10 16:14:02 +08:00
crazywhalecc
864fa9d0eb Fix #1083 2026-04-10 16:09:35 +08:00
crazywhalecc
a27f5cc8be Oops 2026-04-10 14:26:03 +08:00
crazywhalecc
26a14bccbe Disable iouring on glibc build 2026-04-10 14:21:06 +08:00
crazywhalecc
cf48d131b3 Use direct link to official release instead of mirror 2026-04-10 13:52:21 +08:00
crazywhalecc
544fd15c0b test tmate 2026-04-10 13:26:14 +08:00
crazywhalecc
b04b079267 test 2026-04-10 13:22:06 +08:00
crazywhalecc
da49c056c9 test 2026-04-10 12:49:10 +08:00
crazywhalecc
7fc5dd428d Fix krb5 CI build by the way 2026-04-10 12:24:25 +08:00
crazywhalecc
6b62255091 test 2026-04-10 12:21:21 +08:00
crazywhalecc
9d777ca650 fix(icu_static_win): update paths for ICU static libraries and includes 2026-04-09 23:37:36 +08:00
Marc
20f95efcba fix(xlswriter): fix macOS build with modern Clang (C23) (#1086) 2026-04-09 14:30:42 +07:00
Marc
fb7730989c Apply suggestions from code review
Co-authored-by: Marc <m@pyc.ac>
2026-04-09 14:00:10 +07:00
Kévin Dunglas
4d2036f20e fix(xlswriter): use -std=gnu17 to fix K&R declarations rejected by C23
The bundled minizip in xlswriter has K&R C function declarations in
multiple files (mztools.c, ioapi.c). Apple Clang (Xcode 16+) defaults
to C23, which removed K&R from the standard, causing hard build errors.

Instead of patching individual files, downgrade the C standard to gnu17
for the whole build when xlswriter is enabled. This covers all K&R
occurrences in the bundled code.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 08:49:49 +02:00
Kévin Dunglas
105f0328e6 fix(xlswriter): convert K&R function declaration to ANSI C in bundled minizip
The bundled minizip in xlswriter (pinned at libxlsxwriter RELEASE_1.0.0)
uses a K&R-style function declaration in mztools.c. Modern Clang on macOS
(defaulting to C23) rejects this as a hard syntax error since K&R
declarations were removed from the C23 standard.

The upstream libxlsxwriter has already fixed this on their main branch.
This patch applies the same fix during the build process.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 21:33:59 +02:00
Jerry Ma
d411fac9a1 add framework coreservices to watcher library (#1082) 2026-04-04 20:05:47 +08:00
henderkes
ddb9e3e7e4 add framework coreservices to watcher library 2026-04-04 18:18:22 +07:00
Marc
fef361225a Fix file paths for SQLSRV (#1081) 2026-04-04 18:11:38 +07:00
crazywhalecc
0b2b1d51e1 Fix file paths for SQLSRV 2026-04-04 18:39:28 +08:00
Jerry Ma
820d77b8b2 [v2] Fix bunch of build bugs for Windows (#1078) 2026-04-03 19:58:57 +08:00
Jerry Ma
cd3eb3d41d Update src/globals/ext-tests/openssl.php 2026-04-03 19:53:23 +08:00
crazywhalecc
fb8f8d4ef8 Correct openssl test script condition 2026-04-03 15:49:02 +08:00
crazywhalecc
1a476d0e80 Fix xcopy command in FileSystem.php by removing the 'v' flag 2026-04-03 15:34:56 +08:00
crazywhalecc
e5ad72214c Add brotli to curl (just workaround for transitive deps) 2026-04-03 14:18:13 +08:00
crazywhalecc
c339b900f8 Disable simd for libjpeg 2026-04-03 11:33:55 +08:00
crazywhalecc
3ded9881e1 Disable openssl for ngtcp2 temporarily 2026-04-03 09:55:46 +08:00
crazywhalecc
08a6bf38a4 Remove zstd suggested libs for v2 (implemented on v3)
Anyway we don't support zstd windows build before
2026-04-02 18:04:03 +08:00
crazywhalecc
cae668a947 Remove zstd suggested libs for v2 (implemented on v3)
Anyway we don't support zstd windows build before
2026-04-02 17:59:15 +08:00
crazywhalecc
e592488d7a Add test 2026-04-02 16:34:51 +08:00
crazywhalecc
a7184d0411 Fix sqlsrv redundant cflags when building PHP 2026-04-02 16:32:43 +08:00
Marc
d535e4f102 libjpeg-turbo mustn't compile zlib symbols on its own (#1077) 2026-03-30 10:08:49 +07:00
42 changed files with 493 additions and 88 deletions

View File

@@ -63,7 +63,8 @@
], ],
"ext-depends-windows": [ "ext-depends-windows": [
"zlib", "zlib",
"openssl" "openssl",
"brotli"
] ]
}, },
"dba": { "dba": {
@@ -73,6 +74,19 @@
"qdbm" "qdbm"
] ]
}, },
"decimal": {
"type": "external",
"source": "ext-decimal",
"arg-type": "custom",
"lib-depends": [
"libmpdec"
]
},
"deepclone": {
"type": "external",
"source": "deepclone",
"arg-type": "enable"
},
"dio": { "dio": {
"support": { "support": {
"BSD": "wip" "BSD": "wip"

View File

@@ -109,8 +109,7 @@
"krb5" "krb5"
], ],
"lib-suggests-windows": [ "lib-suggests-windows": [
"brotli", "brotli"
"zstd"
], ],
"frameworks": [ "frameworks": [
"CoreFoundation", "CoreFoundation",
@@ -529,6 +528,18 @@
"maxminddb_config.h" "maxminddb_config.h"
] ]
}, },
"libmpdec": {
"source": "libmpdec",
"static-libs-unix": [
"libmpdec.a"
],
"static-libs-windows": [
"libmpdec_a.lib"
],
"headers": [
"mpdecimal.h"
]
},
"libmemcached": { "libmemcached": {
"source": "libmemcached", "source": "libmemcached",
"cpp-library": true, "cpp-library": true,
@@ -763,7 +774,6 @@
"xz" "xz"
], ],
"lib-suggests-windows": [ "lib-suggests-windows": [
"zstd",
"openssl" "openssl"
] ]
}, },
@@ -1000,6 +1010,9 @@
], ],
"headers": [ "headers": [
"wtr/watcher-c.h" "wtr/watcher-c.h"
],
"frameworks": [
"CoreServices"
] ]
}, },
"xz": { "xz": {

View File

@@ -84,6 +84,25 @@
"path": "COPYING" "path": "COPYING"
} }
}, },
"ext-decimal": {
"type": "ghtagtar",
"repo": "php-decimal/ext-decimal",
"match": "v2\\.\\d.*",
"path": "php-src/ext/decimal",
"license": {
"type": "file",
"path": "LICENSE"
}
},
"deepclone": {
"type": "ghtagtar",
"repo": "symfony/php-ext-deepclone",
"path": "php-src/ext/deepclone",
"license": {
"type": "file",
"path": "LICENSE"
}
},
"dio": { "dio": {
"type": "url", "type": "url",
"url": "https://pecl.php.net/get/dio", "url": "https://pecl.php.net/get/dio",
@@ -227,7 +246,7 @@
}, },
"ext-rdkafka": { "ext-rdkafka": {
"type": "ghtar", "type": "ghtar",
"repo": "arnaud-lb/php-rdkafka", "repo": "php-rdkafka/php-rdkafka",
"path": "php-src/ext/rdkafka", "path": "php-src/ext/rdkafka",
"license": { "license": {
"type": "file", "type": "file",
@@ -314,10 +333,9 @@
} }
}, },
"ext-zstd": { "ext-zstd": {
"type": "git", "type": "ghtagtar",
"repo": "kjdev/php-ext-zstd",
"path": "php-src/ext/zstd", "path": "php-src/ext/zstd",
"rev": "master",
"url": "https://github.com/kjdev/php-ext-zstd",
"license": { "license": {
"type": "file", "type": "file",
"path": "LICENSE" "path": "LICENSE"
@@ -462,10 +480,8 @@
} }
}, },
"krb5": { "krb5": {
"type": "ghtagtar", "type": "url",
"repo": "krb5/krb5", "url": "https://web.mit.edu/kerberos/dist/krb5/1.22/krb5-1.22.2.tar.gz",
"match": "krb5.+-final",
"prefer-stable": true,
"license": { "license": {
"type": "file", "type": "file",
"path": "NOTICE" "path": "NOTICE"
@@ -683,6 +699,14 @@
"path": "LICENSE" "path": "LICENSE"
} }
}, },
"libmpdec": {
"type": "url",
"url": "https://www.bytereef.org/software/mpdecimal/releases/mpdecimal-4.0.1.tar.gz",
"license": {
"type": "file",
"path": "COPYRIGHT.txt"
}
},
"libmemcached": { "libmemcached": {
"type": "ghtagtar", "type": "ghtagtar",
"repo": "awesomized/libmemcached", "repo": "awesomized/libmemcached",
@@ -975,7 +999,7 @@
"openssl": { "openssl": {
"type": "ghrel", "type": "ghrel",
"repo": "openssl/openssl", "repo": "openssl/openssl",
"match": "openssl.+\\.tar\\.gz", "match": "openssl-3.+\\.tar\\.gz",
"prefer-stable": true, "prefer-stable": true,
"alt": { "alt": {
"type": "filelist", "type": "filelist",
@@ -1169,7 +1193,6 @@
"path": "php-src/ext/swoole", "path": "php-src/ext/swoole",
"type": "ghtar", "type": "ghtar",
"repo": "swoole/swoole-src", "repo": "swoole/swoole-src",
"match": "v6\\.+",
"prefer-stable": true, "prefer-stable": true,
"license": { "license": {
"type": "file", "type": "file",

View File

@@ -14,6 +14,7 @@ parameters:
- PHP_OS_FAMILY - PHP_OS_FAMILY
excludePaths: excludePaths:
analyseAndScan: analyseAndScan:
- ./src/globals/ext-tests/decimal.php
- ./src/globals/ext-tests/swoole.php - ./src/globals/ext-tests/swoole.php
- ./src/globals/ext-tests/swoole.phpt - ./src/globals/ext-tests/swoole.phpt
- ./src/globals/test-extensions.php - ./src/globals/test-extensions.php

View File

@@ -34,7 +34,7 @@ use Symfony\Component\Console\Application;
*/ */
final class ConsoleApplication extends Application final class ConsoleApplication extends Application
{ {
public const string VERSION = '2.8.4'; public const string VERSION = '2.8.6';
public function __construct() public function __construct()
{ {

View File

@@ -11,6 +11,9 @@ use SPC\exception\ValidationException;
use SPC\exception\WrongUsageException; use SPC\exception\WrongUsageException;
use SPC\store\Config; use SPC\store\Config;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\toolchain\ToolchainManager;
use SPC\toolchain\ZigToolchain;
use SPC\util\GlobalEnvManager;
use SPC\util\SPCConfigUtil; use SPC\util\SPCConfigUtil;
use SPC\util\SPCTarget; use SPC\util\SPCTarget;
@@ -231,7 +234,7 @@ class Extension
if (preg_match('/^(.*_SHARED_LIBADD\s*=\s*)(.*)$/m', $makefileContent, $matches)) { if (preg_match('/^(.*_SHARED_LIBADD\s*=\s*)(.*)$/m', $makefileContent, $matches)) {
$prefix = $matches[1]; $prefix = $matches[1];
$currentLibs = trim($matches[2]); $currentLibs = trim($matches[2]);
$newLibs = trim("{$currentLibs} {$staticLibs} {$lstdcpp}"); $newLibs = clean_spaces("{$currentLibs} {$staticLibs} {$lstdcpp}");
$deduplicatedLibs = deduplicate_flags($newLibs); $deduplicatedLibs = deduplicate_flags($newLibs);
FileSystem::replaceFileRegex( FileSystem::replaceFileRegex(
@@ -543,6 +546,11 @@ class Extension
*/ */
protected function getSharedExtensionEnv(): array protected function getSharedExtensionEnv(): array
{ {
$compiler_extra = getenv('SPC_COMPILER_EXTRA') ?: '';
if (!str_contains($compiler_extra, '-lcompiler_rt') && ToolchainManager::getToolchainClass() === ZigToolchain::class) {
$compiler_extra = trim($compiler_extra . ' -lcompiler_rt');
GlobalEnvManager::putenv("SPC_COMPILER_EXTRA={$compiler_extra}");
}
$config = (new SPCConfigUtil($this->builder, ['no_php' => true]))->getExtensionConfig($this); $config = (new SPCConfigUtil($this->builder, ['no_php' => true]))->getExtensionConfig($this);
[$staticLibs, $sharedLibs] = $this->splitLibsIntoStaticAndShared($config['libs']); [$staticLibs, $sharedLibs] = $this->splitLibsIntoStaticAndShared($config['libs']);
$preStatic = PHP_OS_FAMILY === 'Darwin' ? '' : '-Wl,--start-group '; $preStatic = PHP_OS_FAMILY === 'Darwin' ? '' : '-Wl,--start-group ';

View File

@@ -0,0 +1,46 @@
<?php
declare(strict_types=1);
namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\store\FileSystem;
use SPC\util\CustomExt;
#[CustomExt('decimal')]
class decimal extends Extension
{
// TODO: remove this when https://github.com/php-decimal/ext-decimal/issues/92 is merged
public function patchBeforeBuildconf(): bool
{
FileSystem::replaceFileStr(
$this->source_dir . '/php_decimal.c',
[
'zend_module_entry decimal_module_entry',
'ZEND_GET_MODULE(decimal)',
],
[
'zend_module_entry php_decimal_module_entry',
'ZEND_GET_MODULE(php_decimal)',
]
);
FileSystem::replaceFileStr(
$this->source_dir . '/config.w32',
'ARG_WITH("decimal", "for decimal support", "no");',
'ARG_WITH("decimal", "for decimal support", "no");' . "\n" .
'ADD_EXTENSION_DEP("decimal", "json");'
);
return true;
}
public function getUnixConfigureArg(bool $shared = false): string
{
return '--enable-decimal --with-libmpdec-path="' . BUILD_ROOT_PATH . '"';
}
public function getWindowsConfigureArg(bool $shared = false): string
{
return '--with-decimal';
}
}

View File

@@ -28,6 +28,15 @@ class grpc extends Extension
'zend_ce_exception,', 'zend_ce_exception,',
); );
// Fix include path conflict with pdo_sqlsrv: grpc's PHP ext dir is added to the global include path via
$grpc_php_dir = "{$this->source_dir}/src/php/ext/grpc";
if (file_exists("{$grpc_php_dir}/version.h")) {
copy("{$grpc_php_dir}/version.h", "{$grpc_php_dir}/php_grpc_version.h");
unlink("{$grpc_php_dir}/version.h");
FileSystem::replaceFileStr("{$grpc_php_dir}/php_grpc.h", '#include "version.h"', '#include "php_grpc_version.h"');
FileSystem::replaceFileStr("{$grpc_php_dir}/php_grpc.c", '#include "version.h"', '#include "php_grpc_version.h"');
}
$config_m4 = <<<'M4' $config_m4 = <<<'M4'
PHP_ARG_ENABLE(grpc, [whether to enable grpc support], [AS_HELP_STRING([--enable-grpc], [Enable grpc support])]) PHP_ARG_ENABLE(grpc, [whether to enable grpc support], [AS_HELP_STRING([--enable-grpc], [Enable grpc support])])

View File

@@ -5,11 +5,22 @@ declare(strict_types=1);
namespace SPC\builder\extension; namespace SPC\builder\extension;
use SPC\builder\Extension; use SPC\builder\Extension;
use SPC\store\FileSystem;
use SPC\util\CustomExt; use SPC\util\CustomExt;
#[CustomExt('mongodb')] #[CustomExt('mongodb')]
class mongodb extends Extension class mongodb extends Extension
{ {
public function patchBeforeBuildconf(): bool
{
FileSystem::replaceFileRegex(
SOURCE_PATH . '/php-src/ext/mongodb/config.m4',
'/^(\s+)(src\/libmongoc\/)/m',
'$1${ac_config_dir}/$2'
);
return true;
}
public function getUnixConfigureArg(bool $shared = false): string public function getUnixConfigureArg(bool $shared = false): string
{ {
$arg = ' --enable-mongodb' . ($shared ? '=shared' : '') . ' '; $arg = ' --enable-mongodb' . ($shared ? '=shared' : '') . ' ';

View File

@@ -26,7 +26,7 @@ class password_argon2 extends Extension
public function getConfigureArg(bool $shared = false): string public function getConfigureArg(bool $shared = false): string
{ {
if ($this->builder->getLib('openssl') !== null) { if ($this->builder->getExt('openssl')?->isBuildStatic() || $this->isBuildShared()) {
if ($this->builder->getPHPVersionID() >= 80500 || ($this->builder->getPHPVersionID() >= 80400 && !$this->builder->getOption('enable-zts'))) { if ($this->builder->getPHPVersionID() >= 80500 || ($this->builder->getPHPVersionID() >= 80400 && !$this->builder->getOption('enable-zts'))) {
return '--without-password-argon2'; // use --with-openssl-argon2 in openssl extension instead return '--without-password-argon2'; // use --with-openssl-argon2 in openssl extension instead
} }

View File

@@ -33,4 +33,14 @@ class sqlsrv extends Extension
} }
return false; return false;
} }
public function patchBeforeMake(): bool
{
$makefile = SOURCE_PATH . '/php-src/Makefile';
$makeContent = file_get_contents($makefile);
$makeContent = preg_replace('/^(CFLAGS_(?:PDO_)?SQLSRV=.*?)\s+\/W4\b/m', '$1', $makeContent);
$makeContent = preg_replace('/^(CFLAGS_(?:PDO_)?SQLSRV=.*?)\s+\/WX\b/m', '$1', $makeContent);
file_put_contents($makefile, $makeContent);
return true;
}
} }

View File

@@ -59,7 +59,7 @@ class swoole extends Extension
$arg .= $this->builder->getLib('brotli') ? (' --enable-brotli --with-brotli-dir=' . BUILD_ROOT_PATH) : ''; $arg .= $this->builder->getLib('brotli') ? (' --enable-brotli --with-brotli-dir=' . BUILD_ROOT_PATH) : '';
$arg .= $this->builder->getLib('nghttp2') ? (' --with-nghttp2-dir=' . BUILD_ROOT_PATH) : ''; $arg .= $this->builder->getLib('nghttp2') ? (' --with-nghttp2-dir=' . BUILD_ROOT_PATH) : '';
$arg .= $this->builder->getLib('zstd') ? ' --enable-zstd' : ''; $arg .= $this->builder->getLib('zstd') ? ' --enable-zstd' : '';
$arg .= $this->builder->getLib('liburing') ? ' --enable-iouring --enable-uring-socket' : ''; $arg .= $this->builder->getLib('liburing') && getenv('SPC_LIBC') !== 'glibc' ? ' --enable-iouring --enable-uring-socket' : '--disable-iouring';
$arg .= $this->builder->getExt('sockets') ? ' --enable-sockets' : ''; $arg .= $this->builder->getExt('sockets') ? ' --enable-sockets' : '';
// enable additional features that require the pdo extension, but conflict with pdo_* extensions // enable additional features that require the pdo extension, but conflict with pdo_* extensions

View File

@@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace SPC\builder\freebsd\library;
class libmpdec extends BSDLibraryBase
{
use \SPC\builder\unix\library\libmpdec;
public const NAME = 'libmpdec';
}

View File

@@ -11,6 +11,8 @@ use SPC\store\Config;
use SPC\store\DirDiff; use SPC\store\DirDiff;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\store\SourcePatcher; use SPC\store\SourcePatcher;
use SPC\toolchain\ToolchainManager;
use SPC\toolchain\ZigToolchain;
use SPC\util\GlobalEnvManager; use SPC\util\GlobalEnvManager;
use SPC\util\SPCConfigUtil; use SPC\util\SPCConfigUtil;
use SPC\util\SPCTarget; use SPC\util\SPCTarget;
@@ -65,7 +67,8 @@ class LinuxBuilder extends UnixBuilderBase
// php 8.5 contains opcache extension by default, // php 8.5 contains opcache extension by default,
// if opcache_jit is enabled for 8.5 or opcache enabled, // if opcache_jit is enabled for 8.5 or opcache enabled,
// we need to disable undefined behavior sanitizer. // we need to disable undefined behavior sanitizer.
f_putenv('SPC_COMPILER_EXTRA=-fno-sanitize=undefined'); $compiler_extra = getenv('SPC_COMPILER_EXTRA') ?: '';
f_putenv('SPC_COMPILER_EXTRA=' . trim($compiler_extra . ' -fno-sanitize=undefined'));
} }
if ($this->getOption('enable-zts', false)) { if ($this->getOption('enable-zts', false)) {
@@ -266,6 +269,11 @@ class LinuxBuilder extends UnixBuilderBase
*/ */
protected function buildEmbed(): void protected function buildEmbed(): void
{ {
$compiler_extra = getenv('SPC_COMPILER_EXTRA') ?: '';
if (!str_contains($compiler_extra, '-lcompiler_rt') && ToolchainManager::getToolchainClass() === ZigToolchain::class) {
$compiler_extra = trim($compiler_extra . ' -lcompiler_rt');
GlobalEnvManager::putenv("SPC_COMPILER_EXTRA={$compiler_extra}");
}
$sharedExts = array_filter($this->exts, static fn ($ext) => $ext->isBuildShared()); $sharedExts = array_filter($this->exts, static fn ($ext) => $ext->isBuildShared());
$sharedExts = array_filter($sharedExts, static function ($ext) { $sharedExts = array_filter($sharedExts, static function ($ext) {
return Config::getExt($ext->getName(), 'build-with-php') === true; return Config::getExt($ext->getName(), 'build-with-php') === true;

View File

@@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace SPC\builder\linux\library;
class libmpdec extends LinuxLibraryBase
{
use \SPC\builder\unix\library\libmpdec;
public const NAME = 'libmpdec';
}

View File

@@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace SPC\builder\macos\library;
class libmpdec extends MacOSLibraryBase
{
use \SPC\builder\unix\library\libmpdec;
public const NAME = 'libmpdec';
}

View File

@@ -50,7 +50,7 @@ trait UnixSystemUtilTrait
$defined = array_unique($defined); $defined = array_unique($defined);
sort($defined); sort($defined);
// export // export
if (SPCTarget::getTargetOS() === 'Linux') { if (SPCTarget::getTargetOS() === 'Linux' && ToolchainManager::getToolchainClass() !== ZigToolchain::class) {
file_put_contents("{$lib_file}.dynsym", "{\n" . implode("\n", array_map(fn ($x) => " {$x};", $defined)) . "};\n"); file_put_contents("{$lib_file}.dynsym", "{\n" . implode("\n", array_map(fn ($x) => " {$x};", $defined)) . "};\n");
} else { } else {
file_put_contents("{$lib_file}.dynsym", implode("\n", $defined) . "\n"); file_put_contents("{$lib_file}.dynsym", implode("\n", $defined) . "\n");
@@ -72,10 +72,6 @@ trait UnixSystemUtilTrait
if (!is_file($symbol_file)) { if (!is_file($symbol_file)) {
throw new SPCInternalException("The symbol file {$symbol_file} does not exist, please check if nm command is available."); throw new SPCInternalException("The symbol file {$symbol_file} does not exist, please check if nm command is available.");
} }
// https://github.com/ziglang/zig/issues/24662
if (ToolchainManager::getToolchainClass() === ZigToolchain::class) {
return '-Wl,--export-dynamic'; // needs release 0.16, can be removed then
}
// macOS/zig // macOS/zig
if (SPCTarget::getTargetOS() !== 'Linux' || ToolchainManager::getToolchainClass() === ZigToolchain::class) { if (SPCTarget::getTargetOS() !== 'Linux' || ToolchainManager::getToolchainClass() === ZigToolchain::class) {
return "-Wl,-exported_symbols_list,{$symbol_file}"; return "-Wl,-exported_symbols_list,{$symbol_file}";

View File

@@ -463,9 +463,10 @@ abstract class UnixBuilderBase extends BuilderBase
"-tags={$muslTags}nobadger,nomysql,nopgx{$nobrotli}{$nowatcher}", "-tags={$muslTags}nobadger,nomysql,nopgx{$nobrotli}{$nowatcher}",
'LD_LIBRARY_PATH' => BUILD_LIB_PATH, 'LD_LIBRARY_PATH' => BUILD_LIB_PATH,
], ...GoXcaddy::getEnvironment()]; ], ...GoXcaddy::getEnvironment()];
$pgo = file_exists("{$frankenphpSourceDir}/caddy/frankenphp/default.pgo") ? "--pgo {$frankenphpSourceDir}/caddy/frankenphp/default.pgo " : '';
shell()->cd(BUILD_BIN_PATH) shell()->cd(BUILD_BIN_PATH)
->setEnv($env) ->setEnv($env)
->exec("xcaddy build --output frankenphp {$xcaddyModules}"); ->exec("xcaddy build --output frankenphp {$pgo}{$xcaddyModules}");
$this->deploySAPIBinary(BUILD_TARGET_FRANKENPHP); $this->deploySAPIBinary(BUILD_TARGET_FRANKENPHP);
} }

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\store\FileSystem;
use SPC\util\executor\UnixCMakeExecutor; use SPC\util\executor\UnixCMakeExecutor;
trait curl trait curl
@@ -32,8 +33,16 @@ trait curl
) )
->build(); ->build();
// patch pkgconf
$this->patchPkgconfPrefix(['libcurl.pc']); $this->patchPkgconfPrefix(['libcurl.pc']);
// On glibc <2.28 without built-in pthreads, FindThreads sets
// INTERFACE_LINK_LIBRARIES to '-lpthread'
// curls .pc generator walks and prepends '-l' to each
// entry, resulting in -l-lpthread
FileSystem::replaceFileRegex(
BUILD_LIB_PATH . '/pkgconfig/libcurl.pc',
'/-l(-l\S+)/',
'$1'
);
shell()->cd(BUILD_LIB_PATH . '/cmake/CURL/') shell()->cd(BUILD_LIB_PATH . '/cmake/CURL/')
->exec("sed -ie 's|\"/lib/libcurl.a\"|\"" . BUILD_LIB_PATH . "/libcurl.a\"|g' CURLTargets-release.cmake"); ->exec("sed -ie 's|\"/lib/libcurl.a\"|\"" . BUILD_LIB_PATH . "/libcurl.a\"|g' CURLTargets-release.cmake");
} }

View File

@@ -4,6 +4,8 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\toolchain\ToolchainManager;
use SPC\toolchain\ZigToolchain;
use SPC\util\executor\UnixAutoconfExecutor; use SPC\util\executor\UnixAutoconfExecutor;
use SPC\util\SPCConfigUtil; use SPC\util\SPCConfigUtil;
@@ -13,7 +15,10 @@ trait krb5
{ {
$origin_source_dir = $this->source_dir; $origin_source_dir = $this->source_dir;
$this->source_dir .= '/src'; $this->source_dir .= '/src';
shell()->cd($this->source_dir)->exec('autoreconf -if'); shell()->cd($this->source_dir)->exec('ls -lah');
if (!file_exists($this->source_dir . '/configure')) {
shell()->cd($this->source_dir)->exec('autoreconf -if');
}
$libs = array_map(fn ($x) => $x->getName(), $this->getDependencies(true)); $libs = array_map(fn ($x) => $x->getName(), $this->getDependencies(true));
$spc = new SPCConfigUtil($this->builder, ['no_php' => true, 'libs_only_deps' => true]); $spc = new SPCConfigUtil($this->builder, ['no_php' => true, 'libs_only_deps' => true]);
$config = $spc->config(libraries: $libs, include_suggest_lib: $this->builder->getOption('with-suggested-libs', false)); $config = $spc->config(libraries: $libs, include_suggest_lib: $this->builder->getOption('with-suggested-libs', false));
@@ -36,12 +41,16 @@ trait krb5
$extraEnv['LDFLAGS'] = '-framework Kerberos'; $extraEnv['LDFLAGS'] = '-framework Kerberos';
$args[] = 'ac_cv_func_secure_getenv=no'; $args[] = 'ac_cv_func_secure_getenv=no';
} }
UnixAutoconfExecutor::create($this) $make = UnixAutoconfExecutor::create($this)
->appendEnv($extraEnv) ->appendEnv($extraEnv)
->optionalLib('ldap', '--with-ldap', '--without-ldap') ->optionalLib('ldap', '--with-ldap', '--without-ldap')
->optionalLib('libedit', '--with-libedit', '--without-libedit') ->optionalLib('libedit', '--with-libedit', '--without-libedit')
->configure(...$args) ->configure(...$args);
->make();
if (ToolchainManager::getToolchainClass() === ZigToolchain::class) {
$make->exec('find . -name Makefile -exec sed -i "s/-Werror=incompatible-pointer-types//g" {} +');
}
$make->make();
$this->patchPkgconfPrefix([ $this->patchPkgconfPrefix([
'krb5-gssapi.pc', 'krb5-gssapi.pc',
'krb5.pc', 'krb5.pc',

View File

@@ -13,7 +13,8 @@ trait libde265
UnixCMakeExecutor::create($this) UnixCMakeExecutor::create($this)
->addConfigureArgs( ->addConfigureArgs(
'-DENABLE_SDL=OFF', '-DENABLE_SDL=OFF',
'-DENABLE_DECODER=OFF' '-DENABLE_DECODER=OFF',
'-DHAVE_NEON=OFF',
) )
->build(); ->build();
$this->patchPkgconfPrefix(['libde265.pc']); $this->patchPkgconfPrefix(['libde265.pc']);

View File

@@ -11,15 +11,28 @@ trait libheif
{ {
public function patchBeforeBuild(): bool public function patchBeforeBuild(): bool
{ {
$patched = false;
if (!str_contains(file_get_contents($this->source_dir . '/CMakeLists.txt'), 'libbrotlienc')) { if (!str_contains(file_get_contents($this->source_dir . '/CMakeLists.txt'), 'libbrotlienc')) {
FileSystem::replaceFileStr( FileSystem::replaceFileStr(
$this->source_dir . '/CMakeLists.txt', $this->source_dir . '/CMakeLists.txt',
'list(APPEND REQUIRES_PRIVATE "libbrotlidec")', 'list(APPEND REQUIRES_PRIVATE "libbrotlidec")',
'list(APPEND REQUIRES_PRIVATE "libbrotlidec")' . "\n" . ' list(APPEND REQUIRES_PRIVATE "libbrotlienc")' 'list(APPEND REQUIRES_PRIVATE "libbrotlidec")' . "\n" . ' list(APPEND REQUIRES_PRIVATE "libbrotlienc")'
); );
return true; $patched = true;
} }
return false; // libheif 1.22+ ships a C-incompatible header: `struct heif_bad_pixel`
$heif_properties = $this->source_dir . '/libheif/api/libheif/heif_properties.h';
if (file_exists($heif_properties)
&& str_contains(file_get_contents($heif_properties), 'struct heif_bad_pixel { uint32_t row; uint32_t column; };')
) {
FileSystem::replaceFileStr(
$heif_properties,
'struct heif_bad_pixel { uint32_t row; uint32_t column; };',
'typedef struct heif_bad_pixel { uint32_t row; uint32_t column; } heif_bad_pixel;'
);
$patched = true;
}
return $patched;
} }
protected function build(): void protected function build(): void

View File

@@ -14,7 +14,10 @@ trait libjpeg
->addConfigureArgs( ->addConfigureArgs(
'-DENABLE_STATIC=ON', '-DENABLE_STATIC=ON',
'-DENABLE_SHARED=OFF', '-DENABLE_SHARED=OFF',
'-DWITH_SYSTEM_ZLIB=ON' '-DWITH_SYSTEM_ZLIB=ON',
'-DWITH_TOOLS=OFF',
'-DWITH_TESTS=OFF',
'-DWITH_SIMD=OFF',
) )
->build(); ->build();
// patch pkgconfig // patch pkgconfig

View File

@@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\util\executor\UnixAutoconfExecutor;
trait libmpdec
{
protected function build(): void
{
UnixAutoconfExecutor::create($this)
->configure('--disable-cxx --disable-shared --enable-static')
->make();
}
}

View File

@@ -12,16 +12,16 @@ class icu_static_win extends WindowsLibraryBase
protected function build(): void protected function build(): void
{ {
copy("{$this->source_dir}\\x64-windows-static\\lib\\icudt.lib", "{$this->getLibDir()}\\icudt.lib"); copy("{$this->source_dir}\\lib\\icudt.lib", "{$this->getLibDir()}\\icudt.lib");
copy("{$this->source_dir}\\x64-windows-static\\lib\\icuin.lib", "{$this->getLibDir()}\\icuin.lib"); copy("{$this->source_dir}\\lib\\icuin.lib", "{$this->getLibDir()}\\icuin.lib");
copy("{$this->source_dir}\\x64-windows-static\\lib\\icuio.lib", "{$this->getLibDir()}\\icuio.lib"); copy("{$this->source_dir}\\lib\\icuio.lib", "{$this->getLibDir()}\\icuio.lib");
copy("{$this->source_dir}\\x64-windows-static\\lib\\icuuc.lib", "{$this->getLibDir()}\\icuuc.lib"); copy("{$this->source_dir}\\lib\\icuuc.lib", "{$this->getLibDir()}\\icuuc.lib");
// create libpq folder in buildroot/includes/libpq // create libpq folder in buildroot/includes/libpq
if (!file_exists("{$this->getIncludeDir()}\\unicode")) { if (!file_exists("{$this->getIncludeDir()}\\unicode")) {
mkdir("{$this->getIncludeDir()}\\unicode"); mkdir("{$this->getIncludeDir()}\\unicode");
} }
FileSystem::copyDir("{$this->source_dir}\\x64-windows-static\\include\\unicode", "{$this->getIncludeDir()}\\unicode"); FileSystem::copyDir("{$this->source_dir}\\include\\unicode", "{$this->getIncludeDir()}\\unicode");
} }
} }

View File

@@ -28,6 +28,7 @@ class libjpeg extends WindowsLibraryBase
'-DENABLE_STATIC=ON ' . '-DENABLE_STATIC=ON ' .
'-DBUILD_TESTING=OFF ' . '-DBUILD_TESTING=OFF ' .
'-DWITH_JAVA=OFF ' . '-DWITH_JAVA=OFF ' .
'-DWITH_SIMD=OFF ' .
'-DWITH_CRT_DLL=OFF ' . '-DWITH_CRT_DLL=OFF ' .
"-DENABLE_ZLIB_COMPRESSION={$zlib} " . "-DENABLE_ZLIB_COMPRESSION={$zlib} " .
'-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' '-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' '

View File

@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace SPC\builder\windows\library;
class libmpdec extends WindowsLibraryBase
{
public const NAME = 'libmpdec';
protected function build(): void
{
$makefile_dir = $this->source_dir . '\libmpdec';
$nmake = $this->builder->makeSimpleWrapper('nmake /nologo');
cmd()->cd($makefile_dir)
->exec('copy /y Makefile.vc Makefile')
->execWithWrapper($nmake, 'clean')
->execWithWrapper($nmake, 'MACHINE=x64');
// Copy static lib (rename from versioned name to libmpdec_a.lib)
$libs = glob($makefile_dir . '\libmpdec-*.lib');
foreach ($libs as $lib) {
if (!str_contains($lib, '.dll.')) {
copy($lib, BUILD_LIB_PATH . '\libmpdec_a.lib');
break;
}
}
copy($makefile_dir . '\mpdecimal.h', BUILD_INCLUDE_PATH . '\mpdecimal.h');
}
}

View File

@@ -29,6 +29,7 @@ class ngtcp2 extends WindowsLibraryBase
'-DBUILD_SHARED_LIBS=OFF ' . '-DBUILD_SHARED_LIBS=OFF ' .
'-DENABLE_STATIC_CRT=ON ' . '-DENABLE_STATIC_CRT=ON ' .
'-DENABLE_LIB_ONLY=ON ' . '-DENABLE_LIB_ONLY=ON ' .
'-DENABLE_OPENSSL=OFF ' .
'-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' '-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' '
) )
->execWithWrapper( ->execWithWrapper(

View File

@@ -10,9 +10,9 @@ class postgresql_win extends WindowsLibraryBase
protected function build(): void protected function build(): void
{ {
copy($this->source_dir . '\pgsql\lib\libpq.lib', BUILD_LIB_PATH . '\libpq.lib'); copy($this->source_dir . '\lib\libpq.lib', BUILD_LIB_PATH . '\libpq.lib');
copy($this->source_dir . '\pgsql\lib\libpgport.lib', BUILD_LIB_PATH . '\libpgport.lib'); copy($this->source_dir . '\lib\libpgport.lib', BUILD_LIB_PATH . '\libpgport.lib');
copy($this->source_dir . '\pgsql\lib\libpgcommon.lib', BUILD_LIB_PATH . '\libpgcommon.lib'); copy($this->source_dir . '\lib\libpgcommon.lib', BUILD_LIB_PATH . '\libpgcommon.lib');
// create libpq folder in buildroot/includes/libpq // create libpq folder in buildroot/includes/libpq
if (!file_exists(BUILD_INCLUDE_PATH . '\libpq')) { if (!file_exists(BUILD_INCLUDE_PATH . '\libpq')) {
@@ -21,7 +21,7 @@ class postgresql_win extends WindowsLibraryBase
$headerFiles = ['libpq-fe.h', 'postgres_ext.h', 'pg_config_ext.h', 'libpq\libpq-fs.h']; $headerFiles = ['libpq-fe.h', 'postgres_ext.h', 'pg_config_ext.h', 'libpq\libpq-fs.h'];
foreach ($headerFiles as $header) { foreach ($headerFiles as $header) {
copy($this->source_dir . '\pgsql\include\\' . $header, BUILD_INCLUDE_PATH . '\\' . $header); copy($this->source_dir . '\include\\' . $header, BUILD_INCLUDE_PATH . '\\' . $header);
} }
} }
} }

View File

@@ -109,7 +109,7 @@ class LinuxToolCheckList
public function fixBuildTools(array $distro, array $missing): bool public function fixBuildTools(array $distro, array $missing): bool
{ {
$install_cmd = match ($distro['dist']) { $install_cmd = match ($distro['dist']) {
'ubuntu', 'debian', 'Deepin' => 'apt-get install -y', 'ubuntu', 'debian', 'linuxmint', 'Deepin' => 'apt-get install -y',
'alpine' => 'apk add', 'alpine' => 'apk add',
'redhat' => 'dnf install -y', 'redhat' => 'dnf install -y',
'centos' => 'yum install -y', 'centos' => 'yum install -y',

View File

@@ -98,31 +98,50 @@ class Downloader
{ {
logger()->debug("finding {$name} source from github {$type} tarball"); logger()->debug("finding {$name} source from github {$type} tarball");
$source['query'] ??= ''; $source['query'] ??= '';
$data = json_decode(self::curlExec(
url: "https://api.github.com/repos/{$source['repo']}/{$type}{$source['query']}",
hooks: [[CurlHook::class, 'setupGithubToken']],
retries: self::getRetryAttempts()
), true, 512, JSON_THROW_ON_ERROR);
$url = null; // Use /releases/latest when possible: it returns the semantically latest stable
foreach ($data as $rel) { // release regardless of publish order, avoiding issues with concurrent release branches.
if (($rel['prerelease'] ?? false) === true && ($source['prefer-stable'] ?? false)) { if ($type === 'releases' && empty($source['query']) && !($source['match'] ?? null)) {
continue; $data = json_decode(self::curlExec(
url: "https://api.github.com/repos/{$source['repo']}/releases/latest",
hooks: [[CurlHook::class, 'setupGithubToken']],
retries: self::getRetryAttempts()
), true, 512, JSON_THROW_ON_ERROR);
if (!is_array($data) || empty($data['tarball_url'])) {
throw new DownloaderException("failed to find {$name} source");
} }
if (($rel['draft'] ?? false) === true && (($source['prefer-stable'] ?? false) || !$rel['tarball_url'])) { $url = $data['tarball_url'];
continue; $version = $data['tag_name'] ?? $data['name'] ?? null;
} else {
$data = json_decode(self::curlExec(
url: "https://api.github.com/repos/{$source['repo']}/{$type}{$source['query']}",
hooks: [[CurlHook::class, 'setupGithubToken']],
retries: self::getRetryAttempts()
), true, 512, JSON_THROW_ON_ERROR);
$url = null;
$version = null;
foreach ($data as $rel) {
if (($rel['prerelease'] ?? false) === true && ($source['prefer-stable'] ?? false)) {
continue;
}
if (($rel['draft'] ?? false) === true && (($source['prefer-stable'] ?? false) || !$rel['tarball_url'])) {
continue;
}
if (!($source['match'] ?? null)) {
$url = $rel['tarball_url'] ?? null;
$version = $rel['tag_name'] ?? $rel['name'] ?? null;
break;
}
if (preg_match('|' . $source['match'] . '|', $rel['tarball_url'])) {
$url = $rel['tarball_url'];
$version = $rel['tag_name'] ?? $rel['name'] ?? null;
break;
}
} }
if (!($source['match'] ?? null)) { if (!$url) {
$url = $rel['tarball_url'] ?? null; throw new DownloaderException("failed to find {$name} source");
break;
} }
if (preg_match('|' . $source['match'] . '|', $rel['tarball_url'])) {
$url = $rel['tarball_url'];
break;
}
}
if (!$url) {
throw new DownloaderException("failed to find {$name} source");
} }
$headers = self::curlExec( $headers = self::curlExec(
url: $url, url: $url,
@@ -134,7 +153,7 @@ class Downloader
if ($matches) { if ($matches) {
$filename = $matches['filename']; $filename = $matches['filename'];
} else { } else {
$filename = "{$name}-" . ($type === 'releases' ? $data['tag_name'] : $data['name']) . '.tar.gz'; $filename = "{$name}-" . ($version ?? 'latest') . '.tar.gz';
} }
return [$url, $filename]; return [$url, $filename];

View File

@@ -152,7 +152,7 @@ class FileSystem
$src_path = FileSystem::convertPath($from); $src_path = FileSystem::convertPath($from);
switch (PHP_OS_FAMILY) { switch (PHP_OS_FAMILY) {
case 'Windows': case 'Windows':
f_passthru('xcopy "' . $src_path . '" "' . $dst_path . '" /s/e/v/y/i'); f_passthru('xcopy "' . $src_path . '" "' . $dst_path . '" /s/e/y/i');
break; break;
case 'Linux': case 'Linux':
case 'Darwin': case 'Darwin':

View File

@@ -95,6 +95,10 @@ class SourcePatcher
// patch php-src/build/php.m4 PKG_CHECK_MODULES -> PKG_CHECK_MODULES_STATIC // patch php-src/build/php.m4 PKG_CHECK_MODULES -> PKG_CHECK_MODULES_STATIC
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/build/php.m4', 'PKG_CHECK_MODULES(', 'PKG_CHECK_MODULES_STATIC('); FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/build/php.m4', 'PKG_CHECK_MODULES(', 'PKG_CHECK_MODULES_STATIC(');
if ($builder->getPHPVersionID() >= 80300 && $builder->getPHPVersionID() < 80400) {
self::patchFile('spc_fix_avx512_cache_before_80400.patch', SOURCE_PATH . '/php-src');
}
if ($builder->getOption('enable-micro-win32')) { if ($builder->getOption('enable-micro-win32')) {
self::patchMicroWin32(); self::patchMicroWin32();
} else { } else {
@@ -125,6 +129,15 @@ class SourcePatcher
FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/configure', '/have_capstone="yes"/', 'have_capstone="no"'); FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/configure', '/have_capstone="yes"/', 'have_capstone="no"');
} }
// PHP 8.2 and below: bcmath libbcmath uses K&R style C function
if (is_unix() && $builder->getPHPVersionID() < 80300) {
FileSystem::replaceFileStr(
SOURCE_PATH . '/php-src/configure',
"for ac_arg in '' -std=gnu23",
"for ac_arg in '' -std=gnu17",
);
}
if (file_exists(SOURCE_PATH . '/php-src/configure.ac.bak')) { if (file_exists(SOURCE_PATH . '/php-src/configure.ac.bak')) {
// restore configure.ac // restore configure.ac
FileSystem::restoreBackupFile(SOURCE_PATH . '/php-src/configure.ac'); FileSystem::restoreBackupFile(SOURCE_PATH . '/php-src/configure.ac');

View File

@@ -85,7 +85,7 @@ class GoXcaddy extends CustomPackage
'GOBIN' => "{$pkgroot}/go-xcaddy/bin", 'GOBIN' => "{$pkgroot}/go-xcaddy/bin",
'GOPATH' => "{$pkgroot}/go", 'GOPATH' => "{$pkgroot}/go",
]) ])
->exec('CC=cc go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest'); ->exec('CGO_ENABLED=0 go install github.com/caddyserver/xcaddy/cmd/xcaddy@master');
} }
public static function getEnvironment(): array public static function getEnvironment(): array

View File

@@ -182,7 +182,8 @@ class UnixCMakeExecutor extends Executor
$target_arch = arch2gnu(php_uname('m')); $target_arch = arch2gnu(php_uname('m'));
$cflags = getenv('SPC_DEFAULT_C_FLAGS'); $cflags = getenv('SPC_DEFAULT_C_FLAGS');
$cc = getenv('CC'); $cc = getenv('CC');
$cxx = getenv('CCX'); $cxx = getenv('CXX');
$include = BUILD_INCLUDE_PATH;
logger()->debug("making cmake tool chain file for {$os} {$target_arch} with CFLAGS='{$cflags}'"); logger()->debug("making cmake tool chain file for {$os} {$target_arch} with CFLAGS='{$cflags}'");
$root = BUILD_ROOT_PATH; $root = BUILD_ROOT_PATH;
$pkgConfigExecutable = PkgConfigUtil::findPkgConfig(); $pkgConfigExecutable = PkgConfigUtil::findPkgConfig();
@@ -210,6 +211,8 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_C_STANDARD_INCLUDE_DIRECTORIES "{$include}")
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES "{$include}")
set(CMAKE_EXE_LINKER_FLAGS "-ldl -lpthread -lm -lutil") set(CMAKE_EXE_LINKER_FLAGS "-ldl -lpthread -lm -lutil")
CMAKE; CMAKE;
// Whoops, linux may need CMAKE_AR sometimes // Whoops, linux may need CMAKE_AR sometimes

View File

@@ -1,17 +1,12 @@
#include <sapi/embed/php_embed.h> #include <sapi/embed/php_embed.h>
int main(int argc,char **argv){ int main(int argc, char **argv) {
PHP_EMBED_START_BLOCK(argc, argv)
PHP_EMBED_START_BLOCK(argc,argv)
zend_file_handle file_handle; zend_file_handle file_handle;
zend_stream_init_filename(&file_handle, "embed.php");
zend_stream_init_filename(&file_handle,"embed.php"); if(!php_execute_script(&file_handle)) {
if(!php_execute_script(&file_handle)){
php_printf("Failed to execute PHP script.\n"); php_printf("Failed to execute PHP script.\n");
} }
PHP_EMBED_END_BLOCK() PHP_EMBED_END_BLOCK()
return 0; return 0;
} }

View File

@@ -25,12 +25,16 @@ const DANGER_CMD = [
// spc internal extensions // spc internal extensions
const SPC_INTERNAL_EXTENSIONS = [ const SPC_INTERNAL_EXTENSIONS = [
'core', 'core',
'date',
'hash', 'hash',
'json', 'json',
'lexbor',
'pcre', 'pcre',
'random',
'reflection', 'reflection',
'spl', 'spl',
'standard', 'standard',
'uri',
]; ];
// spc extension alias // spc extension alias

View File

@@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
assert(class_exists('Decimal\Decimal'));
assert(method_exists('Decimal\Decimal', 'valueOf'));
assert(0.1 + 0.2 !== 0.3);
$result = Decimal\Decimal::valueOf('0.1') + Decimal\Decimal::valueOf('0.2');
$expected = Decimal\Decimal::valueOf('0.3');
assert($result == $expected);

View File

@@ -31,6 +31,6 @@ if (file_exists('/etc/ssl/openssl.cnf')) {
} }
assert($valid); assert($valid);
} }
if (PHP_VERSION_ID >= 80500 && defined('OPENSSL_VERSION_NUMBER') && OPENSSL_VERSION_NUMBER >= 0x30200000) { if (PHP_VERSION_ID >= 80500 && (!PHP_ZTS || PHP_OS_FAMILY !== 'Windows') && defined('OPENSSL_VERSION_NUMBER') && OPENSSL_VERSION_NUMBER >= 0x30200000) {
assert(function_exists('openssl_password_hash')); assert(function_exists('openssl_password_hash'));
} }

View File

@@ -0,0 +1,91 @@
--- a/build/php.m4
+++ b/build/php.m4
@@ -2812,27 +2812,26 @@
dnl PHP_CHECK_AVX512_SUPPORTS
dnl
AC_DEFUN([PHP_CHECK_AVX512_SUPPORTS], [
- AC_MSG_CHECKING([for avx512 supports in compiler])
- save_CFLAGS="$CFLAGS"
- CFLAGS="-mavx512f -mavx512cd -mavx512vl -mavx512dq -mavx512bw $CFLAGS"
-
- AC_LINK_IFELSE([AC_LANG_SOURCE([[
- #include <immintrin.h>
- int main(void) {
- __m512i mask = _mm512_set1_epi32(0x1);
- char out[32];
- _mm512_storeu_si512(out, _mm512_shuffle_epi8(mask, mask));
- return 0;
- }]])], [
+ AC_CACHE_CHECK([whether compiler supports AVX-512], [php_cv_have_avx512], [
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="-mavx512f -mavx512cd -mavx512vl -mavx512dq -mavx512bw $CFLAGS"
+ AC_LINK_IFELSE([AC_LANG_SOURCE([[
+ #include <immintrin.h>
+ int main(void) {
+ __m512i mask = _mm512_set1_epi32(0x1);
+ char out[32];
+ _mm512_storeu_si512(out, _mm512_shuffle_epi8(mask, mask));
+ return 0;
+ }]])],
+ [php_cv_have_avx512=yes],
+ [php_cv_have_avx512=no])
+ CFLAGS="$save_CFLAGS"
+ ])
+ if test "$php_cv_have_avx512" = "yes"; then
have_avx512_supports=1
- AC_MSG_RESULT([yes])
- ], [
+ else
have_avx512_supports=0
- AC_MSG_RESULT([no])
- ])
-
- CFLAGS="$save_CFLAGS"
-
+ fi
AC_DEFINE_UNQUOTED([PHP_HAVE_AVX512_SUPPORTS],
[$have_avx512_supports], [Whether the compiler supports AVX512])
])
@@ -2841,24 +2840,26 @@
dnl PHP_CHECK_AVX512_VBMI_SUPPORTS
dnl
AC_DEFUN([PHP_CHECK_AVX512_VBMI_SUPPORTS], [
- AC_MSG_CHECKING([for avx512 vbmi supports in compiler])
- save_CFLAGS="$CFLAGS"
- CFLAGS="-mavx512f -mavx512cd -mavx512vl -mavx512dq -mavx512bw -mavx512vbmi $CFLAGS"
- AC_LINK_IFELSE([AC_LANG_SOURCE([[
- #include <immintrin.h>
- int main(void) {
- __m512i mask = _mm512_set1_epi32(0x1);
- char out[32];
- _mm512_storeu_si512(out, _mm512_permutexvar_epi8(mask, mask));
- return 0;
- }]])], [
+ AC_CACHE_CHECK([whether compiler supports AVX-512 VBMI], [php_cv_have_avx512vbmi], [
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="-mavx512f -mavx512cd -mavx512vl -mavx512dq -mavx512bw -mavx512vbmi $CFLAGS"
+ AC_LINK_IFELSE([AC_LANG_SOURCE([[
+ #include <immintrin.h>
+ int main(void) {
+ __m512i mask = _mm512_set1_epi32(0x1);
+ char out[32];
+ _mm512_storeu_si512(out, _mm512_permutexvar_epi8(mask, mask));
+ return 0;
+ }]])],
+ [php_cv_have_avx512vbmi=yes],
+ [php_cv_have_avx512vbmi=no])
+ CFLAGS="$save_CFLAGS"
+ ])
+ if test "$php_cv_have_avx512vbmi" = "yes"; then
have_avx512_vbmi_supports=1
- AC_MSG_RESULT([yes])
- ], [
+ else
have_avx512_vbmi_supports=0
- AC_MSG_RESULT([no])
- ])
- CFLAGS="$save_CFLAGS"
+ fi
AC_DEFINE_UNQUOTED([PHP_HAVE_AVX512_VBMI_SUPPORTS],
[$have_avx512_vbmi_supports], [Whether the compiler supports AVX512 VBMI])
])

View File

@@ -16,7 +16,7 @@ $test_php_version = [
// '8.1', // '8.1',
// '8.2', // '8.2',
// '8.3', // '8.3',
'8.4', // '8.4',
'8.5', '8.5',
// 'git', // 'git',
]; ];
@@ -24,14 +24,14 @@ $test_php_version = [
// test os (macos-15-intel, macos-15, ubuntu-latest, windows-latest are available) // test os (macos-15-intel, macos-15, ubuntu-latest, windows-latest are available)
$test_os = [ $test_os = [
// 'macos-15-intel', // bin/spc for x86_64 // 'macos-15-intel', // bin/spc for x86_64
'macos-15', // bin/spc for arm64 // 'macos-15', // bin/spc for arm64
'ubuntu-latest', // bin/spc-alpine-docker for x86_64 // 'ubuntu-latest', // bin/spc-alpine-docker for x86_64
'ubuntu-22.04', // bin/spc-gnu-docker for x86_64 'ubuntu-22.04', // bin/spc-gnu-docker for x86_64
// 'ubuntu-24.04', // bin/spc for x86_64 // 'ubuntu-24.04', // bin/spc for x86_64
'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64 'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64
// 'ubuntu-24.04-arm', // bin/spc for arm64 // 'ubuntu-24.04-arm', // bin/spc for arm64
// 'windows-2022', // .\bin\spc.ps1 // 'windows-2022', // .\bin\spc.ps1
'windows-2025', // 'windows-2025',
]; ];
// whether enable thread safe // whether enable thread safe
@@ -43,15 +43,15 @@ $no_strip = false;
$upx = false; $upx = false;
// whether to test frankenphp build, only available for macOS and linux // whether to test frankenphp build, only available for macOS and linux
$frankenphp = false; $frankenphp = true;
// prefer downloading pre-built packages to speed up the build process // prefer downloading pre-built packages to speed up the build process
$prefer_pre_built = false; $prefer_pre_built = true;
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
$extensions = match (PHP_OS_FAMILY) { $extensions = match (PHP_OS_FAMILY) {
'Linux', 'Darwin' => 'zlib', 'Linux', 'Darwin' => 'curl,gd',
'Windows' => 'gd,zlib,mbstring,filter', 'Windows' => 'bcmath,brotli,bz2,ctype,curl,dom,exif,fileinfo,filter,ftp,gd,iconv,intl,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pdo,pdo_mysql,pdo_pgsql,pgsql,session,simdjson,simplexml,sodium,sqlite3,tokenizer,xml,xmlreader,xmlwriter,zip,zlib',
}; };
// If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`). // If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`).
@@ -66,7 +66,7 @@ $with_suggested_libs = true;
// If you want to test extra libs for extensions, add them below (comma separated, example `libwebp,libavif`). Unnecessary, when $with_suggested_libs is true. // If you want to test extra libs for extensions, add them below (comma separated, example `libwebp,libavif`). Unnecessary, when $with_suggested_libs is true.
$with_libs = match (PHP_OS_FAMILY) { $with_libs = match (PHP_OS_FAMILY) {
'Linux', 'Darwin' => 'libjpeg', 'Linux', 'Darwin' => '',
'Windows' => '', 'Windows' => '',
}; };

View File

@@ -12,6 +12,15 @@ use SPC\exception\SPCInternalException;
function f_exec(string $command, mixed &$output, mixed &$result_code): bool function f_exec(string $command, mixed &$output, mixed &$result_code): bool
{ {
$result_code = 0; $result_code = 0;
if (str_contains($command, 'https://api.github.com/repos/AOMediaCodec/libavif/releases/latest')) {
$output = explode("\n", json_encode([
'tag_name' => 'v1.1.1',
'tarball_url' => 'https://api.github.com/repos/AOMediaCodec/libavif/tarball/v1.1.1',
'prerelease' => false,
'draft' => false,
]));
return true;
}
if (str_contains($command, 'https://api.github.com/repos/AOMediaCodec/libavif/releases')) { if (str_contains($command, 'https://api.github.com/repos/AOMediaCodec/libavif/releases')) {
$output = explode("\n", gzdecode(file_get_contents(__DIR__ . '/../assets/github_api_AOMediaCodec_libavif_releases.json.gz'))); $output = explode("\n", gzdecode(file_get_contents(__DIR__ . '/../assets/github_api_AOMediaCodec_libavif_releases.json.gz')));
return true; return true;