# 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    = "cargo-c"
version = "0.10.23"

[source]
tarball = "https://github.com/lu-zero/cargo-c/archive/v0.10.23.tar.gz"
# FIXME sha256: el wrapper lo calcula (Alpine publica sha512). sha512 de Alpine:
# sha512 = "c979e3f2ed549d34a00a63afc031b2bc3eaee910523a398af492fcad5633dfcada47850b2b9e5af667fc6ba40447649016f48438c37fc1d360aa670d803dce09"
sha256  = "17679af6c00a70ce1d70668023e993045539afdc7ab0ca1a081aa8ef6993a595"

[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() {
rm target/release/cargo-*.d
	install -Dm755 target/release/cargo-* -t "/out"/usr/bin/

	install -Dm644 -t "/out/usr/share/doc/cargo-c" README.md
	install -Dm644 -t "/out/usr/share/doc/cargo-c" LICENSE
}
_abuild_phase
'''

[deps]
build = ["curl", "libgit2", "libssh2", "openssl-dev>3", "zlib"]
