packaging: libevdev into a prefix for the Crafter.Graphics build

The crafter-build Flatpak's SDK ships no libevdev, headers or library,
and neither does the Freedesktop Platform, while Crafter.Graphics's
gamepad backend includes and links it. The script builds the release
tarball (checksum pinned) with the SDK's meson into a prefix.

Tested: run inside the sandbox on the workstation, the prefix holds
libevdev.so.2.3.0 and libevdev-1.0/libevdev/libevdev.h.
This commit is contained in:
Jorijn van der Graaf 2026-10-17 23:48:01 +02:00
commit 985519b970
Signed by: jorijnvdgraaf
GPG key ID: 2937E59CDCC1BCFB
2 changed files with 31 additions and 1 deletions

30
packaging/build-libevdev.sh Executable file
View file

@ -0,0 +1,30 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-3.0-only
# SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
# build-libevdev.sh — libevdev into a prefix, for Crafter.Graphics's gamepad
# backend. The crafter-build Flatpak's SDK ships no libevdev (headers or
# library) and neither does the Freedesktop Platform, so the library is
# built from source into a prefix.
#
# packaging/build-libevdev.sh [prefix] # default: ~/.cache/imsd-messages/libevdev-<arch>
#
# Runs inside the crafter-build sandbox (meson, ninja, python3 and a C
# compiler are the SDK's). Network: the release tarball from freedesktop.org.
set -eu
VERSION=1.13.4
# pinned at the first download (2026-10-17); a mismatch stops the build
SHA256=f00ab8d42ad8b905296fab67e13b871f1a424839331516642100f82ad88127cd
ARCH=$(uname -m)
PREFIX="${1:-$HOME/.cache/imsd-messages/libevdev-$ARCH}"
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT
echo ">> libevdev $VERSION into $PREFIX"
curl -fsSL -o "$work/libevdev.tar.xz" "https://www.freedesktop.org/software/libevdev/libevdev-$VERSION.tar.xz"
got=$(sha256sum "$work/libevdev.tar.xz" | cut -d' ' -f1)
[ "$got" = "$SHA256" ] || { echo "libevdev-$VERSION.tar.xz: sha256 $got, expected $SHA256" >&2; exit 1; }
tar -xJf "$work/libevdev.tar.xz" -C "$work"
cd "$work/libevdev-$VERSION"
meson setup build --prefix="$PREFIX" --libdir=lib -Dtests=disabled -Ddocumentation=disabled -Dcoverity=false >/dev/null
ninja -C build install >/dev/null
echo ">> done: $(ls "$PREFIX"/lib/libevdev.so*) ; headers in $PREFIX/include/libevdev-1.0"