Make intl use c++17

This commit is contained in:
crazywhalecc
2026-05-09 08:15:45 +08:00
parent e4201a28ca
commit 04df87cd5f

View File

@@ -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'
);
}
}