mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
Add gettext
This commit is contained in:
parent
e732543bd7
commit
e4d6723b01
19
config/pkg/lib/gettext.yml
Normal file
19
config/pkg/lib/gettext.yml
Normal file
@ -0,0 +1,19 @@
|
||||
gettext:
|
||||
type: library
|
||||
artifact:
|
||||
source:
|
||||
type: filelist
|
||||
url: 'https://ftp.gnu.org/pub/gnu/gettext/'
|
||||
regex: '/href="(?<file>gettext-(?<version>[^"]+)\.tar\.xz)"/'
|
||||
metadata:
|
||||
license-files: [gettext-runtime/intl/COPYING.LIB]
|
||||
license: LGPL-2.1-or-later
|
||||
static-libs@unix:
|
||||
- libintl.a
|
||||
depends:
|
||||
- libiconv
|
||||
suggests:
|
||||
- ncurses
|
||||
- libxml2
|
||||
frameworks:
|
||||
- CoreFoundation
|
||||
48
src/Package/Library/gettext.php
Normal file
48
src/Package/Library/gettext.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Library;
|
||||
|
||||
use StaticPHP\Attribute\Package\BuildFor;
|
||||
use StaticPHP\Attribute\Package\Library;
|
||||
use StaticPHP\Package\LibraryPackage;
|
||||
use StaticPHP\Package\PackageBuilder;
|
||||
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
||||
|
||||
#[Library('gettext')]
|
||||
class gettext
|
||||
{
|
||||
#[BuildFor('Linux')]
|
||||
#[BuildFor('Darwin')]
|
||||
public function build(LibraryPackage $pkg, PackageBuilder $builder): void
|
||||
{
|
||||
$autoconf = UnixAutoconfExecutor::create($pkg)
|
||||
->optionalPackage('ncurses', "--with-libncurses-prefix={$pkg->getBuildRootPath()}")
|
||||
->optionalPackage('libxml2', "--with-libxml2-prefix={$pkg->getBuildRootPath()}")
|
||||
->addConfigureArgs(
|
||||
'--disable-java',
|
||||
'--disable-c++',
|
||||
'--disable-d',
|
||||
'--disable-rpath',
|
||||
'--disable-modula2',
|
||||
'--disable-libasprintf',
|
||||
'--with-included-libintl',
|
||||
"--with-iconv-prefix={$pkg->getBuildRootPath()}",
|
||||
);
|
||||
|
||||
// zts
|
||||
if ($builder->getOption('enable-zts')) {
|
||||
$autoconf->addConfigureArgs('--enable-threads=isoc+posix')
|
||||
->appendEnv([
|
||||
'CFLAGS' => '-lpthread -D_REENTRANT',
|
||||
'LDFLGAS' => '-lpthread',
|
||||
]);
|
||||
} else {
|
||||
$autoconf->addConfigureArgs('--disable-threads');
|
||||
}
|
||||
|
||||
$autoconf->configure()->make(dir: "{$pkg->getSourceDir()}/gettext-runtime/intl");
|
||||
$pkg->patchLaDependencyPrefix();
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user