From 053a1a9c512d00ccdbf3f81e5869b4fccbc8ff2b Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Thu, 12 Aug 2010 13:46:58 +0100 Subject: [PATCH] build: Add simple scripts for setting up jhbuild Use the same script also used by gnome-shell to set up the system dependencies for building Clutter (and its dependencies) using jhbuild. --- build/clutter-build-setup.sh | 174 +++++++++++++++++++++++++++++++++ build/jhbuildrc-clutter | 73 ++++++++++++++ build/jhbuildrc-custom-example | 19 ++++ 3 files changed, 266 insertions(+) create mode 100644 build/clutter-build-setup.sh create mode 100644 build/jhbuildrc-clutter create mode 100644 build/jhbuildrc-custom-example diff --git a/build/clutter-build-setup.sh b/build/clutter-build-setup.sh new file mode 100644 index 000000000..b9e8ccca9 --- /dev/null +++ b/build/clutter-build-setup.sh @@ -0,0 +1,174 @@ +#!/bin/sh +# +# Copyright (C) 2010, Intel Corp. +# +# Modified version of gnome-shell-build-setup.sh for building Clutter +# and its dependencies using jhbuild +# +# Copyright (C) 2008, Red Hat, Inc. +# +# Some ideas and code taken from gtk-osx-build +# +# Copyright (C) 2006, 2007, 2008 Imendio AB +# + +# Pre-check on GNOME version + +release_file= + +if which lsb_release > /dev/null 2>&1; then + system=`lsb_release -is` + version=`lsb_release -rs` +elif [ -f /etc/fedora-release ] ; then + system=Fedora + release_file=/etc/fedora-release +elif [ -f /etc/SuSE-release ] ; then + system=SUSE + release_file=/etc/SuSE-release +elif [ -f /etc/mandriva-release ]; then + system=MandrivaLinux + release_file=/etc/mandriva-release +fi + +if [ x$release_file != x ] ; then + version=`sed 's/[^0-9\.]*\([0-9\.]\+\).*/\1/' < $release_file` +fi + +if test x$system = xUbuntu -o x$system = xDebian -o x$system = xLinuxMint ; then + reqd="" + if [ ! -x /usr/bin/dpkg-checkbuilddeps ]; then + echo "Please run 'sudo apt-get install dpkg-dev' and try again." + echo + exit 1 + fi + for pkg in \ + build-essential curl \ + automake bison flex gettext git-core gnome-common gtk-doc-tools \ + libjasper-dev libjpeg-dev libpng-dev libstartup-notification0-dev libtiff-dev \ + libgl1-mesa-dev libxml2-dev mesa-common-dev mesa-utils \ + python-dev python-gconf python-gobject \ + libgstreamer0.10-dev gstreamer0.10-plugins-base gstreamer0.10-plugins-good \ + ; do + if ! dpkg-checkbuilddeps -d $pkg /dev/null 2> /dev/null; then + reqd="$pkg $reqd" + fi + done + if test ! "x$reqd" = x; then + echo "Please run 'sudo apt-get install $reqd' and try again." + echo + exit 1 + fi +fi + +if test x$system = xFedora ; then + reqd=" + binutils curl gcc gcc-c++ make + automake bison flex gettext git gnome-common gnome-doc-utils intltool + libtool pkgconfig jasper-devel libffi-devel libjpeg-devel + libpng-devel libtiff-devel libwnck-devel mesa-libGL-devel + python-devel pygobject2 libXdamage-devel libxml2-devel + gstreamer-devel gstreamer-plugins-base gstreamer-plugins-good + glx-utils + " + + if expr $version \>= 14 > /dev/null ; then + reqd="$reqd gettext-autopoint" + fi + + for pkg in $reqd ; do + if ! rpm -q $pkg > /dev/null 2>&1; then + missing="$pkg $missing" + fi + done + if test ! "x$missing" = x; then + gpk-install-package-name $missing + fi +fi + +if test x$system = xSUSE ; then + reqd="" + for pkg in \ + curl \ + bison flex gnome-doc-utils-devel \ + xorg-x11-proto-devel xorg-x11-devel xorg-x11 xorg-x11-server-extra \ + ; do + if ! rpm -q $pkg > /dev/null 2>&1; then + reqd="$pkg $reqd" + fi + done + if test ! "x$reqd" = x; then + echo "Please run 'su --command=\"zypper install $reqd\"' and try again." + echo + exit 1 + fi +fi + +if test x$system = xMandrivaLinux ; then + reqd="" + for pkg in \ + curl \ + bison flex gnome-common gnome-doc-utils gtk-doc intltool \ + libwnck-1-devel GL-devel \ + libxdamage-devel mesa-demos \ + ; do + if ! rpm -q --whatprovides $pkg > /dev/null 2>&1; then + reqd="$pkg $reqd" + fi + done + if test ! "x$reqd" = x; then + gurpmi --auto $reqd + fi +fi + +SOURCE=$HOME/Source +BASEURL=http://git.clutter-project.org/clutter/plain/build + +if [ -d $SOURCE ] ; then : ; else + mkdir $SOURCE + echo "Created $SOURCE" +fi + +if [ -d $SOURCE/jhbuild ] ; then + if [ -d $SOURCE/jhbuild/.git ] ; then + echo -n "Updating jhbuild ... " + ( cd $SOURCE/jhbuild && git pull --rebase > /dev/null ) || exit 1 + echo "done" + else + echo "$SOURCE/jhbuild is not a git repository" + echo "You should remove it and rerun this script" + exit 1 + fi +else + echo -n "Checking out jhbuild into $SOURCE/jhbuild ... " + cd $SOURCE + git clone git://git.gnome.org/jhbuild > /dev/null || exit 1 + echo "done" +fi + +echo "Installing jhbuild..." +(cd $SOURCE/jhbuild && make -f Makefile.plain DISABLE_GETTEXT=1 bindir=$HOME/bin install >/dev/null) + +if [ -e $HOME/.jhbuildrc ] ; then + if grep JHBUILDRC_GNOME_SHELL $HOME/.jhbuildrc > /dev/null ; then : ; else + mv $HOME/.jhbuildrc $HOME/.jhbuildrc.bak + echo "Saved ~/.jhbuildrc as ~/.jhbuildrc.bak" + fi +fi + +echo -n "Writing ~/.jhbuildrc ... " +curl -L -s -o $HOME/.jhbuildrc $BASEURL/jhbuildrc-clutter +echo "done" + +if [ ! -f $HOME/.jhbuildrc-custom ]; then + echo -n "Writing example ~/.jhbuildrc-custom ... " + curl -L -s -o $HOME/.jhbuildrc-custom $BASEURL/jhbuildrc-custom-example + echo "done" +fi + +if test "x`echo $PATH | grep $HOME/bin`" = x; then + echo "PATH does not contain $HOME/bin, it is recommended that you add that." + echo +fi + +echo "Done." + diff --git a/build/jhbuildrc-clutter b/build/jhbuildrc-clutter new file mode 100644 index 000000000..4c254a59c --- /dev/null +++ b/build/jhbuildrc-clutter @@ -0,0 +1,73 @@ +# -*- mode: python -*- +# +# jhbuildrc for building Clutter. Customizations shuld be done in +# ~/.jhbuildrc-custom +# +# Copyright (C) Intel Corp. +# +# Based on the gnome-shell variant +# +# Copyright (C) 2008 Red Hat, Inc. +# +# Some ideas and a bit of code taken from gtk-osx-build +# +# Copyright (C) 2006, 2007, 2008 Imendio AB +# +# Use .jhbuildrc-custom to override the moduleset, modules to build, +# the source checkout location, installation prefix, or svn usernames +# etc. +# +# JHBUILDRC_CLUTTER - Do not edit this line (or anything else) + +# Only rebuild modules that have changed +build_policy = 'updated' + +moduleset = 'http://git.clutter-project.org/clutter/plain/build/clutter.modules' + +modules = [ 'meta-clutter' ] + +# what directory should the source be checked out to? +checkoutroot = os.path.expanduser('~/clutter/source') + +# the prefix to configure/install modules to (must have write access) +prefix = os.path.expanduser('~/clutter/install') + +# Use system libraries for the builds +#addpath('PKG_CONFIG_PATH', os.path.join(os.sep, 'usr', 'lib', 'pkgconfig')) +#addpath('PKG_CONFIG_PATH', os.path.join(os.sep, 'usr', 'share', 'pkgconfig')) + +# Look in /usr/share for icons, D-BUS service files, etc +addpath('XDG_DATA_DIRS', os.path.join(os.sep, 'usr', 'share')) +# Look in /etc/xdg for system-global autostart files +addpath('XDG_CONFIG_DIRS', os.path.join(os.sep, 'etc', 'xdg')) + +# +# For Ubuntu Intrepid, libmozjs lives in /usr/lib/xulrunner- +# However, that path isn't in ld.so.conf, meaning that it's basically +# impossible to use the xulrunner .pc files and libraries. Work around +# this by deriving the path and adding it to LD_LIBRARY_PATH ourself. +# +import re +import subprocess +_pkgconfig = subprocess.Popen(['pkg-config', '--variable=sdkdir', 'mozilla-js'], + stdout=subprocess.PIPE) +_sdkdir = _pkgconfig.communicate()[0].strip() +_pkgconfig.wait() +if _pkgconfig.returncode == 0: + _libdir = re.sub('-(sdk|devel)', '', _sdkdir) + if os.path.exists(_libdir + '/libmozjs.so'): + addpath('LD_LIBRARY_PATH', _libdir) + +# Rebuild faster +os.environ['INSTALL'] = os.path.expanduser('~/bin/install-check') + +# Use the standard system bus +os.environ['DBUS_SYSTEM_BUS_ADDRESS'] = 'unix:path=/var/run/dbus/system_bus_socket' + +# Import optional user RC for further customization. You can override +# the prefix or default build setup for example, or CFLAGS or +# module_autogenargs, etc. +# +_userrc = os.path.join(os.environ['HOME'], '.jhbuildrc-custom') +if os.path.exists(_userrc): + execfile(_userrc) diff --git a/build/jhbuildrc-custom-example b/build/jhbuildrc-custom-example new file mode 100644 index 000000000..bb988082a --- /dev/null +++ b/build/jhbuildrc-custom-example @@ -0,0 +1,19 @@ +# -*- mode: python -*- + +# The username for repositories can be overridden. +# +#repos["git.gnome.org"] = "ssh://@git.gnome.org/git/" +#repos["git.clutter-project.org"] = "ssh://git@git.clutter-project.org/" + +# Directory where to check sources out +# +#checkoutroot = '/opt/clutter/source' + +# Directory where to install +# +#prefix = '/opt/clutter/install' + +# Work around http://bugzilla.gnome.org/show_bug.cgi?id=571240 if +# your 'install' program is somewhere other than /usr/bin/install +# (affects: Arch Linux) +#installprog = 'bin/install'