# About this chapter

This chapter describes how to build and install LIRC. Note that LIRC is packaged for all major linux distributions. If you just want to use lirc, you should be able to install it like any other package. This way, you don't have to look at the dependencies, build and installation description found here.

The ./configure script is the ultimate source as to what libraries and tools LIRC requires. The list here is not complete in any way, being focused on things to install before building.

# Dependencies

Mandatory dependencies

There are a few mandatory dependencies, all of which packaged on most (all?) Linux distributions.

- Building directly from the git source tree requires autoconf,automake and libtool.
- Compilation and linking requires the GNU toolchain including make, gcc, g++ and ld.
- python3
- Building requires pkg-config.
- xsltproc

Optional dependencies

If these are missing, ./configure can cope with it and still build LIRC in a more or less limited way.

- On linux building requires modinfo, often in the package kmod. Without modinfo, all kernel drivers are excluded from the build.
- On Linux building requires kernel headers, often in the kernel-headers package. Building without these is possible, but strongly discouraged (on linux).
- Several scripts need the python3 PyYaml at http://pyyaml.org/wiki/PyYAML. Some distributions includes a python3-yaml package. There is also a pypi package at https://pypi.python.org/pypi/PyYAML. Building without this is possible but not recommended.
- Generating the HTML manpages requires man2html.
- Generating the API documentation requires Doxygen.
- The Python bindings needs python 3.5+ to enable all functionality. Other python3 version should work, but will limit the python bindings API.
- The lirc-setup GUI configuration tool needs python3-gi and thus also the Gtk libs and icons. These are not required for the build, though.
- Building the X11 GUI tools like irxevent and xmode2 requires the X11 header files.
- The audio drivers needs the alsa and portaudio libs (libraries and headers).
- The ftdi and ftdix drivers require libftdi from http://www.intra2net.com/de/produkte/opensource/ftdi/

# Kernel

As of 0.9.0+, lirc uses the kernel modules from the kernel. Some of these are formerly lirc modules which are now part of the kernel. Thus, building lirc does not involve building any kernel modules (as it used to).

Some of the former lirc modules are part of the official kernel and should be available on any reasonably updated system. However, some are in the staging area; if they are part of your kernel depends on the distro you use (unless of course if you compile your own kernel).

There are example and test kernel modules in the drivers/ directory. None of these are required for regular LIRC use, but they are supposed to be helpful while testing or writing drivers.

# Compile and Install

Since 0.9.1+ , lirc loads drivers dynamically. This means that that the build system is redesigned to always build all drivers. The former setup.sh script is dropped in favor of a standard ./configure, make, make install sequence.

When building directly from git, a first required step to create ./configure and some other files is

               ./autogen.sh

Whether using git sources or just using a distributed tarball, the next steps are the canonical

                ./configure
                make
                sudo make install

Notes:

- When running the configure script, please pay attention at its output. Specifically, at the very end it prints a list of the enabled functionality.
- Running configure without options will install lirc in /usr/local according to GNU standards. However, many examples in this manual as well as other documentation are assuming that ./configure ran with the --prefix=/usr option, installing in /etc/lirc, /usr/bin etc.
- When cross-compiling, the configure script cannot use the defaults determined from the build host. Hence, cross-compiling requires a close look to the ./configure --help output which have some hints for this.
- The build system supports VPATH builds which does not clutter the source tree. To use this do something like:

                  mkdir _build; cd _build;
                  ../configure
                  make
                  sudo make install

# Checking the build

Since the dynamic drivers are not linked during the build, it's recommended to check that the expected drivers are built and can be loaded using

                 cd tools; ./lirc-lsplugins -U ../plugins/.libs

Is some cases, lirc-lsplugins will crash on missing libraries e. g., liblirc.so.0. If so, you need to add the path where lirc installs it's libraries (by default, /usr/local/lib) to the runtime linker path. Refer to generic ld.so(1) documentation.

With working paths lirc-lsplugins will create a list of all drivers available, and also possible link errors not revealed during the build. lirc-lsplugins has a -h option providing help, and nroff -man ../doc/man/lirc-lsplugins.1 | more provides more complete info.

The test/ directory contains some (but too few) unit tests. Compiling these requires the cppunit library from https://www.freedesktop.org/wiki/Software/cppunit. cppunit is packaged in most linux distribtutions. With this in place, do:

             $ cd test
             $ make
             $ ./run-tests

From 0.10.0, the python-pkg has some traditional unittests. These tests requires the socat and expect packages, both of which packaged for major linux distributions. The python version needs to be 3.5+. To invoke:

              $ cd python-pkg/tests
              $ python3 -m unittest discover

# Configuration

Formerly, lirc was configured during build where the setup.sh script was used to select driver, configuration file, etc. Also, there was little support for starting and running the services from boot. From 0.9.1+ the configuration is instead done after the build. The configuration steps for the main lircd program involves:

- In some cases e. g., serial devices setting up kernel module options in /etc/modprobe.d or using udev rules.
- Selecting the driver and kernel device for your capture device.
- Selecting configuration file for your remote.
- Configuring and using systemd to run the services.
- Creating lircrc files for your applications.

This is described in the configuration guide.

# Uninstall

- Remove the installed artifacts:
  make uninstall
- Remove the config files, if you don't need them anymore:
  rm -rf /etc/lirc/
  rm -f ~/.config/lircrc
  You might also want to check /etc/modprobe.d for left-overs.

# Updating from older versions

The NEWS file describes the changes since last version. Normally, upgrading from a previous version should not be too painful. However, if you have to update a really old version it's probably better to make a fresh install.