summaryrefslogtreecommitdiff
path: root/doc/building.dox
blob: 0ca1bb71bbd58e22d5ccb985bdd1aca74fb01b8b (plain)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
/**
@page building_libinput libinput build instructions

@tableofcontents

Instructions on how to build libinput and its tools and how to build against
libinput.

The build instruction on this page detail how to overwrite your
system-provided libinput with one from the git repository, see
see @ref reverting_install to revert to the previous state.

@section building Building libinput

libinput uses [meson](https://www.mesonbuild.com) and
[ninja](https://www.ninja-build.org). A build is usually the three-step
process below.  A successful build requires the @ref
building_dependencies to be installed before running meson.

@code
$> git clone git://anongit.freedesktop.org/git/wayland/libinput
$> cd libinput
$> meson --prefix=/usr builddir/
$> ninja -C builddir/
$> sudo ninja -C builddir/ install
$> sudo udevadm hwdb --update
@endcode

The ```prefix``` option or other options can be changed later with the
```mesonconf``` command.

@code
$> mesonconf builddir/ -Dprefix=/some/other/prefix
$> ninja -C builddir
$> sudo ninja -C builddir/ install
@endcode

@note On Fedora, you may need to use ```ninja-build``` instead of
```ninja```. See [this bug](https://bugzilla.redhat.com/show_bug.cgi?id=1166135)

@subsection building_autotools Building with automake

libinput currently also provides the autotools build system, but this will
be removed in future libinput versions. A build with automake is usually the
three-step process below. A successful build requires the @ref
building_dependencies to be installed at configure time.

@code
$> git clone git://anongit.freedesktop.org/git/wayland/libinput
$> cd libinput
$> ./autogen.sh --prefix=/usr --libdir=/usr/lib64
$> make
$> sudo make install
$> sudo udevadm hwdb --update
@endcode

@note On Debian-based distributions including Ubuntu and its derivatives skip the
```--libdir=/usr/lib64``` argument.

@subsection verifying_install Verifying the install

To verify the install worked correctly, check that libinput.so.x.x.x is in
the library path and that all symlinks point to the new library.
<pre>
$> ls -l /usr/lib64/libinput.*
-rwxr-xr-x 1 root root    946 Apr 28  2015 /usr/lib64/libinput.la
lrwxrwxrwx 1 root root     19 Feb  1 15:12 /usr/lib64/libinput.so -> libinput.so.10.11.2
lrwxrwxrwx 1 root root     19 Feb  1 15:12 /usr/lib64/libinput.so.10 -> libinput.so.10.11.2
-rwxr-xr-x 1 root root 204992 Feb  1 15:12 /usr/lib64/libinput.so.10.11.2
</pre>

The .so installed from git master may have a lower number than the
system-provided one. In that case, manually adjust the symlinks to point to
the newly installed .so.x.x.x

@subsection reverting_install Reverting to the system-provided libinput packge

The recommended way to revert to the system install is to use the package
manager to reinstall the libinput package. In some cases, this may leave
files in the system (e.g. ```/usr/lib/libinput.la```) but these files are
usually harmless. To definitely remove all files, run the following command
from the libinput source directory:

@code
$> sudo ninja -C builddir/ uninstall
@endcode

or when using autotools:

@code
$> sudo make uninstall
# WARNING: Do not restart the computer/X/the Wayland compositor after make
# uninstall, reinstall the system package immediately!
@endcode

The following commands reinstall the current system package for libinput,
overwriting manually installed files.

<ul>
<li><b>Debian/Ubuntu</b> based distributions: ```sudo apt-get install
--reinstall libinput```</li>
<li><b>Fedora 22</b> and later: ```sudo dnf reinstall libinput```</li>
<li><b>RHEL/CentOS/Fedora 21</b> and earlier: ```sudo yum reinstall libinput```</li>
<li><b>openSUSE</b>: ```sudo zypper install --force libinput10```</li>
<li><b>Arch</b>: ```sudo packman -S libinput```</li>
</ul>

@subsection building_dependencies Build dependencies

libinput has a few build-time dependencies that must be installed prior to
running configure. In most cases, it is sufficient to install the
dependencies that your distribution uses to build the libinput package.
These can be installed with one of the following commands:

<ul>
<li><b>Debian/Ubuntu</b> based distributions: ```sudo apt-get build-dep
libinput```</li>
<li><b>Fedora 22</b> and later: ```sudo dnf builddep libinput```</li>
<li><b>RHEL/CentOS/Fedora 21</b> and earlier: ```sudo yum-builddep libinput```</li>
<li><b>openSUSE</b>:
<pre>
$> sudo zypper modifyrepo --enable `zypper repos | grep source | awk '{print $5}'`
$> sudo zypper source-install -d libinput10
$> sudo zypper install autoconf automake libtool
$> sudo zypper modifyrepo --disable `zypper repos | grep source | awk '{print $5}'`
</pre>
</li>
<li><b>Arch</b>:
<pre>
$> abs extra/libinput
$> cd $(mktemp -d)
$> cp /var/abs/extra/libinput/PKGBUILD .
$> makepkg --syncdeps --nobuild
</pre>
</li>
</ul>

If dependencies are missing, a message ```No package 'foo' found``` will be
shown during the configure stage. See
<a href="https://who-t.blogspot.com.au/2014/05/configure-fails-with-no-package-foo.html">this blog post here</a>.
for instructions on how to fix it.

@subsection building_libwacom Building without libwacom

libwacom is required by libinput's tablet code to gather additional
information about tablets that is not available from the kernel device
itself. libwacom is required by default but can be skipped when @ref
building.

@code
$> meson --prefix=/usr -Dlibwacom=false builddir
@endcode

or when building with autotools:

@code
$> ./autogen.sh --disable-libwacom --prefix=/usr --libdir=/usr/lib64
@endcode

It is not recommended to disable libwacom unless libinput is used in an
environment where tablet support is not required. libinput provides tablet
support even without libwacom, but some features may be missing or working
differently.

@subsection buildling_debug-gui Building without the graphical helper tool

The @ref tools provide commandline features as well as graphical debugging
features. To keep dependencies in check on some builds, the graphical
features of the @ref tools can be disabled. By default, the `debug-gui`
feature of the `libinput` tool is enabled and if the required libraries are
not available, the build will fail. If the feature is not required, use the
``--disable-debug-gui`` argument when @ref building.

@code
$> meson --prefix=/usr -Ddebug-gui=false builddir
@endcode

or when building with autotools:

@code
$> ./autogen.sh --disable-debug-gui --prefix=/usr --libdir=/usr/lib64
@endcode

@section building_against Building against libinput

libinput provides a
[pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/) file.
Software that uses libinput should use pkg-config and the
`PKG_CHECK_MODULES` autoconf macro.
Otherwise, the most rudimentary way to compile and link a program against
libinput is:

@code
    gcc -o myprogram myprogram.c `pkg-config --cflags --libs libinput`
@endcode

For further information on using pkgconfig see the pkg-config documentation.

*/