# 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    = "dhcpcd"
version = "10.3.2"
license = "BSD-2-Clause"

[source]
tarball = "https://github.com/NetworkConfiguration/dhcpcd/releases/download/v10.3.2/dhcpcd-10.3.2.tar.xz"
# FIXME sha256: el wrapper lo calcula (Alpine publica sha512). sha512 de Alpine:
# sha512 = "5944fa141bd40c8aabb2c3c46748d736f69f6fd0a773386508cbff868d8f69d88305a0fd97dff4da21c5662918016b36d8327498e5b0509804dbec80603f6d6d"
sha256  = "b6aa46932074906a9badef1bfe142b8aff9d041c2689e1ef8b74c12e9fd942bd"
patches = ["busybox-logger.patch", "fix-chrony-conf-location.patch"]

[build]
compiler = "zig-cc"
target   = "x86_64-linux-musl"
link     = "static"

# Split de la info de depuración (SDD 23 etapa 4, tanda de HOJAS). Entra en `hash_inputs`.
strip_debug = true
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 \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--libexecdir=/usr/lib/dhcpcd \
		--dbdir=/var/lib/dhcpcd \
		--rundir=/run/dhcpcd \
		--runstatedir=/run/dhcpcd \
		--enable-ipv6 \
		--enable-privsep \
		--enable-seccomp \
		--without-dev \
		--without-udev
	make
}
_abuild_phase
'''
# de package() de Alpine (traducido $pkgdir→/out):
install = '''
_abuild_phase() {
make DESTDIR="/out" install
}
_abuild_phase
'''

[deps]
build = ["binutils", "linux-headers", "make", "pkgconf"]
