# 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    = "duckscript"
version = "0.11.1"

[source]
tarball = "https://github.com/sagiegurari/duckscript/archive/0.11.1/duckscript-0.11.1.tar.gz"
# FIXME sha256: el wrapper lo calcula (Alpine publica sha512). sha512 de Alpine:
# sha512 = "1059e7f8169d1249a21e8d4a49c331b1ce402301ea784774ede882cfedf694120475de1c210b2e3a3de38d606a31afd13d73337958b5958aa228ecdf9344a04d"
sha256  = "2e23b16359fb9b2c521f0bd250f6eb754bcb8ef40a7f8bf8076f87387276032a"
patches = ["use-zlib.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() {
cargo auditable build $_cargo_opts --release
}
_abuild_phase
'''
# de package() de Alpine (traducido $pkgdir→/out):
install = '''
_abuild_phase() {
install -D -m755 target/release/duck -t "/out"/usr/bin/
}
_abuild_phase
'''

[deps]
build = ["bzip2", "openssl", "zlib"]
