Add intl/ICU support

This commit is contained in:
Marcel Pociot 2023-06-02 11:47:11 +02:00
parent 09ba11affb
commit 1158931d91
7 changed files with 68 additions and 2 deletions

View File

@ -460,5 +460,18 @@
"static-libs-unix": [ "static-libs-unix": [
"libsodium.a" "libsodium.a"
] ]
},
"icu": {
"source": "icu",
"static-libs-unix": [
"libicudata.a",
"libicui18n.a",
"libicuio.a",
"libicutu.a",
"libicuuc.a"
],
"headers": [
]
} }
} }

View File

@ -419,5 +419,13 @@
"type": "file", "type": "file",
"path": "LICENSE" "path": "LICENSE"
} }
},
"icu": {
"type": "url",
"url": "https://github.com/unicode-org/icu/releases/download/release-73-1/icu4c-73_1-src.tgz",
"license": {
"type": "file",
"path": "LICENSE"
}
} }
} }

View File

@ -139,7 +139,7 @@ class LinuxBuilder extends BuilderBase
) )
); );
} }
if ($this->getExt('swoole')) { if ($this->getExt('swoole') || $this->getExt('intl')) {
$extra_libs .= ' -lstdc++'; $extra_libs .= ' -lstdc++';
} }
if ($this->getExt('imagick')) { if ($this->getExt('imagick')) {

View File

@ -0,0 +1,20 @@
<?php
declare(strict_types=1);
namespace SPC\builder\linux\library;
class icu extends LinuxLibraryBase
{
public const NAME = 'icu';
protected function build()
{
$root = BUILD_ROOT_PATH;
shell()->cd($this->source_dir . '/source')
->exec("{$this->builder->configure_env} ./runConfigureICU Linux --enable-static --disable-shared --prefix={$root}")
->exec('make clean')
->exec("make -j{$this->builder->concurrency}")
->exec('make install');
}
}

View File

@ -123,7 +123,7 @@ class MacOSBuilder extends BuilderBase
*/ */
public function buildPHP(int $build_target = BUILD_TARGET_NONE, bool $bloat = false): void public function buildPHP(int $build_target = BUILD_TARGET_NONE, bool $bloat = false): void
{ {
$extra_libs = $this->getFrameworks(true) . ' ' . ($this->getExt('swoole') ? '-lc++ ' : ''); $extra_libs = $this->getFrameworks(true) . ' ' . ($this->getExt('swoole') || $this->getExt('intl') ? '-lc++ ' : '');
if (!$bloat) { if (!$bloat) {
$extra_libs .= implode(' ', $this->getAllStaticLibFiles()); $extra_libs .= implode(' ', $this->getAllStaticLibFiles());
} else { } else {

View File

@ -0,0 +1,20 @@
<?php
declare(strict_types=1);
namespace SPC\builder\macos\library;
class icu extends MacOSLibraryBase
{
public const NAME = 'icu';
protected function build()
{
$root = BUILD_ROOT_PATH;
shell()->cd($this->source_dir . '/source')
->exec("{$this->builder->configure_env} ./runConfigureICU MacOSX --enable-static --disable-shared --prefix={$root}")
->exec('make clean')
->exec("make -j{$this->builder->concurrency}")
->exec('make install');
}
}

View File

@ -0,0 +1,5 @@
<?php
declare(strict_types=1);
assert(class_exists(NumberFormatter::class));