mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-08 17:35:36 +08:00
Merge pull request #756 from crazywhalecc/feat/intl-win
Add intl support for windows
This commit is contained in:
2
.github/workflows/tests.yml
vendored
2
.github/workflows/tests.yml
vendored
@@ -190,7 +190,7 @@ jobs:
|
|||||||
echo "UPX_CMD=$(php src/globals/test-extensions.php upx)" >> $GITHUB_ENV
|
echo "UPX_CMD=$(php src/globals/test-extensions.php upx)" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: "Run Build Tests (download)"
|
- name: "Run Build Tests (download)"
|
||||||
run: GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} php src/globals/test-extensions.php download_cmd ${{ matrix.os }} ${{ matrix.php }}
|
run: php src/globals/test-extensions.php download_cmd ${{ matrix.os }} ${{ matrix.php }}
|
||||||
|
|
||||||
- name: "Run Build Tests (build)"
|
- name: "Run Build Tests (build)"
|
||||||
run: php src/globals/test-extensions.php build_cmd ${{ matrix.os }} ${{ matrix.php }}
|
run: php src/globals/test-extensions.php build_cmd ${{ matrix.os }} ${{ matrix.php }}
|
||||||
|
|||||||
@@ -304,12 +304,14 @@
|
|||||||
},
|
},
|
||||||
"intl": {
|
"intl": {
|
||||||
"support": {
|
"support": {
|
||||||
"Windows": "no",
|
|
||||||
"BSD": "wip"
|
"BSD": "wip"
|
||||||
},
|
},
|
||||||
"type": "builtin",
|
"type": "builtin",
|
||||||
"lib-depends": [
|
"lib-depends-unix": [
|
||||||
"icu"
|
"icu"
|
||||||
|
],
|
||||||
|
"lib-depends-windows": [
|
||||||
|
"icu-static-win"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"ldap": {
|
"ldap": {
|
||||||
@@ -336,6 +338,9 @@
|
|||||||
},
|
},
|
||||||
"type": "builtin",
|
"type": "builtin",
|
||||||
"arg-type": "none",
|
"arg-type": "none",
|
||||||
|
"ext-depends": [
|
||||||
|
"xml"
|
||||||
|
],
|
||||||
"target": [
|
"target": [
|
||||||
"static"
|
"static"
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -207,6 +207,18 @@
|
|||||||
"libicudata.a"
|
"libicudata.a"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"icu-static-win": {
|
||||||
|
"source": "icu-static-win",
|
||||||
|
"static-libs-windows": [
|
||||||
|
"icudt.lib",
|
||||||
|
"icuin.lib",
|
||||||
|
"icuio.lib",
|
||||||
|
"icuuc.lib"
|
||||||
|
],
|
||||||
|
"headers-windows": [
|
||||||
|
"unicode"
|
||||||
|
]
|
||||||
|
},
|
||||||
"imagemagick": {
|
"imagemagick": {
|
||||||
"source": "imagemagick",
|
"source": "imagemagick",
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
|
|||||||
@@ -342,6 +342,14 @@
|
|||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"icu-static-win": {
|
||||||
|
"type": "url",
|
||||||
|
"url": "https://dl.static-php.dev/static-php-cli/deps/icu-static-windows-x64/icu-static-windows-x64.zip",
|
||||||
|
"license": {
|
||||||
|
"type": "text",
|
||||||
|
"text": "none"
|
||||||
|
}
|
||||||
|
},
|
||||||
"igbinary": {
|
"igbinary": {
|
||||||
"type": "url",
|
"type": "url",
|
||||||
"url": "https://pecl.php.net/get/igbinary",
|
"url": "https://pecl.php.net/get/igbinary",
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||||||
namespace SPC\builder\extension;
|
namespace SPC\builder\extension;
|
||||||
|
|
||||||
use SPC\builder\Extension;
|
use SPC\builder\Extension;
|
||||||
|
use SPC\builder\windows\WindowsBuilder;
|
||||||
use SPC\store\FileSystem;
|
use SPC\store\FileSystem;
|
||||||
use SPC\util\CustomExt;
|
use SPC\util\CustomExt;
|
||||||
|
|
||||||
@@ -13,13 +14,15 @@ class intl extends Extension
|
|||||||
{
|
{
|
||||||
public function patchBeforeBuildconf(): bool
|
public function patchBeforeBuildconf(): bool
|
||||||
{
|
{
|
||||||
// TODO: remove the following line when https://github.com/php/php-src/pull/14002 will be released
|
if ($this->builder instanceof WindowsBuilder) {
|
||||||
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/intl/config.m4', 'PHP_CXX_COMPILE_STDCXX(11', 'PHP_CXX_COMPILE_STDCXX(17');
|
FileSystem::replaceFileStr(
|
||||||
// Also need to use clang++ -std=c++17 to force override the default C++ standard
|
SOURCE_PATH . '/php-src/ext/intl/config.w32',
|
||||||
if (is_string($env = getenv('CXX')) && !str_contains($env, 'std=c++17')) {
|
'EXTENSION("intl", "php_intl.c intl_convert.c intl_convertcpp.cpp intl_error.c ", true,',
|
||||||
f_putenv('CXX=' . $env . ' -std=c++17');
|
'EXTENSION("intl", "php_intl.c intl_convert.c intl_convertcpp.cpp intl_error.c ", PHP_INTL_SHARED,'
|
||||||
|
);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function patchBeforeSharedPhpize(): bool
|
public function patchBeforeSharedPhpize(): bool
|
||||||
|
|||||||
27
src/SPC/builder/windows/library/icu_static_win.php
Normal file
27
src/SPC/builder/windows/library/icu_static_win.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\windows\library;
|
||||||
|
|
||||||
|
use SPC\store\FileSystem;
|
||||||
|
|
||||||
|
class icu_static_win extends WindowsLibraryBase
|
||||||
|
{
|
||||||
|
public const NAME = 'icu-static-win';
|
||||||
|
|
||||||
|
protected function build(): void
|
||||||
|
{
|
||||||
|
copy("{$this->source_dir}\\x64-windows-static\\lib\\icudt.lib", "{$this->getLibDir()}\\icudt.lib");
|
||||||
|
copy("{$this->source_dir}\\x64-windows-static\\lib\\icuin.lib", "{$this->getLibDir()}\\icuin.lib");
|
||||||
|
copy("{$this->source_dir}\\x64-windows-static\\lib\\icuio.lib", "{$this->getLibDir()}\\icuio.lib");
|
||||||
|
copy("{$this->source_dir}\\x64-windows-static\\lib\\icuuc.lib", "{$this->getLibDir()}\\icuuc.lib");
|
||||||
|
|
||||||
|
// create libpq folder in buildroot/includes/libpq
|
||||||
|
if (!file_exists("{$this->getIncludeDir()}\\unicode")) {
|
||||||
|
mkdir("{$this->getIncludeDir()}\\unicode");
|
||||||
|
}
|
||||||
|
|
||||||
|
FileSystem::copyDir("{$this->source_dir}\\x64-windows-static\\include\\unicode", "{$this->getIncludeDir()}\\unicode");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -27,9 +27,9 @@ $test_os = [
|
|||||||
// 'ubuntu-latest',
|
// 'ubuntu-latest',
|
||||||
// 'ubuntu-22.04',
|
// 'ubuntu-22.04',
|
||||||
// 'ubuntu-24.04',
|
// 'ubuntu-24.04',
|
||||||
'ubuntu-22.04-arm',
|
// 'ubuntu-22.04-arm',
|
||||||
// 'ubuntu-24.04-arm',
|
// 'ubuntu-24.04-arm',
|
||||||
// 'windows-latest',
|
'windows-latest',
|
||||||
];
|
];
|
||||||
|
|
||||||
// whether enable thread safe
|
// whether enable thread safe
|
||||||
@@ -48,8 +48,8 @@ $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' => 'apcu,ast,bcmath,calendar,ctype,curl,dba,dom,exif,fileinfo,filter,iconv,libxml,mbregex,mbstring,opcache,openssl,pcntl,phar,posix,readline,session,simplexml,sockets,sodium,tokenizer,xml,xmlreader,xmlwriter,zip,zlib',
|
'Linux', 'Darwin' => 'curl',
|
||||||
'Windows' => 'xlswriter,openssl',
|
'Windows' => 'intl',
|
||||||
};
|
};
|
||||||
|
|
||||||
// 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`).
|
||||||
|
|||||||
Reference in New Issue
Block a user