Add intl/ICU support#67
Conversation
|
Linux build failed with a strange linking issue. This error did not appear in the compilation of ICU, but in the link section of compiling PHP. I have attempted to change <?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;
$cppflag = 'CPPFLAGS="-DU_CHARSET_IS_UTF8=1 -DU_USING_ICU_NAMESPACE=1 -DU_STATIC_IMPLEMENTATION=1"';
shell()->cd($this->source_dir . '/source')
->exec(
"{$this->builder->configure_env} {$cppflag} ./runConfigureICU Linux " .
'--enable-static ' .
'--disable-shared ' .
'--with-data-packaging=static ' .
'--enable-release=yes ' .
'--enable-extras=yes ' .
'--enable-icuio=yes ' .
'--enable-dyload=no ' .
'--enable-tools=yes ' .
'--enable-tests=no ' .
'--enable-samples=no ' .
"--prefix={$root}"
)
->exec('make clean')
->exec("make -j{$this->builder->concurrency}")
->exec('make install');
}
}PR can be merged now, but only support macOS. |
|
And don't forget sorting config: bin/spc sort-config ext
bin/spc sort-config lib
bin/spc sort-config source |
|
This error has been resolved via Stack Overflow. But a new error has appeared :( Failed in sanity check: I checked it, it caused by C++. That means we can only build icu in alpine docker (like swoole). |
|
Yeah, I just stumbled upon that Stack Overflow answer as well! 👍 Just for my understanding: is it a problem if this can only be built in alpine docker? Thanks for letting me know about the sort-config commands and for already taking care of it. |
In linux, it is difficult to statically link libraries written in C++, especially when using glibc distributions. Alpine Linux uses musl-libc and its g++ is working well with static compilation (so far, it seems like this). |
This PR adds support for the intl extension by compiling ICU statically and closes #66 .
I only tested MacOS support so far but modified the Linux build settings accordingly.
The download link for ICU points to a fixed version number, because the GitHub releases also contain other releases that are missing the file we actually want.