# Importada de Alpine aports por `hammer import-alpine` (Etapa G). PUNTO DE PARTIDA — pero
# YA trae los parches de musl de Alpine (lo que un import de nix pierde). Pendiente: el
# sha256 del tarball (el wrapper lo calcula), y adaptar build/install del shell de abuild.
name    = "pciutils"
version = "3.15.0"

[source]
tarball = "https://github.com/pciutils/pciutils/archive/refs/tags/v3.15.0.tar.gz"
# FIXME sha256: el wrapper lo calcula (Alpine publica sha512). sha512 de Alpine:
# sha512 = "8164652b4283edd5bbb9db6604aee4135f4ca4398de337bf111fec09b8a8825d00a4ad363cd4a0848bd750c846c0037bfaa4f88c36fe709b4fd67462c6501abf"
sha256  = "06f467642057599acf396bc17340452fac3308f1e08be19e0c32587e42d7017b"

[build]
compiler = "zig-cc"
target   = "x86_64-linux-musl"
link     = "static"
flags    = []

[build.phases]
# pciutils no usa autotools: es make + variables. Build estático musl con zlib.
compile = '''
_abuild_phase() {
make OPT="$CFLAGS" ZLIB=no \
		SHARED=no \
		PREFIX=/usr \
		IDSDIR=/usr/share/misc \
		MANDIR=/usr/share/man \
		HWDB=no DNS=no \
		all
}
_abuild_phase
'''
install = '''
_abuild_phase() {
make PREFIX=/usr \
		DESTDIR=/out \
		SHARED=no \
		IDSDIR=/usr/share/misc \
		MANDIR=/usr/share/man \
		install
}
_abuild_phase
'''

# depends de runtime de Alpine (NO build-deps): hwdata-pci

[deps]
build = ["linux-headers", "make"]
