# 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    = "rsync"
version = "3.4.4"
license = "GPL-3.0-or-later"

[source]
tarball = "https://download.samba.org/pub/rsync/rsync-3.4.4.tar.gz"
# FIXME sha256: el wrapper lo calcula (Alpine publica sha512). sha512 de Alpine:
# sha512 = "cf9a838b1f019b70fd67fa2c293f267be3f24e579c2ea33177ec7afc502c97ce0b613ff0854088c0eb28acd14ee0a75706ae8445115cef4669bd586c505d8453"
sha256  = "bd88cf82fa653da32314fb229136407c5c90f80d1758d8f4b091767877d8fa96"
patches = ["dont-use-nobody.patch"]

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

[build.phases]
# fase configure EXPLÍCITA: si la receta no la define, hammer autogenera su propio
# `./configure --prefix=/usr` (sin nuestros --disable-*) y aborta antes del compile.
configure = '''
cp rrsync.1 support/rrsync.1
./configure \
	--build=$CBUILD \
	--host=$CHOST \
	--prefix=/usr \
	--sysconfdir=/etc \
	--mandir=/usr/share/man \
	--localstatedir=/var \
	--disable-acl-support \
	--disable-xattr-support \
	--disable-xxhash \
	--disable-zstd \
	--disable-lz4 \
	--with-rrsync \
	--with-included-popt \
	--with-included-zlib \
	--disable-md2man \
	--disable-openssl
	# deps externas quitadas (no en catálogo): popt/zlib embebidos; acl/xattr/xxhash/zstd/lz4/openssl deshabilitados
'''
# de build() de Alpine (traducido; el lab provee $CBUILD/$CHOST — Etapa G Fase 3):
compile = '''
make
'''
# de package() de Alpine (traducido $pkgdir→/out):
install = '''
make DESTDIR="/out" install
'''
# ficheros de servicio de Alpine (rsyncd.initd/conf/confd/logrotate) omitidos: no viajan en el tarball

# depends de runtime de Alpine (NO build-deps): python3

[deps]
build = ["zlib", "linux-headers"]
