# 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    = "mc"
version = "4.8.33"

[source]
tarball = "https://ftp.osuosl.org/pub/midnightcommander/mc-4.8.33.tar.xz"
# FIXME sha256: el wrapper lo calcula (Alpine publica sha512). sha512 de Alpine:
# sha512 = "3eb857af2fa689e9458aeef6d3b236fb92684e05c0e3e78e7e5a5fa5dba6431cae39bec51bc84598b0bb60579cb0a0679dcdc6e9f7d88ca85dc37ace251c8632"
sha256  = "cae149d42f844e5185d8c81d7db3913a8fa214c65f852200a9d896b468af164c"
patches = ["alpine_syntax.patch", "ticket_4642_parse_ls_vga_fix.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 \
		--libexecdir=/usr/lib \
		--mandir=/usr/share/man \
		--sysconfdir=/etc \
		--enable-background \
		--enable-charset \
		--enable-largefile \
		--enable-vfs-sftp \
		--with-internal-edit \
		--with-screen=slang \
		--with-subshell \
		--with-gpm-mouse \
		--without-x
	make
}
_abuild_phase
'''
# de package() de Alpine (traducido $pkgdir→/out):
install = '''
_abuild_phase() {
make DESTDIR="/out" install
	rm -fr "/out"/usr/share/man/??
}
_abuild_phase
'''

[deps]
build = ["e2fsprogs", "glib", "libssh2", "slang", "perl", "gpm"]
