Compare commits

..

3 Commits

Author SHA1 Message Date
henderkes
cc59b39a02 string interpolation 2026-03-26 12:20:53 +07:00
henderkes
a8e50276d9 fix config validator to sort source.json (no changes) 2026-03-26 12:12:40 +07:00
henderkes
423b916736 add pecl type to downloader, fixes pecl/get giving us v3 of protobuf instead of v5. 2026-03-26 12:10:51 +07:00
44 changed files with 165 additions and 591 deletions

View File

@@ -11,6 +11,7 @@
"require": {
"php": ">= 8.3",
"ext-mbstring": "*",
"ext-simplexml": "*",
"ext-zlib": "*",
"laravel/prompts": "^0.1.12",
"symfony/console": "^5.4 || ^6 || ^7",

View File

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

View File

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

View File

@@ -8,30 +8,25 @@
"alt": false
},
"amqp": {
"type": "url",
"url": "https://pecl.php.net/get/amqp",
"type": "pecl",
"path": "php-src/ext/amqp",
"filename": "amqp.tgz",
"license": {
"type": "file",
"path": "LICENSE"
}
},
"apcu": {
"type": "url",
"url": "https://pecl.php.net/get/APCu",
"type": "pecl",
"pecl": "APCu",
"path": "php-src/ext/apcu",
"filename": "apcu.tgz",
"license": {
"type": "file",
"path": "LICENSE"
}
},
"ast": {
"type": "url",
"url": "https://pecl.php.net/get/ast",
"type": "pecl",
"path": "php-src/ext/ast",
"filename": "ast.tgz",
"license": {
"type": "file",
"path": "LICENSE"
@@ -84,40 +79,17 @@
"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": {
"type": "url",
"url": "https://pecl.php.net/get/dio",
"type": "pecl",
"path": "php-src/ext/dio",
"filename": "dio.tgz",
"license": {
"type": "file",
"path": "LICENSE"
}
},
"ev": {
"type": "url",
"url": "https://pecl.php.net/get/ev",
"type": "pecl",
"path": "php-src/ext/ev",
"filename": "ev.tgz",
"license": {
"type": "file",
"path": "LICENSE"
@@ -134,10 +106,8 @@
}
},
"ext-ds": {
"type": "url",
"url": "https://pecl.php.net/get/ds",
"type": "pecl",
"path": "php-src/ext/ds",
"filename": "ds.tgz",
"license": {
"type": "file",
"path": "LICENSE"
@@ -153,10 +123,8 @@
}
},
"ext-excimer": {
"type": "url",
"url": "https://pecl.php.net/get/excimer",
"type": "pecl",
"path": "php-src/ext/excimer",
"filename": "excimer.tgz",
"license": {
"type": "file",
"path": "LICENSE"
@@ -181,10 +149,8 @@
}
},
"ext-grpc": {
"type": "url",
"url": "https://pecl.php.net/get/grpc",
"type": "pecl",
"path": "php-src/ext/grpc",
"filename": "grpc.tgz",
"license": {
"type": "file",
"path": [
@@ -193,20 +159,16 @@
}
},
"ext-imagick": {
"type": "url",
"url": "https://pecl.php.net/get/imagick",
"type": "pecl",
"path": "php-src/ext/imagick",
"filename": "imagick.tgz",
"license": {
"type": "file",
"path": "LICENSE"
}
},
"ext-imap": {
"type": "url",
"url": "https://pecl.php.net/get/imap",
"type": "pecl",
"path": "php-src/ext/imap",
"filename": "imap.tgz",
"license": {
"type": "file",
"path": [
@@ -226,19 +188,15 @@
}
},
"ext-maxminddb": {
"type": "url",
"url": "https://pecl.php.net/get/maxminddb",
"filename": "ext-maxminddb.tgz",
"type": "pecl",
"license": {
"type": "file",
"path": "LICENSE"
}
},
"ext-memcache": {
"type": "url",
"url": "https://pecl.php.net/get/memcache",
"type": "pecl",
"path": "php-src/ext/memcache",
"filename": "memcache.tgz",
"license": {
"type": "file",
"path": "LICENSE"
@@ -246,7 +204,7 @@
},
"ext-rdkafka": {
"type": "ghtar",
"repo": "php-rdkafka/php-rdkafka",
"repo": "arnaud-lb/php-rdkafka",
"path": "php-src/ext/rdkafka",
"license": {
"type": "file",
@@ -254,10 +212,8 @@
}
},
"ext-simdjson": {
"type": "url",
"url": "https://pecl.php.net/get/simdjson",
"type": "pecl",
"path": "php-src/ext/simdjson",
"filename": "simdjson.tgz",
"license": {
"type": "file",
"path": "LICENSE"
@@ -274,40 +230,32 @@
}
},
"ext-ssh2": {
"type": "url",
"url": "https://pecl.php.net/get/ssh2",
"type": "pecl",
"path": "php-src/ext/ssh2",
"filename": "ssh2.tgz",
"license": {
"type": "file",
"path": "LICENSE"
}
},
"ext-trader": {
"type": "url",
"url": "https://pecl.php.net/get/trader",
"type": "pecl",
"path": "php-src/ext/trader",
"filename": "trader.tgz",
"license": {
"type": "file",
"path": "LICENSE"
}
},
"ext-uuid": {
"type": "url",
"url": "https://pecl.php.net/get/uuid",
"type": "pecl",
"path": "php-src/ext/uuid",
"filename": "uuid.tgz",
"license": {
"type": "file",
"path": "LICENSE"
}
},
"ext-uv": {
"type": "url",
"url": "https://pecl.php.net/get/uv",
"type": "pecl",
"path": "php-src/ext/uv",
"filename": "uv.tgz",
"license": {
"type": "file",
"path": "LICENSE"
@@ -324,9 +272,7 @@
}
},
"ext-zip": {
"type": "url",
"url": "https://pecl.php.net/get/zip",
"filename": "ext-zip.tgz",
"type": "pecl",
"license": {
"type": "file",
"path": "LICENSE"
@@ -431,10 +377,8 @@
}
},
"igbinary": {
"type": "url",
"url": "https://pecl.php.net/get/igbinary",
"type": "pecl",
"path": "php-src/ext/igbinary",
"filename": "igbinary.tgz",
"license": {
"type": "file",
"path": "COPYING"
@@ -458,10 +402,8 @@
}
},
"inotify": {
"type": "url",
"url": "https://pecl.php.net/get/inotify",
"type": "pecl",
"path": "php-src/ext/inotify",
"filename": "inotify.tgz",
"license": {
"type": "file",
"path": "LICENSE"
@@ -481,8 +423,10 @@
}
},
"krb5": {
"type": "url",
"url": "https://web.mit.edu/kerberos/dist/krb5/1.22/krb5-1.22.2.tar.gz",
"type": "ghtagtar",
"repo": "krb5/krb5",
"match": "krb5.+-final",
"prefer-stable": true,
"license": {
"type": "file",
"path": "NOTICE"
@@ -658,7 +602,6 @@
"libjpeg": {
"type": "ghtar",
"repo": "libjpeg-turbo/libjpeg-turbo",
"prefer-stable": true,
"license": {
"type": "file",
"path": "LICENSE.md"
@@ -700,14 +643,6 @@
"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": {
"type": "ghtagtar",
"repo": "awesomized/libmemcached",
@@ -870,10 +805,8 @@
}
},
"memcached": {
"type": "url",
"url": "https://pecl.php.net/get/memcached",
"type": "pecl",
"path": "php-src/ext/memcached",
"filename": "memcached.tgz",
"license": {
"type": "file",
"path": "LICENSE"
@@ -911,10 +844,8 @@
}
},
"msgpack": {
"type": "url",
"url": "https://pecl.php.net/get/msgpack",
"type": "pecl",
"path": "php-src/ext/msgpack",
"filename": "msgpack.tgz",
"license": {
"type": "file",
"path": "LICENSE"
@@ -1000,7 +931,7 @@
"openssl": {
"type": "ghrel",
"repo": "openssl/openssl",
"match": "openssl-3.+\\.tar\\.gz",
"match": "openssl.+\\.tar\\.gz",
"prefer-stable": true,
"alt": {
"type": "filelist",
@@ -1014,39 +945,31 @@
}
},
"opentelemetry": {
"type": "url",
"url": "https://pecl.php.net/get/opentelemetry",
"type": "pecl",
"path": "php-src/ext/opentelemetry",
"filename": "opentelemetry.tgz",
"license": {
"type": "file",
"path": "LICENSE"
}
},
"parallel": {
"type": "url",
"url": "https://pecl.php.net/get/parallel",
"type": "pecl",
"path": "php-src/ext/parallel",
"filename": "parallel.tgz",
"license": {
"type": "file",
"path": "LICENSE"
}
},
"pcov": {
"type": "url",
"url": "https://pecl.php.net/get/pcov",
"filename": "pcov.tgz",
"type": "pecl",
"license": {
"type": "file",
"path": "LICENSE"
}
},
"pdo_sqlsrv": {
"type": "url",
"url": "https://pecl.php.net/get/pdo_sqlsrv",
"type": "pecl",
"path": "php-src/ext/pdo_sqlsrv",
"filename": "pdo_sqlsrv.tgz",
"license": {
"type": "file",
"path": "LICENSE"
@@ -1079,10 +1002,8 @@
}
},
"protobuf": {
"type": "url",
"url": "https://pecl.php.net/get/protobuf-5.34.1.tgz",
"type": "pecl",
"path": "php-src/ext/protobuf",
"filename": "protobuf.tgz",
"license": {
"type": "file",
"path": "LICENSE"
@@ -1141,10 +1062,8 @@
}
},
"redis": {
"type": "url",
"url": "https://pecl.php.net/get/redis",
"type": "pecl",
"path": "php-src/ext/redis",
"filename": "redis.tgz",
"license": {
"type": "file",
"path": [
@@ -1181,10 +1100,8 @@
}
},
"sqlsrv": {
"type": "url",
"url": "https://pecl.php.net/get/sqlsrv",
"type": "pecl",
"path": "php-src/ext/sqlsrv",
"filename": "sqlsrv.tgz",
"license": {
"type": "file",
"path": "LICENSE"
@@ -1194,6 +1111,7 @@
"path": "php-src/ext/swoole",
"type": "ghtar",
"repo": "swoole/swoole-src",
"match": "v6\\.+",
"prefer-stable": true,
"license": {
"type": "file",
@@ -1246,20 +1164,16 @@
}
},
"xhprof": {
"type": "url",
"url": "https://pecl.php.net/get/xhprof",
"type": "pecl",
"path": "php-src/ext/xhprof-src",
"filename": "xhprof.tgz",
"license": {
"type": "file",
"path": "LICENSE"
}
},
"xlswriter": {
"type": "url",
"url": "https://pecl.php.net/get/xlswriter",
"type": "pecl",
"path": "php-src/ext/xlswriter",
"filename": "xlswriter.tgz",
"license": {
"type": "file",
"path": "LICENSE"
@@ -1277,10 +1191,8 @@
}
},
"yac": {
"type": "url",
"url": "https://pecl.php.net/get/yac",
"type": "pecl",
"path": "php-src/ext/yac",
"filename": "yac.tgz",
"license": {
"type": "file",
"path": "LICENSE"

View File

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

View File

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

View File

@@ -11,9 +11,6 @@ use SPC\exception\ValidationException;
use SPC\exception\WrongUsageException;
use SPC\store\Config;
use SPC\store\FileSystem;
use SPC\toolchain\ToolchainManager;
use SPC\toolchain\ZigToolchain;
use SPC\util\GlobalEnvManager;
use SPC\util\SPCConfigUtil;
use SPC\util\SPCTarget;
@@ -234,7 +231,7 @@ class Extension
if (preg_match('/^(.*_SHARED_LIBADD\s*=\s*)(.*)$/m', $makefileContent, $matches)) {
$prefix = $matches[1];
$currentLibs = trim($matches[2]);
$newLibs = clean_spaces("{$currentLibs} {$staticLibs} {$lstdcpp}");
$newLibs = trim("{$currentLibs} {$staticLibs} {$lstdcpp}");
$deduplicatedLibs = deduplicate_flags($newLibs);
FileSystem::replaceFileRegex(
@@ -546,11 +543,6 @@ class Extension
*/
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);
[$staticLibs, $sharedLibs] = $this->splitLibsIntoStaticAndShared($config['libs']);
$preStatic = PHP_OS_FAMILY === 'Darwin' ? '' : '-Wl,--start-group ';

View File

@@ -1,46 +0,0 @@
<?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,15 +28,6 @@ class grpc extends Extension
'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'
PHP_ARG_ENABLE(grpc, [whether to enable grpc support], [AS_HELP_STRING([--enable-grpc], [Enable grpc support])])

View File

@@ -5,22 +5,11 @@ declare(strict_types=1);
namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\store\FileSystem;
use SPC\util\CustomExt;
#[CustomExt('mongodb')]
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
{
$arg = ' --enable-mongodb' . ($shared ? '=shared' : '') . ' ';

View File

@@ -26,7 +26,7 @@ class password_argon2 extends Extension
public function getConfigureArg(bool $shared = false): string
{
if ($this->builder->getExt('openssl')?->isBuildStatic() || $this->isBuildShared()) {
if ($this->builder->getLib('openssl') !== null) {
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
}

View File

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

View File

@@ -7,7 +7,6 @@ namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\store\SourcePatcher;
use SPC\util\CustomExt;
use SPC\util\GlobalEnvManager;
#[CustomExt('xlswriter')]
class xlswriter extends Extension
@@ -29,13 +28,6 @@ class xlswriter extends Extension
public function patchBeforeMake(): bool
{
$patched = parent::patchBeforeMake();
// Remove when https://github.com/viest/php-ext-xlswriter/pull/560 is merged
if (PHP_OS_FAMILY !== 'Windows') {
GlobalEnvManager::putenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS=' . getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS') . ' -std=gnu17');
$patched = true;
}
if (PHP_OS_FAMILY === 'Windows') {
// fix windows build with openssl extension duplicate symbol bug
SourcePatcher::patchFile('spc_fix_xlswriter_win32.patch', $this->source_dir);
@@ -48,10 +40,4 @@ class xlswriter extends Extension
}
return $patched;
}
// Remove when https://github.com/viest/php-ext-xlswriter/pull/560 is merged
protected function getExtraEnv(): array
{
return ['CFLAGS' => '-std=gnu17'];
}
}

View File

@@ -1,12 +0,0 @@
<?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,8 +11,6 @@ use SPC\store\Config;
use SPC\store\DirDiff;
use SPC\store\FileSystem;
use SPC\store\SourcePatcher;
use SPC\toolchain\ToolchainManager;
use SPC\toolchain\ZigToolchain;
use SPC\util\GlobalEnvManager;
use SPC\util\SPCConfigUtil;
use SPC\util\SPCTarget;
@@ -67,8 +65,7 @@ class LinuxBuilder extends UnixBuilderBase
// php 8.5 contains opcache extension by default,
// if opcache_jit is enabled for 8.5 or opcache enabled,
// we need to disable undefined behavior sanitizer.
$compiler_extra = getenv('SPC_COMPILER_EXTRA') ?: '';
f_putenv('SPC_COMPILER_EXTRA=' . trim($compiler_extra . ' -fno-sanitize=undefined'));
f_putenv('SPC_COMPILER_EXTRA=-fno-sanitize=undefined');
}
if ($this->getOption('enable-zts', false)) {
@@ -269,11 +266,6 @@ class LinuxBuilder extends UnixBuilderBase
*/
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($sharedExts, static function ($ext) {
return Config::getExt($ext->getName(), 'build-with-php') === true;

View File

@@ -1,12 +0,0 @@
<?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

@@ -1,12 +0,0 @@
<?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);
sort($defined);
// export
if (SPCTarget::getTargetOS() === 'Linux' && ToolchainManager::getToolchainClass() !== ZigToolchain::class) {
if (SPCTarget::getTargetOS() === 'Linux') {
file_put_contents("{$lib_file}.dynsym", "{\n" . implode("\n", array_map(fn ($x) => " {$x};", $defined)) . "};\n");
} else {
file_put_contents("{$lib_file}.dynsym", implode("\n", $defined) . "\n");
@@ -72,6 +72,10 @@ trait UnixSystemUtilTrait
if (!is_file($symbol_file)) {
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
if (SPCTarget::getTargetOS() !== 'Linux' || ToolchainManager::getToolchainClass() === ZigToolchain::class) {
return "-Wl,-exported_symbols_list,{$symbol_file}";

View File

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

View File

@@ -4,7 +4,6 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\store\FileSystem;
use SPC\util\executor\UnixCMakeExecutor;
trait curl
@@ -33,16 +32,8 @@ trait curl
)
->build();
// patch pkgconf
$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/')
->exec("sed -ie 's|\"/lib/libcurl.a\"|\"" . BUILD_LIB_PATH . "/libcurl.a\"|g' CURLTargets-release.cmake");
}

View File

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

View File

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

View File

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

View File

@@ -1,17 +0,0 @@
<?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
{
copy("{$this->source_dir}\\lib\\icudt.lib", "{$this->getLibDir()}\\icudt.lib");
copy("{$this->source_dir}\\lib\\icuin.lib", "{$this->getLibDir()}\\icuin.lib");
copy("{$this->source_dir}\\lib\\icuio.lib", "{$this->getLibDir()}\\icuio.lib");
copy("{$this->source_dir}\\lib\\icuuc.lib", "{$this->getLibDir()}\\icuuc.lib");
copy("{$this->source_dir}\\x64-windows-static\\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}\\x64-windows-static\\lib\\icuio.lib", "{$this->getLibDir()}\\icuio.lib");
copy("{$this->source_dir}\\x64-windows-static\\lib\\icuuc.lib", "{$this->getLibDir()}\\icuuc.lib");
// create libpq folder in buildroot/includes/libpq
if (!file_exists("{$this->getIncludeDir()}\\unicode")) {
mkdir("{$this->getIncludeDir()}\\unicode");
}
FileSystem::copyDir("{$this->source_dir}\\include\\unicode", "{$this->getIncludeDir()}\\unicode");
FileSystem::copyDir("{$this->source_dir}\\x64-windows-static\\include\\unicode", "{$this->getIncludeDir()}\\unicode");
}
}

View File

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

View File

@@ -1,31 +0,0 @@
<?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,7 +29,6 @@ class ngtcp2 extends WindowsLibraryBase
'-DBUILD_SHARED_LIBS=OFF ' .
'-DENABLE_STATIC_CRT=ON ' .
'-DENABLE_LIB_ONLY=ON ' .
'-DENABLE_OPENSSL=OFF ' .
'-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' '
)
->execWithWrapper(

View File

@@ -10,9 +10,9 @@ class postgresql_win extends WindowsLibraryBase
protected function build(): void
{
copy($this->source_dir . '\lib\libpq.lib', BUILD_LIB_PATH . '\libpq.lib');
copy($this->source_dir . '\lib\libpgport.lib', BUILD_LIB_PATH . '\libpgport.lib');
copy($this->source_dir . '\lib\libpgcommon.lib', BUILD_LIB_PATH . '\libpgcommon.lib');
copy($this->source_dir . '\pgsql\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 . '\pgsql\lib\libpgcommon.lib', BUILD_LIB_PATH . '\libpgcommon.lib');
// create libpq folder in buildroot/includes/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'];
foreach ($headerFiles as $header) {
copy($this->source_dir . '\include\\' . $header, BUILD_INCLUDE_PATH . '\\' . $header);
copy($this->source_dir . '\pgsql\include\\' . $header, BUILD_INCLUDE_PATH . '\\' . $header);
}
}
}

View File

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

View File

@@ -16,6 +16,43 @@ use SPC\util\SPCTarget;
*/
class Downloader
{
/**
* Get latest stable version from PECL
*
* @param string $name Source name
* @param array $source Source meta info: [pecl?]
* @return array<int, string> [url, filename]
*/
public static function getPECLInfo(string $name, array $source): array
{
$package = $source['pecl'] ?? (str_starts_with($name, 'ext-') ? substr($name, 4) : $name);
$lp = strtolower($package);
$api_url = "https://pecl.php.net/rest/r/{$lp}/allreleases.xml";
logger()->debug("Fetching {$name} source from PECL: {$api_url}");
$xml = self::curlExec(
url: $api_url,
retries: self::getRetryAttempts()
);
$dom = new \SimpleXMLElement($xml);
$version = null;
if ($source['prefer-stable'] ?? false) {
foreach ($dom->r as $release) {
if ((string) $release->s === 'stable') {
$version = (string) $release->v;
break;
}
}
}
$version ??= isset($dom->r[0]) ? (string) $dom->r[0]->v : null;
if ($version === null) {
throw new DownloaderException("failed to find any release for {$name} on PECL");
}
$url = "https://pecl.php.net/get/{$package}-{$version}.tgz";
$filename = "{$package}-{$version}.tgz";
logger()->info("Found {$name} PECL version: {$version}");
return [$url, $filename];
}
/**
* Get latest version from PIE config (Packagist)
*
@@ -98,50 +135,31 @@ class Downloader
{
logger()->debug("finding {$name} source from github {$type} tarball");
$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);
// Use /releases/latest when possible: it returns the semantically latest stable
// release regardless of publish order, avoiding issues with concurrent release branches.
if ($type === 'releases' && empty($source['query']) && !($source['match'] ?? null)) {
$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");
$url = null;
foreach ($data as $rel) {
if (($rel['prerelease'] ?? false) === true && ($source['prefer-stable'] ?? false)) {
continue;
}
$url = $data['tarball_url'];
$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 (($rel['draft'] ?? false) === true && (($source['prefer-stable'] ?? false) || !$rel['tarball_url'])) {
continue;
}
if (!$url) {
throw new DownloaderException("failed to find {$name} source");
if (!($source['match'] ?? null)) {
$url = $rel['tarball_url'] ?? null;
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(
url: $url,
@@ -153,7 +171,7 @@ class Downloader
if ($matches) {
$filename = $matches['filename'];
} else {
$filename = "{$name}-" . ($version ?? 'latest') . '.tar.gz';
$filename = "{$name}-" . ($type === 'releases' ? $data['tag_name'] : $data['name']) . '.tar.gz';
}
return [$url, $filename];
@@ -631,6 +649,7 @@ class Downloader
* @param array{
* url?: string,
* repo?: string,
* pecl?: string,
* rev?: string,
* path?: string,
* filename?: string,
@@ -650,6 +669,10 @@ class Downloader
{
try {
switch ($type) {
case 'pecl': // PECL (latest stable)
[$url, $filename] = self::getPECLInfo($name, $conf);
self::downloadFile($name, $url, $filename, $conf['path'] ?? $conf['extract'] ?? null, $download_as);
break;
case 'pie': // Packagist
[$url, $filename] = self::getPIEInfo($name, $conf);
self::downloadFile($name, $url, $filename, $conf['path'] ?? $conf['extract'] ?? null, $download_as, hooks: [[CurlHook::class, 'setupGithubToken']]);

View File

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

View File

@@ -95,10 +95,6 @@ class SourcePatcher
// 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(');
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')) {
self::patchMicroWin32();
} else {
@@ -129,15 +125,6 @@ class SourcePatcher
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')) {
// restore 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",
'GOPATH' => "{$pkgroot}/go",
])
->exec('CGO_ENABLED=0 go install github.com/caddyserver/xcaddy/cmd/xcaddy@master');
->exec('CC=cc go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest');
}
public static function getEnvironment(): array

View File

@@ -22,7 +22,9 @@ class ConfigValidator
'regex' => 'string', // regex pattern
'rev' => 'string', // revision/branch
'repo' => 'string', // repository name
'pecl' => 'string', // PECL package name
'match' => 'string', // match pattern (aaa*bbb)
'query' => 'string', // query string for API requests
'filename' => 'string', // filename
'path' => 'string', // copy path
'extract' => 'string', // copy path (alias of path)
@@ -73,12 +75,13 @@ class ConfigValidator
private const array SOURCE_TYPE_FIELDS = [
'filelist' => [['url', 'regex'], []],
'git' => [['url', 'rev'], ['path', 'extract', 'submodules']],
'ghtagtar' => [['repo'], ['path', 'extract', 'prefer-stable', 'match']],
'ghtar' => [['repo'], ['path', 'extract', 'prefer-stable', 'match']],
'ghtagtar' => [['repo'], ['path', 'extract', 'prefer-stable', 'match', 'query']],
'ghtar' => [['repo'], ['path', 'extract', 'prefer-stable', 'match', 'query']],
'ghrel' => [['repo', 'match'], ['path', 'extract', 'prefer-stable']],
'url' => [['url'], ['filename', 'path', 'extract']],
'bitbuckettag' => [['repo'], ['path', 'extract']],
'local' => [['dirname'], ['path', 'extract']],
'pecl' => [[], ['pecl', 'path', 'prefer-stable']],
'pie' => [['repo'], ['path']],
'custom' => [[], ['func']],
];

View File

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

View File

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

View File

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

View File

@@ -1,10 +0,0 @@
<?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);
}
if (PHP_VERSION_ID >= 80500 && (!PHP_ZTS || PHP_OS_FAMILY !== 'Windows') && defined('OPENSSL_VERSION_NUMBER') && OPENSSL_VERSION_NUMBER >= 0x30200000) {
if (PHP_VERSION_ID >= 80500 && defined('OPENSSL_VERSION_NUMBER') && OPENSSL_VERSION_NUMBER >= 0x30200000) {
assert(function_exists('openssl_password_hash'));
}

View File

@@ -1,91 +0,0 @@
--- 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

@@ -13,10 +13,10 @@ declare(strict_types=1);
// test php version (8.1 ~ 8.4 available, multiple for matrix)
$test_php_version = [
// '8.1',
'8.1',
// '8.2',
// '8.3',
// '8.4',
'8.4',
'8.5',
// 'git',
];
@@ -26,12 +26,12 @@ $test_os = [
// 'macos-15-intel', // bin/spc for x86_64
// 'macos-15', // bin/spc for arm64
// '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-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
// 'windows-2022', // .\bin\spc.ps1
// 'windows-2025',
'windows-2025',
];
// whether enable thread safe
@@ -42,16 +42,16 @@ $no_strip = false;
// compress with upx
$upx = false;
// whether to test frankenphp build, only available for macOS and linux
$frankenphp = true;
// whether to test frankenphp build, only available for macos and linux
$frankenphp = false;
// prefer downloading pre-built packages to speed up the build process
$prefer_pre_built = true;
$prefer_pre_built = false;
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
$extensions = match (PHP_OS_FAMILY) {
'Linux', 'Darwin' => 'curl,gd',
'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',
'Linux', 'Darwin' => 'pgsql',
'Windows' => 'gd,zlib,mbstring,filter',
};
// If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`).

View File

@@ -12,15 +12,6 @@ use SPC\exception\SPCInternalException;
function f_exec(string $command, mixed &$output, mixed &$result_code): bool
{
$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')) {
$output = explode("\n", gzdecode(file_get_contents(__DIR__ . '/../assets/github_api_AOMediaCodec_libavif_releases.json.gz')));
return true;