The instructions below assume some familiarity with git and building and running experimental software. Also, be prepared for the fact that this project isn't at all useful right now, it's still very much a prototype. When the instructions suggest to clone a git repo, you can of course just add a remote and fetch instead, if you have a clone of that repo around already. By default the software is installed in $HOME/install but you can change it by altering $WLD (explained later). You can also install everything system-wide by setting WLD to /usr and passing --sysconfdir=/etc to autogen.sh.
X output requires DRI2. DRM output (without X) requires Kernel Mode Setting (KMS) and the page flip ioctl. These are supported by:
Intel: 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.
AMD/ATI: 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).
nVidia: Requires Nouveau (open source driver). DRM output requires kernel version 3.7-rc3. DRM output previously required kernel version 2.6.37 for nv40 or lower cards, 2.6.38 for nv50 cards. Some new cards require loading external firmware.
For building Weston for Raspberry Pi, see Raspberry Pi build guide.
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:
WLD=$HOME/install # change this to another location if you prefer LD_LIBRARY_PATH=$WLD/lib PKG_CONFIG_PATH=$WLD/lib/pkgconfig/:$WLD/share/pkgconfig/ ACLOCAL="aclocal -I $WLD/share/aclocal" export WLD LD_LIBRARY_PATH PKG_CONFIG_PATH ACLOCAL
Do not set LD_LIBRARY_PATH as your default, it will break things.
You may put the above in a script and source it in the terminal you wish to build the packages.
To install system wide, you'll need to set this variable, and possibly build with --libdir=/usr/lib64 :
WLD=/usr export WLD
This is required in order to be able to build Mesa with --with-egl-platforms=x11,wayland,drm.
$ git clone git://anongit.freedesktop.org/wayland/wayland $ cd wayland $ ./autogen.sh --prefix=$WLD $ make $ make install
Wayland uses the mesa EGL stack, and all extensions required to run EGL on KMS are now upstream on the master branch. Wayland master requires mesa master. Wayland 0.85 works with mesa branch 8.0 and master. For this you'll also need a development package for libdrm. Other dependencies are development packages of xcb-dri2 and xcb-xfixes.
$ git clone git://anongit.freedesktop.org/git/mesa/drm $ cd drm $ ./autogen.sh --prefix=$WLD $ make && make install $ git clone git://anongit.freedesktop.org/mesa/mesa $ cd mesa $ ./autogen.sh --prefix=$WLD --enable-gles2 --disable-gallium-egl \ --with-egl-platforms=x11,wayland,drm --enable-gbm --enable-shared-glapi \ --with-gallium-drivers=r300,r600,swrast,nouveau $ make && make install
We disable Gallium for Intel 915 and 965, which just means that libEGL won't try to load the Gallium drivers directly. The Gallium drivers will be built as DRI drivers, which the EGL loader will load just fine.
Example mesa configure output.
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 "git clean -xfd", and possibly deleting your $WLD directory, as Mesa requires this often.
Wayland needs libxkbcommon for translating evdev keycodes to keysyms. For wayland 0.85 use libxkbcommon branch for-weston-0.85. For this you'll need a development packages for macros.
$ git clone git://github.com/xkbcommon/libxkbcommon $ cd libxkbcommon/ $ ./autogen.sh --prefix=$WLD --with-xkb-config-root=/usr/share/X11/xkb $ make && make install
The Wayland clients can render using cairo-gl, but fall back to software when cairo-gl is not available. For cairo-gl, cairo 1.11.3 or newer is needed. For this you'll need a development package for pixman.
$ git clone git://anongit.freedesktop.org/pixman $ cd pixman $ ./autogen.sh --prefix=$WLD $ make && make install $ git clone git://anongit.freedesktop.org/cairo $ cd cairo $ ./autogen.sh --prefix=$WLD --enable-gl --enable-xcb $ make && make install
Weston requires libunwind v1.1 if you don't configure with --disable-libunwind .
$ git clone git://git.sv.gnu.org/libunwind $ cd libunwind $ autoreconf -i $ ./configure --prefix=$installdir $ make && make install
Weston creates its unix socket file (for example, wayland-0) in the directory specified by the required environment variable $XDG_RUNTIME_DIR . Clients use the same variable to find that socket. This is provided by Fedora using systemd. Ubuntu began providing it in Quantal. Arch began providing it with systemd in June 2012. It is not provided by Gentoo. If you are using a distro that does not set $XDG_RUNTIME_DIR for you, do:
$ mkdir /tmp/wayland $ chmod 0700 /tmp/wayland $ su -c 'echo XDG_RUNTIME_DIR=/tmp/wayland >> /etc/environment'
Using PAM like this involves some security concerns, and may break things. Don't forget to undo it. (Relevant bug.)
Weston is the reference implementation of a Wayland compositor. It's available in the weston repo and comes with a few demo applications.
Aside from mesa and libxkbcommon, the Weston dependencies can be satisfied with released versions of: gdk-pixbuf-2.0, libudev 136, libdrm 2.4.23, pixman-1, cairo-gl 1.11.3, glib-2.0, and gobject-2.0. And optionally, for the pdf viewer: poppler-glib and gio-2.0.
$ git clone git://anongit.freedesktop.org/wayland/weston $ cd weston $ ./autogen.sh --prefix=$WLD $ make $ make install
If DISPLAY is set, the weston will run under X in a window and take input from X. Otherwise it will run on the KMS framebuffer and take input from evdev devices. Copy the weston.ini config file to ~/.config and edit it to set a background image that you like. Then run the compositor by typing:
For KMS/DRM output (outside of X) use weston-launch, which needs root permissions, which are set if "make install" is run as root, but some distributions disable it. It also requires that you 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:
$ sudo groupadd weston-launch $ sudo usermod -a -G weston-launch $USER $ # Log all the way out (of X, etc.) $ sudo chown root weston-launch $ sudo chmod +s weston-launch $ weston-launch
To run clients, switch to a different VT and run the client from there. Or run it under X and start up the clients from a terminal window. There are a few demo clients available, but they are all pretty simple and mostly for testing specific features in the wayland protocol:
Directions for building support for X clients (XWayland)
Environment variables which will get you more debugging output:
MESA_DEBUG=1 EGL_LOG_LEVEL=debug LIBGL_DEBUG=verbose WAYLAND_DEBUG=1