# 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    = "wayland"
version = "1.25.0"

[source]
tarball = "https://gitlab.freedesktop.org/wayland/wayland/-/releases/1.25.0/downloads/wayland-1.25.0.tar.xz"
# FIXME sha256: el wrapper lo calcula (Alpine publica sha512). sha512 de Alpine:
# sha512 = "20ae71ecc8b6d61b3e111171260911469cc7c3470048629db28eb4115415124e5a9392e1d9be84adb324cf1a29e557ae8e033e17c51fbab2fc80d9c6b9aad82c"
sha256  = "c065f040afdff3177680600f249727e41a1afc22fccf27222f15f5306faa1f03"

[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() {
abuild-meson \
		-Db_lto=true \
		-Ddocumentation=false \
		-Ddefault_library=both \
		. output

	meson compile -C output
}
_abuild_phase
'''
# de package() de Alpine (traducido $pkgdir→/out):
install = '''
_abuild_phase() {
depends="
		wayland-libs-client=1.25.0-r$pkgrel
		wayland-libs-cursor=1.25.0-r$pkgrel
		wayland-libs-egl=1.25.0-r$pkgrel
		wayland-libs-server=1.25.0-r$pkgrel
		"
	DESTDIR="/out" meson install --no-rebuild -C output
}
_abuild_phase
'''

[deps]
build = ["_dev", "libxml2-dev~2.13"]
