Darxus' build scripts made getting, building and running wayland very easy. It seems useful to provide these to users on the official wayland site to lower the barrier to getting started with wayland.
I combined two of them together and split some of the functionality out into separate commands to make it easier to update, rebuild etc. I also added a brief mention to the top of the building.html. Chris
From 71f876333bc37b164c8e62c3ec4ac9329ba59ffb Mon Sep 17 00:00:00 2001 From: Chris Morgan <chmor...@gmail.com> Date: Fri, 4 Feb 2011 22:46:51 -0500 Subject: [PATCH] Add the wayland-build.sh script to building.html and to the directory --- building.html | 13 +++ wayland-build.sh | 302 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 315 insertions(+), 0 deletions(-) create mode 100755 wayland-build.sh diff --git a/building.html b/building.html index 446e780..a864e4d 100644 --- a/building.html +++ b/building.html @@ -21,6 +21,19 @@ below, but you can use your favorite directory of course or install over your system copy (pass --prefix=/usr --sysconfdir=/etc, generally).</p> +<h2>wayland-build.sh helper script</h2> +<p>A helpful script, <a href="wayland-build.sh">wayland-build.sh</a>, is available that can automate building and running Wayland. This script performs most of the steps found in the below sections.</p> +<p> +To get started put this script into a directory on your system and run: +<pre> +./wayland-build.sh ubuntu (if on ubuntu) +./wayland-build.sh clone +./wayland-build.sh configure +./wayland-build.sh make +./wayland-build.sh run +</pre> +</p> + <h2>Setting up the environment</h2> <p>If you want to install in $HOME/install (or another location that won't interfere with the rest of your system) you'll need to set the following diff --git a/wayland-build.sh b/wayland-build.sh new file mode 100755 index 0000000..978eeb1 --- /dev/null +++ b/wayland-build.sh @@ -0,0 +1,302 @@ +#!/bin/bash + +# This builds and installs Wayland. Also includes setup for Ubuntu Maverick +# +# 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-04 Break steps into separate functions, add usage documentation + + +build_gtk=0 + +# Change this to where you want everything installed: +installprefix=$HOME/wayland/install + +# 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 + +# 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 +#WAYLAND_DEBUG=1 +#export WAYLAND_DEBUG + +XDG_RUNTIME_DIR=/tmp +export XDG_RUNTIME_DIR +GDK_BACKEND=wayland +export GDK_BACKEND + +# Do *not* put this in your ~/.bashrc, it will break things. +LD_LIBRARY_PATH=$installprefix/lib +export LD_LIBRARY_PATH + +gitDirectories="drm mesa xproto kbproto macros libX11 libxkbcommon pixman cairo wayland" + +DIST=`cat /etc/lsb-release | grep '^DISTRIB_ID' | awk -F= '{ print $2 }'` + +function ubuntu_prerequisites() +{ + # Paste these one at a time because they're interactive. + 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 +} + +function clone() +{ + # Needed for wayland on nouveau + git clone git://anongit.freedesktop.org/git/mesa/drm + + # Needed for wayland + git clone git://anongit.freedesktop.org/mesa/mesa + + # Needed for libxkbcommon + git clone git://anongit.freedesktop.org/xorg/proto/xproto + + # Needed for libxkbcommon + git clone git://anongit.freedesktop.org/xorg/proto/kbproto + + # Needed for libX11 + git clone git://anongit.freedesktop.org/xorg/util/macros + + # Needed for libxkbcommon + git clone git://anongit.freedesktop.org/xorg/lib/libX11 + + # Needed for wayland + git clone git://people.freedesktop.org/xorg/lib/libxkbcommon.git + + # Needed for cairo + git clone git://anongit.freedesktop.org/pixman + + # Needed for wayland + git clone git://anongit.freedesktop.org/cairo + + git clone git://anongit.freedesktop.org/wayland + + if [ $build_gtk == '1' ] + then + git clone git://git.gnome.org/glib + + #git clone git://anongit.freedesktop.org/~krh/gtk --branch wayland-backend + git clone git://git.gnome.org/gtk+ --branch gdk-backend-wayland + + git clone git://git.gnome.org/vte + fi + + # copy rules and setup udevadm if on ubuntu + if [ $DIST == 'Ubuntu' ] + then + if [ ! -e /etc/udev/rules.d/70-wayland.rules ] + then + sudo cp -a wayland/compositor/70-wayland.rules /etc/udev/rules.d/ + fi + sudo udevadm trigger --subsystem-match=drm --subsystem-match=input + fi +} + +function configure() +{ + if [ ! -d $installprefix/share/aclocal ] + then + mkdir -p $installprefix/share/aclocal + fi + + cd drm + ./autogen.sh --prefix=$installprefix --enable-nouveau-experimental-api + cd .. + + # Needed for wayland + cd mesa + + # --enable-gallium-nouveau is obviously only needed for nouveau. + # --disable-gallium-egl or --disable-gallium-{915,965} is needed because + # of problems with Intel picking a usable driver, without breaking nVidia + # and ATI/AMD. + # --with-dri-drivers=i915,i965 is to disable the classic r600 driver. + ./autogen.sh --prefix=$installprefix --enable-egl --enable-gles1 --enable-gles2 --enable-gallium-nouveau --with-state-trackers=glx,dri,egl --with-egl-platforms=drm --enable-gallium-r600 --with-dri-drivers=i915,i965 + # Recommendation by Chia-I Wu, doesn't work on nVidia: + #./autogen.sh --prefix=$installprefix --enable-gles2 --enable-gallium-nouveau --with-state-trackers=dri + cd .. + + # Needed for libxkbcommon + cd xproto + ./autogen.sh --prefix=$installprefix + cd .. + + # Needed for libxkbcommon + cd kbproto/ + ./autogen.sh --prefix=$installprefix + cd .. + + # Needed for libX11 + cd macros + ./autogen.sh --prefix=$installprefix + cd .. + + # Needed for libxkbcommon + cd libX11 + ./autogen.sh --prefix=$installprefix + cd .. + + # Needed for wayland + cd libxkbcommon + ./autogen.sh --prefix=$installprefix --with-xkb-config-root=/usr/share/X11/xkb + cd .. + + # Needed for cairo + cd pixman + ./autogen.sh --prefix=$installprefix + cd .. + + # Needed for wayland + cd cairo + ./autogen.sh --prefix=$installprefix --enable-gl --enable-xcb + cd .. + + cd wayland/ + ./autogen.sh --prefix=$installprefix + cp wayland/wayland-client.pc $installprefix/lib/pkgconfig/ # satisfy gtk + cd .. + + if [ $build_gtk == '1' ] + then + cd glib + ./autogen.sh --prefix=$installprefix + cd .. + + cd gtk+ + ./autogen.sh --prefix=$installprefix --enable-wayland-backend --enable-x11-backend + cd .. + + cd vte + ./autogen.sh --prefix=$installprefix --with-gtk=3.0 + cd .. + fi +} + +function makemakeinstall() +{ + for d in $gitDirectories + do + cd $d + make + make install + cd .. + done +} + +# perform the git operation specified in $0 on each of the git repositories +function git_operation() +{ + for d in $gitDirectories + do + echo - $d + cd $d + git $1 + cd .. + done +} + +function run() +{ + echo -e "\nRunning wayland." + + wayland/compositor/compositor & + sleep 2 + wayland/clients/eventdemo & + wayland/clients/flower & + wayland/clients/gears & + wayland/clients/resizor & + wayland/clients/simple-client & + wayland/clients/smoke & + wayland/clients/terminal & + + + if [ $build_gtk == '1' ] + then + gtk+/tests/testgtk & + $installprefix/bin/vte2_90 & + fi +} + +function print_usage() +{ + echo "Usage:" + echo "$0 [env|make|build|pull|clone|run|ubuntu]" + echo "" + echo "env - Source this script (source $0) to setup the environment necessary to run the Wayland compositor and clients" + echo "build - Build the code (runs autogen, make, make install)" + echo "make - Rebuild the code (runs make, make install)" + echo "pull - git pull each of the git repositories" + echo "clone - git clone each of the necessary git repositories" + echo "run - Start the Wayland compositor and some example clients" + echo "ubuntu - Install ubuntu pre-requisites" + echo "" + echo "To get started run: " + echo "$0 ubuntu (if on ubuntu)" + echo "$0 clone" + echo "$0 configure" + echo "$0 make" + echo "$0 run" +} + + +# skip argument parsing if we are being sourced in order +# to setup the wayland environment +if [ "/bin/bash" != "$0" ] +then + set -e # exit script if anything fails + #set -x # enable debugging + + # print usage if we don't have 1 argument + if [ $# -ne 1 ] + then + print_usage `basename $0` + exit 1 + fi + + # handle the input argument + if [ "$1" == "env" ] + then + echo "source this script via 'source $0' to setup your environment" + elif [ "$1" == "pull" ] + then + git_operation "pull" + elif [ "$1" == "run" ] + then + run + elif [ "$1" == "clone" ] + then + clone + elif [ "$1" == "configure" ] + then + configure + elif [ "$1" == "make" ] + then + makemakeinstall + else + print_usage `basename $0` + fi +fi -- 1.7.1
_______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel