wxWidgets/build/buildbot/config/include/testdrive-unix.xml
2008-04-28 17:16:14 +00:00

244 lines
6.5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!--
Name: include/testdrive-unix.xml
Purpose: Declarations for the testdrive unix build slave
Author: Mike Wetherell
RCS-ID: $Id$
Copyright: (c) 2007 Mike Wetherell
Licence: wxWidgets licence
-->
<bot xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xsl:version="1.0">
<xi:include href="testdrive.xml"/>
<!--
post-checkout - post checkout <command> run by <checkout>
Usage: <post-checkout/>
The command is executed inside the shared checkout dir, and normally it
is used to make a private copy.
-->
<xsl:template name="post-checkout">
<command>
mkdir -p $TOPDIR
chown $USER $TOPDIR
rm -rf $BUILDDIR
cp -pR . $BUILDDIR || { cd; rm -rf $BUILDDIR; exit 1; }
</command>
</xsl:template>
<!--
unarchive - post fetch <command> run by <fetch>
Usage: <unarchive/>
The command is executed in the $HOME directory on the remote machine,
it is used to extract the fetched archive to the build directory.
-->
<xsl:template name="unarchive">
<command>
mkdir -p $TOPDIR
chown $USER $TOPDIR
rm -rf $BUILDDIR
SOURCE=`echo $SOURCE | sed "s|^[^/]|$HOME/&amp;|"`
cd $TOPDIR
case $SOURCE in
*.tar.gz)
gunzip -c $SOURCE | tar xf -
;;
*.tar.bz2)
bunzip2 -c $SOURCE | tar xf -
;;
*.zip)
unzip $SOURCE
;;
esac
mv wx* $BUILDDIR
</command>
</xsl:template>
<!--
configure - make disable-precomp-headers a default configure option for
the testdrive, and post process the Makefiles to use ccache.
Usage: <configure options="-with-foobar"/>
-->
<xsl:template name="configure">
<xsl:param name="content"/>
<xsl:param name="options"/>
<configure>
<copy-with-defaults content="{$content}">
<command>./configure --disable-precomp-headers <xsl:value-of select="normalize-space($options)"/></command>
</copy-with-defaults>
<command>find . -name Makefile | xargs perl -pi -e 's/^(?:CC|CXX) = /$&amp;ccache /'</command>
</configure>
</xsl:template>
<!--
setup - a build step that makes sure any prerequisites are set up for
the current testdrive build.
Usage: <setup/>
<setup cppunit-options="-host=i686-apple-darwin8"/>
One of the things it sets up is cppunit. There is more than one compiler
available on some of the testdrive machines, and generally speaking
cppuint needs to be compiled by the same one that will be used for the
build.
-->
<xsl:template name="setup">
<xsl:param name="content"/>
<xsl:param name="options"/>
<xsl:param name="ccache-configure" select="'./configure INSTALL=./install-sh\ -c --prefix=$HOME --bindir=$OPTDIR/bin'"/>
<xsl:param name="ccache-options"/>
<xsl:param name="cppunit-configure" select="'./configure INSTALL=config/install-sh\ -c --prefix=$HOME --bindir=$OPTDIR/bin --libdir=$OPTDIR/lib --disable-static'"/>
<xsl:param name="cppunit-options"/>
<shellcommand>
<description>setting up</description>
<descriptionDone>set up</descriptionDone>
<haltOnFailure/>
<command>
MINSPACE=1000000
DSPACE=`df -Pk $BUILDDIR | tail -1 | awk '{ print $4 }'`
if [ $DSPACE -lt $MINSPACE ]; then
echo "Disk space low, skipping build"
exit 1
fi
if [ -z "$CCACHE_DIR" ]; then
gunzip -c $HOME/src/ccache-*.tar.gz | tar xf -
cd ccache-*
<xsl:value-of select="concat($ccache-configure, ' ', $ccache-options, ' ', $options)"/>
make
strip ccache
make install
cd $BUILDDIR
rm -r ccache-*
fi
if { cppunit-config --version || "$CPPUNIT_CONFIG" --version; } 2>/dev/null; then
HAVE_CPPUNIT=1
fi
if [ -z "$HAVE_CPPUNIT" ]; then
gunzip -c $HOME/src/cppunit-*.tar.gz | tar xf -
cd cppunit-*
<xsl:value-of select="concat($cppunit-configure, ' ', $cppunit-options, ' ', $options)"/>
make install-strip
chmod +x $OPTDIR/bin/cppunit-config
cd $BUILDDIR
rm -rf cppunit-*
fi
</command>
</shellcommand>
</xsl:template>
<!--
profile - see <steps>.
-->
<xsl:template name="profile">
<command>
set -e
uname -smnr
umask 022
LANG=C
TOPDIR=<get-builddir/>
BUILDDIR=$TOPDIR/build
OPTDIR=$HOME/opt/<basename><get name="builddir"/></basename>
</command>
</xsl:template>
<!--
prologue - see <steps>.
-->
<xsl:template name="prologue">
<command>
INSTALLDIR=$TOPDIR/install
case `uname -sm` in
Linux*86*) PATH=$HOME/linux-x86/bin:$PATH ;;
esac
PATH=$OPTDIR/bin:$PATH
LD_LIBRARY_PATH=$BUILDDIR/lib:$OPTDIR/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
if { ccache -V; } >/dev/null 2>&amp;1; then
CCACHE_DIR=$TOPDIR/ccache
export CCACHE_DIR
ccache -M 120M
fi
cd $BUILDDIR
if [ -f wx-config ]; then
`./wx-config --cxx` --version
fi
<if-del-on-fail>trap 'cd; rm -rf $BUILDDIR' EXIT</if-del-on-fail>
</command>
</xsl:template>
<!--
epilogue - see <steps>.
-->
<xsl:template name="epilogue">
<xsl:if test="position() != last()">
<if-del-on-fail>
<command>trap '' EXIT</command>
</if-del-on-fail>
</xsl:if>
</xsl:template>
<!--
builddir - override <builddir> to accept a full path
Usage: <builddir>/tmp/wx/foobar</builddir>
Normally builddir is a single directory name not a full path. Override
to allow a working directory to be selected on the remote testdrive
machine.
The actual builddir (i.e. last part 'foobar') as usual must be unique
across all the builds of all the slaves.
-->
<xsl:template name="builddir">
<xsl:param name="content"/>
<builddir>
<basename><xsl:copy-of select="$content"/></basename>
</builddir>
</xsl:template>
<!--
Put builds under /tmp/wx on the remote machines by default.
If the <builddir> element specifies a full path then returns that
as-is, otherwise prepends '/tmp/wx/'.
-->
<xsl:template name="get-builddir">
<xsl:variable name="builddir"><get name="builddir"/></xsl:variable>
<xsl:if test="substring($builddir, 1, 1) != '/'">
<xsl:text>/tmp/wx/</xsl:text>
</xsl:if>
<xsl:value-of select="$builddir"/>
</xsl:template>
<!--
basename - returns the final component of a path
Usage: <basename>/foo/bar</basename>
Evaluates to 'bar'.
-->
<xsl:template name="basename">
<xsl:param name="path"/>
<xsl:choose>
<xsl:when test="contains($path, '/')">
<xsl:call-template name="basename">
<xsl:with-param name="path" select="substring-after($path, '/')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$path"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</bot>