Files
static-php-cli/src/Package/Target/htop.php
2026-03-18 15:01:06 +08:00

30 lines
988 B
PHP

<?php
declare(strict_types=1);
namespace Package\Target;
use StaticPHP\Attribute\Package\BuildFor;
use StaticPHP\Attribute\Package\Target;
use StaticPHP\Package\TargetPackage;
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
use StaticPHP\Toolchain\Interface\ToolchainInterface;
#[Target('htop')]
class htop extends TargetPackage
{
#[BuildFor('Darwin')]
#[BuildFor('Linux')]
public function build(ToolchainInterface $toolchain): void
{
// htop's --enable-static adds -static to CFLAGS/LDFLAGS globally (not just for .a libraries),
// which causes zig-cc to fail on glibc targets. Only enable it for truly static (musl) builds.
UnixAutoconfExecutor::create($this)
->removeConfigureArgs('--disable-shared', '--enable-static')
->exec('./autogen.sh')
->addConfigureArgs($toolchain->isStatic() ? '--enable-static' : '--disable-static')
->configure()
->make(with_clean: false);
}
}