Wayland logo Building Weston on Ubuntu 16.04

The following sequence of commands successfully built Weston and XWayland on a pristine Ubuntu 16.04 system, on August 16, 2016. These commands will probably work on any system based on Ubuntu 16.04. ~2 GB used with documentation dependencies, ~500 MB used without them.

All the "apt install" commands can probably be replaced by just running "sudo apt build-dep wayland weston wayland-protocols libinput xserver-xorg".

"make check" runs included tests, and is not required, but is a good habit.

For errors like "No package 'libffi' found" you can try searching with "apt-file search /libffi.pc". 'pc' stands for pkg-config.

# setup environment for local install:
export WLD=$HOME/install
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 $ACLOCAL_PATH
export MAKEFLAGS="j5" # run 5 threads, or use your own flags


# libwayland:

# The program 'git' is currently not installed. You can install it by typing:
sudo apt install git

# ./autogen.sh: 7: ./autogen.sh: autoreconf: not found
sudo apt install autoconf

# Makefile.am:176: error: Libtool library used but 'LIBTOOL' is undefined
sudo apt install libtool

# No package 'libffi' found
sudo apt install libffi-dev

# configure: error: Can't find expat.h. Please install expat.
sudo apt install libexpat1-dev

# configure: error: Package requirements (libxml-2.0) were not met:
sudo apt install libxml2-dev


# * These three are not necessary with the --disable-documentation flag, and
#   pull 1,400 MB of packages:
# configure: error: Documentation build requested but doxygen not found.
#   Install doxygen or disable the documentation using --disable-documentation
# configure: error: Documentation build requested but xmlto not found.
#   Install xmlto or disable the documentation using --disable-documentation
# configure: error: Documentation build requested but graphviz's dot not found.
#   Install graphviz or disable the documentation using --disable-documentation
sudo apt install doxygen xmlto graphviz

git clone git://anongit.freedesktop.org/wayland/wayland
cd wayland
./autogen.sh --prefix=$WLD # --disable-documentation
make check
make && make install
cd ..


# wayland-protocols:

git clone git://anongit.freedesktop.org/wayland/wayland-protocols
cd wayland-protocols
./autogen.sh --prefix=$WLD
make check
make && make install
cd ..


# libinput:

# configure: error: Package requirements (mtdev >= 1.1.0) were not met:
# configure: error: Package requirements (libudev) were not met:
# configure: error: Package requirements (libevdev >= 0.4) were not met:
# configure: error: Package requirements (libwacom >= 0.12) were not met:
sudo apt install libmtdev-dev libudev-dev libevdev-dev libwacom-dev

git clone git://anongit.freedesktop.org/wayland/libinput
cd libinput
./autogen.sh --prefix=$WLD
make check
make && make install
cd ..


# X Server:

# xserver: configure.ac:38: error: must install xorg-macros 1.14 or later before running autoconf/autogen
# xserver: configure: error: Package requirements (glproto >= 1.4.17 gl >= 9.2.0) were not met:
sudo apt install xutils-dev libgl1-mesa-dev

# checking for SHA1 implementation... configure: error: No suitable SHA1 implementation found
# checking for SHA1Init in -lmd... no
sudo apt install libmd-dev # no .pc file?

# configure: error: Package requirements (fixesproto >= 5.0 damageproto >= 1.1 xcmiscproto >= 1.2.0 xtrans >= 1.3.5 bigreqsproto >= 1.1.0 xproto >= 7.0.28 randrproto >= 1.5.0 renderproto >= 0.11 xextproto >= 7.2.99.901 inputproto >= 2.3 kbproto >= 1.0.3 fontsproto >= 2.1.3 pixman-1 >= 0.27.2 videoproto compositeproto >= 0.4 recordproto >= 1.13.99.1 scrnsaverproto >= 1.1 resourceproto >= 1.2.0 xf86driproto >= 2.1.0 glproto >= 1.4.17 dri >= 7.8.0 presentproto >= 1.0 xineramaproto xkbfile  pixman-1 >= 0.27.2 xfont >= 1.4.2 xau xshmfence >= 1.1 xdmcp) were not met:
sudo apt install x11proto-xcmisc-dev x11proto-bigreqs-dev x11proto-randr-dev \
  x11proto-fonts-dev x11proto-video-dev x11proto-composite-dev \
  x11proto-record-dev x11proto-scrnsaver-dev x11proto-resource-dev \
  x11proto-xf86dri-dev x11proto-present-dev x11proto-xinerama-dev \
  libxkbfile-dev libxfont-dev libpixman-1-dev x11proto-render-dev

# configure: error: Xwayland build explicitly requested, but required modules not found.
# checking for XWAYLANDMODULES... no
# XWAYLANDMODULES="wayland-client >= 1.3.0 libdrm epoxy"
sudo apt install libepoxy-dev # this error message is uninformative

# No package 'xfont2' found
git clone git://anongit.freedesktop.org/xorg/lib/libXfont
cd libXfont
./autogen.sh --prefix=$WLD
make check
make && make install
cd ..

git clone git://anongit.freedesktop.org/xorg/xserver
cd xserver
./autogen.sh --prefix=$WLD --disable-docs --disable-devel-docs \
  --enable-xwayland --disable-xorg --disable-xvfb --disable-xnest \
  --disable-xquartz --disable-xwin
make check
make && make install
cd ..


# weston:

# configure: error: Package requirements (egl glesv2) were not met:
# configure: error: Package requirements (xcb xcb-xfixes xcb-composite xcursor cairo-xcb) were not met:
# configure: error: Package requirements (libudev >= 136 libdrm >= 2.4.30 gbm mtdev >= 1.1.0) were not met:
# configure: error: weston-launch requires pam
sudo apt install libgles2-mesa-dev libxcb-composite0-dev libxcursor-dev \
  libcairo2-dev libgbm-dev libpam0g-dev

# Links needed so XWayland works:
mkdir -p $WLD/share/X11/xkb/rules
ln -s /usr/share/X11/xkb/rules/evdev $WLD/share/X11/xkb/rules/
ln -s /usr/bin/xkbcomp $WLD/bin/

git clone git://anongit.freedesktop.org/wayland/weston
cd weston
./autogen.sh --prefix=$WLD --disable-setuid-install --with-xserver-path=$WLD/bin/Xwayland
make check # runs Xwayland
make && make install
cd ..


# Weston configuration:
mkdir -p ~/.config
cp weston/weston.ini ~/.config
editor ~/.config/weston.ini # edit to set background and turn on xwayland.so module

# Run it in an X11 window:
weston