2024-02-16 01:28:10 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace SPC\builder\unix\library;
|
|
|
|
|
|
|
|
|
|
trait gettext
|
|
|
|
|
{
|
|
|
|
|
protected function build(): void
|
|
|
|
|
{
|
|
|
|
|
$extra = $this->builder->getLib('ncurses') ? ('--with-libncurses-prefix=' . BUILD_ROOT_PATH . ' ') : '';
|
|
|
|
|
$extra .= $this->builder->getLib('libxml2') ? ('--with-libxml2-prefix=' . BUILD_ROOT_PATH . ' ') : '';
|
2025-02-10 21:28:00 +09:00
|
|
|
|
|
|
|
|
$zts = $this->builder->getOption('enable-zts') ? '--enable-threads=isoc+posix ' : '--disable-threads ';
|
|
|
|
|
|
|
|
|
|
$cflags = $this->builder->getOption('enable-zts') ? '-lpthread -D_REENTRANT' : '';
|
|
|
|
|
$ldflags = $this->builder->getOption('enable-zts') ? '-lpthread' : '';
|
|
|
|
|
|
2024-02-16 01:28:10 +08:00
|
|
|
shell()->cd($this->source_dir)
|
2025-03-21 07:35:06 +01:00
|
|
|
->setEnv([
|
|
|
|
|
'CFLAGS' => "{$this->getLibExtraCFlags()} {$cflags}",
|
|
|
|
|
'LDFLAGS' => $this->getLibExtraLdFlags() ?: $ldflags,
|
|
|
|
|
'LIBS' => $this->getLibExtraLibs(),
|
|
|
|
|
])
|
2024-04-07 15:52:24 +08:00
|
|
|
->execWithEnv(
|
2024-02-16 01:28:10 +08:00
|
|
|
'./configure ' .
|
|
|
|
|
'--enable-static ' .
|
|
|
|
|
'--disable-shared ' .
|
|
|
|
|
'--disable-java ' .
|
2025-03-21 07:35:06 +01:00
|
|
|
'--disable-c++ ' .
|
2025-02-10 21:28:00 +09:00
|
|
|
$zts .
|
2024-02-16 01:28:10 +08:00
|
|
|
$extra .
|
2024-12-10 23:08:31 +08:00
|
|
|
'--with-included-gettext ' .
|
2024-02-16 01:28:10 +08:00
|
|
|
'--with-libiconv-prefix=' . BUILD_ROOT_PATH . ' ' .
|
|
|
|
|
'--prefix=' . BUILD_ROOT_PATH
|
|
|
|
|
)
|
2024-04-07 15:52:24 +08:00
|
|
|
->execWithEnv('make clean')
|
|
|
|
|
->execWithEnv("make -j{$this->builder->concurrency}")
|
|
|
|
|
->execWithEnv('make install');
|
2025-05-20 23:16:36 +07:00
|
|
|
$this->patchLaDependencyPrefix(['libintl.la']);
|
2024-02-16 01:28:10 +08:00
|
|
|
}
|
|
|
|
|
}
|