mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-19 13:24:51 +08:00
Add libxslt
This commit is contained in:
parent
0c386e967a
commit
017fabd556
15
config/pkg/lib/libxslt.yml
Normal file
15
config/pkg/lib/libxslt.yml
Normal file
@ -0,0 +1,15 @@
|
||||
libxslt:
|
||||
type: library
|
||||
artifact:
|
||||
source:
|
||||
type: filelist
|
||||
url: 'https://download.gnome.org/sources/libxslt/1.1/'
|
||||
regex: '/href="(?<file>libxslt-(?<version>[^"]+)\.tar\.xz)"/'
|
||||
metadata:
|
||||
license-files: [Copyright]
|
||||
license: MIT
|
||||
depends:
|
||||
- libxml2
|
||||
static-libs@unix:
|
||||
- libxslt.a
|
||||
- libexslt.a
|
||||
52
src/Package/Library/libxslt.php
Normal file
52
src/Package/Library/libxslt.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?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\PackageInstaller;
|
||||
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
||||
use StaticPHP\Runtime\SystemTarget;
|
||||
use StaticPHP\Util\SPCConfigUtil;
|
||||
|
||||
#[Library('libxslt')]
|
||||
class libxslt
|
||||
{
|
||||
#[BuildFor('Darwin')]
|
||||
#[BuildFor('Linux')]
|
||||
public function buildUnix(LibraryPackage $lib, PackageInstaller $installer): void
|
||||
{
|
||||
$static_libs = new SPCConfigUtil(['libs_only_deps' => true, 'no_php'])->getPackageDepsConfig($lib->getName(), array_keys($installer->getResolvedPackages()));
|
||||
$cpp = SystemTarget::getTargetOS() === 'Darwin' ? '-lc++' : '-lstdc++';
|
||||
$ac = UnixAutoconfExecutor::create($lib)
|
||||
->appendEnv([
|
||||
'CFLAGS' => "-I{$lib->getIncludeDir()}",
|
||||
'LDFLAGS' => "-L{$lib->getLibDir()}",
|
||||
'LIBS' => "{$static_libs['libs']} {$cpp}",
|
||||
])
|
||||
->addConfigureArgs(
|
||||
'--without-python',
|
||||
'--without-crypto',
|
||||
'--without-debug',
|
||||
'--without-debugger',
|
||||
"--with-libxml-prefix={$lib->getBuildRootPath()}",
|
||||
);
|
||||
if (getenv('SPC_LD_LIBRARY_PATH') && getenv('SPC_LIBRARY_PATH')) {
|
||||
$ac->appendEnv([
|
||||
'LD_LIBRARY_PATH' => getenv('SPC_LD_LIBRARY_PATH'),
|
||||
'LIBRARY_PATH' => getenv('SPC_LIBRARY_PATH'),
|
||||
]);
|
||||
}
|
||||
$ac->configure()->make();
|
||||
|
||||
$lib->patchPkgconfPrefix(['libexslt.pc', 'libxslt.pc']);
|
||||
$lib->patchLaDependencyPrefix();
|
||||
$AR = getenv('AR') ?: 'ar';
|
||||
shell()->cd($lib->getLibDir())
|
||||
->exec("{$AR} -t libxslt.a | grep '\\.a$' | xargs -n1 {$AR} d libxslt.a")
|
||||
->exec("{$AR} -t libexslt.a | grep '\\.a$' | xargs -n1 {$AR} d libexslt.a");
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user