# 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    = "lynx"
version = "2.9.3"

[source]
tarball = "https://invisible-mirror.net/archives/lynx/tarballs/lynx${pkgver/_p/rel.}.tar.bz2"
# FIXME sha256: el wrapper lo calcula (Alpine publica sha512). sha512 de Alpine:
# sha512 = "96fe5d8b427c0ceeaaa1778d88dae21f4fde79781243428f0c47e2ffb6f32c4ca918d608a60c55975fb101d5aae710d3aa3a8d6af3316599307bf810c0c87144"
sha256  = "FIXME-sha256"

[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 \
		--localstatedir=/var \
		--enable-ipv6 \
		--with-ssl \
		--enable-default-colors \
		--with-screen=ncursesw \
		--with-zlib \
		--disable-full-paths \
		--enable-externs \
		--enable-nls
	make helpdir=/usr/share/doc/lynx/help \
		docdir=/usr/share/doc/lynx
}
_abuild_phase
'''
# de package() de Alpine (traducido $pkgdir→/out):
install = '''
_abuild_phase() {
make DESTDIR="/out" install install-help install-doc \
		helpdir=/usr/share/doc/lynx/help \
		docdir=/usr/share/doc/lynx
}
_abuild_phase
'''

[deps]
build = ["openssl-dev>3", "gettext", "zlib", "glib", "perl", "ncurses"]
