mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
49 lines
1.6 KiB
PHP
49 lines
1.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace SPC\builder\linux\library;
|
|
|
|
use SPC\store\FileSystem;
|
|
|
|
class icu extends LinuxLibraryBase
|
|
{
|
|
use \SPC\builder\unix\library\icu;
|
|
|
|
public const NAME = 'icu';
|
|
|
|
protected function build(): void
|
|
{
|
|
$cppflags = 'CPPFLAGS="-DU_CHARSET_IS_UTF8=1 -DU_USING_ICU_NAMESPACE=1 -DU_STATIC_IMPLEMENTATION=1 -DPIC -fPIC"';
|
|
$cxxflags = 'CXXFLAGS="-std=c++17 -fPIC -fno-ident"';
|
|
$ldflags = getenv('SPC_LIBC') !== 'glibc' ? 'LDFLAGS="-static"' : '';
|
|
shell()->cd($this->source_dir . '/source')
|
|
->setEnv([
|
|
'CFLAGS' => $this->getLibExtraCFlags(),
|
|
'LDFLAGS' => $this->getLibExtraLdFlags(),
|
|
'LIBS' => $this->getLibExtraLibs(),
|
|
])
|
|
->execWithEnv(
|
|
"{$cppflags} {$cxxflags} {$ldflags} " .
|
|
'./runConfigureICU Linux ' .
|
|
'--enable-static ' .
|
|
'--disable-shared ' .
|
|
'--with-data-packaging=static ' .
|
|
'--enable-release=yes ' .
|
|
'--enable-extras=no ' .
|
|
'--enable-icuio=yes ' .
|
|
'--enable-dyload=no ' .
|
|
'--enable-tools=yes ' .
|
|
'--enable-tests=no ' .
|
|
'--enable-samples=no ' .
|
|
'--prefix=' . BUILD_ROOT_PATH
|
|
)
|
|
->execWithEnv('make clean')
|
|
->execWithEnv("make -j{$this->builder->concurrency}")
|
|
->execWithEnv('make install');
|
|
|
|
$this->patchPkgconfPrefix(['icu-i18n.pc', 'icu-io.pc', 'icu-uc.pc'], PKGCONF_PATCH_PREFIX);
|
|
FileSystem::removeDir(BUILD_LIB_PATH . '/icu');
|
|
}
|
|
}
|