This commit is contained in:
2026-08-18 18:59:25 -04:00
parent e65dcbb790
commit 815160cfd7
17 changed files with 593 additions and 10 deletions
+74
View File
@@ -0,0 +1,74 @@
/*
* curl — the transfer tool (HTTP/HTTPS, ftp, ...).
*
* Optional deps are kappa FEATURES (Gentoo-USE-flag style): each maps to
* a curl --with-* configure flag carrying the resolved store path, and a
* feature-conditional dependency. Enable in the system config:
*
* packages { curl { features { zlib = true, brotli = true, ... } } }
*
* PKG_CONFIG_LIBDIR=/nonexistent makes pkg-config find nothing, so a
* feature only takes effect through its explicit flag — a dev host can
* never leak its own libraries into the store build. Static curl +
* static store openssl = zero runtime lib resolution.
*/
package "curl" {
const version = "8.21.0"
const source = "https://curl.se/download/curl-${version}.tar.gz"
sha256 = "d9b327997999045a24cda50f3983e69e51c516bd8be6ef9842fc7f99135e33bb"
license = "curl"
provides = ["curl"]
features {
zlib = { enabled = false, flag = "--with-zlib=$(cat zlib.path 2>/dev/null)" }
brotli = { enabled = false, flag = "--with-brotli=$(cat brotli.path 2>/dev/null)" }
zstd = { enabled = false, flag = "--with-zstd=$(cat zstd.path 2>/dev/null)" }
libidn2 = { enabled = false, flag = "--with-libidn2=$(cat idn2.path 2>/dev/null)" }
libpsl = { enabled = false, flag = "--with-libpsl=$(cat psl.path 2>/dev/null)" }
}
depends = [
{ name = "openssl" },
{ name = "ca-certificates" },
{ name = "zlib", feature = "zlib" },
{ name = "brotli", feature = "brotli" },
{ name = "zstd", feature = "zstd" },
{ name = "libidn2", feature = "libidn2" },
{ name = "libpsl", feature = "libpsl" },
{ name = "make" },
]
prepare {
curl -L -o curl-${version}.tar.gz ${source}
echo "d9b327997999045a24cda50f3983e69e51c516bd8be6ef9842fc7f99135e33bb curl-${version}.tar.gz" | sha256sum -c -
tar xf curl-${version}.tar.gz --strip-components=1
ROOT=$KAPPA_ROOT; [ -z $ROOT ] && ROOT=/usr/local/kappa; if [ -d $ROOT/temp/openssl/destdir/usr ]; then echo $ROOT/temp/openssl/destdir/usr; else echo $ROOT/bin/$(grep '^openssl ' $ROOT/db/installed | tail -1 | cut -d' ' -f3)/usr; fi > openssl.path
ROOT=$KAPPA_ROOT; [ -z $ROOT ] && ROOT=/usr/local/kappa; if [ ${feature.zlib} ]; then if [ -d $ROOT/temp/zlib/destdir/usr ]; then echo $ROOT/temp/zlib/destdir/usr; else echo $ROOT/bin/$(grep '^zlib ' $ROOT/db/installed | tail -1 | cut -d' ' -f3)/usr; fi > zlib.path; fi
ROOT=$KAPPA_ROOT; [ -z $ROOT ] && ROOT=/usr/local/kappa; if [ ${feature.brotli} ]; then if [ -d $ROOT/temp/brotli/destdir/usr ]; then echo $ROOT/temp/brotli/destdir/usr; else echo $ROOT/bin/$(grep '^brotli ' $ROOT/db/installed | tail -1 | cut -d' ' -f3)/usr; fi > brotli.path; fi
ROOT=$KAPPA_ROOT; [ -z $ROOT ] && ROOT=/usr/local/kappa; if [ ${feature.zstd} ]; then if [ -d $ROOT/temp/zstd/destdir/usr ]; then echo $ROOT/temp/zstd/destdir/usr; else echo $ROOT/bin/$(grep '^zstd ' $ROOT/db/installed | tail -1 | cut -d' ' -f3)/usr; fi > zstd.path; fi
ROOT=$KAPPA_ROOT; [ -z $ROOT ] && ROOT=/usr/local/kappa; if [ ${feature.libidn2} ]; then if [ -d $ROOT/temp/libidn2/destdir/usr ]; then echo $ROOT/temp/libidn2/destdir/usr; else echo $ROOT/bin/$(grep '^libidn2 ' $ROOT/db/installed | tail -1 | cut -d' ' -f3)/usr; fi > idn2.path; fi
ROOT=$KAPPA_ROOT; [ -z $ROOT ] && ROOT=/usr/local/kappa; if [ ${feature.libpsl} ]; then if [ -d $ROOT/temp/libpsl/destdir/usr ]; then echo $ROOT/temp/libpsl/destdir/usr; else echo $ROOT/bin/$(grep '^libpsl ' $ROOT/db/installed | tail -1 | cut -d' ' -f3)/usr; fi > psl.path; fi
// all enabled libs' -L dirs via a file (the .pc files lie about
// their location — configured /usr — so pkg-config -L misses the
// store and hits host libs; the explicit -L list fixes it).
echo -L$(cat openssl.path)/lib -L$(cat zlib.path 2>/dev/null)/lib -L$(cat brotli.path 2>/dev/null)/lib -L$(cat zstd.path 2>/dev/null)/lib -L$(cat idn2.path 2>/dev/null)/lib -L$(cat psl.path 2>/dev/null)/lib > ldflags.txt
echo -I$(cat openssl.path)/include -I$(cat zlib.path 2>/dev/null)/include -I$(cat brotli.path 2>/dev/null)/include -I$(cat zstd.path 2>/dev/null)/include -I$(cat idn2.path 2>/dev/null)/include -I$(cat psl.path 2>/dev/null)/include > cppflags.txt
}
build {
// The --without-* flags always sit in the line (curl's configure
// also header-detects, so pkg-config starvation alone is not
// enough); each feature flag is injected AFTER them, so the last
// --with-X=<store> wins when enabled.
// PKG_CONFIG_LIBDIR covers openssl + every enabled feature lib's
// pkgconfig dir (missing ones are empty entries, skipped by
// pkg-config) — curl's --with-X=PATH checks use pkg-config.
PKG_CONFIG_LIBDIR=$(cat openssl.path)/lib/pkgconfig:$(cat zlib.path 2>/dev/null)/lib/pkgconfig:$(cat brotli.path 2>/dev/null)/lib/pkgconfig:$(cat zstd.path 2>/dev/null)/lib/pkgconfig:$(cat idn2.path 2>/dev/null)/lib/pkgconfig:$(cat psl.path 2>/dev/null)/lib/pkgconfig CPPFLAGS=$(cat cppflags.txt) LDFLAGS=$(cat ldflags.txt) LIBS=-lcrypto ./configure --prefix=${prefix} --disable-shared --enable-static --with-openssl=$(cat openssl.path) --without-zlib --without-brotli --without-zstd --without-libidn2 --without-libpsl --without-nghttp2 --without-nghttp3 --without-ngtcp2 --without-quiche --without-libuv --disable-ldap --disable-ldaps ${feature.zlib} ${feature.brotli} ${feature.zstd} ${feature.libidn2} ${feature.libpsl} --with-ca-bundle=/etc/ssl/certs/ca-certificates.crt
make -j${jobs}
}
install {
make DESTDIR=${destdir} install
}
}