mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-02 22:35:43 +08:00
Compare commits
6 Commits
2.8.0
...
fix/postgr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9e00814bfe | ||
|
|
b89ff3c083 | ||
|
|
0cfa2036f0 | ||
|
|
c5882c1f8e | ||
|
|
4531c9fe57 | ||
|
|
223dd10ac6 |
@@ -75,8 +75,10 @@ SPC_MICRO_PATCHES=static_extensions_win32,cli_checks,disable_huge_page,vcruntime
|
|||||||
; - musl-native: used for alpine linux, can build `musl` and `musl -dynamic` target.
|
; - musl-native: used for alpine linux, can build `musl` and `musl -dynamic` target.
|
||||||
; - gnu-native: used for general linux distros, can build gnu target for the installed glibc version only.
|
; - gnu-native: used for general linux distros, can build gnu target for the installed glibc version only.
|
||||||
|
|
||||||
; LEGACY option to specify the target
|
; option to specify the target, superceded by SPC_TARGET if set
|
||||||
SPC_LIBC=musl
|
SPC_LIBC=musl
|
||||||
|
; uncomment to link libc dynamically on musl
|
||||||
|
; SPC_MUSL_DYNAMIC=true
|
||||||
|
|
||||||
; Recommended: specify your target here. Zig toolchain will be used.
|
; Recommended: specify your target here. Zig toolchain will be used.
|
||||||
; examples:
|
; examples:
|
||||||
|
|||||||
@@ -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"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -542,7 +542,7 @@ class Extension
|
|||||||
*/
|
*/
|
||||||
protected function getSharedExtensionEnv(): array
|
protected function getSharedExtensionEnv(): array
|
||||||
{
|
{
|
||||||
$config = (new SPCConfigUtil($this->builder))->getExtensionConfig($this);
|
$config = (new SPCConfigUtil($this->builder, ['no_php' => true]))->getExtensionConfig($this);
|
||||||
[$staticLibs, $sharedLibs] = $this->splitLibsIntoStaticAndShared($config['libs']);
|
[$staticLibs, $sharedLibs] = $this->splitLibsIntoStaticAndShared($config['libs']);
|
||||||
$preStatic = PHP_OS_FAMILY === 'Darwin' ? '' : '-Wl,--start-group ';
|
$preStatic = PHP_OS_FAMILY === 'Darwin' ? '' : '-Wl,--start-group ';
|
||||||
$postStatic = PHP_OS_FAMILY === 'Darwin' ? '' : ' -Wl,--end-group ';
|
$postStatic = PHP_OS_FAMILY === 'Darwin' ? '' : ' -Wl,--end-group ';
|
||||||
|
|||||||
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';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace SPC\builder\extension;
|
|
||||||
|
|
||||||
use SPC\builder\Extension;
|
|
||||||
use SPC\util\CustomExt;
|
|
||||||
|
|
||||||
#[CustomExt('excimer')]
|
|
||||||
class excimer extends Extension
|
|
||||||
{
|
|
||||||
public function getSharedExtensionEnv(): array
|
|
||||||
{
|
|
||||||
$env = parent::getSharedExtensionEnv();
|
|
||||||
$env['LIBS'] = clean_spaces(str_replace('-lphp', '', $env['LIBS']));
|
|
||||||
return $env;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -45,4 +45,11 @@ class spx extends Extension
|
|||||||
FileSystem::copy($this->source_dir . '/src/php_spx.h', $this->source_dir . '/php_spx.h');
|
FileSystem::copy($this->source_dir . '/src/php_spx.h', $this->source_dir . '/php_spx.h');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getSharedExtensionEnv(): array
|
||||||
|
{
|
||||||
|
$env = parent::getSharedExtensionEnv();
|
||||||
|
$env['SPX_SHARED_LIBADD'] = $env['LIBS'];
|
||||||
|
return $env;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,11 @@ trait gettext
|
|||||||
->addConfigureArgs(
|
->addConfigureArgs(
|
||||||
'--disable-java',
|
'--disable-java',
|
||||||
'--disable-c++',
|
'--disable-c++',
|
||||||
'--with-included-gettext',
|
'--disable-d',
|
||||||
|
'--disable-rpath',
|
||||||
|
'--disable-modula2',
|
||||||
|
'--disable-libasprintf',
|
||||||
|
'--with-included-libintl',
|
||||||
"--with-iconv-prefix={$this->getBuildRootPath()}",
|
"--with-iconv-prefix={$this->getBuildRootPath()}",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ trait postgresql
|
|||||||
// fix aarch64 build on glibc 2.17 (e.g. CentOS 7)
|
// fix aarch64 build on glibc 2.17 (e.g. CentOS 7)
|
||||||
if (SPCTarget::getLibcVersion() === '2.17' && GNU_ARCH === 'aarch64') {
|
if (SPCTarget::getLibcVersion() === '2.17' && GNU_ARCH === 'aarch64') {
|
||||||
try {
|
try {
|
||||||
FileSystem::replaceFileStr("{$this->source_dir}/src/port/pg_popcount_aarch64.c", 'HWCAP_SVE', '0');
|
// FileSystem::replaceFileStr("{$this->source_dir}/src/port/pg_popcount_aarch64.c", 'HWCAP_SVE', '0');
|
||||||
FileSystem::replaceFileStr(
|
FileSystem::replaceFileStr(
|
||||||
"{$this->source_dir}/src/port/pg_crc32c_armv8_choose.c",
|
"{$this->source_dir}/src/port/pg_crc32c_armv8_choose.c",
|
||||||
'#if defined(__linux__) && !defined(__aarch64__) && !defined(HWCAP2_CRC32)',
|
'#if defined(__linux__) && !defined(__aarch64__) && !defined(HWCAP2_CRC32)',
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
@@ -27,10 +27,10 @@ class SPCTarget
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (ToolchainManager::getToolchainClass() === GccNativeToolchain::class) {
|
if (ToolchainManager::getToolchainClass() === GccNativeToolchain::class) {
|
||||||
return PHP_OS_FAMILY === 'Linux' && SystemUtil::isMuslDist();
|
return PHP_OS_FAMILY === 'Linux' && SystemUtil::isMuslDist() && !getenv('SPC_MUSL_DYNAMIC');
|
||||||
}
|
}
|
||||||
if (ToolchainManager::getToolchainClass() === ClangNativeToolchain::class) {
|
if (ToolchainManager::getToolchainClass() === ClangNativeToolchain::class) {
|
||||||
return PHP_OS_FAMILY === 'Linux' && SystemUtil::isMuslDist();
|
return PHP_OS_FAMILY === 'Linux' && SystemUtil::isMuslDist() && !getenv('SPC_MUSL_DYNAMIC');
|
||||||
}
|
}
|
||||||
// if SPC_LIBC is set, it means the target is static, remove it when 3.0 is released
|
// if SPC_LIBC is set, it means the target is static, remove it when 3.0 is released
|
||||||
if ($target = getenv('SPC_TARGET')) {
|
if ($target = getenv('SPC_TARGET')) {
|
||||||
|
|||||||
@@ -14,22 +14,22 @@ 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
|
||||||
// 'windows-2025',
|
// 'windows-2025',
|
||||||
];
|
];
|
||||||
@@ -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' => 'pgsql',
|
||||||
'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