# 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    = "giflib"
version = "5.2.2"

[source]
tarball = "https://downloads.sourceforge.net/sourceforge/giflib/giflib-5.2.2.tar.gz"
# FIXME sha256: el wrapper lo calcula (Alpine publica sha512). sha512 de Alpine:
# sha512 = "0865ab2b1904fa14640c655fdb14bb54244ad18a66e358565c00287875d00912343f9be8bfac7658cc0146200d626f7ec9160d7a339f20ba3be6b9941d73975f"
sha256  = "be7ffbd057cadebe2aa144542fd90c6838c6a083b5e8a9048b8ee3b66b29d5fb"
patches = ["CVE-2021-40633.patch", "CVE-2025-31344.patch", "correct-document-page-install.patch", "dont-build-html-pages-images.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 CFLAGS="$CFLAGS -fPIC"
}
_abuild_phase
'''
# de package() de Alpine (traducido $pkgdir→/out):
install = '''
_abuild_phase() {
make DESTDIR="/out" PREFIX=/usr install
}
_abuild_phase
'''

# xmlto era dep espuria del import (solo docs, ya desactivadas por dont-build-html-pages-images.patch).
[deps]
build = ["make"]
