Compare commits

...

48 Commits

Author SHA1 Message Date
henderkes
5ef4623051 grpc will fail for php 8.5, it's not updated yet 2025-12-27 23:05:35 +01:00
henderkes
e952f1c76a we don't even need to build grpc library for grpc extension... 2025-12-27 22:36:24 +01:00
henderkes
09b89a30f9 WIP: use system libraries for grpc without building our own grpc lib 2025-12-27 22:20:02 +01:00
henderkes
9a681a9fa6 add mariadb mysqlnd plugins 2025-12-27 21:22:10 +01:00
crazywhalecc
f7ca621efe Test 2025-12-26 15:03:54 +08:00
henderkes
6b5200002e fix downloader selecting drafts 2025-12-20 23:29:25 +01:00
henderkes
53f7cdefe0 fix swoole compilation with php 8.5.1 2025-12-18 20:12:01 +01:00
henderkes
e1a14bbb9f fix implicit include 2025-12-18 17:39:05 +01:00
henderkes
9e051c8c80 fix: check for link first before checking for is_dir 2025-12-18 17:32:02 +01:00
henderkes
e677be74d7 remove 2025-12-18 17:32:02 +01:00
henderkes
037d224fd7 why does phpstan think this is necessary? 2025-12-18 17:32:02 +01:00
henderkes
ce44e00bd4 @crazywhalecc how to use patch points to delete source dirs? 2025-12-18 17:32:01 +01:00
henderkes
0247458853 we were installing to wrong dir if source name != lib name 2025-12-18 17:32:01 +01:00
henderkes
656a58c3fa remove source dir after successful build in CI environment 2025-12-18 17:32:01 +01:00
Jerry Ma
9fdfef5057 macOS don't need to disable avx2 explicitly (#1007) 2025-12-18 21:21:47 +08:00
Marc
18c5ccfe9d the libwebp 1.6.0 bug affects centos 7 too (#1004) 2025-12-16 09:33:20 +01:00
henderkes
d064e1353c the libwebp 1.6.0 bug affects centos 7 too 2025-12-15 18:50:20 +01:00
Jerry Ma
3c89ce6c7f Update version to 2.7.10 (#997) 2025-12-10 17:14:27 +08:00
Marc
07ea1e2887 update libwebp and libxml2 (#982) 2025-12-10 10:01:24 +01:00
Jerry Ma
f0b5e4f59e Fix typo in ncurses.php enable-symlinks option (#994) 2025-12-10 15:43:24 +08:00
Marc
a54021bf19 Apply suggestion from @henderkes 2025-12-10 08:42:28 +01:00
henderkes
dce63d3c87 we need extensions to explicitly tell which c std they need 2025-12-06 11:18:10 +01:00
henderkes
47ab5d7584 use c17 for extensions as well? 2025-12-05 13:57:28 +01:00
henderkes
b2182b4fe1 use source extract hook for pdo_sqlsrv 2025-12-05 12:20:14 +01:00
henderkes
1d5aec037b c17 instead 2025-12-05 12:14:57 +01:00
henderkes
6b5f702719 ncurses can't build with std=c23 (default with gcc 15) 2025-12-05 11:43:51 +01:00
henderkes
7bdcda1d62 gmp can't build with std=c23 (default with gcc 15) 2025-12-05 11:37:35 +01:00
henderkes
66840a8eed update xdebug to use pie sources 2025-12-05 09:15:22 +01:00
henderkes
98773ee5a6 zig toolchain can always use libc 2025-12-03 15:02:14 +01:00
henderkes
719d818fd1 we need to check for structure of pdo_sqlsrv extension 2025-12-02 21:34:32 +01:00
henderkes
b8444070ee update go-xcaddy version automatically 2025-12-01 20:41:58 +01:00
henderkes
5b4f4f8e55 maybe? 2025-12-01 19:55:51 +01:00
henderkes
22d263c0a8 maybe explicit mavx2?! 2025-12-01 19:27:44 +01:00
henderkes
150d866c15 revert turning off sse for libwebp, need to check why debian fails building 2025-12-01 19:12:43 +01:00
henderkes
c051a48d56 don't add -l:libstdc++.a if we're not actually using gcc/clang 2025-12-01 17:28:59 +01:00
henderkes
b965ffcd82 don't build extra programs 2025-12-01 17:16:59 +01:00
henderkes
7f863d182f don't remove dir, just don't build tests 2025-12-01 17:10:56 +01:00
henderkes
d1041c57dc remove openssl source/test dir (4.1gb?!) 2025-12-01 17:05:50 +01:00
henderkes
14b822a185 don't build avx2 if we don't have it 2025-12-01 16:55:52 +01:00
Marc
7204d277b4 Update PHP extensions for Linux and Darwin 2025-12-01 11:39:56 +01:00
Marc
5a0fd40dc4 update libwebp and libxml2 2025-12-01 09:55:46 +01:00
Marc
59a6e27532 add pcov extension (shared only, like xdebug) (#979) 2025-12-01 08:12:39 +01:00
Marc
6b3b841c0e Fix cross-device warning in rename function (#978) 2025-11-30 16:08:09 +01:00
henderkes
e6591ffe9c add pcov extension (shared only, like xdebug) 2025-11-29 14:03:17 +01:00
crazywhalecc
e316971764 Fix cross-device warning in rename function 2025-11-29 14:08:34 +08:00
Marc
d55278714f we need to change source_path for shared build (#977) 2025-11-26 16:10:27 +07:00
Jerry Ma
cb7eca9049 Bump version from 2.7.8 to 2.7.9 2025-11-26 17:08:49 +08:00
henderkes
5b8c9e6f09 we need to change source_path for shared build 2025-11-26 09:37:21 +01:00
27 changed files with 527 additions and 306 deletions

428
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -236,7 +236,9 @@
"arg-type-unix": "enable-path", "arg-type-unix": "enable-path",
"cpp-extension": true, "cpp-extension": true,
"lib-depends": [ "lib-depends": [
"grpc" "zlib",
"openssl",
"libcares"
] ]
}, },
"iconv": { "iconv": {
@@ -487,6 +489,36 @@
"zlib" "zlib"
] ]
}, },
"mysqlnd_ed25519": {
"type": "external",
"source": "mysqlnd_ed25519",
"arg-type": "enable",
"target": [
"shared"
],
"ext-depends": [
"mysqlnd"
],
"lib-depends": [
"libsodium",
"openssl"
]
},
"mysqlnd_parsec": {
"type": "external",
"source": "mysqlnd_parsec",
"arg-type": "enable",
"target": [
"shared"
],
"ext-depends": [
"mysqlnd"
],
"lib-depends": [
"libsodium",
"openssl"
]
},
"oci8": { "oci8": {
"type": "wip", "type": "wip",
"support": { "support": {
@@ -567,6 +599,13 @@
"type": "builtin", "type": "builtin",
"unix-only": true "unix-only": true
}, },
"pcov": {
"type": "external",
"source": "pcov",
"target": [
"shared"
]
},
"pdo": { "pdo": {
"type": "builtin" "type": "builtin"
}, },

View File

@@ -771,8 +771,9 @@
] ]
}, },
"libwebp": { "libwebp": {
"type": "url", "type": "ghtagtar",
"url": "https://github.com/webmproject/libwebp/archive/refs/tags/v1.3.2.tar.gz", "repo": "webmproject/libwebp",
"match": "v1\\.\\d+\\.\\d+$",
"provide-pre-built": true, "provide-pre-built": true,
"license": { "license": {
"type": "file", "type": "file",
@@ -780,8 +781,10 @@
} }
}, },
"libxml2": { "libxml2": {
"type": "url", "type": "ghtagtar",
"url": "https://github.com/GNOME/libxml2/archive/refs/tags/v2.12.5.tar.gz", "repo": "GNOME/libxml2",
"match": "v2\\.\\d+\\.\\d+$",
"provide-pre-built": false,
"license": { "license": {
"type": "file", "type": "file",
"path": "Copyright" "path": "Copyright"
@@ -868,6 +871,24 @@
"path": "LICENSE" "path": "LICENSE"
} }
}, },
"mysqlnd_ed25519": {
"type": "pie",
"repo": "mariadb/mysqlnd_ed25519",
"path": "php-src/ext/mysqlnd_ed25519",
"license": {
"type": "file",
"path": "LICENSE"
}
},
"mysqlnd_parsec": {
"type": "pie",
"repo": "mariadb/mysqlnd_parsec",
"path": "php-src/ext/mysqlnd_parsec",
"license": {
"type": "file",
"path": "LICENSE"
}
},
"ncurses": { "ncurses": {
"type": "filelist", "type": "filelist",
"url": "https://ftp.gnu.org/pub/gnu/ncurses/", "url": "https://ftp.gnu.org/pub/gnu/ncurses/",
@@ -963,6 +984,15 @@
"path": "LICENSE" "path": "LICENSE"
} }
}, },
"pcov": {
"type": "url",
"url": "https://pecl.php.net/get/pcov",
"filename": "pcov.tgz",
"license": {
"type": "file",
"path": "LICENSE"
}
},
"pdo_sqlsrv": { "pdo_sqlsrv": {
"type": "url", "type": "url",
"url": "https://pecl.php.net/get/pdo_sqlsrv", "url": "https://pecl.php.net/get/pdo_sqlsrv",
@@ -1160,9 +1190,8 @@
} }
}, },
"xdebug": { "xdebug": {
"type": "url", "type": "pie",
"url": "https://pecl.php.net/get/xdebug", "repo": "xdebug/xdebug",
"filename": "xdebug.tgz",
"license": { "license": {
"type": "file", "type": "file",
"path": "LICENSE" "path": "LICENSE"

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.7.8'; public const string VERSION = '2.7.11';
public function __construct() public function __construct()
{ {

View File

@@ -385,6 +385,9 @@ class Extension
logger()->info('Shared extension [' . $this->getName() . '] was already built, skipping (' . $this->getName() . '.so)'); logger()->info('Shared extension [' . $this->getName() . '] was already built, skipping (' . $this->getName() . '.so)');
return; return;
} }
if ((string) Config::getExt($this->getName(), 'type') === 'addon') {
return;
}
logger()->info('Building extension [' . $this->getName() . '] as shared extension (' . $this->getName() . '.so)'); logger()->info('Building extension [' . $this->getName() . '] as shared extension (' . $this->getName() . '.so)');
foreach ($this->dependencies as $dependency) { foreach ($this->dependencies as $dependency) {
if (!$dependency instanceof Extension) { if (!$dependency instanceof Extension) {

View File

@@ -184,18 +184,18 @@ abstract class LibraryBase
// extract first if not exists // extract first if not exists
if (!is_dir($this->source_dir)) { if (!is_dir($this->source_dir)) {
$this->getBuilder()->emitPatchPoint('before-library[ ' . static::NAME . ']-extract'); $this->getBuilder()->emitPatchPoint('before-library[' . static::NAME . ']-extract');
SourceManager::initSource(libs: [static::NAME], source_only: true); SourceManager::initSource(libs: [static::NAME], source_only: true);
$this->getBuilder()->emitPatchPoint('after-library[ ' . static::NAME . ']-extract'); $this->getBuilder()->emitPatchPoint('after-library[' . static::NAME . ']-extract');
} }
if (!$this->patched && $this->patchBeforeBuild()) { if (!$this->patched && $this->patchBeforeBuild()) {
file_put_contents($this->source_dir . '/.spc.patched', 'PATCHED!!!'); file_put_contents($this->source_dir . '/.spc.patched', 'PATCHED!!!');
} }
$this->getBuilder()->emitPatchPoint('before-library[ ' . static::NAME . ']-build'); $this->getBuilder()->emitPatchPoint('before-library[' . static::NAME . ']-build');
$this->build(); $this->build();
$this->installLicense(); $this->installLicense();
$this->getBuilder()->emitPatchPoint('after-library[ ' . static::NAME . ']-build'); $this->getBuilder()->emitPatchPoint('after-library[' . static::NAME . ']-build');
return LIB_STATUS_OK; return LIB_STATUS_OK;
} }
@@ -346,19 +346,19 @@ abstract class LibraryBase
*/ */
protected function installLicense(): void protected function installLicense(): void
{ {
FileSystem::createDir(BUILD_ROOT_PATH . '/source-licenses/' . $this->getName());
$source = Config::getLib($this->getName(), 'source'); $source = Config::getLib($this->getName(), 'source');
FileSystem::createDir(BUILD_ROOT_PATH . "/source-licenses/{$source}");
$license_files = Config::getSource($source)['license'] ?? []; $license_files = Config::getSource($source)['license'] ?? [];
if (is_assoc_array($license_files)) { if (is_assoc_array($license_files)) {
$license_files = [$license_files]; $license_files = [$license_files];
} }
foreach ($license_files as $index => $license) { foreach ($license_files as $index => $license) {
if ($license['type'] === 'text') { if ($license['type'] === 'text') {
FileSystem::writeFile(BUILD_ROOT_PATH . '/source-licenses/' . $this->getName() . "/{$index}.txt", $license['text']); FileSystem::writeFile(BUILD_ROOT_PATH . "/source-licenses/{$source}/{$index}.txt", $license['text']);
continue; continue;
} }
if ($license['type'] === 'file') { if ($license['type'] === 'file') {
copy($this->source_dir . '/' . $license['path'], BUILD_ROOT_PATH . '/source-licenses/' . $this->getName() . "/{$index}.txt"); copy($this->source_dir . '/' . $license['path'], BUILD_ROOT_PATH . "/source-licenses/{$source}/{$index}.txt");
} }
} }
} }
@@ -375,8 +375,17 @@ abstract class LibraryBase
return false; return false;
} }
} }
$pkg_config_path = getenv('PKG_CONFIG_PATH') ?: '';
$search_paths = array_filter(explode(is_unix() ? ':' : ';', $pkg_config_path));
foreach (Config::getLib(static::NAME, 'pkg-configs', []) as $name) { foreach (Config::getLib(static::NAME, 'pkg-configs', []) as $name) {
if (!file_exists(BUILD_LIB_PATH . "/pkgconfig/{$name}.pc")) { $found = false;
foreach ($search_paths as $path) {
if (file_exists($path . "/{$name}.pc")) {
$found = true;
break;
}
}
if (!$found) {
return false; return false;
} }
} }

View File

@@ -5,6 +5,8 @@ declare(strict_types=1);
namespace SPC\builder\extension; namespace SPC\builder\extension;
use SPC\builder\Extension; use SPC\builder\Extension;
use SPC\toolchain\ToolchainManager;
use SPC\toolchain\ZigToolchain;
use SPC\util\CustomExt; use SPC\util\CustomExt;
#[CustomExt('imagick')] #[CustomExt('imagick')]
@@ -19,7 +21,9 @@ class imagick extends Extension
protected function splitLibsIntoStaticAndShared(string $allLibs): array protected function splitLibsIntoStaticAndShared(string $allLibs): array
{ {
[$static, $shared] = parent::splitLibsIntoStaticAndShared($allLibs); [$static, $shared] = parent::splitLibsIntoStaticAndShared($allLibs);
if (str_contains(getenv('PATH'), 'rh/devtoolset') || str_contains(getenv('PATH'), 'rh/gcc-toolset')) { if (ToolchainManager::getToolchainClass() !== ZigToolchain::class &&
(str_contains(getenv('PATH'), 'rh/devtoolset') || str_contains(getenv('PATH'), 'rh/gcc-toolset'))
) {
$static .= ' -l:libstdc++.a'; $static .= ' -l:libstdc++.a';
$shared = str_replace('-lstdc++', '', $shared); $shared = str_replace('-lstdc++', '', $shared);
} }

View File

@@ -5,6 +5,7 @@ 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('maxminddb')] #[CustomExt('maxminddb')]
@@ -12,15 +13,13 @@ class maxminddb extends Extension
{ {
public function patchBeforeBuildconf(): bool public function patchBeforeBuildconf(): bool
{ {
if (!is_link(SOURCE_PATH . '/php-src/ext/maxminddb')) { if (!is_dir(SOURCE_PATH . '/php-src/ext/maxminddb')) {
$original = $this->source_dir; $original = $this->source_dir;
if (PHP_OS_FAMILY === 'Windows') { FileSystem::copyDir($original . '/ext', SOURCE_PATH . '/php-src/ext/maxminddb');
f_passthru('cd ' . SOURCE_PATH . '/php-src/ext && mklink /D maxminddb ' . $original . '\ext'); $this->source_dir = SOURCE_PATH . '/php-src/ext/maxminddb';
} else {
f_passthru('cd ' . SOURCE_PATH . '/php-src/ext && ln -s ' . $original . '/ext maxminddb');
}
return true; return true;
} }
$this->source_dir = SOURCE_PATH . '/php-src/ext/maxminddb';
return false; return false;
} }
} }

View File

@@ -43,4 +43,9 @@ EOF
); );
return true; return true;
} }
protected function getExtraEnv(): array
{
return ['CFLAGS' => '-std=c17'];
}
} }

View File

@@ -24,4 +24,9 @@ class mongodb extends Extension
$arg .= $this->builder->getLib('zlib') ? ' --with-mongodb-zlib=yes ' : ' --with-mongodb-zlib=bundled '; $arg .= $this->builder->getLib('zlib') ? ' --with-mongodb-zlib=yes ' : ' --with-mongodb-zlib=bundled ';
return clean_spaces($arg); return clean_spaces($arg);
} }
public function getExtraEnv(): array
{
return ['CFLAGS' => '-std=c17'];
}
} }

View File

@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\util\CustomExt;
#[CustomExt('mysqlnd_ed25519')]
class mysqlnd_ed25519 extends Extension
{
public function getConfigureArg(bool $shared = false): string
{
return '--with-mysqlnd_ed25519' . ($shared ? '=shared' : '');
}
public function getUnixConfigureArg(bool $shared = false): string
{
return $this->getConfigureArg();
}
}

View File

@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\util\CustomExt;
#[CustomExt('mysqlnd_parsec')]
class mysqlnd_parsec extends Extension
{
public function getConfigureArg(bool $shared = false): string
{
return '--enable-mysqlnd_parsec' . ($shared ? '=shared' : '');
}
public function getUnixConfigureArg(bool $shared = false): string
{
return $this->getConfigureArg();
}
}

View File

@@ -45,7 +45,7 @@ class pgsql extends Extension
protected function getExtraEnv(): array protected function getExtraEnv(): array
{ {
return [ return [
'CFLAGS' => '-Wno-int-conversion', 'CFLAGS' => '-std=c17 -Wno-int-conversion',
]; ];
} }
} }

View File

@@ -17,6 +17,7 @@ class swoole extends Extension
public function patchBeforeMake(): bool public function patchBeforeMake(): bool
{ {
$patched = parent::patchBeforeMake(); $patched = parent::patchBeforeMake();
FileSystem::replaceFileStr($this->source_dir . '/ext-src/php_swoole_private.h', 'PHP_VERSION_ID > 80500', 'PHP_VERSION_ID >= 80600');
if ($this->builder instanceof MacOSBuilder) { if ($this->builder instanceof MacOSBuilder) {
// Fix swoole with event extension <util.h> conflict bug // Fix swoole with event extension <util.h> conflict bug
$util_path = shell()->execWithResult('xcrun --show-sdk-path', false)[1][0] . '/usr/include/util.h'; $util_path = shell()->execWithResult('xcrun --show-sdk-path', false)[1][0] . '/usr/include/util.h';

View File

@@ -6,6 +6,8 @@ namespace SPC\builder\linux\library;
use SPC\builder\linux\SystemUtil; use SPC\builder\linux\SystemUtil;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\toolchain\GccNativeToolchain;
use SPC\toolchain\ToolchainManager;
use SPC\util\executor\UnixAutoconfExecutor; use SPC\util\executor\UnixAutoconfExecutor;
use SPC\util\SPCTarget; use SPC\util\SPCTarget;
@@ -15,26 +17,19 @@ class liburing extends LinuxLibraryBase
public function patchBeforeBuild(): bool public function patchBeforeBuild(): bool
{ {
if (!SystemUtil::isMuslDist()) { if (SystemUtil::isMuslDist()) {
return false; FileSystem::replaceFileStr($this->source_dir . '/configure', 'realpath -s', 'realpath');
return true;
} }
FileSystem::replaceFileStr($this->source_dir . '/configure', 'realpath -s', 'realpath'); return false;
return true;
} }
protected function build(): void protected function build(): void
{ {
$use_libc = SPCTarget::getLibc() !== 'glibc' || version_compare(SPCTarget::getLibcVersion(), '2.30', '>='); $use_libc = ToolchainManager::getToolchainClass() !== GccNativeToolchain::class || version_compare(SPCTarget::getLibcVersion(), '2.30', '>=');
$make = UnixAutoconfExecutor::create($this); $make = UnixAutoconfExecutor::create($this);
if (!$use_libc) { if ($use_libc) {
$make->appendEnv([
'CC' => 'gcc', // libc-less version fails to compile with clang or zig
'CXX' => 'g++',
'AR' => 'ar',
'LD' => 'ld',
]);
} else {
$make->appendEnv([ $make->appendEnv([
'CFLAGS' => '-D_GNU_SOURCE', 'CFLAGS' => '-D_GNU_SOURCE',
]); ]);
@@ -51,7 +46,7 @@ class liburing extends LinuxLibraryBase
$use_libc ? '--use-libc' : '', $use_libc ? '--use-libc' : '',
) )
->configure() ->configure()
->make('library', 'install ENABLE_SHARED=0', with_clean: false); ->make('library ENABLE_SHARED=0', 'install ENABLE_SHARED=0', with_clean: false);
$this->patchPkgconfPrefix(); $this->patchPkgconfPrefix();
} }

View File

@@ -62,6 +62,7 @@ class openssl extends LinuxLibraryBase
"{$zlib_extra}" . "{$zlib_extra}" .
'enable-pie ' . 'enable-pie ' .
'no-legacy ' . 'no-legacy ' .
'no-tests ' .
"linux-{$arch}" "linux-{$arch}"
) )
->exec('make clean') ->exec('make clean')

View File

@@ -34,7 +34,7 @@ trait UnixLibraryTrait
$files = array_map(fn ($x) => "{$x}.pc", $conf_pc); $files = array_map(fn ($x) => "{$x}.pc", $conf_pc);
} }
foreach ($files as $name) { foreach ($files as $name) {
$realpath = realpath(BUILD_ROOT_PATH . '/lib/pkgconfig/' . $name); $realpath = realpath(BUILD_LIB_PATH . '/pkgconfig/' . $name);
if ($realpath === false) { if ($realpath === false) {
throw new PatchException('pkg-config prefix patcher', 'Cannot find library [' . static::NAME . '] pkgconfig file [' . $name . '] in ' . BUILD_LIB_PATH . '/pkgconfig/ !'); throw new PatchException('pkg-config prefix patcher', 'Cannot find library [' . static::NAME . '] pkgconfig file [' . $name . '] in ' . BUILD_LIB_PATH . '/pkgconfig/ !');
} }

View File

@@ -10,7 +10,12 @@ trait gmp
{ {
protected function build(): void protected function build(): void
{ {
UnixAutoconfExecutor::create($this)->configure()->make(); UnixAutoconfExecutor::create($this)
->appendEnv([
'CFLAGS' => '-std=c17',
])
->configure()
->make();
$this->patchPkgconfPrefix(['gmp.pc']); $this->patchPkgconfPrefix(['gmp.pc']);
} }
} }

View File

@@ -29,13 +29,17 @@ trait libjxl
); );
if (ToolchainManager::getToolchainClass() === ZigToolchain::class) { if (ToolchainManager::getToolchainClass() === ZigToolchain::class) {
$cmake->addConfigureArgs( $cflags = getenv('SPC_DEFAULT_C_FLAGS') ?: getenv('CFLAGS') ?: '';
'-DCXX_MAVX512F_SUPPORTED:BOOL=FALSE', $has_avx512 = str_contains($cflags, '-mavx512') || str_contains($cflags, '-march=x86-64-v4');
'-DCXX_MAVX512DQ_SUPPORTED:BOOL=FALSE', if (!$has_avx512) {
'-DCXX_MAVX512CD_SUPPORTED:BOOL=FALSE', $cmake->addConfigureArgs(
'-DCXX_MAVX512BW_SUPPORTED:BOOL=FALSE', '-DCXX_MAVX512F_SUPPORTED:BOOL=FALSE',
'-DCXX_MAVX512VL_SUPPORTED:BOOL=FALSE' '-DCXX_MAVX512DQ_SUPPORTED:BOOL=FALSE',
); '-DCXX_MAVX512CD_SUPPORTED:BOOL=FALSE',
'-DCXX_MAVX512BW_SUPPORTED:BOOL=FALSE',
'-DCXX_MAVX512VL_SUPPORTED:BOOL=FALSE'
);
}
} }
$cmake->build(); $cmake->build();

View File

@@ -10,8 +10,26 @@ trait libwebp
{ {
protected function build(): void protected function build(): void
{ {
$code = '#include <immintrin.h>
int main() { return _mm256_cvtsi256_si32(_mm256_setzero_si256()); }';
$cc = getenv('CC') ?: 'gcc';
[$ret] = shell()->execWithResult("printf '%s' '{$code}' | {$cc} -x c -mavx2 -o /dev/null - 2>&1");
$disableAvx2 = $ret !== 0 && GNU_ARCH === 'x86_64' && PHP_OS_FAMILY === 'Linux';
UnixCMakeExecutor::create($this) UnixCMakeExecutor::create($this)
->addConfigureArgs('-DWEBP_BUILD_EXTRAS=ON') ->addConfigureArgs(
'-DWEBP_BUILD_EXTRAS=OFF',
'-DWEBP_BUILD_ANIM_UTILS=OFF',
'-DWEBP_BUILD_CWEBP=OFF',
'-DWEBP_BUILD_DWEBP=OFF',
'-DWEBP_BUILD_GIF2WEBP=OFF',
'-DWEBP_BUILD_IMG2WEBP=OFF',
'-DWEBP_BUILD_VWEBP=OFF',
'-DWEBP_BUILD_WEBPINFO=OFF',
'-DWEBP_BUILD_WEBPMUX=OFF',
'-DWEBP_BUILD_FUZZTEST=OFF',
$disableAvx2 ? '-DWEBP_ENABLE_SIMD=OFF' : ''
)
->build(); ->build();
// patch pkgconfig // patch pkgconfig
$this->patchPkgconfPrefix(patch_option: PKGCONF_PATCH_PREFIX | PKGCONF_PATCH_LIBDIR); $this->patchPkgconfPrefix(patch_option: PKGCONF_PATCH_PREFIX | PKGCONF_PATCH_LIBDIR);

View File

@@ -16,6 +16,7 @@ trait ncurses
UnixAutoconfExecutor::create($this) UnixAutoconfExecutor::create($this)
->appendEnv([ ->appendEnv([
'CFLAGS' => '-std=c17',
'LDFLAGS' => SPCTarget::isStatic() ? '-static' : '', 'LDFLAGS' => SPCTarget::isStatic() ? '-static' : '',
]) ])
->configure( ->configure(
@@ -29,7 +30,7 @@ trait ncurses
'--without-tests', '--without-tests',
'--without-dlsym', '--without-dlsym',
'--without-debug', '--without-debug',
'-enable-symlinks', '--enable-symlinks',
"--bindir={$this->getBinDir()}", "--bindir={$this->getBinDir()}",
"--includedir={$this->getIncludeDir()}", "--includedir={$this->getIncludeDir()}",
"--libdir={$this->getLibDir()}", "--libdir={$this->getLibDir()}",

View File

@@ -108,6 +108,9 @@ class Downloader
if (($rel['prerelease'] ?? false) === true && ($source['prefer-stable'] ?? false)) { if (($rel['prerelease'] ?? false) === true && ($source['prefer-stable'] ?? false)) {
continue; continue;
} }
if (($rel['draft'] ?? false) === true && (($source['prefer-stable'] ?? false) || !$rel['tarball_url'])) {
continue;
}
if (!($source['match'] ?? null)) { if (!($source['match'] ?? null)) {
$url = $rel['tarball_url'] ?? null; $url = $rel['tarball_url'] ?? null;
break; break;

View File

@@ -408,13 +408,13 @@ class FileSystem
continue; continue;
} }
$sub_file = self::convertPath($dir . '/' . $v); $sub_file = self::convertPath($dir . '/' . $v);
if (is_dir($sub_file)) { if (is_link($sub_file) || is_file($sub_file)) {
# 如果是 目录 且 递推 , 则递推添加下级文件 if (!unlink($sub_file)) {
if (!self::removeDir($sub_file)) {
return false; return false;
} }
} elseif (is_link($sub_file) || is_file($sub_file)) { } elseif (is_dir($sub_file)) {
if (!unlink($sub_file)) { # 如果是 目录 且 递推 , 则递推添加下级文件
if (!self::removeDir($sub_file)) {
return false; return false;
} }
} }
@@ -572,6 +572,44 @@ class FileSystem
return file_put_contents($file, implode('', $lines)); return file_put_contents($file, implode('', $lines));
} }
/**
* Move file or directory, handling cross-device scenarios
* Uses rename() if possible, falls back to copy+delete for cross-device moves
*
* @param string $source Source path
* @param string $dest Destination path
*/
public static function moveFileOrDir(string $source, string $dest): void
{
$source = self::convertPath($source);
$dest = self::convertPath($dest);
// Check if source and dest are on the same device to avoid cross-device rename errors
$source_stat = @stat($source);
$dest_parent = dirname($dest);
$dest_stat = @stat($dest_parent);
// Only use rename if on same device
if ($source_stat !== false && $dest_stat !== false && $source_stat['dev'] === $dest_stat['dev']) {
if (@rename($source, $dest)) {
return;
}
}
// Fall back to copy + delete for cross-device moves or if rename failed
if (is_dir($source)) {
self::copyDir($source, $dest);
self::removeDir($source);
} else {
if (!copy($source, $dest)) {
throw new FileSystemException("Failed to copy file from {$source} to {$dest}");
}
if (!unlink($source)) {
throw new FileSystemException("Failed to remove source file: {$source}");
}
}
}
private static function extractArchive(string $filename, string $target): void private static function extractArchive(string $filename, string $target): void
{ {
// Create base dir // Create base dir
@@ -648,36 +686,6 @@ class FileSystem
}; };
} }
/**
* Move file or directory, handling cross-device scenarios
* Uses rename() if possible, falls back to copy+delete for cross-device moves
*
* @param string $source Source path
* @param string $dest Destination path
*/
private static function moveFileOrDir(string $source, string $dest): void
{
$source = self::convertPath($source);
$dest = self::convertPath($dest);
// Try rename first (fast, atomic)
if (@rename($source, $dest)) {
return;
}
if (is_dir($source)) {
self::copyDir($source, $dest);
self::removeDir($source);
} else {
if (!copy($source, $dest)) {
throw new FileSystemException("Failed to copy file from {$source} to {$dest}");
}
if (!unlink($source)) {
throw new FileSystemException("Failed to remove source file: {$source}");
}
}
}
/** /**
* Unzip file with stripping top-level directory * Unzip file with stripping top-level directory
*/ */

View File

@@ -25,6 +25,7 @@ class SourcePatcher
FileSystem::addSourceExtractHook('php-src', [__CLASS__, 'patchFfiCentos7FixO3strncmp']); FileSystem::addSourceExtractHook('php-src', [__CLASS__, 'patchFfiCentos7FixO3strncmp']);
FileSystem::addSourceExtractHook('sqlsrv', [__CLASS__, 'patchSQLSRVWin32']); FileSystem::addSourceExtractHook('sqlsrv', [__CLASS__, 'patchSQLSRVWin32']);
FileSystem::addSourceExtractHook('pdo_sqlsrv', [__CLASS__, 'patchSQLSRVWin32']); FileSystem::addSourceExtractHook('pdo_sqlsrv', [__CLASS__, 'patchSQLSRVWin32']);
FileSystem::addSourceExtractHook('pdo_sqlsrv', [__CLASS__, 'patchSQLSRVPhp85']);
FileSystem::addSourceExtractHook('yaml', [__CLASS__, 'patchYamlWin32']); FileSystem::addSourceExtractHook('yaml', [__CLASS__, 'patchYamlWin32']);
FileSystem::addSourceExtractHook('libyaml', [__CLASS__, 'patchLibYaml']); FileSystem::addSourceExtractHook('libyaml', [__CLASS__, 'patchLibYaml']);
FileSystem::addSourceExtractHook('php-src', [__CLASS__, 'patchImapLicense']); FileSystem::addSourceExtractHook('php-src', [__CLASS__, 'patchImapLicense']);
@@ -432,6 +433,23 @@ class SourcePatcher
return false; return false;
} }
/**
* Fix the compilation issue of pdo_sqlsrv with php 8.5
*/
public static function patchSQLSRVPhp85(): bool
{
$source_dir = SOURCE_PATH . '/php-src/ext/pdo_sqlsrv';
if (!file_exists($source_dir . '/config.m4') && is_dir($source_dir . '/source/pdo_sqlsrv')) {
FileSystem::moveFileOrDir($source_dir . '/LICENSE', $source_dir . '/source/pdo_sqlsrv/LICENSE');
FileSystem::moveFileOrDir($source_dir . '/source/shared', $source_dir . '/source/pdo_sqlsrv/shared');
FileSystem::moveFileOrDir($source_dir . '/source/pdo_sqlsrv', SOURCE_PATH . '/pdo_sqlsrv');
FileSystem::removeDir($source_dir);
FileSystem::moveFileOrDir(SOURCE_PATH . '/pdo_sqlsrv', $source_dir);
return true;
}
return false;
}
public static function patchYamlWin32(): bool public static function patchYamlWin32(): bool
{ {
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/yaml/config.w32', "lib.substr(lib.length - 6, 6) == '_a.lib'", "lib.substr(lib.length - 6, 6) == '_a.lib' || 'yes' == 'yes'"); FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/yaml/config.w32', "lib.substr(lib.length - 6, 6) == '_a.lib'", "lib.substr(lib.length - 6, 6) == '_a.lib' || 'yes' == 'yes'");

View File

@@ -48,10 +48,10 @@ class GoXcaddy extends CustomPackage
'macos' => 'darwin', 'macos' => 'darwin',
default => throw new \InvalidArgumentException('Unsupported OS: ' . $name), default => throw new \InvalidArgumentException('Unsupported OS: ' . $name),
}; };
$go_version = '1.25.0'; [$go_version] = explode("\n", Downloader::curlExec('https://go.dev/VERSION?m=text'));
$config = [ $config = [
'type' => 'url', 'type' => 'url',
'url' => "https://go.dev/dl/go{$go_version}.{$os}-{$arch}.tar.gz", 'url' => "https://go.dev/dl/{$go_version}.{$os}-{$arch}.tar.gz",
]; ];
Downloader::downloadPackage($name, $config, $force); Downloader::downloadPackage($name, $config, $force);
} }

View File

@@ -226,9 +226,17 @@ class SPCConfigUtil
// parse pkg-configs // parse pkg-configs
foreach ($libraries as $library) { foreach ($libraries as $library) {
$pc = Config::getLib($library, 'pkg-configs', []); $pc = Config::getLib($library, 'pkg-configs', []);
$pkg_config_path = getenv('PKG_CONFIG_PATH') ?: '';
$search_paths = array_filter(explode(is_unix() ? ':' : ';', $pkg_config_path));
foreach ($pc as $file) { foreach ($pc as $file) {
if (!file_exists(BUILD_LIB_PATH . "/pkgconfig/{$file}.pc")) { $found = false;
throw new WrongUsageException("pkg-config file '{$file}.pc' for lib [{$library}] does not exist in '" . BUILD_LIB_PATH . "/pkgconfig'. Please build it first."); foreach ($search_paths as $path) {
if (file_exists($path . "/{$file}.pc")) {
$found = true;
}
}
if (!$found) {
throw new WrongUsageException("pkg-config file '{$file}.pc' for lib [{$library}] does not exist. Please build it first.");
} }
} }
$pc_cflags = implode(' ', $pc); $pc_cflags = implode(' ', $pc);
@@ -257,9 +265,17 @@ class SPCConfigUtil
foreach ($libraries as $library) { foreach ($libraries as $library) {
// add pkg-configs libs // add pkg-configs libs
$pkg_configs = Config::getLib($library, 'pkg-configs', []); $pkg_configs = Config::getLib($library, 'pkg-configs', []);
foreach ($pkg_configs as $pkg_config) { $pkg_config_path = getenv('PKG_CONFIG_PATH') ?: '';
if (!file_exists(BUILD_LIB_PATH . "/pkgconfig/{$pkg_config}.pc")) { $search_paths = array_filter(explode(is_unix() ? ':' : ';', $pkg_config_path));
throw new WrongUsageException("pkg-config file '{$pkg_config}.pc' for lib [{$library}] does not exist in '" . BUILD_LIB_PATH . "/pkgconfig'. Please build it first."); foreach ($pkg_configs as $file) {
$found = false;
foreach ($search_paths as $path) {
if (file_exists($path . "/{$file}.pc")) {
$found = true;
}
}
if (!$found) {
throw new WrongUsageException("pkg-config file '{$file}.pc' for lib [{$library}] does not exist. Please build it first.");
} }
} }
$pkg_configs = implode(' ', $pkg_configs); $pkg_configs = implode(' ', $pkg_configs);

View File

@@ -13,7 +13,7 @@ declare(strict_types=1);
// test php version (8.1 ~ 8.4 available, multiple for matrix) // test php version (8.1 ~ 8.4 available, multiple for matrix)
$test_php_version = [ $test_php_version = [
'8.1', // '8.1',
'8.2', '8.2',
'8.3', '8.3',
'8.4', '8.4',
@@ -28,14 +28,14 @@ $test_os = [
'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
$zts = false; $zts = true;
$no_strip = false; $no_strip = false;
@@ -50,13 +50,13 @@ $prefer_pre_built = false;
// 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' => 'maxminddb', 'Linux', 'Darwin' => 'mysqli',
'Windows' => 'bcmath', 'Windows' => 'bcmath',
}; };
// 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`).
$shared_extensions = match (PHP_OS_FAMILY) { $shared_extensions = match (PHP_OS_FAMILY) {
'Linux' => '', 'Linux' => 'grpc,mysqlnd_parsec,mysqlnd_ed25519',
'Darwin' => '', 'Darwin' => '',
'Windows' => '', 'Windows' => '',
}; };
@@ -66,7 +66,7 @@ $with_suggested_libs = false;
// 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' => '', 'Linux', 'Darwin' => 'libwebp',
'Windows' => '', 'Windows' => '',
}; };