#!/bin/sh
# CI, in each distribution's image (.tangled/workflows/build*.yml).
# Ubuntu: build the release as it ships into /opt/cont8nuum
# (the container is thrown away) and, with the spindle's artifacts on,
# make its tarball, then the .deb packages (built again, for /usr);
# Debian: only the .deb packages.
# Fedora and openSUSE: the RPM packages. Packages are installed and
# checked here before they're kept.
# The tarball's own libraries are found by the rpath, not LD_LIBRARY_PATH:
# apps started from Start mustn't inherit them.
set -eu
if ! command -v dpkg-deb >/dev/null; then
if [ -z "${ARTIFACTS:-}" ]; then
./build.sh --prefix /usr --stage "$(mktemp -d)" --apps all
exit 0
fi
rpms=$(mktemp -d)
packaging/rpm/make-rpms.sh "$rpms"
packaging/rpm/test-rpms.sh "$rpms"
cp "$rpms"/*.rpm "$ARTIFACTS/"
exit 0
fi
# The tarball only where the image has wlroots in /usr/local (Ubuntu's),
# which it bundles; Debian's packages build their own
if pkg-config --exists wlroots-0.20; then
prefix=/opt/cont8nuum
mkdir -p "$prefix"
./build.sh --prefix "$prefix" --apps all \
"-Dc_link_args=-Wl,-rpath,$prefix/lib/$(cc -print-multiarch)"
[ -z "${ARTIFACTS:-}" ] || packaging/release/make-tarball.sh "$ARTIFACTS"
elif [ -z "${ARTIFACTS:-}" ]; then
echo "No wlroots 0.20 here: only packages, with artifacts on" >&2
exit 1
fi
if [ -n "${ARTIFACTS:-}" ]; then
debs=$(mktemp -d)
packaging/deb/make-debs.sh "$debs"
packaging/deb/test-debs.sh "$debs"
cp "$debs"/*.deb "$ARTIFACTS/"
fi