Files
unraid-podman/packages/crun/crun.SlackBuild
T
maggesandClaude Sonnet 5 c3b8ae8ed9
Build Packages / Build .txz packages (push) Failing after 7m21s
Lint / ShellCheck (push) Successful in 10s
Lint / Validate .plg XML (push) Successful in 9s
Lint / EditorConfig (push) Successful in 5s
Fix CI: json-c for crun, and fetch crun's git submodules as pinned tarballs
Verified end-to-end with a full local build of all 8 packages on the
actual runner host (docker exec against vbatts/slackware:15.0, bind-
mounted repo on the cache pool) instead of round-tripping through
Gitea Actions for each fix — much faster for a chain of issues this
deep. All 8 packages now build successfully from a clean checkout.

Three fixes, all in crun (the last package still failing):

1. "Package requirements (json-c >= 0.14) were not met" — added
   json-c to the toolchain bootstrap.

2. crun depends on the libocispec git submodule, which in turn depends
   on the image-spec and runtime-spec git submodules. GitHub's source
   archive tarball never includes submodule content (no .git directory
   for `git submodule update` to work against — the existing `|| true`
   masked this failing silently). Fetched all three as their own
   pinned tarballs instead, at the exact commits crun 1.28 references
   (cross-checked via the GitHub contents API), matching how every
   other dependency in this project is already pinned.

3. crun.c unconditionally #includes git-version.h, which crun's own
   Makefile only generates via `git describe` (again, no .git) or from
   a pre-existing .tarball-git-version.h — the file crun's own `make
   dist` would have written, which we never run. Write that file
   ourselves in the exact format the Makefile already expects; this is
   the documented fallback path bundled release tarballs rely on, not
   a workaround around it.

Also includes the podman go-md2man pre-seed fix and setup-slackware-
buildenv.sh python3 addition from the previous commit's follow-up
testing (both already verified working in this same local build run).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-11 22:17:02 +00:00

88 lines
3.7 KiB
Bash
Executable File

#!/bin/bash
# =============================================================================
# packages/crun/crun.SlackBuild
#
# Builds the crun .txz package from upstream source (C, autotools). crun is
# the OCI runtime this project uses (preferred over runc — lighter, cgroup
# v2-friendly, see docs/ARCHITECTURE.md section 5.1).
#
# Requires (in the build environment): gcc, make, autoconf, automake,
# libtool, pkg-config, libcap-dev, libseccomp-dev, libyajl-dev, python3
# (used by crun's build-time code generator).
# =============================================================================
set -eu
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
# shellcheck source=/dev/null
. "$REPO_ROOT/scripts/lib/slackbuild-common.sh"
# shellcheck source=/dev/null
. "$REPO_ROOT/versions.env"
VERSION="$CRUN_VERSION"
ARCH="$PKG_ARCH"
BUILD="$PKG_BUILD"
TAG="$PKG_TAG"
sb_init "crun"
tarball=$(sb_fetch_and_verify "$CRUN_SRC_URL" "$CRUN_SRC_SHA256" "crun-$VERSION.tar.gz")
srcdir=$(sb_extract "$tarball")
for patch in "$CWD"/patches/*.patch; do
[ -e "$patch" ] || continue
echo "==> [crun] applying $(basename "$patch")"
patch -d "$srcdir" -p1 < "$patch"
done
cd "$srcdir"
# GitHub's source archive has no .git directory, so `git submodule
# update` can never work against it (it needs an actual git repo to
# resolve against) — it silently fails and leaves libocispec/ empty,
# which only surfaces much later as a confusing "No rule to make target
# 'all'" in that subdirectory. Fetch libocispec as its own pinned source
# instead, matching every other dependency in this project, and unpack it
# directly over the empty submodule directory.
echo "==> [crun] fetching libocispec (git submodule, pinned separately — see versions.env)"
libocispec_tarball=$(sb_fetch_and_verify "$LIBOCISPEC_SRC_URL" "$LIBOCISPEC_SRC_SHA256" "libocispec-$LIBOCISPEC_COMMIT.tar.gz")
rm -rf "$srcdir/libocispec"
mkdir -p "$srcdir/libocispec"
tar -xf "$libocispec_tarball" -C "$srcdir/libocispec" --strip-components=1
# libocispec has its own two git submodules (image-spec, runtime-spec) —
# same problem, one level deeper. Same fix, same reasoning.
echo "==> [crun] fetching libocispec's image-spec/runtime-spec submodules"
imagespec_tarball=$(sb_fetch_and_verify "$IMAGE_SPEC_SRC_URL" "$IMAGE_SPEC_SRC_SHA256" "image-spec-$IMAGE_SPEC_COMMIT.tar.gz")
rm -rf "$srcdir/libocispec/image-spec"
mkdir -p "$srcdir/libocispec/image-spec"
tar -xf "$imagespec_tarball" -C "$srcdir/libocispec/image-spec" --strip-components=1
runtimespec_tarball=$(sb_fetch_and_verify "$RUNTIME_SPEC_SRC_URL" "$RUNTIME_SPEC_SRC_SHA256" "runtime-spec-$RUNTIME_SPEC_COMMIT.tar.gz")
rm -rf "$srcdir/libocispec/runtime-spec"
mkdir -p "$srcdir/libocispec/runtime-spec"
tar -xf "$runtimespec_tarball" -C "$srcdir/libocispec/runtime-spec" --strip-components=1
# crun.c unconditionally #includes git-version.h. Its own Makefile only
# generates that file from `git describe` (needs .git, which a plain
# tarball checkout never has) or, failing that, from a pre-existing
# .tarball-git-version.h — the file crun's own `make dist` would have
# written. We're not running `make dist`, so write it ourselves in the
# exact format that Makefile target expects; this is the documented
# fallback path, not a workaround around it.
printf '/* autogenerated. */\n#ifndef GIT_VERSION\n# define GIT_VERSION "%s"\n#endif\n' "$VERSION" \
> .tarball-git-version.h
echo "==> [crun] autogen + configure"
./autogen.sh
./configure --prefix=/usr --disable-systemd
echo "==> [crun] make"
make
echo "==> [crun] make install into \$PKG"
make install DESTDIR="$PKG"
sb_install_docs "$srcdir/COPYING" "$srcdir/README.md"
sb_make_package "$VERSION" "$ARCH" "$BUILD" "$TAG"