mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-09 01:45:36 +08:00
feat: add pkg-config tool package config
This commit is contained in:
13
config/pkg/tool/pkg-config.yml
Normal file
13
config/pkg/tool/pkg-config.yml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
pkg-config:
|
||||||
|
type: tool
|
||||||
|
artifact:
|
||||||
|
source: 'https://dl.static-php.dev/static-php-cli/deps/pkg-config/pkg-config-0.29.2.tar.gz'
|
||||||
|
binary:
|
||||||
|
linux-x86_64: { type: ghrel, repo: static-php/hosted, match: pkg-config-x86_64-linux-musl-1.2.5.txz, extract: { bin/pkg-config: '{pkg_root_path}/bin/pkg-config' } }
|
||||||
|
linux-aarch64: { type: ghrel, repo: static-php/hosted, match: pkg-config-aarch64-linux-musl-1.2.5.txz, extract: { bin/pkg-config: '{pkg_root_path}/bin/pkg-config' } }
|
||||||
|
macos-x86_64: { type: ghrel, repo: static-php/hosted, match: pkg-config-x86_64-darwin.txz, extract: { bin/pkg-config: '{pkg_root_path}/bin/pkg-config' } }
|
||||||
|
macos-aarch64: { type: ghrel, repo: static-php/hosted, match: pkg-config-aarch64-darwin.txz, extract: { bin/pkg-config: '{pkg_root_path}/bin/pkg-config' } }
|
||||||
|
tool:
|
||||||
|
provides:
|
||||||
|
- pkg-config
|
||||||
|
binary-subdir: bin
|
||||||
45
src/Package/Tool/pkgconfig.php
Normal file
45
src/Package/Tool/pkgconfig.php
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Package\Tool;
|
||||||
|
|
||||||
|
use StaticPHP\Attribute\Package\BuildFor;
|
||||||
|
use StaticPHP\Attribute\Package\InitPackage;
|
||||||
|
use StaticPHP\Attribute\Package\Tool;
|
||||||
|
use StaticPHP\DI\ApplicationContext;
|
||||||
|
use StaticPHP\Package\ToolPackage;
|
||||||
|
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
||||||
|
use StaticPHP\Toolchain\Interface\ToolchainInterface;
|
||||||
|
|
||||||
|
#[Tool('pkg-config')]
|
||||||
|
class pkgconfig
|
||||||
|
{
|
||||||
|
#[InitPackage]
|
||||||
|
public function resolveBuild(): void
|
||||||
|
{
|
||||||
|
ApplicationContext::set('elephant', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[BuildFor('Linux')]
|
||||||
|
#[BuildFor('Darwin')]
|
||||||
|
public function build(ToolPackage $package, ToolchainInterface $toolchain): void
|
||||||
|
{
|
||||||
|
UnixAutoconfExecutor::create($package)
|
||||||
|
->appendEnv([
|
||||||
|
'CFLAGS' => '-Wimplicit-function-declaration -Wno-int-conversion',
|
||||||
|
'LDFLAGS' => $toolchain->isStatic() ? '--static' : '',
|
||||||
|
])
|
||||||
|
->configure(
|
||||||
|
'--with-internal-glib',
|
||||||
|
'--disable-host-tool',
|
||||||
|
'--without-sysroot',
|
||||||
|
'--without-system-include-path',
|
||||||
|
'--without-system-library-path',
|
||||||
|
'--without-pc-path',
|
||||||
|
)
|
||||||
|
->make(with_install: 'install-exec');
|
||||||
|
|
||||||
|
shell()->exec("strip {$package->getBinDir()}/pkg-config");
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user