|
root / base / xf86-input-keyboard / build.sh
build.sh Bash 68 lines 2.9 KB
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/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"