mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-03 14:55:39 +08:00
Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f2b2af774c | ||
|
|
a78e6fa5f8 | ||
|
|
5d9e4e2c81 | ||
|
|
eb97711347 | ||
|
|
5c8ec7a56d | ||
|
|
e85cd55dba | ||
|
|
f9f4ca9a01 | ||
|
|
fd882ce03e | ||
|
|
99a512c4a4 | ||
|
|
8d038f435d | ||
|
|
134186c94f | ||
|
|
ef95e4f857 | ||
|
|
fd4f70d526 | ||
|
|
c7738749e2 | ||
|
|
44f9cb1ffd | ||
|
|
970343b143 | ||
|
|
e21bb528c0 | ||
|
|
5b5861c366 | ||
|
|
7a71a40824 | ||
|
|
a9e1327a80 | ||
|
|
93a227bc6d | ||
|
|
4eaeeb8230 | ||
|
|
0588401ee3 | ||
|
|
75856e361e | ||
|
|
abfdae256a | ||
|
|
450e0e1ecb | ||
|
|
a373df2444 | ||
|
|
95a4b4d738 | ||
|
|
4e9edf6c9d | ||
|
|
14fc3f8d87 | ||
|
|
f52e8ad449 | ||
|
|
0ed1bbc74a | ||
|
|
1272acd07e |
@@ -246,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",
|
||||||
@@ -333,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"
|
||||||
@@ -1194,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",
|
||||||
|
|||||||
@@ -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.5';
|
public const string VERSION = '2.8.6';
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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' : '') . ' ';
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ namespace SPC\builder\extension;
|
|||||||
use SPC\builder\Extension;
|
use SPC\builder\Extension;
|
||||||
use SPC\store\SourcePatcher;
|
use SPC\store\SourcePatcher;
|
||||||
use SPC\util\CustomExt;
|
use SPC\util\CustomExt;
|
||||||
use SPC\util\GlobalEnvManager;
|
|
||||||
|
|
||||||
#[CustomExt('xlswriter')]
|
#[CustomExt('xlswriter')]
|
||||||
class xlswriter extends Extension
|
class xlswriter extends Extension
|
||||||
@@ -29,13 +28,6 @@ class xlswriter extends Extension
|
|||||||
public function patchBeforeMake(): bool
|
public function patchBeforeMake(): bool
|
||||||
{
|
{
|
||||||
$patched = parent::patchBeforeMake();
|
$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') {
|
if (PHP_OS_FAMILY === 'Windows') {
|
||||||
// fix windows build with openssl extension duplicate symbol bug
|
// fix windows build with openssl extension duplicate symbol bug
|
||||||
SourcePatcher::patchFile('spc_fix_xlswriter_win32.patch', $this->source_dir);
|
SourcePatcher::patchFile('spc_fix_xlswriter_win32.patch', $this->source_dir);
|
||||||
@@ -48,10 +40,4 @@ class xlswriter extends Extension
|
|||||||
}
|
}
|
||||||
return $patched;
|
return $patched;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove when https://github.com/viest/php-ext-xlswriter/pull/560 is merged
|
|
||||||
protected function getExtraEnv(): array
|
|
||||||
{
|
|
||||||
return ['CFLAGS' => '-std=gnu17'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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']);
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -98,6 +98,21 @@ class Downloader
|
|||||||
{
|
{
|
||||||
logger()->debug("finding {$name} source from github {$type} tarball");
|
logger()->debug("finding {$name} source from github {$type} tarball");
|
||||||
$source['query'] ??= '';
|
$source['query'] ??= '';
|
||||||
|
|
||||||
|
// 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 = $data['tarball_url'];
|
||||||
|
$version = $data['tag_name'] ?? $data['name'] ?? null;
|
||||||
|
} else {
|
||||||
$data = json_decode(self::curlExec(
|
$data = json_decode(self::curlExec(
|
||||||
url: "https://api.github.com/repos/{$source['repo']}/{$type}{$source['query']}",
|
url: "https://api.github.com/repos/{$source['repo']}/{$type}{$source['query']}",
|
||||||
hooks: [[CurlHook::class, 'setupGithubToken']],
|
hooks: [[CurlHook::class, 'setupGithubToken']],
|
||||||
@@ -105,6 +120,7 @@ class Downloader
|
|||||||
), true, 512, JSON_THROW_ON_ERROR);
|
), true, 512, JSON_THROW_ON_ERROR);
|
||||||
|
|
||||||
$url = null;
|
$url = null;
|
||||||
|
$version = null;
|
||||||
foreach ($data as $rel) {
|
foreach ($data as $rel) {
|
||||||
if (($rel['prerelease'] ?? false) === true && ($source['prefer-stable'] ?? false)) {
|
if (($rel['prerelease'] ?? false) === true && ($source['prefer-stable'] ?? false)) {
|
||||||
continue;
|
continue;
|
||||||
@@ -114,16 +130,19 @@ class Downloader
|
|||||||
}
|
}
|
||||||
if (!($source['match'] ?? null)) {
|
if (!($source['match'] ?? null)) {
|
||||||
$url = $rel['tarball_url'] ?? null;
|
$url = $rel['tarball_url'] ?? null;
|
||||||
|
$version = $rel['tag_name'] ?? $rel['name'] ?? null;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (preg_match('|' . $source['match'] . '|', $rel['tarball_url'])) {
|
if (preg_match('|' . $source['match'] . '|', $rel['tarball_url'])) {
|
||||||
$url = $rel['tarball_url'];
|
$url = $rel['tarball_url'];
|
||||||
|
$version = $rel['tag_name'] ?? $rel['name'] ?? null;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$url) {
|
if (!$url) {
|
||||||
throw new DownloaderException("failed to find {$name} source");
|
throw new DownloaderException("failed to find {$name} source");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$headers = self::curlExec(
|
$headers = self::curlExec(
|
||||||
url: $url,
|
url: $url,
|
||||||
method: 'HEAD',
|
method: 'HEAD',
|
||||||
@@ -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];
|
||||||
|
|||||||
@@ -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');
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ 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;
|
$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;
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
91
src/globals/patch/spc_fix_avx512_cache_before_80400.patch
Normal file
91
src/globals/patch/spc_fix_avx512_cache_before_80400.patch
Normal 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])
|
||||||
|
])
|
||||||
@@ -24,7 +24,7 @@ $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
|
||||||
@@ -50,13 +50,13 @@ $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' => 'openssl,brotli',
|
'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',
|
'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`).
|
||||||
$shared_extensions = match (PHP_OS_FAMILY) {
|
$shared_extensions = match (PHP_OS_FAMILY) {
|
||||||
'Linux' => 'zstd',
|
'Linux' => '',
|
||||||
'Darwin' => '',
|
'Darwin' => '',
|
||||||
'Windows' => '',
|
'Windows' => '',
|
||||||
};
|
};
|
||||||
@@ -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' => 'krb5',
|
'Linux', 'Darwin' => '',
|
||||||
'Windows' => '',
|
'Windows' => '',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user