# 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    = "wild"
version = "0.8.0"

[source]
tarball = "https://github.com/davidlattimore/wild/archive/refs/tags/0.8.0.tar.gz"
# FIXME sha256: el wrapper lo calcula (Alpine publica sha512). sha512 de Alpine:
# sha512 = "dc88b41cdfbbdbff69c4dedf121e30dc5f3543bfab0eb53ebcc35590a200582d2157f752effd0750d9862addd92252dc1e61e60b545a5bb9dcff4a59adcd9217"
sha256  = "3828028f41c668caf02aa9ffc4dc3bd1a33b4957eb66a7aa015f7c92e4f064ce"
patches = ["fix-riscv64-test.patch"]

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

[build.phases]
# de build() de Alpine (traducido; el lab provee $CBUILD/$CHOST — Etapa G Fase 3; revisá --shared para estático):
compile = '''
_abuild_phase() {
# https://github.com/davidlattimore/wild/blob/main/PACKAGING.md
	cargo auditable build --frozen --features mimalloc --profile dist
}
_abuild_phase
'''
# de package() de Alpine (traducido $pkgdir→/out):
install = '''
_abuild_phase() {
install -Dm 755 target/dist/wild "/out"/usr/bin/wild

	install -Dm 644 LICENSE-APACHE LICENSE-MIT -t "/out"/usr/share/licenses/"wild"/
}
_abuild_phase
'''

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