# 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    = "gross"
version = "1.0.4"

[source]
tarball = "https://codeberg.org/bizdelnick/gross/releases/download/v1.0.4/gross-1.0.4.tar.xz"
# FIXME sha256: el wrapper lo calcula (Alpine publica sha512). sha512 de Alpine:
# sha512 = "28126ed65ca82b9826b04f6210a95865fc514b924c0f14123e822923d2ce44f2c5c80d41f5b23c3ff845f9734a8e6ca3424fa165e7955d0fa99d52ae45bb30ea"
sha256  = "0ee4fb368151558dc962328f2e99d9b6b61ddede44ead606fec8131774a5d174"
patches = ["gross-1.0.1-default-conf.patch", "gross-grey_tuple.patch", "gcc15-bool.patch", "gcc15-conflicting-types.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() {
./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info
	make -j1
}
_abuild_phase
'''
# de package() de Alpine (traducido $pkgdir→/out):
install = '''
_abuild_phase() {
make -j1 DESTDIR="/out" install

	install -dD "/out"/var/run/gross
	install -m755 -D "$srcdir"/grossd.initd "/out"/etc/init.d/grossd
	install -m644 -D "$srcdir"/grossd.confd "/out"/etc/conf.d/grossd
}
_abuild_phase
'''

[deps]
build = ["c-ares", "autoconf", "automake", "libtool", "sed"]
