# 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    = "meson"
version = "1.11.1"

[source]
tarball = "https://github.com/mesonbuild/meson/releases/download/1.11.1/meson-1.11.1.tar.gz"
# FIXME sha256: el wrapper lo calcula (Alpine publica sha512). sha512 de Alpine:
# sha512 = "c30c98714ab595ca1b5241fbb546c9c5fbb3eada53bfe782652a5734b04d45d66944a5fc8673ee602797c8173e27473036bcb01e09032bbc518567ee89dd6d70"
sha256  = "6788ae299979643f8d841bcaf64352558436cae45a0355148a3aeeccf7913866"
patches = ["fix-ninja-output-test.patch", "skip-broken-tests.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() {
gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}
_abuild_phase
'''
# de package() de Alpine (traducido $pkgdir→/out):
install = '''
_abuild_phase() {
python3 -m installer -d "/out" .dist/*.whl

	install -Dm644 data/shell-completions/zsh/* -t "/out"/usr/share/zsh/site-functions
	install -Dm644 data/shell-completions/bash/* -t "/out"/usr/share/bash-completion/completions
}
_abuild_phase
'''

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

[deps]
build = ["py3-gpep517", "py3-setuptools", "py3-wheel"]
