Add target htop

This commit is contained in:
crazywhalecc 2026-03-18 15:01:06 +08:00
parent 0b0ecd17c3
commit 9e2a5ce188
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680
2 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,10 @@
htop:
type: target
artifact:
source:
type: ghrel
repo: htop-dev/htop
match: htop.+\.tar\.xz
prefer-stable: true
depends:
- ncursesw

View File

@ -0,0 +1,29 @@
<?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);
}
}