mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-08 01:15:37 +08:00
Merge branch 'main' into feat/pgo
This commit is contained in:
@@ -1194,7 +1194,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' : '') . ' ';
|
||||||
|
|||||||
@@ -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']);
|
||||||
|
|||||||
@@ -98,31 +98,50 @@ class Downloader
|
|||||||
{
|
{
|
||||||
logger()->debug("finding {$name} source from github {$type} tarball");
|
logger()->debug("finding {$name} source from github {$type} tarball");
|
||||||
$source['query'] ??= '';
|
$source['query'] ??= '';
|
||||||
$data = json_decode(self::curlExec(
|
|
||||||
url: "https://api.github.com/repos/{$source['repo']}/{$type}{$source['query']}",
|
|
||||||
hooks: [[CurlHook::class, 'setupGithubToken']],
|
|
||||||
retries: self::getRetryAttempts()
|
|
||||||
), true, 512, JSON_THROW_ON_ERROR);
|
|
||||||
|
|
||||||
$url = null;
|
// Use /releases/latest when possible: it returns the semantically latest stable
|
||||||
foreach ($data as $rel) {
|
// release regardless of publish order, avoiding issues with concurrent release branches.
|
||||||
if (($rel['prerelease'] ?? false) === true && ($source['prefer-stable'] ?? false)) {
|
if ($type === 'releases' && empty($source['query']) && !($source['match'] ?? null)) {
|
||||||
continue;
|
$data = json_decode(self::curlExec(
|
||||||
|
url: "https://api.github.com/repos/{$source['repo']}/releases/latest",
|
||||||
|
hooks: [[CurlHook::class, 'setupGithubToken']],
|
||||||
|
retries: self::getRetryAttempts()
|
||||||
|
), true, 512, JSON_THROW_ON_ERROR);
|
||||||
|
if (!is_array($data) || empty($data['tarball_url'])) {
|
||||||
|
throw new DownloaderException("failed to find {$name} source");
|
||||||
}
|
}
|
||||||
if (($rel['draft'] ?? false) === true && (($source['prefer-stable'] ?? false) || !$rel['tarball_url'])) {
|
$url = $data['tarball_url'];
|
||||||
continue;
|
$version = $data['tag_name'] ?? $data['name'] ?? null;
|
||||||
|
} else {
|
||||||
|
$data = json_decode(self::curlExec(
|
||||||
|
url: "https://api.github.com/repos/{$source['repo']}/{$type}{$source['query']}",
|
||||||
|
hooks: [[CurlHook::class, 'setupGithubToken']],
|
||||||
|
retries: self::getRetryAttempts()
|
||||||
|
), true, 512, JSON_THROW_ON_ERROR);
|
||||||
|
|
||||||
|
$url = null;
|
||||||
|
$version = null;
|
||||||
|
foreach ($data as $rel) {
|
||||||
|
if (($rel['prerelease'] ?? false) === true && ($source['prefer-stable'] ?? false)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (($rel['draft'] ?? false) === true && (($source['prefer-stable'] ?? false) || !$rel['tarball_url'])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!($source['match'] ?? null)) {
|
||||||
|
$url = $rel['tarball_url'] ?? null;
|
||||||
|
$version = $rel['tag_name'] ?? $rel['name'] ?? null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (preg_match('|' . $source['match'] . '|', $rel['tarball_url'])) {
|
||||||
|
$url = $rel['tarball_url'];
|
||||||
|
$version = $rel['tag_name'] ?? $rel['name'] ?? null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!($source['match'] ?? null)) {
|
if (!$url) {
|
||||||
$url = $rel['tarball_url'] ?? null;
|
throw new DownloaderException("failed to find {$name} source");
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if (preg_match('|' . $source['match'] . '|', $rel['tarball_url'])) {
|
|
||||||
$url = $rel['tarball_url'];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!$url) {
|
|
||||||
throw new DownloaderException("failed to find {$name} source");
|
|
||||||
}
|
}
|
||||||
$headers = self::curlExec(
|
$headers = self::curlExec(
|
||||||
url: $url,
|
url: $url,
|
||||||
@@ -134,7 +153,7 @@ class Downloader
|
|||||||
if ($matches) {
|
if ($matches) {
|
||||||
$filename = $matches['filename'];
|
$filename = $matches['filename'];
|
||||||
} else {
|
} else {
|
||||||
$filename = "{$name}-" . ($type === 'releases' ? $data['tag_name'] : $data['name']) . '.tar.gz';
|
$filename = "{$name}-" . ($version ?? 'latest') . '.tar.gz';
|
||||||
}
|
}
|
||||||
|
|
||||||
return [$url, $filename];
|
return [$url, $filename];
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -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])
|
||||||
|
])
|
||||||
@@ -14,7 +14,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',
|
||||||
'8.5',
|
'8.5',
|
||||||
@@ -26,9 +26,9 @@ $test_os = [
|
|||||||
// 'macos-15-intel', // bin/spc for x86_64
|
// 'macos-15-intel', // bin/spc for x86_64
|
||||||
'macos-15', // bin/spc for arm64
|
'macos-15', // bin/spc for arm64
|
||||||
// 'ubuntu-latest', // bin/spc-alpine-docker for x86_64
|
// 'ubuntu-latest', // bin/spc-alpine-docker for x86_64
|
||||||
'ubuntu-22.04', // bin/spc-gnu-docker for x86_64
|
// 'ubuntu-22.04', // bin/spc-gnu-docker for x86_64
|
||||||
// 'ubuntu-24.04', // bin/spc for x86_64
|
// 'ubuntu-24.04', // bin/spc for x86_64
|
||||||
'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64
|
// 'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64
|
||||||
// 'ubuntu-24.04-arm', // bin/spc for arm64
|
// 'ubuntu-24.04-arm', // bin/spc for arm64
|
||||||
// 'windows-2022', // .\bin\spc.ps1
|
// 'windows-2022', // .\bin\spc.ps1
|
||||||
// 'windows-2025',
|
// 'windows-2025',
|
||||||
@@ -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' => 'swoole,mongodb',
|
||||||
'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