: nply/foundationpkgs

commit d438eb6e56cdc27386c8be1c41fb9fcedad9a539
parent b9df9c400e23fa14665ca30ac22548c1fb455aba
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Thu, 29 Oct 2026 22:27:08 +0530

Add stage0 recipe for portable upstream abuild
3 files changed, 84 insertions(+), 0 deletions(-)
A
stage0/abuild/APKBUILD
|
43
+++++++++++++++++++++++++++++++++++++++++++
A
stage0/abuild/README.md
|
34
++++++++++++++++++++++++++++++++++
A
stage0/abuild/abuild-debian-shell.patch
|
7
+++++++
diff --git a/stage0/abuild/APKBUILD b/stage0/abuild/APKBUILD
@@ -0,0 +1,43 @@
+pkgname=abuild
+pkgver=3.18.0_rc5_git20260823
+pkgrel=0
+pkgdesc="Upstream Alpine packaging tools with a minimal Debian shell portability patch"
+url="https://gitlab.alpinelinux.org/alpine/abuild"
+arch="all"
+license="GPL-2.0-only"
+depends="apk-tools busybox fakeroot pax-utils libcap-utils openssl pkgconf bc binutils make
+	git patch curl tar gzip bzip2 xz zstd"
+makedepends="pkgconf openssl-dev zlib-dev scdoc"
+_commit=2770c8ec05ca2a5bbdaf74e340b9dba0257c1fd5
+source="https://github.com/alpinelinux/abuild/archive/$_commit.tar.gz
+	abuild-debian-shell.patch"
+sha256sums="
+dde9e38cd4d7074640cc362cd8fe5eeca72f4d4b9b6b657fb70d6f2cdb7d79c4  $_commit.tar.gz
+a0e3627d8b8075240446900325a4f7ec0056fbdd3b6a1070a8c7d0757bfe2be7  abuild-debian-shell.patch
+"
+builddir="$srcdir/$pkgname-$_commit"
+
+build() {
+	make
+	# The current foundationpkgs builder does not invoke check() itself.
+	if ! cross_compiling; then
+		check
+	fi
+}
+
+check() {
+	grep -q '^#!/bin/busybox ash$' abuild
+	ABUILD_SHAREDIR="$builddir" ABUILD_CONF=/dev/null ABUILD_USERCONF=/dev/null ./abuild -V
+}
+
+package() {
+	make DESTDIR="$pkgdir" install
+	# Bootstrap packaging must not introduce a setuid helper on Debian.
+	chmod 0755 "$pkgdir/usr/bin/abuild-sudo"
+	# Match upstream man-page policy without relying on builder-specific splits.
+	find "$pkgdir/usr/share/man" -type f -exec gzip -n -9 {} \;
+	# Debian keeps getcap outside a regular user's default PATH.
+	printf '\nexport PATH="$PATH:/usr/sbin:/sbin"\n' >>"$pkgdir/etc/abuild.conf"
+	mkdir -p "$pkgdir/usr/share/licenses/$pkgname"
+	install -m644 COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING"
+}
diff --git a/stage0/abuild/README.md b/stage0/abuild/README.md
@@ -0,0 +1,34 @@
+# abuild bootstrap recipe
+
+Pinned upstream abuild with the same minimal shell patch used by
+`~/Projects/bootstrap-binaries`: Debian's `/bin/busybox ash` replaces Alpine's
+`/bin/ash -e`, preserving `set -e`. There is no maintained abuild fork.
+
+Build on the Debian host after provisioning native `apk-tools`, BusyBox,
+fakeroot, scanelf, `bc`, getcap, OpenSSL/zlib development files, pkgconf, and scdoc:
+
+```sh
+scripts/build.sh stage0/abuild/APKBUILD
+```
+
+The existing foundationpkgs builder produces its usual tarball, not a `.deb` or
+APK. `stage0/` is not yet a default recipe-discovery bucket, so use the explicit
+path. This recipe does not change CI, discovery, or the output-format backend.
+The Debian bootstrap `.deb` files live in `bootstrap-binaries`.
+
+The recipe is also usable by real upstream abuild, with its normal package and
+index signing. When running on Debian, `abuild -d` leaves build dependencies to
+the host/toolchain. Real abuild's ELF dependency tracing expects a matching APK
+package database; a Debian dpkg database is not a substitute. Provision target
+libraries/database or explicitly manage tracing and runtime dependencies for
+your build. No toolchain or glibc-to-musl conversion is imposed here.
+
+Upstream installation is retained, including man pages (compressed here), but
+`abuild-sudo` is deliberately not setuid. The installed configuration adds the
+standard sbin directories to PATH so Debian's getcap is available.
+
+Verification on Debian 13 amd64: targeted foundationpkgs build passed. Native
+upstream abuild also constructed and signature-verified an abuild APK as a
+regular user, with an explicit **test-only `!tracedeps`** override because the
+Debian host has no target APK database. That checks packaging, not Alpine binary
+compatibility; the override is not baked into this recipe.
diff --git a/stage0/abuild/abuild-debian-shell.patch b/stage0/abuild/abuild-debian-shell.patch
@@ -0,0 +1,7 @@
+--- a/abuild.in
++++ b/abuild.in
+@@ -1,2 +1,3 @@
+-#!/bin/ash -e
++#!/bin/busybox ash
++set -e
+ # vim: set filetype=sh: