Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

182.3. lirc-0.10.2

Infrared remote control daemon, client library and tools — lircd, irexec, irw, liblirc_client and the Python bindings

Version 0.10.2, release 2
Shelf hardware — Device access, bus and sensor tools, power management, and Bluetooth
Phase 42_graphics (Graphics Stack), 127 of 189 in build order
Licence GPL-2.0-or-later AND MIT
Homepage https://www.lirc.org/
Build time 1.6 SBU
Installed size 3.7 MiB in 392 files
Recipe ports/core/hardware/lirc/kpkgbuild

About

LIRC decodes infrared remote controls. lircd reads a receiver through one of its driver plugins (the kernel’s rc-core devices through devinput, or USB, serial, FTDI, HID and audio-input receivers through their own), turns the pulses into button names using the remote’s lircd.conf, and serves them on the socket /run/lirc/lircd, which Kodi, VLC and every other liblirc_client program read. irexec runs commands on buttons, irw prints what arrives, and lircd-uinput turns buttons into ordinary input events. The port also installs the Python bindings. How the service starts is in Services.

Why it is in KDOS

The comment above it in script/phases/42_graphics/packages.d/hardware.txt:

Here and not in 41_system because its audio input reads portaudio, which links pipewire's libjack.

Sources

Dependencies

Depends on: pkgconf, python3, python3-setuptools, python3-yaml, libxslt, eudev, libusb, libusb-compat, libftdi, alsa-lib, portaudio.

Required by (4): audacious-plugins, kodi, rhythmbox, vlc.

Patches

build.sh applies these; kpkg applies nothing by itself.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/42_graphics/phase.env && kpkg install lirc'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/hardware/lirc.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/hardware/lirc
echo 'a44a26caf9ba55c2343e065f0a9451425c136572b279ea1e011ad012b36b607e  lirc-0.10.2.tar.gz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/lirc
SRC=$SRC_ROOT/lirc-0.10.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf lirc-0.10.2.tar.gz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

patch -p1 -i "$PORT_SRC/0001-lirc.org-Remove-non-free-advertising.patch"
patch -p1 -i "$PORT_SRC/0008-fix-event-time-on-32bit.patch"
patch -p1 -i "$PORT_SRC/0010-lirc-add-include-for-major.patch"
patch -p1 -i "$PORT_SRC/musl-gcc14.patch"
patch -p1 -i "$PORT_SRC/py3-keep-client-so.patch"

./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --runstatedir=/run \
	--libdir=/usr/lib --disable-static \
	--enable-devinput \
	--enable-uinput \
	--with-lockdir=/run/lock \
	--with-systemdsystemunitdir=no \
	--without-x
make
make DESTDIR=$PKG install
test -e "$PKG"/usr/lib/lirc/plugins/atilibusb.so

_site=$(python3 -c 'import sys, sysconfig; print(sysconfig.get_path("purelib", vars={"base": sys.argv[1]}))' "$PKG/usr")
install -m644 python-pkg/lirc/config.py -t "$_site/lirc"
PYTHONDONTWRITEBYTECODE=1 PYTHONPATH="$_site" LD_LIBRARY_PATH="$PKG/usr/lib" \
	python3 -c 'import lirc.client, lirc.config'
test -e "$_site/lirc/_client.so"

rm -rf "$PKG/lib/systemd" "$PKG/usr/lib/systemd" "$PKG/var/run"

install -d "$PKG/etc/init.d"
cat > "$PKG/etc/init.d/64_lircd.sh" <<'KDOS_SH'
#!/bin/bash
. /etc/init.d/service_helper

NAME="lircd"
DAEMON="/usr/sbin/lircd"

case "$1" in
    start)
        [ ! -x "$DAEMON" ] && { echo "[SKIP] $NAME: $DAEMON not found"; exit 0; }
        found=
        for d in /dev/lirc* /sys/class/rc/rc*; do
            [ -e "$d" ] && found=1
        done
        if [ -z "$found" ]; then
            echo "[SKIP] $NAME: no infrared receiver"
            exit 0
        fi
        install -d -m 755 /run/lirc
        echo "[KDOS] Starting $NAME..."
        supervise "$NAME" "$DAEMON" --nodaemon
        ;;
    stop)   stop_service "$NAME" ;;
    status) check_status "$NAME" ;;
    *)      echo "Usage: $0 {start|stop|status}"; exit 1 ;;
esac
KDOS_SH
chmod 755 "$PKG/etc/init.d/64_lircd.sh"

rm -rf "$PKG/usr/bin/lirc-setup" "$PKG"/usr/lib/python3*/site-packages/lirc-setup \
	"$PKG/usr/share/man/man1/lirc-setup.1"

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/lirc, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf lirc-0.10.2-2.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/lirc, and runs the triggers its paths call for.

Contents

Installed programs: ircat, irdb-get, irexec, irpipe, irpty, irrecord, irsend, irsimreceive, irsimsend, irtestcase, irtext2udp, irw, lirc-config-tool, lirc-data2table, lirc-init-db, lirc-lsplugins, lirc-lsremotes, lirc-make-devinput, lirc-postinstall, lircd, lircd-setup, lircd-uinput, lircmd, lircrcd, mode2, pronto2lirc.

Installed libraries: libirrecord.so, liblirc.so, liblirc_client.so, liblirc_driver.so.

Installed directories: /etc/lirc, /usr/include/lirc, /usr/lib/lirc, /usr/lib/python3.14/site-packages/lirc, /usr/share/doc/lirc, /usr/share/licenses/lirc, /usr/share/lirc, /var/lib/lirc.

Short descriptions

ircat print strings when pressing buttons
irdb-get list, search and download lirc configuration files.
irexec run programs with one button press
irpipe tool to send data to lircd over /dev/irpipe kernel device.
irpty Pseudo tty driver.
irrecord IR-codes recording tool for usage with LIRC
irsend basic LIRC program to send infra-red commands
irsimreceive Decode IR durations data.
irsimsend Send simulated IR data.
irtestcase Create or check decoding testcases.
irtext2udp Convert pulse/space text data to binary UDP driver format
irw Send data from Unix domain socket to stdout
lirc-config-tool tool to scan and generate lirc config files
lirc-lsplugins Print dynamic modules info
lirc-lsremotes parse lirc configuration files.
lirc-make-devinput create a devinput.lircd.conf for the local site.
lirc-postinstall lirc postinstall configuration
lircd Decode infrared signals and provide them on a socket.
lircd-setup Run setup commands in lirc_options.conf
lircd-uinput Forward lirc button presses as uinput events
lircmd Translate infrared signals into mouse events.
lircrcd Synchronize lircrc state among client applications.
mode2 Show kernel output available for LIRC drivers
pronto2lirc convert pronto-encoded data to lircd.conf format
lirc.pc LIRC Linux Infrared Control client libs.
lirc-driver.pc LIRC Linux Infrared Control userspace driver lib.

Notes

The receiver plugins for libusb, FTDI, ALSA and PortAudio devices are built only when configure finds their libraries, with no switch for any of them, so every library they need is in depends: the libusb plugins use the libusb-0.1 API of libusb-compat, and the FTDI one needs libftdi and libusb together. build.sh checks for atilibusb.so, one of the libusb plugins, after the install, so a build in which the probe failed stops there.

The Python package is lirc in site-packages, with the _client extension inside it. lirc/client.py imports lirc.config, the module that holds the configured paths (SYSCONFDIR, VARRUNDIR), but Makefile.am installs the generated config.py only into the copy of the package source under /usr/share/lirc/python-pkg, one directory above its package; build.sh installs it into site-packages/lirc as well. It then imports lirc.client and lirc.config from the package with LD_LIBRARY_PATH naming the package’s own liblirc_client, so a package in which the bindings cannot load stops the build, and checks that _client.so is still there afterwards: importing lirc runs paths.py, and the check proves that py3-keep-client-so.patch stopped it from deleting the extension.

configure installs systemd units whatever --with-systemdsystemunitdir says when the build host’s /proc/version names Ubuntu, and inside the chroot that file belongs to the host’s kernel; the recipe deletes lib/systemd and usr/lib/systemd from the package. The install also creates /var/run/lirc, a path through the /var/run link that a package cannot own; it is deleted, and 64_lircd.sh creates /run/lirc before it starts the daemon, since lircd does not create its socket directory itself.

/etc/init.d/64_lircd.sh starts lircd --nodaemon under the supervisor only when a receiver is present: a /dev/lirc* node or an rc-core device under /sys/class/rc. With neither, there is nothing to decode and it skips.

lirc-setup is deleted. It is a GTK 3 configuration wizard that downloads its list of remotes, and each remote’s configuration, from the lirc-remotes project on SourceForge, so offline it has no remote to offer; a remote’s lircd.conf is placed by hand under /etc/lirc/lircd.conf.d instead.