# 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    = "kakoune"
version = "2026.05.21"

[source]
tarball = "https://github.com/mawww/kakoune/archive/v2026.05.21.tar.gz"
# FIXME sha256: el wrapper lo calcula (Alpine publica sha512). sha512 de Alpine:
# sha512 = "e5a0fae85c779192a7f9bd6bacfa50955abd0b2140b1a65f2826c373c3365e11f05125cd621980a43ead67768c5117ce3f6b1a2ca347d37dcf29175872a83f2b"
sha256  = "7ef778bd199e05977841e6f69aad2bee6cd58fb23b0e4bc265d012d42de17580"
patches = ["0001-fix-CXXFLAGS.patch", "constexpr.patch", "0001-use-pattern-matching-instead-of-pathchk-in-autorestore.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() {
make debug=no
}
_abuild_phase
'''
# de package() de Alpine (traducido $pkgdir→/out):
install = '''
_abuild_phase() {
make -j1 PREFIX="/usr" DESTDIR="/out/" debug=no install
	install -Dm644 "$srcdir"/alpine-linux.kak \
		-t "/out"/usr/share/kak/autoload/filetype/
}
_abuild_phase
'''
