mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-12 03:15:35 +08:00
Compare commits
21 Commits
970343b143
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3ce68b64cf | ||
|
|
9a403ae79e | ||
|
|
532972337e | ||
|
|
fe1ef6e2e0 | ||
|
|
f2b2af774c | ||
|
|
a78e6fa5f8 | ||
|
|
5d9e4e2c81 | ||
|
|
ca3daad350 | ||
|
|
eb97711347 | ||
|
|
5c8ec7a56d | ||
|
|
e85cd55dba | ||
|
|
f9f4ca9a01 | ||
|
|
fd882ce03e | ||
|
|
99a512c4a4 | ||
|
|
8d038f435d | ||
|
|
134186c94f | ||
|
|
ef95e4f857 | ||
|
|
fd4f70d526 | ||
|
|
c7738749e2 | ||
|
|
44f9cb1ffd | ||
|
|
75856e361e |
@@ -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"
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace SPC\builder\extension;
|
|
||||||
|
|
||||||
use SPC\builder\Extension;
|
|
||||||
use SPC\store\FileSystem;
|
|
||||||
use SPC\util\CustomExt;
|
|
||||||
|
|
||||||
#[CustomExt('pdo_sqlite')]
|
|
||||||
class pdo_sqlite extends Extension
|
|
||||||
{
|
|
||||||
public function patchBeforeConfigure(): bool
|
|
||||||
{
|
|
||||||
FileSystem::replaceFileRegex(
|
|
||||||
SOURCE_PATH . '/php-src/configure',
|
|
||||||
'/sqlite3_column_table_name=yes/',
|
|
||||||
'sqlite3_column_table_name=no'
|
|
||||||
);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,12 @@ trait sqlite
|
|||||||
{
|
{
|
||||||
protected function build(): void
|
protected function build(): void
|
||||||
{
|
{
|
||||||
UnixAutoconfExecutor::create($this)->configure()->make();
|
UnixAutoconfExecutor::create($this)
|
||||||
|
->appendEnv([
|
||||||
|
'CFLAGS' => '-DSQLITE_ENABLE_COLUMN_METADATA=1',
|
||||||
|
])
|
||||||
|
->configure()
|
||||||
|
->make();
|
||||||
$this->patchPkgconfPrefix(['sqlite3.pc']);
|
$this->patchPkgconfPrefix(['sqlite3.pc']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
16
src/globals/ext-tests/pdo_sqlite.php
Normal file
16
src/globals/ext-tests/pdo_sqlite.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
$pdo = new PDO('sqlite::memory:');
|
||||||
|
$pdo->exec('CREATE TABLE spc_column_metadata_test (id INTEGER)');
|
||||||
|
|
||||||
|
$stmt = $pdo->query('SELECT id FROM spc_column_metadata_test');
|
||||||
|
if ($stmt === false) {
|
||||||
|
throw new RuntimeException('Failed to query SQLite metadata test table.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$metadata = $stmt->getColumnMeta(0);
|
||||||
|
if (($metadata['table'] ?? null) !== 'spc_column_metadata_test') {
|
||||||
|
throw new RuntimeException('PDO SQLite column metadata does not include the origin table.');
|
||||||
|
}
|
||||||
10
src/globals/ext-tests/sqlite3.php
Normal file
10
src/globals/ext-tests/sqlite3.php
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
$sqlite = new SQLite3(':memory:');
|
||||||
|
$enabled = $sqlite->querySingle("SELECT sqlite_compileoption_used('ENABLE_COLUMN_METADATA')");
|
||||||
|
|
||||||
|
if ((int) $enabled !== 1) {
|
||||||
|
throw new RuntimeException('SQLite was not built with SQLITE_ENABLE_COLUMN_METADATA.');
|
||||||
|
}
|
||||||
@@ -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',
|
||||||
@@ -24,11 +24,11 @@ $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
|
||||||
// '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,7 +50,7 @@ $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' => 'swoole,mongodb',
|
'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',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user