project, packaging: libevdev comes with Crafter.Graphics
Crafter.Graphics vendors libevdev since dfb70bc and links it statically: its gamepad backend compiles against its own copy, which comes first on the include path, and the executable needs no libevdev.so. The prefix build-libevdev.sh made, the include and library paths project.cpp added for libevdev and the executable's rpath into ~/.cache are left with nothing to do, so they go.
This commit is contained in:
parent
8e94af86b5
commit
b27200a3c5
3 changed files with 1 additions and 49 deletions
|
|
@ -34,7 +34,7 @@ and §7.9 (Messaging) and §8.1 (the frozen one).
|
||||||
| `tests/<Name>/main.cpp` | One test per directory, declared in `project.cpp`. |
|
| `tests/<Name>/main.cpp` | One test per directory, declared in `project.cpp`. |
|
||||||
| `utilities/` | `fake-imsd.py`: imsd's Messaging interface on the session bus, for benches. |
|
| `utilities/` | `fake-imsd.py`: imsd's Messaging interface on the session bus, for benches. |
|
||||||
| `assets/` | The bundled font (Noto Sans, OFL 1.1). |
|
| `assets/` | The bundled font (Noto Sans, OFL 1.1). |
|
||||||
| `packaging/` | `build-libevdev.sh` (libevdev into a prefix, for the Crafter.Graphics build), the desktop entry and the icon. |
|
| `packaging/` | The desktop entry and the icon. |
|
||||||
|
|
||||||
## 3. Building and testing
|
## 3. Building and testing
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
#!/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"
|
|
||||||
18
project.cpp
18
project.cpp
|
|
@ -176,24 +176,6 @@ extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> a
|
||||||
ApplyGioFlags(cfg, gio);
|
ApplyGioFlags(cfg, gio);
|
||||||
cfg.files.push_back("assets/NotoSans-Regular.ttf");
|
cfg.files.push_back("assets/NotoSans-Regular.ttf");
|
||||||
|
|
||||||
// libevdev, for Crafter.Graphics's gamepad backend: the crafter-build
|
|
||||||
// Flatpak's SDK has none, so a sysroot build looks for it in the
|
|
||||||
// sysroot and a native build in the prefix of
|
|
||||||
// packaging/build-libevdev.sh. Crafter.Graphics itself names
|
|
||||||
// the host's directory, which is an ignored, absent path in the sandbox.
|
|
||||||
if (!cfg.sysroot.empty()) {
|
|
||||||
graphics->compileFlags.push_back("-I=/usr/include/libevdev-1.0");
|
|
||||||
} else {
|
|
||||||
const std::string arch = cfg.target.substr(0, cfg.target.find('-'));
|
|
||||||
const char* env = std::getenv("IMSD_MESSAGES_LIBEVDEV");
|
|
||||||
const char* home = std::getenv("HOME");
|
|
||||||
const fs::path prefix = env ? fs::path(env) : fs::path(home ? home : ".") / ".cache" / "imsd-messages" / std::format("libevdev-{}", arch);
|
|
||||||
if (!fs::exists(prefix / "include" / "libevdev-1.0")) std::println(std::cerr, "imsd-messages: no libevdev at {} — run packaging/build-libevdev.sh first", prefix.string());
|
|
||||||
graphics->compileFlags.push_back(std::format("-I{}", (prefix / "include" / "libevdev-1.0").string()));
|
|
||||||
cfg.linkFlags.push_back(std::format("-L{}", (prefix / "lib").string()));
|
|
||||||
cfg.linkFlags.push_back(std::format("-Wl,-rpath,{}", (prefix / "lib").string()));
|
|
||||||
}
|
|
||||||
|
|
||||||
cfg.AddTest("Number").Dependencies({ Core.get() });
|
cfg.AddTest("Number").Dependencies({ Core.get() });
|
||||||
cfg.AddTest("Time").Dependencies({ Core.get() });
|
cfg.AddTest("Time").Dependencies({ Core.get() });
|
||||||
cfg.AddTest("Wrap").Dependencies({ Core.get() });
|
cfg.AddTest("Wrap").Dependencies({ Core.get() });
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue