mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-07 16:55:38 +08:00
Merge branch 'v3' into feat/clickhouse
This commit is contained in:
@@ -9,6 +9,7 @@ use StaticPHP\Attribute\Package\BeforeStage;
|
||||
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Attribute\Package\Validate;
|
||||
use StaticPHP\Attribute\PatchDescription;
|
||||
use StaticPHP\Exception\WrongUsageException;
|
||||
use StaticPHP\Package\PackageBuilder;
|
||||
use StaticPHP\Package\PackageInstaller;
|
||||
@@ -26,6 +27,19 @@ class imap extends PhpExtensionPackage
|
||||
}
|
||||
}
|
||||
|
||||
#[BeforeStage('php', [php::class, 'makeCliForUnix'], 'ext-imap')]
|
||||
#[PatchDescription('Fix imap zend_zval_value_name() call for PHP 8.2 compatibility')]
|
||||
public function patchBeforeMake(): void
|
||||
{
|
||||
// zend_zval_value_name() was introduced in PHP 8.3; PHP 8.2 imap backported the call but not the declaration
|
||||
// replace with the equivalent PHP 8.2-compatible function
|
||||
FileSystem::replaceFileStr(
|
||||
"{$this->getSourceDir()}/php_imap.c",
|
||||
'zend_zval_value_name(data)',
|
||||
'zend_zval_type_name(data)'
|
||||
);
|
||||
}
|
||||
|
||||
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-imap')]
|
||||
public function patchBeforeBuildconf(PackageInstaller $installer): void
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ use StaticPHP\Util\FileSystem;
|
||||
class intl extends PhpExtensionPackage
|
||||
{
|
||||
#[BeforeStage('php', [php::class, 'buildconfForWindows'], 'ext-intl')]
|
||||
#[PatchDescription('Fix intl config.w32: replace hardcoded true with PHP_INTL_SHARED for static build support')]
|
||||
#[PatchDescription('Fix intl config.w32: replace hardcoded true with PHP_INTL_SHARED for static build support; add /std:c++17 required by ICU 73+')]
|
||||
public function patchBeforeBuildconfForWindows(PackageInstaller $installer): void
|
||||
{
|
||||
$php_src = $installer->getTargetPackage('php')->getSourceDir();
|
||||
@@ -25,5 +25,11 @@ class intl extends PhpExtensionPackage
|
||||
'EXTENSION("intl", "php_intl.c intl_convert.c intl_convertcpp.cpp intl_error.c ", true,',
|
||||
'EXTENSION("intl", "php_intl.c intl_convert.c intl_convertcpp.cpp intl_error.c ", PHP_INTL_SHARED,'
|
||||
);
|
||||
// ICU 73+ headers (char16ptr.h etc.) unconditionally include <string_view> which requires C++17.
|
||||
FileSystem::replaceFileStr(
|
||||
"{$php_src}/ext/intl/config.w32",
|
||||
'ADD_FLAG("CFLAGS_INTL", "/EHsc',
|
||||
'ADD_FLAG("CFLAGS_INTL", "/std:c++17 /EHsc'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,20 @@ class memcache extends PhpExtensionPackage
|
||||
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-memcache')]
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
// PHP 8.5 moved php_smart_string*.h from ext/standard/ to Zend/
|
||||
foreach (['src/memcache_pool.h', 'src/memcache_pool.c', 'src/memcache_session.c', 'src/memcache_ascii_protocol.c', 'src/memcache_binary_protocol.c'] as $file) {
|
||||
FileSystem::replaceFileStr(
|
||||
"{$this->getSourceDir()}/{$file}",
|
||||
'#include "ext/standard/php_smart_string_public.h"',
|
||||
'#include "Zend/zend_smart_string_public.h"',
|
||||
);
|
||||
FileSystem::replaceFileStr(
|
||||
"{$this->getSourceDir()}/{$file}",
|
||||
'#include "ext/standard/php_smart_string.h"',
|
||||
'#include "Zend/zend_smart_string.h"',
|
||||
);
|
||||
}
|
||||
|
||||
if (!$this->isBuildStatic()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -7,15 +7,21 @@ namespace Package\Extension;
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\BeforeStage;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Toolchain\Interface\ToolchainInterface;
|
||||
use StaticPHP\Toolchain\ZigToolchain;
|
||||
use StaticPHP\Util\GlobalEnvManager;
|
||||
|
||||
#[Extension('opentelemetry')]
|
||||
class opentelemetry
|
||||
{
|
||||
#[BeforeStage('php', [php::class, 'makeForUnix'], 'ext-opentelemetry')]
|
||||
public function patchBeforeMake(): void
|
||||
public function patchBeforeMake(ToolchainInterface $toolchain): void
|
||||
{
|
||||
// add -Wno-strict-prototypes
|
||||
GlobalEnvManager::putenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS=' . getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS') . ' -Wno-strict-prototypes');
|
||||
$extra_cflags = getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS') ?: '';
|
||||
$extra_cflags .= ' -Wno-strict-prototypes';
|
||||
if ($toolchain instanceof ZigToolchain) {
|
||||
$extra_cflags .= ' -Wno-unknown-warning-option';
|
||||
}
|
||||
GlobalEnvManager::putenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS=' . trim($extra_cflags));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ class swow extends PhpExtensionPackage
|
||||
#[CustomPhpConfigureArg('Windows')]
|
||||
public function configureArg(PackageInstaller $installer): string
|
||||
{
|
||||
$arg = '--enable-swow';
|
||||
$arg = '--enable-swow --disable-swow-pdo-pgsql';
|
||||
$arg .= $installer->getLibraryPackage('openssl') ? ' --enable-swow-ssl' : ' --disable-swow-ssl';
|
||||
$arg .= $installer->getLibraryPackage('curl') ? ' --enable-swow-curl' : ' --disable-swow-curl';
|
||||
return $arg;
|
||||
|
||||
@@ -8,15 +8,16 @@ use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Package\PackageBuilder;
|
||||
use StaticPHP\Package\PackageInstaller;
|
||||
|
||||
#[Extension('zlib')]
|
||||
class zlib
|
||||
{
|
||||
#[CustomPhpConfigureArg('Darwin')]
|
||||
#[CustomPhpConfigureArg('Linux')]
|
||||
public function unixConfigureArg(PackageBuilder $builder): string
|
||||
public function unixConfigureArg(PackageBuilder $builder, PackageInstaller $installer): string
|
||||
{
|
||||
$zlib_dir = php::getPHPVersionID() >= 80400 ? '' : ' --with-zlib-dir=' . $builder->getBuildRootPath();
|
||||
return '--with-zlib' . $zlib_dir;
|
||||
$zlib_dir = (php::getPHPVersionID() >= 80400 && !$installer->getPhpExtensionPackage('spx')) ? '' : " --with-zlib-dir={$builder->getBuildRootPath()}";
|
||||
return "--with-zlib{$zlib_dir}";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user