#!/bin/sh # Build script for xf86-input-keyboard (autotools, Template A). # # Phase 2 Task 4 (M3). Ships a pre-generated `configure` (standard fd.o # release tarball, unlike xf86-video-illumosfb's git-commit-archive), so no # autogen.sh/autoreconf step is needed - straight Template A. # # Patches (patches/, applied below): # 01-sun-kbd-headers.patch - add sys/param.h, unistd.h, stropts.h includes # to src/sun_kbd.c (missing-header compile fix # on GCC 14 / illumos headers). Equivalent of # OI's 01-sun-kbd.patch. # # Module install dir: like xf86-video-illumosfb, this driver's configure.ac # computes inputdir=${moduledir}/input, and moduledir defaults from # --with-xorg-module-dir. The XLibre Xorg server (base/xlibre-xserver-xorg) # advertises input_drivers_dir=${exec_prefix}/lib/xorg/modules/xlibre-25/drivers/input # in its xorg-server.pc, so pass # --with-xorg-module-dir="$PREFIX/lib/xorg/modules/xlibre-25/drivers" # (NOT ".../xlibre-25" as the video driver used - video's own Makefile.am # appends "/drivers" itself, whereas ours appends "/input" directly) so the # built .../input subdir lines up with where Xorg actually looks. set -e # Resolve the port dir (holds patches/) BEFORE cd'ing into the extracted source. PORTDIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) cd "$SRCDIR" # --- Hammerhead/illumos portability patches --- for p in "$PORTDIR"/patches/*.patch; do [ -f "$p" ] || continue echo "==> Applying patch: $(basename "$p")" patch -p1 < "$p" done export PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig:$PREFIX/share/pkgconfig:$PKG_CONFIG_PATH" export CFLAGS="${CFLAGS} -I$PREFIX/include -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS" export LDFLAGS="${LDFLAGS} -L$PREFIX/lib -R$PREFIX/lib" # MANDATORY libtool fix (Template A) - piggyback hammerhead onto the # kopensolaris arm in configure's dynamic-linker case block. if [ -f configure ]; then sed -i -E 's/(kopensolaris\*-gnu)([^)]*\))/\1 | hammerhead*\2/' configure fi # OS-detection fix: sun_kbd.c (the VUID /dev/kbd backend) is only selected # when configure's `case $host_os in ... solaris*) IS_SOLARIS="yes" ;;` # matches - our host_os is "hammerhead", not "solaris*", so the generated # configure's unmatched `*)` arm hard-errors with "Your operating system is # not supported by the kbd driver." Piggyback hammerhead* onto the solaris* # arm (same VUID/STREAMS ioctl convention) in the *generated* configure # (this tarball ships one; there is no configure.ac regen step here). if [ -f configure ]; then sed -i -E 's/^ solaris\*\)$/ solaris* | hammerhead*)/' configure fi ./configure \ --prefix="$PREFIX" \ --build="$BUILD_TRIPLE" \ --host="$BUILD_TRIPLE" \ --sysconfdir="$SYSCONFDIR" \ --disable-static \ --with-xorg-module-dir="$PREFIX/lib/xorg/modules/xlibre-25/drivers" gmake -j${JOBS:-1} gmake install DESTDIR="$PKGDIR" # xf86-input-keyboard - X.Org keyboard input driver # # Phase 2 Task 4 (M3): the VUID /dev/kbd STREAMS backend (src/sun_kbd.c) is # already upstream (uses sys/vuid_event.h, sys/kbd.h). One local patch adds # a few missing header includes needed to compile against GCC 14 / illumos # headers (see patches/01-sun-kbd-headers.patch). [package] name = "xf86-input-keyboard" version = "1.9.0" release = 1 description = "X.Org keyboard input driver (illumos /dev/kbd VUID backend)" url = "https://gitlab.freedesktop.org/xorg/driver/xf86-input-keyboard" license = "MIT" maintainer = "Chris Tusa " arch = "x86_64" [dependencies] runtime = ["xlibre-xserver-xorg"] build = ["xlibre-xserver-xorg", "util-macros"] [[source]] file = "xf86-input-keyboard-1.9.0.tar.gz" urls = ["https://www.x.org/archive/individual/driver/xf86-input-keyboard-1.9.0.tar.gz"] checksum = "407cf742246708843126617feee85b30a8b7b7567b3bc507a6cfda7443a8d9ac" extract = true [build] parallel = true --- a/src/sun_kbd.c 2026-07-23 13:55:22.652012681 -0500 +++ b/src/sun_kbd.c 2026-07-23 13:59:47.345032786 -0500 @@ -56,9 +56,21 @@ #include "xf86OSKbd.h" #include "sun_kbd.h" -#include +/* OI fix (missing-header build failure on illumos/GCC 14): pull in + * sys/param.h, unistd.h, stropts.h explicitly - sun_kbd.c uses + * usleep()/ioctl() and STREAMS ioctl constants (I_PUSH/I_POP/I_FIND) + * that are not reliably pulled in transitively on this toolchain. + * sys/kbio.h is ALSO required (not just sys/kbd.h): Hammerhead's + * does not transitively include it, and it is the header + * that actually defines the KIOC* keyboard ioctl constants + * (KIOCSLED/KIOCGLED/KIOCTYPE/KIOCLAYOUT/KIOCGDIRECT/KIOCSDIRECT/ + * KIOCCMD/KIOCMKTONE/...) this driver uses throughout. */ +#include +#include +#include #include #include +#include #include /* needed before including older versions of hid.h */ #include