Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 38 additions & 2 deletions ci/ci-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ _classify_failure() {
}
trap _classify_failure EXIT

PDFIO_VER=1.6.4
LIBCUPSFILTERS_URL="${LIBCUPSFILTERS_URL:-https://github.com/OpenPrinting/libcupsfilters.git}"
LIBCUPSFILTERS_REF="${LIBCUPSFILTERS_REF:-master}"

Expand Down Expand Up @@ -112,6 +111,38 @@ build_autoconf() {
$SUDO ldconfig || true
}

prepare_libcupsfilters_source() {
cache_root="${RUNNER_TEMP:-${TMPDIR:-/tmp}}/libppd-libcupsfilters"
src="$cache_root/source"
if [ ! -d "$src/.git" ]; then
mkdir -p "$src"
git -C "$src" init -q
git -C "$src" remote add origin "$LIBCUPSFILTERS_URL"
git -C "$src" fetch -q --depth 1 origin "$LIBCUPSFILTERS_REF"
git -C "$src" checkout -q --detach FETCH_HEAD
printf '%s\n' "$LIBCUPSFILTERS_REF" > "$cache_root/requested-ref"
fi

[ "$(git -C "$src" remote get-url origin)" = "$LIBCUPSFILTERS_URL" ] || {
echo "ci-setup: cached libcupsfilters URL does not match" >&2; exit 2;
}
[ "$(cat "$cache_root/requested-ref")" = "$LIBCUPSFILTERS_REF" ] || {
echo "ci-setup: cached libcupsfilters ref does not match" >&2; exit 2;
}
printf '%s\n' "$src"
}

build_libcupsfilters() {
src="$(prepare_libcupsfilters_source)"
echo "ci-setup: building $LIBCUPSFILTERS_URL @ $(git -C "$src" rev-parse HEAD)"
( cd "$src"
[ -x ./configure ] || ./autogen.sh
./configure --prefix=/usr
make -j"$(nproc)"
$SUDO make install )
$SUDO ldconfig || true
}

cmd_cups() {
kind="$1"
case "$kind" in
Expand Down Expand Up @@ -141,6 +172,11 @@ cmd_cups() {
}

cmd_pdfio() {
libcupsfilters_src="$(prepare_libcupsfilters_source)"
# shellcheck disable=SC1091
. "$libcupsfilters_src/dependency-versions"
PDFIO_VER="$PDFIO_MIN_VERSION"
[ -n "$PDFIO_VER" ] || { echo "ci-setup: missing PDFIO_MIN_VERSION" >&2; exit 2; }
echo "ci-setup: building pdfio $PDFIO_VER"
src="$(mktemp -d)"
( cd "$src"
Expand All @@ -163,7 +199,7 @@ cmd_libcupsfilters() {
# Build libcupsfilters against the CUPS already installed above.
# Its configure auto-detects CUPS via pkg-config (cups3 / cups /
# cups-config), so the same source matches every CUPS release.
build_autoconf "$LIBCUPSFILTERS_URL" "$LIBCUPSFILTERS_REF" ""
build_libcupsfilters
;;
*)
echo "ci-setup: unknown libcupsfilters kind: $kind" >&2; exit 2 ;;
Expand Down
Loading