mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-04 23:35:40 +08:00
Compare commits
22 Commits
2.8.1
...
feat/avif-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8cc6452620 | ||
|
|
6123c83df7 | ||
|
|
3e9a8291f8 | ||
|
|
1a3c271963 | ||
|
|
594345893d | ||
|
|
67ef8f6608 | ||
|
|
d83a597689 | ||
|
|
5623fed37f | ||
|
|
38140d115f | ||
|
|
98117c3a04 | ||
|
|
b01d3ce12c | ||
|
|
608c915e14 | ||
|
|
c680299654 | ||
|
|
794ab16b32 | ||
|
|
661723c99a | ||
|
|
d9834d05c6 | ||
|
|
9a53ef3498 | ||
|
|
f680731f9d | ||
|
|
0fe1442f7e | ||
|
|
1e4780397b | ||
|
|
6b67cb90fc | ||
|
|
b89ff3c083 |
19
.github/workflows/build-unix.yml
vendored
19
.github/workflows/build-unix.yml
vendored
@@ -46,6 +46,10 @@ on:
|
|||||||
description: Prefer pre-built binaries (reduce build time)
|
description: Prefer pre-built binaries (reduce build time)
|
||||||
type: boolean
|
type: boolean
|
||||||
default: true
|
default: true
|
||||||
|
with-suggested-libs:
|
||||||
|
description: Build with suggested libs
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
debug:
|
debug:
|
||||||
description: Show full build logs
|
description: Show full build logs
|
||||||
type: boolean
|
type: boolean
|
||||||
@@ -86,6 +90,10 @@ on:
|
|||||||
description: Prefer pre-built binaries (reduce build time)
|
description: Prefer pre-built binaries (reduce build time)
|
||||||
type: boolean
|
type: boolean
|
||||||
default: true
|
default: true
|
||||||
|
with-suggested-libs:
|
||||||
|
description: Include suggested libs
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
debug:
|
debug:
|
||||||
description: Show full build logs
|
description: Show full build logs
|
||||||
type: boolean
|
type: boolean
|
||||||
@@ -157,6 +165,9 @@ jobs:
|
|||||||
if [ ${{ inputs.prefer-pre-built }} == true ]; then
|
if [ ${{ inputs.prefer-pre-built }} == true ]; then
|
||||||
DOWN_CMD="$DOWN_CMD --prefer-pre-built"
|
DOWN_CMD="$DOWN_CMD --prefer-pre-built"
|
||||||
fi
|
fi
|
||||||
|
if [ ${{ inputs.with-suggested-libs }} == true ]; then
|
||||||
|
BUILD_CMD="$BUILD_CMD --with-suggested-libs"
|
||||||
|
fi
|
||||||
if [ ${{ inputs.build-cli }} == true ]; then
|
if [ ${{ inputs.build-cli }} == true ]; then
|
||||||
BUILD_CMD="$BUILD_CMD --build-cli"
|
BUILD_CMD="$BUILD_CMD --build-cli"
|
||||||
fi
|
fi
|
||||||
@@ -202,6 +213,14 @@ jobs:
|
|||||||
# if: ${{ failure() }}
|
# if: ${{ failure() }}
|
||||||
# uses: mxschmitt/action-tmate@v3
|
# uses: mxschmitt/action-tmate@v3
|
||||||
|
|
||||||
|
# Upload debug logs
|
||||||
|
- if: ${{ inputs.debug && failure() }}
|
||||||
|
name: "Upload build logs on failure"
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: spc-logs-${{ inputs.php-version }}-${{ inputs.os }}
|
||||||
|
path: log/*.log
|
||||||
|
|
||||||
# Upload cli executable
|
# Upload cli executable
|
||||||
- if: ${{ inputs.build-cli == true }}
|
- if: ${{ inputs.build-cli == true }}
|
||||||
name: "Upload PHP cli SAPI"
|
name: "Upload PHP cli SAPI"
|
||||||
|
|||||||
@@ -43,6 +43,14 @@
|
|||||||
"calendar": {
|
"calendar": {
|
||||||
"type": "builtin"
|
"type": "builtin"
|
||||||
},
|
},
|
||||||
|
"com_dotnet": {
|
||||||
|
"support": {
|
||||||
|
"BSD": "no",
|
||||||
|
"Linux": "no",
|
||||||
|
"Darwin": "no"
|
||||||
|
},
|
||||||
|
"type": "builtin"
|
||||||
|
},
|
||||||
"ctype": {
|
"ctype": {
|
||||||
"type": "builtin"
|
"type": "builtin"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -58,9 +58,6 @@
|
|||||||
"brotlicommon.lib",
|
"brotlicommon.lib",
|
||||||
"brotlienc.lib",
|
"brotlienc.lib",
|
||||||
"brotlidec.lib"
|
"brotlidec.lib"
|
||||||
],
|
|
||||||
"headers": [
|
|
||||||
"brotli"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"bzip2": {
|
"bzip2": {
|
||||||
@@ -373,6 +370,15 @@
|
|||||||
],
|
],
|
||||||
"static-libs-windows": [
|
"static-libs-windows": [
|
||||||
"avif.lib"
|
"avif.lib"
|
||||||
|
],
|
||||||
|
"lib-depends": [
|
||||||
|
"libaom"
|
||||||
|
],
|
||||||
|
"lib-suggests": [
|
||||||
|
"libwebp",
|
||||||
|
"libjpeg",
|
||||||
|
"libxml2",
|
||||||
|
"libpng"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"libcares": {
|
"libcares": {
|
||||||
@@ -853,17 +859,13 @@
|
|||||||
},
|
},
|
||||||
"openssl": {
|
"openssl": {
|
||||||
"source": "openssl",
|
"source": "openssl",
|
||||||
"static-libs-unix": [
|
"pkg-configs": [
|
||||||
"libssl.a",
|
"openssl"
|
||||||
"libcrypto.a"
|
|
||||||
],
|
],
|
||||||
"static-libs-windows": [
|
"static-libs-windows": [
|
||||||
"libssl.lib",
|
"libssl.lib",
|
||||||
"libcrypto.lib"
|
"libcrypto.lib"
|
||||||
],
|
],
|
||||||
"headers": [
|
|
||||||
"openssl"
|
|
||||||
],
|
|
||||||
"lib-depends": [
|
"lib-depends": [
|
||||||
"zlib"
|
"zlib"
|
||||||
]
|
]
|
||||||
@@ -965,10 +967,10 @@
|
|||||||
},
|
},
|
||||||
"unixodbc": {
|
"unixodbc": {
|
||||||
"source": "unixodbc",
|
"source": "unixodbc",
|
||||||
"static-libs-unix": [
|
"pkg-configs": [
|
||||||
"libodbc.a",
|
"odbc",
|
||||||
"libodbccr.a",
|
"odbccr",
|
||||||
"libodbcinst.a"
|
"odbcinst"
|
||||||
],
|
],
|
||||||
"lib-depends": [
|
"lib-depends": [
|
||||||
"libiconv"
|
"libiconv"
|
||||||
|
|||||||
@@ -526,7 +526,7 @@
|
|||||||
"libavif": {
|
"libavif": {
|
||||||
"type": "ghtar",
|
"type": "ghtar",
|
||||||
"repo": "AOMediaCodec/libavif",
|
"repo": "AOMediaCodec/libavif",
|
||||||
"provide-pre-built": true,
|
"provide-pre-built": false,
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
|
|||||||
@@ -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.0';
|
public const string VERSION = '2.8.3';
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -177,18 +177,19 @@ abstract class LibraryBase
|
|||||||
if (file_exists($this->source_dir . '/.spc.patched')) {
|
if (file_exists($this->source_dir . '/.spc.patched')) {
|
||||||
$this->patched = true;
|
$this->patched = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// extract first if not exists, needed for licenses of shared libraries
|
||||||
|
if (!is_dir($this->source_dir)) {
|
||||||
|
$this->getBuilder()->emitPatchPoint('before-library[' . static::NAME . ']-extract');
|
||||||
|
SourceManager::initSource(libs: [static::NAME], source_only: true);
|
||||||
|
$this->getBuilder()->emitPatchPoint('after-library[' . static::NAME . ']-extract');
|
||||||
|
}
|
||||||
|
|
||||||
// force means just build
|
// force means just build
|
||||||
if ($force_build) {
|
if ($force_build) {
|
||||||
$type = Config::getLib(static::NAME, 'type', 'lib');
|
$type = Config::getLib(static::NAME, 'type', 'lib');
|
||||||
logger()->info('Building required ' . $type . ' [' . static::NAME . ']');
|
logger()->info('Building required ' . $type . ' [' . static::NAME . ']');
|
||||||
|
|
||||||
// extract first if not exists
|
|
||||||
if (!is_dir($this->source_dir)) {
|
|
||||||
$this->getBuilder()->emitPatchPoint('before-library[' . static::NAME . ']-extract');
|
|
||||||
SourceManager::initSource(libs: [static::NAME], source_only: true);
|
|
||||||
$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!!!');
|
||||||
}
|
}
|
||||||
|
|||||||
17
src/SPC/builder/extension/com_dotnet.php
Normal file
17
src/SPC/builder/extension/com_dotnet.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\extension;
|
||||||
|
|
||||||
|
use SPC\builder\Extension;
|
||||||
|
use SPC\util\CustomExt;
|
||||||
|
|
||||||
|
#[CustomExt('com_dotnet')]
|
||||||
|
class com_dotnet extends Extension
|
||||||
|
{
|
||||||
|
public function getWindowsConfigureArg(bool $shared = false): string
|
||||||
|
{
|
||||||
|
return '--enable-com-dotnet=yes';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -93,7 +93,7 @@ class LinuxBuilder extends UnixBuilderBase
|
|||||||
$php_configure_env = SystemUtil::makeEnvVarString([
|
$php_configure_env = SystemUtil::makeEnvVarString([
|
||||||
'CFLAGS' => getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS'),
|
'CFLAGS' => getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS'),
|
||||||
'CPPFLAGS' => '-I' . BUILD_INCLUDE_PATH, // . ' -Dsomethinghere', // . $musl_flag,
|
'CPPFLAGS' => '-I' . BUILD_INCLUDE_PATH, // . ' -Dsomethinghere', // . $musl_flag,
|
||||||
'LDFLAGS' => '-L' . BUILD_LIB_PATH,
|
'LDFLAGS' => clean_spaces("{$this->arch_ld_flags} -L" . BUILD_LIB_PATH),
|
||||||
// 'LIBS' => SPCTarget::getRuntimeLibs(), // do not pass static libraries here yet, they may contain polyfills for libc functions!
|
// 'LIBS' => SPCTarget::getRuntimeLibs(), // do not pass static libraries here yet, they may contain polyfills for libc functions!
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
@@ -365,6 +365,7 @@ abstract class UnixBuilderBase extends BuilderBase
|
|||||||
$frankenphpAppPath = $this->getOption('with-frankenphp-app');
|
$frankenphpAppPath = $this->getOption('with-frankenphp-app');
|
||||||
|
|
||||||
if ($frankenphpAppPath) {
|
if ($frankenphpAppPath) {
|
||||||
|
$frankenphpAppPath = trim($frankenphpAppPath, "\"'");
|
||||||
if (!is_dir($frankenphpAppPath)) {
|
if (!is_dir($frankenphpAppPath)) {
|
||||||
throw new WrongUsageException("The path provided to --with-frankenphp-app is not a valid directory: {$frankenphpAppPath}");
|
throw new WrongUsageException("The path provided to --with-frankenphp-app is not a valid directory: {$frankenphpAppPath}");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,11 @@ trait libavif
|
|||||||
protected function build(): void
|
protected function build(): void
|
||||||
{
|
{
|
||||||
UnixCMakeExecutor::create($this)
|
UnixCMakeExecutor::create($this)
|
||||||
|
->optionalLib('libaom', '-DAVIF_CODEC_AOM=SYSTEM', '-DAVIF_CODEC_AOM=OFF')
|
||||||
|
->optionalLib('libsharpyuv', '-DAVIF_LIBSHARPYUV=SYSTEM', '-DAVIF_LIBSHARPYUV=OFF')
|
||||||
|
->optionalLib('libjpeg', '-DAVIF_JPEG=SYSTEM', '-DAVIF_JPEG=OFF')
|
||||||
|
->optionalLib('libxml2', '-DAVIF_LIBXML2=SYSTEM', '-DAVIF_LIBXML2=OFF')
|
||||||
|
->optionalLib('libpng', '-DAVIF_LIBPNG=SYSTEM', '-DAVIF_LIBPNG=OFF')
|
||||||
->addConfigureArgs('-DAVIF_LIBYUV=OFF')
|
->addConfigureArgs('-DAVIF_LIBYUV=OFF')
|
||||||
->build();
|
->build();
|
||||||
// patch pkgconfig
|
// patch pkgconfig
|
||||||
|
|||||||
@@ -4,29 +4,14 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace SPC\builder\unix\library;
|
namespace SPC\builder\unix\library;
|
||||||
|
|
||||||
use SPC\exception\FileSystemException;
|
|
||||||
use SPC\store\FileSystem;
|
use SPC\store\FileSystem;
|
||||||
use SPC\util\PkgConfigUtil;
|
use SPC\util\PkgConfigUtil;
|
||||||
use SPC\util\SPCConfigUtil;
|
use SPC\util\SPCConfigUtil;
|
||||||
use SPC\util\SPCTarget;
|
|
||||||
|
|
||||||
trait postgresql
|
trait postgresql
|
||||||
{
|
{
|
||||||
public function patchBeforeBuild(): bool
|
public function patchBeforeBuild(): bool
|
||||||
{
|
{
|
||||||
// fix aarch64 build on glibc 2.17 (e.g. CentOS 7)
|
|
||||||
if (SPCTarget::getLibcVersion() === '2.17' && GNU_ARCH === 'aarch64') {
|
|
||||||
try {
|
|
||||||
FileSystem::replaceFileStr("{$this->source_dir}/src/port/pg_popcount_aarch64.c", 'HWCAP_SVE', '0');
|
|
||||||
FileSystem::replaceFileStr(
|
|
||||||
"{$this->source_dir}/src/port/pg_crc32c_armv8_choose.c",
|
|
||||||
'#if defined(__linux__) && !defined(__aarch64__) && !defined(HWCAP2_CRC32)',
|
|
||||||
'#if defined(__linux__) && !defined(HWCAP_CRC32)'
|
|
||||||
);
|
|
||||||
} catch (FileSystemException) {
|
|
||||||
// allow file not-existence to make it compatible with old and new version
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// skip the test on platforms where libpq infrastructure may be provided by statically-linked libraries
|
// skip the test on platforms where libpq infrastructure may be provided by statically-linked libraries
|
||||||
FileSystem::replaceFileStr("{$this->source_dir}/src/interfaces/libpq/Makefile", 'invokes exit\'; exit 1;', 'invokes exit\';');
|
FileSystem::replaceFileStr("{$this->source_dir}/src/interfaces/libpq/Makefile", 'invokes exit\'; exit 1;', 'invokes exit\';');
|
||||||
// disable shared libs build
|
// disable shared libs build
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ class SwitchPhpVersionCommand extends BaseCommand
|
|||||||
$this->addArgument(
|
$this->addArgument(
|
||||||
'php-major-version',
|
'php-major-version',
|
||||||
InputArgument::REQUIRED,
|
InputArgument::REQUIRED,
|
||||||
'PHP major version (supported: 7.4, 8.0, 8.1, 8.2, 8.3, 8.4)',
|
'PHP major version (supported: 7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5)',
|
||||||
null,
|
null,
|
||||||
fn () => ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
|
fn () => ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
|
||||||
);
|
);
|
||||||
$this->no_motd = true;
|
$this->no_motd = true;
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ class SwitchPhpVersionCommand extends BaseCommand
|
|||||||
public function handle(): int
|
public function handle(): int
|
||||||
{
|
{
|
||||||
$php_ver = $this->input->getArgument('php-major-version');
|
$php_ver = $this->input->getArgument('php-major-version');
|
||||||
if (!in_array($php_ver, ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4'])) {
|
if (!in_array($php_ver, ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5'])) {
|
||||||
// match x.y.z
|
// match x.y.z
|
||||||
preg_match('/^\d+\.\d+\.\d+$/', $php_ver, $matches);
|
preg_match('/^\d+\.\d+\.\d+$/', $php_ver, $matches);
|
||||||
if (!$matches) {
|
if (!$matches) {
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ class GoXcaddy extends CustomPackage
|
|||||||
public function fetch(string $name, bool $force = false, ?array $config = null): void
|
public function fetch(string $name, bool $force = false, ?array $config = null): void
|
||||||
{
|
{
|
||||||
$pkgroot = PKG_ROOT_PATH;
|
$pkgroot = PKG_ROOT_PATH;
|
||||||
$go_exec = "{$pkgroot}/{$name}/bin/go";
|
$go_exec = "{$pkgroot}/go-xcaddy/bin/go";
|
||||||
$xcaddy_exec = "{$pkgroot}/{$name}/bin/xcaddy";
|
$xcaddy_exec = "{$pkgroot}/go-xcaddy/bin/xcaddy";
|
||||||
if ($force) {
|
if ($force) {
|
||||||
FileSystem::removeDir("{$pkgroot}/{$name}");
|
FileSystem::removeDir("{$pkgroot}/{$name}");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,20 +14,20 @@ 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',
|
||||||
// 'git',
|
// 'git',
|
||||||
];
|
];
|
||||||
|
|
||||||
// test os (macos-15-intel, macos-15, ubuntu-latest, windows-latest are available)
|
// test os (macos-15-intel, macos-15, ubuntu-latest, windows-latest are available)
|
||||||
$test_os = [
|
$test_os = [
|
||||||
'macos-15-intel', // bin/spc for x86_64
|
// 'macos-15-intel', // bin/spc for x86_64
|
||||||
'macos-15', // bin/spc for arm64
|
// 'macos-15', // bin/spc for arm64
|
||||||
'ubuntu-latest', // bin/spc-alpine-docker for x86_64
|
// 'ubuntu-latest', // bin/spc-alpine-docker for x86_64
|
||||||
'ubuntu-22.04', // bin/spc-gnu-docker for x86_64
|
// 'ubuntu-22.04', // bin/spc-gnu-docker for x86_64
|
||||||
'ubuntu-24.04', // bin/spc for x86_64
|
// 'ubuntu-24.04', // bin/spc for x86_64
|
||||||
// 'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64
|
// 'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64
|
||||||
// 'ubuntu-24.04-arm', // bin/spc for arm64
|
// 'ubuntu-24.04-arm', // bin/spc for arm64
|
||||||
// 'windows-2022', // .\bin\spc.ps1
|
// 'windows-2022', // .\bin\spc.ps1
|
||||||
@@ -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' => 'mysqli,gmp',
|
'Linux', 'Darwin' => '',
|
||||||
'Windows' => 'bcmath',
|
'Windows' => 'com_dotnet',
|
||||||
};
|
};
|
||||||
|
|
||||||
// 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' => 'grpc,mysqlnd_parsec,mysqlnd_ed25519',
|
'Linux' => '',
|
||||||
'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' => 'libwebp',
|
'Linux', 'Darwin' => '',
|
||||||
'Windows' => '',
|
'Windows' => '',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user