# 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    = "kalker"
version = "2.2.2"

[source]
tarball = "https://github.com/PaddiM8/kalker/archive/refs/tags/v2.2.2.tar.gz"
# FIXME sha256: el wrapper lo calcula (Alpine publica sha512). sha512 de Alpine:
# sha512 = "7595e38245ea36ebd0b72df4d44db73411e19d363102e7a967d043b0dc2266a5d3db8f6b6e69b6f259ed640220d4fa48cfbc5de7ea52425e6f320aac2abec64b"
sha256  = "4f35555e19c8a1a05ceba6a7043088a00fea3fbf780bbd4af90696172ce9f7c3"
patches = ["system-libs.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 --release --frozen
}
_abuild_phase
'''
# de package() de Alpine (traducido $pkgdir→/out):
install = '''
_abuild_phase() {
install -Dm755 target/release/kalker "/out"/usr/bin/kalker
}
_abuild_phase
'''

[deps]
build = ["gmp", "m4", "mpc1", "mpfr"]
