summaryrefslogtreecommitdiff
path: root/building.html
blob: 22838ddb9481b87d49f4b45776d932ed4229324d (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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<link href="wayland.css" rel="stylesheet" type="text/css">
<title>Building Weston</title>
</head>

<body>
<h1><a href="index.html"><img src="wayland.png" alt="Wayland logo"></a></h1>

<h2>Building Weston</h2>

<p>
Most major Linux distributions now include releases of Wayland and
Weston in their package management systems.  There are also automatic
build systems that package even more recent Wayland/Weston packages for
particular distros, such as the
<a href="https://launchpad.net/~wayland.admin/+archive/ubuntu/daily-builds">Wayland Daily Builds PPA for Ubuntu</a>.
</p>

<p>
If you want an even current build, you can use
our <a href="https://github.com/bryceharrington/wayland-build-tools/">wayland-build-tools</a>
scripts to check out and build all the git trees for your local system.
</p>

<p>
If those options don't suit your needs, you can also manually build the
stack yourself.  The directions below are provided as a guide, but will
need adapted for the Linux system you're using.  The instructions below
assume some familiarity with
<a href="http://git-scm.com/">git</a>,
<a href="http://www.freedesktop.org/wiki/Software/pkg-config/">pkg-config</a>,
<a href="http://www.gnu.org/software/autoconf/">autoconf</a>, and
building and running experimental software.</p>

<p>Some help for figuring out how to fix dependency problems:
<a href="http://who-t.blogspot.com.au/2014/05/configure-fails-with-no-package-foo.html">Configure
fails with "No package 'foo' found" - and how to fix it</a>.</p>

<h2>System-specific Directions</h2>

<p>This page has the generic instructions on building Wayland and Weston
from git. There are also some guides specific to certain distribution
or hardware:</p>

<ul>

<li><a href="ubuntu16.04.html">Building Weston and XWayland on
Ubuntu 16.04</a>. May be useful for any Debian-derived system.</li>

<li><a href="mint17.html">Building Weston and XWayland on
Linux Mint 17</a>, which is derived from Ubuntu 14.04.</li>

<li><a href="ubuntu12.04.html">Building Weston and XWayland on
Ubuntu 12.04</a>. May be useful for any Debian-derived system.</li>

<li>For building Weston for <a href="http://www.raspberrypi.org/">Raspberry
Pi</a>, follow the normal build guide after checking out the
<a href="https://dri.freedesktop.org/wiki/VC4/">FOSS drivers</a>, and use
the DRM-backend.</li>

<li>For building Wayland on Arch note that <a href="https://wiki.archlinux.org/index.php/Docbook#Setting_up_Docbook_in_Arch">DocBook dependencies</a> will be needed when building documentation.</li>

</ul>

<h2>Hardware / Drivers</h2>

<p>X output requires <a href="http://dri.freedesktop.org/wiki/">DRI2</a>.
Output outside of X requres <a href="http://dri.freedesktop.org/wiki/DRM/">DRM</a> and <a href="https://wiki.archlinux.org/index.php/kernel_mode_setting">Kernel Mode
Setting (KMS)</a> with the page flip ioctl.  These are supported by:</p>

<p><b>Intel</b>: i915 (June 2004) or newer cards.  DRM support has been
in the kernel since around 2.6.29.  Sandy Bridge chips require kernel
2.6.37.</p>

<p><b>AMD/ATI</b>: Requires open source driver (radeon/ati,
not fglrx/catalyst).  DRM output requires kernel version 2.6.38.
Cards probably work back to Radeon 7200 (2000).</p>

<p><b>nVidia</b>: Requires Nouveau (open source driver).  DRM output
<a href="https://bugs.freedesktop.org/show_bug.cgi?id=55596">requires
kernel version 3.7-rc3</a>.  DRM output previously required kernel
version 2.6.37 for nv40 or lower cards, 2.6.38 for nv50 cards. Some new
cards require
<a href="http://nouveau.freedesktop.org/wiki/InstallDRM#Firmware">loading
external firmware</a>.</p>

<h2 id="environment">Setting up the environment</h2>
<h3>Installing in a custom location</h3>
<p>If you do not want to install system wide, you'll need to set
the following environment variables to get various libraries to link
appropriately:</p>

<pre>
export WLD=$HOME/install   <span class="comment"># change this to another location if you prefer</span>
export LD_LIBRARY_PATH=$WLD/lib
export PKG_CONFIG_PATH=$WLD/lib/pkgconfig/:$WLD/share/pkgconfig/
export PATH=$WLD/bin:$PATH
export ACLOCAL_PATH=$WLD/share/aclocal
export ACLOCAL="aclocal -I $ACLOCAL_PATH"

mkdir -p $WLD/share/aclocal <span class="comment"># needed by autotools</span>
</pre>

<p>Do not set LD_LIBRARY_PATH as your default, it will break things.</p>
<p>You may put the above in a script and source it in the terminal
you wish to build the packages.</p>

<h3>Installing system wide</h3>

<p>To install system wide, you'll need to set WLD differently, add
some switches to every autogen.sh invocation, and use sudo to make
install. Choose the libdir as appropriate for your distribution and
architecture (it may be <code>/usr/lib32</code> or <code>/usr/lib64</code>).</p>

<pre>
export WLD=/usr
...
./autogen.sh --prefix=$WLD --libdir=/usr/lib --sysconfdir=/etc
make
sudo make install
...
</pre>

<h2>Wayland libraries</h2>

<p>This is required in order to be able to build Mesa with the Wayland EGL platform.</p>

<pre>
$ git clone <a href="http://cgit.freedesktop.org/wayland/wayland">git://anongit.freedesktop.org/wayland/wayland</a>
$ cd wayland
$ ./autogen.sh --prefix=$WLD
$ make &amp;&amp; make install
$ cd ..
</pre>

<ul>
<li>You can avoid the <a href="http://www.stack.nl/~dimitri/doxygen/">Doxygen</a> dependency
with <code>--disable-documentation</code>.</li>

<li>Under Arch Linux,  <a href="https://wiki.archlinux.org/index.php/Docbook#Setting_up_Docbook_in_Arch">DocBook dependencies</a> will be needed when building documentation. These include <code>docbook-xml</code> and <code>docbook-xsl</code>.</li>

</ul>

<h2>Wayland protocols</h2>

<p>This contains a set of protocols that add functionality not available in the Wayland core protocol.</p>

<pre>
$ git clone <a href="http://cgit.freedesktop.org/wayland/wayland-protocols">git://anongit.freedesktop.org/wayland/wayland-protocols</a>
$ cd wayland-protocols
$ ./autogen.sh --prefix=$WLD
$ make install
$ cd ..
</pre>

<h2>Mesa</h2>

<p>Wayland uses the <a href="http://www.mesa3d.org/egl.html">Mesa
EGL</a> stack, and all extensions required to run EGL on KMS are now
upstream.  Wayland should work with any mesa release after 9.0, but in
some cases extra functionality or optimization will only be available in
more recent releases.</p>

<pre>
$ git clone <a href="http://cgit.freedesktop.org/mesa/mesa">git://anongit.freedesktop.org/mesa/mesa</a>
$ cd mesa
$ ./autogen.sh --prefix=$WLD --enable-gles2 \
  --with-egl-platforms=x11,wayland,drm --enable-gbm --enable-shared-glapi \
  --with-gallium-drivers=r300,r600,swrast,nouveau
$ make &amp;&amp; make install
$ cd ..
</pre>

<ul>
<li><a href="mesa-configure.html">Example mesa configure output.</a></li>

<li>You will probably need a development package for <a href="https://01.org/linuxgraphics/community/libdrm">libdrm</a>. This is
available in <a href="http://cgit.freedesktop.org/mesa/drm"><code>git://anongit.freedesktop.org/mesa/drm</code></a></li>

<li><a href="http://xcb.freedesktop.org/">xcb</a>-* dependencies can be fixed by compiling and installing
<a href="http://cgit.freedesktop.org/xcb/proto"><code>git://anongit.freedesktop.org/xcb/proto</code></a> and
<a href="http://cgit.freedesktop.org/xcb/libxcb"><code>git://anongit.freedesktop.org/xcb/libxcb</code></a>.
</li>

<li>*proto dependencies can be built from
<a href="http://cgit.freedesktop.org/xorg/proto"><code>git://anongit.freedesktop.org/xorg/proto/*proto</code></a>.
</li>

<li><code>--disable-dri3</code> may remove some dependencies.</li>

<li>If you plan to compile <a href="xserver.html">XWayland</a> you may
want to install any dependencies it needs now. This is so Mesa
uses the same header files as xwayland.
</ul>

<p>Note on Mesa build failures: If you're not building in your Mesa git
repo for the first time, the first thing to try is always
"<code>git&nbsp;clean&nbsp;-xfd</code>", and possibly deleting your $WLD
directory, as Mesa requires this often.</p>

<h2>libunwind</h2>

<p>Weston requires <a href="http://www.nongnu.org/libunwind/">libunwind</a>
v1.1 if you don't configure it with <code>--disable-libunwind</code>.
Libunwind only helps with weston crash reports and is safe to skip, if not
intending to report bugs.</p>

<pre>
$ git clone <a href="http://git.savannah.gnu.org/gitweb/?p=libunwind.git">git://git.sv.gnu.org/libunwind</a>
$ cd libunwind
$ autoreconf -i
$ ./configure --prefix=$WLD
$ make &amp;&amp; make install
$ cd ..
</pre>

<h2>libinput</h2>

<p><a href="http://www.freedesktop.org/wiki/Software/libinput/">Libinput</a>
translates evdev events into Wayland events. It has been split from
Weston as the code is reusable by any Wayland compositor on Linux.</p>

<pre>
$ git clone <a href="http://cgit.freedesktop.org/wayland/libinput">git://anongit.freedesktop.org/wayland/libinput</a>
$ cd libinput
$ ./autogen.sh --prefix=$WLD
$ make &amp;&amp; make install
$ cd ..
</pre>

<ul>
<li>You probably need the development package for
  <a href="http://www.freedesktop.org/wiki/Software/libevdev/">libevdev</a>,
  this is in <a href="http://cgit.freedesktop.org/libevdev"><code>git://anongit.freedesktop.org/libevdev</code></a></li>

<li><a href="https://sourceforge.net/projects/linuxwacom/">libwacom</a> source is in <code>git://git.code.sf.net/p/linuxwacom/libwacom</code></li>

<li><a href="http://xkbcommon.org/">libxkbcommon</a> source is
in <a href="http://github.com/xkbcommon/libxkbcommon"><code>git://github.com/xkbcommon/libxkbcommon</code></a>.</li>
</ul>

<h2>Weston and demo applications</h2>

<p>Weston is the reference implementation of a Wayland compositor.  It's
available in the weston repo and comes with a few demo applications.
</p>

<pre>
$ git clone <a href="http://cgit.freedesktop.org/wayland/weston">git://anongit.freedesktop.org/wayland/weston</a>
$ cd weston
$ ./autogen.sh --prefix=$WLD
$ make
$ sudo make install
$ cd ..
</pre>

<ul>
<li>Use <code>--disable-setuid-install</code> to avoid having to
use <code>sudo make install</code>. This is useful
if you only plan to run weston under X.</li>
</ul>

<h2>Running Weston</h2>

<p>Weston creates its unix socket file (for example, <code>wayland-0</code>)
in the directory specified by the required environment variable
<a href="http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html"><code>$XDG_RUNTIME_DIR</code></a>. Clients use the same variable to find that
socket. This is provided using systemd by some distributions (Fedora,
<a href="https://www.archlinux.org/news/systemd-tools-replaces-udev/">Arch
since June 2012</a> or Exherbo).
<a href="https://bugs.launchpad.net/ubuntu/+source/pam-xdg-support/+bug/894391">Ubuntu began providing it in Quantal.</a>
It is not provided by Gentoo.
</p>
<p>
If you are using a distro that does set <code>$XDG_RUNTIME_DIR</code> for you,
you can skip this part. Otherwise, you must set it using your shell profile
capability.
</p>
<p>
First, please read your shell manual to use the correct file. Some shells will
read multiple files (Zshell), others will pick the first available one ignoring
the others (Bash). <code>~/.profile</code> is generally a good guess, for most
Bourne-shell compatible shells, <code>~/.zprofile</code> is the Zshell
equivalent. You should use the profile file if there is any, otherwise the
login file will do the trick.
</p>
<p>
We will use <code>/tmp</code> as the base to put our
<code>$XDG_RUNTIME_DIR</code> in. Since <code>/tmp</code> can be a tmpfs, and
thus wiped on restart, we should take care of creating it when we need it. Also,
if you share your computer between several users, you must take care of using a
unique <code>$XDG_RUNTIME_DIR</code> for each one. We will also check if the
variable is already set. This way, if your system starts providing it, you will
use it directly. It is also useful if you want to use your profile file on
different systems.</p>

<p>Here is the code to put in your shell profile file (it is Bourne-shell
compatible, feel free to adapt it to your shell’s internals):
</p>

<pre>
if test -z "${XDG_RUNTIME_DIR}"; then
    export XDG_RUNTIME_DIR=/tmp/${UID}-runtime-dir
    if ! test -d "${XDG_RUNTIME_DIR}"; then
        mkdir "${XDG_RUNTIME_DIR}"
        chmod 0700 "${XDG_RUNTIME_DIR}"
    fi
fi
</pre>

<p>Copy the <code>weston.ini</code> file and edit it to set a
background image that you like:</p>

<pre>
$ mkdir -p ~/.config
$ cp weston/weston.ini ~/.config
$ $EDITOR ~/.config/weston.ini
</pre>

<p>If <code>$DISPLAY</code> is set, the weston will run under X in a
window and take input from X. Run the compositor by typing:</p>

<pre>
$ weston
</pre>

<p>Otherwise (outside of X) it will run on the KMS/DRM framebuffer and
take input from evdev devices. Use weston-launch, which as a setuid-root
program does privileged operations on Weston's behalf.  It also requires
that you either enable systemd session support for weston-launch (by
using systemd and having the systemd-login devel headers at configure
time), or add yourself to the "weston-launch" group:</p>

<pre>
$ sudo groupadd weston-launch
$ sudo usermod -a -G weston-launch $USER
$ <span class="comment"># Log all the way out (of X, etc.)</span>
$ sudo chown root $WLD/bin/weston-launch
$ sudo chmod +s $WLD/bin/weston-launch
$ weston-launch
</pre>

<p>To run clients, the second button in the top bar will run
weston-terminal, from which you can run clients. It is also possible to
run clients from a different VT when running on hardware, or from an
xterm if running under X. There are a few demo clients available in the
weston build directory, but they are all pretty simple and mostly for
testing specific features in the wayland protocol: </p>

<ul>
  <li>'weston-terminal' is a simple terminal emulator, not very compliant at all,
    but works well enough for bash</li>
  <li>'weston-flower' draws a flower on the screen, testing the frame
    protocol</li>
  <li>'weston-gears' glxgears, but for wayland</li>
  <li>'weston-smoke' tests SHM buffer sharing</li>
  <li>'weston-image' loads the image files passed on the command line and
    shows them</li>
  <li>'weston-view' does the same for pdf files</li>
  <li>'weston-resizor' demonstrates smooth window resizing
    (use up and down keys)</li>
  <li>'weston-eventdemo' reports libtoytoolkit's
    events to console (see weston-eventdemo --help)</li>
</ul>

<p>Optional environment variables which will get you more debugging
output:</p>

<pre>
export MESA_DEBUG=1
export EGL_LOG_LEVEL=debug
export LIBGL_DEBUG=verbose
export WAYLAND_DEBUG=1
</pre>

<h2>XWayland</h2>
<p>
<a href="xserver.html">Directions for building support for X clients (XWayland)</a>
</p>

</body>
</html>