#!/bin/bash
# This builds and installs Wayland on Ubuntu Maverick machines with most video cards.
#
# 2010-11-20 Changes from Andr de Souza Pinto
# 2010-12-06 "set -e" instead of "set -u". More aggressive git cleaning.
# 2010-12-29 --with-xkb-config-root, WAYLAND_DEBUG,
# gtk building stuff that doesn't work yet
# 2011-01-03 Upstream gtk git, reset --hard
# 2011-01-04 Conditional for building gtk instead of commenting out
# 2011-01-07 Don't reset to origin/master, build vte, added
# gobject-introspection package required to build vte, added
# gperf for gtk
# 2011-01-23 Added pixman git, new dep of cairo, stop using deprecated
# --enable-gles-overlay
# 2011-01-26 Install rsvg-convert for new window icon, also start:
# eventdemo, resizor, and simple-client
# 2011-01-31 Remove --disable-gallium-{i915,i965} from mesa build flags
# 2011-02-08 Update for wayland-egl.
# 2011-02-13 Stop building Gallium EGL driver, nolonger needed.
# 2011-02-14 Only do Ubuntu stuff if on Ubuntu. Re-install
# 70-wayland.rules if previously installed but different.
# Don't change XDG_RUNTIME_DIR if it's already set.
# 2011-02-16 Update for wayland repo split.
# 2011-04-02 Change build order to match instructions, thanks to creak
# in #wayland.
set -e # exit script if anything fails
# Change this to where you want everything installed:
installprefix=$HOME/install
# Change to 1 to build gtk stuff.
BUILD_GTK=1
# Set to nothing to skip cleaning for faster but less reliable rebuilds.
#CLEAN='git clean -x -f -d'
CLEAN=
# You might want to put these in your ~/.bashrc
PKG_CONFIG_PATH=$installprefix/lib/pkgconfig/:$installprefix/share/pkgconfig/
export PKG_CONFIG_PATH
ACLOCAL="aclocal -I $installprefix/share/aclocal"
export ACLOCAL
C_INCLUDE_PATH=$installprefix/include
export C_INCLUDE_PATH
LIBRARY_PATH=$installprefix/lib
export LIBRARY_PATH
# Do *not* put this in your ~/.bashrc, it will break things.
LD_LIBRARY_PATH=$installprefix/lib
export LD_LIBRARY_PATH
# Get some more debugging output
MESA_DEBUG=1
export MESA_DEBUG
EGL_LOG_LEVEL=debug
export EGL_LOG_LEVEL
LIBGL_DEBUG=verbose
export LIBGL_DEBUG
# This one is noisy.
WAYLAND_DEBUG=1
export WAYLAND_DEBUG
QTVER=qt5
export QTVER
QTDIR=$installprefix
export QTDIR
QT_PLUGIN_PATH=$installprefix/lib/plugins
export QT_PLUGIN_PATH
if [ "$XDG_RUNTIME_DIR" == "" ]
then
XDG_RUNTIME_DIR=/tmp
export XDG_RUNTIME_DIR
fi
GDK_BACKEND=wayland
export GDK_BACKEND
if [ ! -d $installprefix/share/aclocal ]
then
mkdir -p $installprefix/share/aclocal
fi
# Should I install Ubuntu packages?
if [ -e /etc/lsb-release ]
then
DIST=`cat /etc/lsb-release | grep '^DISTRIB_ID' | awk -F= '{ print $2 }'`
fi
if [ "$DIST" == 'Ubuntu' ]
then
:
# sudo apt-get install aptitude
# sudo aptitude install build-essential libtool libxi-dev libxmu-dev libxt-dev bison flex libgl1-mesa-dev xutils-dev libtalloc-dev libdrm-dev autoconf x11proto-kb-dev libegl1-mesa-dev libgles2-mesa-dev libgdk-pixbuf2.0-dev libudev-dev libxcb-dri2-0-dev libxcb-xfixes0-dev shtool libffi-dev libpoppler-glib-dev libgtk2.0-dev git diffstat libx11-xcb-dev quilt autopoint dh-autoreconf xkb-data gtk-doc-tools gobject-introspection gperf librsvg2-bin
fi
# Wayland libraries, required by Mesa
if [ ! -d wayland ]
then
git clone git://anongit.freedesktop.org/wayland/wayland
else
cd wayland
$CLEAN
# git pull
cd ..
fi
cd wayland/
./autogen.sh --prefix=$installprefix
make
make install
cd ..
cd glproto/
# ./autogen.sh --prefix=$installprefix
# make
# make install
cd ..
cd glib/
# ./autogen.sh --prefix=$installprefix
# make
# make install
cd ..
cd dri2proto/
# ./autogen.sh --prefix=$installprefix
# make
# make install
cd ..
cd proto/
# ./autogen.sh --prefix=$installprefix
# make
# make install
cd ..
cd libxcb/
# ./autogen.sh --prefix=$installprefix
# make
# make install
cd ..
# Needed for wayland on nouveau and ATI
if [ ! -d drm ]
then
git clone git://anongit.freedesktop.org/git/mesa/drm
else
cd drm
$CLEAN
# git pull
cd ..
fi
cd drm
# ./autogen.sh --prefix=$installprefix --enable-nouveau-experimental-api
# make
# make install
cd ..
# Needed for wayland
if [ ! -d mesa ]
then
git clone git://anongit.freedesktop.org/mesa/mesa
else
cd mesa
$CLEAN
# git pull
cd ..
fi
cd mesa
# Now using egl_dri2 for everything.
# ./autogen.sh --exec-prefix=$installprefix --prefix=$installprefix --enable-gles2 --disable-gallium-egl --with-egl-platforms=wayland,drm --enable-shared-glapi --enable-gbm
# --enable-gallium-r600
#--enable-gallium-nouveau
# make
# make install
cd ..
# Needed for libX11 and xproto
if [ ! -d macros ]
then
git clone git://anongit.freedesktop.org/xorg/util/macros
else
cd macros
$CLEAN
# git pull
cd ..
fi
cd macros
# ./autogen.sh --prefix=$installprefix
# make
# make install
cd ..
# Needed for libxkbcommon
if [ ! -d xproto ]
then
git clone git://anongit.freedesktop.org/xorg/proto/xproto
else
cd xproto
$CLEAN
# git pull
cd ..
fi
cd xproto
# ./autogen.sh --prefix=$installprefix
# make
# make install
cd ..
# Needed for libxkbcommon
if [ ! -d kbproto ]
then
git clone git://anongit.freedesktop.org/xorg/proto/kbproto
else
cd kbproto
$CLEAN
# git pull
cd ..
fi
cd kbproto/
# ./autogen.sh --prefix=$installprefix
# make
# make install
cd ..
# Needed for libxkbcommon
if [ ! -d libX11 ]
then
git clone git://anongit.freedesktop.org/xorg/lib/libX11
else
cd libX11
$CLEAN
# git pull
cd ..
fi
cd libX11
# ./autogen.sh --prefix=$installprefix
# make
# make install
cd ..
# Needed for wayland
if [ ! -d libxkbcommon ]
then
git clone git://people.freedesktop.org/xorg/lib/libxkbcommon.git
else
cd libxkbcommon
$CLEAN
# git pull
cd ..
fi
cd libxkbcommon/
# ./autogen.sh --prefix=$installprefix --with-xkb-config-root=/usr/share/X11/xkb
# make
# make install
cd ..
# Needed for pixman :D
if [ ! -d pango ]
then
git clone git://git.gnome.org/pango
else
cd pango
$CLEAN
# git pull
cd ..
fi
cd pango
# ./autogen.sh --prefix=$installprefix
# make
# make install
cd ..
# Needed for cairo
if [ ! -d pixman ]
then
git clone git://anongit.freedesktop.org/pixman
else
cd pixman
$CLEAN
# git pull
cd ..
fi
cd pixman
# ./autogen.sh --prefix=$installprefix
# make
# make install
cd ..
# Needed for wayland
if [ ! -d cairo ]
then
git clone git://anongit.freedesktop.org/cairo
else
cd cairo
$CLEAN
# git pull
cd ..
fi
cd cairo
# ./autogen.sh --prefix=$installprefix --enable-xcb --enable-gl
# make
# make install
cd ..
# Wayland demo applications (compositor, terminal, flower, etc.)
if [ ! -d wayland-demos ]
then
git clone git://anongit.freedesktop.org/wayland/wayland-demos
else
cd wayland-demos
$CLEAN
# git pull
cd ..
fi
cd wayland-demos
# ./autogen.sh --prefix=$installprefix
# make
# make install
cd ..
cd weston
./autogen.sh --prefix=$installprefix
make
make install
cd ..
cd atk
# ./autogen.sh --prefix=$installprefix
# make
# make install
cd ..
cd gdk-pixbuf
# ./autogen.sh --prefix=$installprefix --without-libtiff
# make
# make install
cd ..
# The one file that needs to be installed outside of ~/install/ .
#diff -q wayland/compositor/70-wayland.rules /etc/udev/rules.d/70-wayland.rules
#if [ $? -eq 1 ] && [ -d /etc/udev/rules.d ]
#then
# sudo cp -a wayland-demos/compositor/70-wayland.rules /etc/udev/rules.d/
# sudo udevadm trigger --subsystem-match=drm --subsystem-match=input
#fi
if [ $BUILD_GTK == '1' ]
then
if [ ! -d glib ]
then
git clone git://git.gnome.org/glib
else
cd glib
$CLEAN
# git pull
cd ..
fi
cd glib
# ./autogen.sh --prefix=$installprefix
# make
# make install
cd ..
if [ ! -d gtk+ ]
then
#git clone git://anongit.freedesktop.org/~krh/gtk --branch wayland-backend
git clone git://git.gnome.org/gtk+ --branch gdk-backend-wayland
else
cd gtk+
$CLEAN
# git pull
cd ..
fi
cd gtk+
# ./autogen.sh --prefix=$installprefix --enable-wayland-backend --enable-x11-backend
# make
# make install
cd ..
if [ ! -d vte ]
then
git clone git://git.gnome.org/vte
else
cd vte
$CLEAN
# git pull
cd ..
fi
cd vte
# ./autogen.sh --prefix=$installprefix --with-gtk=3.0
# make
# make install
cd ..
fi
cd qtbase
./configure -confirm-license -opensource -no-phonon-backend -debug -qpa -xcb -wayland -egl -opengl es2 --prefix=$installprefix
make
make install
cd ..
if [ $BUILD_GTK == '1' ]
then
gtk+/tests/testgtk &
$installprefix/bin/vte2_90 &
fi