]> git.saurik.com Git - wxWidgets.git/commitdiff
Add support for the Windows Testdrive machines, and other improvments.
authorMichael Wetherell <mike.wetherell@ntlworld.com>
Wed, 12 Dec 2007 21:41:56 +0000 (21:41 +0000)
committerMichael Wetherell <mike.wetherell@ntlworld.com>
Wed, 12 Dec 2007 21:41:56 +0000 (21:41 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50673 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

build/buildbot/config/common.xml
build/buildbot/config/example.xml
build/buildbot/config/include.xml [deleted file]
build/buildbot/config/include/defs.xml [new file with mode: 0644]
build/buildbot/config/include/testdrive-unix.xml [new file with mode: 0644]
build/buildbot/config/include/testdrive-win.xml [new file with mode: 0644]
build/buildbot/config/include/testdrive.xml [new file with mode: 0644]
build/buildbot/config/testdrive-inc.xml [deleted file]
build/buildbot/config/testdrive-unix.xml [new file with mode: 0644]
build/buildbot/config/testdrive.xml [deleted file]
build/buildbot/tools/embedded.xsl

index 3a8c77787fc84a7d6b223cd8c8f2f6e87c53f24c..c2f94913ab7cf2efb4e5d079be588e83bc284f44 100644 (file)
@@ -9,12 +9,9 @@
     Licence:    wxWidgets licence
 -->
 
     Licence:    wxWidgets licence
 -->
 
-<bot xmlns:xi="http://www.w3.org/2001/XInclude"
-     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-     xmlns:exsl="http://exslt.org/common"
-     xsl:version="1.0">
+<bot xmlns:xi="http://www.w3.org/2001/XInclude">
 
 
-<xi:include href="include.xml" xpointer="xpointer(*/*)"/>
+<xi:include href="include/defs.xml"/>
 
 <!--
     Quick schedulers. Builds using these are triggered after each change to
 
 <!--
     Quick schedulers. Builds using these are triggered after each change to
     one if it should run several times a week on particular days.
 -->
 
     one if it should run several times a week on particular days.
 -->
 
-<nightly>
-    <name>sunday_6am</name>
-    <hour>6</hour>
-    <dayOfWeek>0</dayOfWeek>
-</nightly>
-
-<nightly>
-    <name>monday_6am</name>
-    <hour>6</hour>
-    <dayOfWeek>1</dayOfWeek>
-</nightly>
-
-<nightly>
-    <name>tuesday_6am</name>
-    <hour>6</hour>
-    <dayOfWeek>2</dayOfWeek>
-</nightly>
-
-<nightly>
-    <name>wednesday_6am</name>
-    <hour>6</hour>
-    <dayOfWeek>3</dayOfWeek>
-</nightly>
-
-<nightly>
-    <name>thursday_6am</name>
-    <hour>6</hour>
-    <dayOfWeek>4</dayOfWeek>
-</nightly>
-
-<nightly>
-    <name>friday_6am</name>
-    <hour>6</hour>
-    <dayOfWeek>5</dayOfWeek>
-</nightly>
-
-<nightly>
-    <name>saturday_6am</name>
-    <hour>6</hour>
-    <dayOfWeek>6</dayOfWeek>
-</nightly>
+<nightly-schedulers name="sunday"/>
+<nightly-schedulers name="monday"/>
+<nightly-schedulers name="tuesday"/>
+<nightly-schedulers name="wednesday"/>
+<nightly-schedulers name="thursday"/>
+<nightly-schedulers name="friday"/>
+<nightly-schedulers name="saturday"/>
 
 <!--
     Schedulers for daily builds.
 -->
 
 
 <!--
     Schedulers for daily builds.
 -->
 
-<nightly>
-    <name>daily_6am</name>
-    <hour>6</hour>
-</nightly>
+<nightly-schedulers name="daily"/>
 
 <!--
     Track SVN changes using the wx-cvs mailing list.
 
 <!--
     Track SVN changes using the wx-cvs mailing list.
index e7bde42b32d2c67375079274d1c51c8f9d4fedb0..344c8abc92ceaedfa9a8173caf164a3caa8409d8 100644 (file)
     http://www.wxwidgets.org/wiki/index.php/Development:_Buildbot
 -->
 
     http://www.wxwidgets.org/wiki/index.php/Development:_Buildbot
 -->
 
-<bot xmlns:xi="http://www.w3.org/2001/XInclude"
-     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-     xmlns:exsl="http://exslt.org/common"
-     xsl:version="1.0">
+<bot xmlns:xi="http://www.w3.org/2001/XInclude">
 
 <!--
     Common declarations.
 -->
 
 <!--
     Common declarations.
 -->
-<xi:include href="include.xml" xpointer="xpointer(*/*)"/>
+<xi:include href="include/defs.xml"/>
 
 <!--
     Notes:
 
 <!--
     Notes:
     <name>Linux x86_64 wxGTK Stable</name>
 
     <!--
     <name>Linux x86_64 wxGTK Stable</name>
 
     <!--
-        Unique. The name of a directory for the bulid. On most slaves must
-        be a single name, on the Testdrive builds it must be a path such as
-        '/tmp/wx/td_gtk'.
+        Unique. The name of a directory for the bulid.
     -->
     <builddir>example_gtk</builddir>
 
     <!--
     -->
     <builddir>example_gtk</builddir>
 
     <!--
-        The name of a scheduler that will trigger this build. The schedulers
-        are usually defined in common.xml, look in there to see if there is
-        already one you can use, and add a new one if not.
+        The name of a scheduler that will trigger this build. common.xml
+        currently defines:
+        
+        * 'trunk_quick' and 'stable_quick'. These trigger a build after
+          every source change on the trunk and stable branches respectively.
 
 
-        The 'trunk_quick' and 'stable_quick' schedulers currently in
-        common.xml trigger a build after every source change on the trunk
-        and stable branches respectively. There are also daily and weekly
-        schedulers 'daily_6am', 'monday_6am', 'tuesday_6am' and so on.
+        * Weekly schedulers that fire once a week. There is one of these
+          for every half hour of the week, e.g. you have monday_0600,
+          monday_0630, etc..
+
+        * Daily schedulers that fire once a day. There is also one of these
+          for every half hour, e.g. daily_0600, daily_0630, etc..
+
+        An empty <scheduler/> element takes its value from the previous build
+        incremented in the following way:
+        
+        * Weekly schedulers are incremented by a day, monday_0600 becomes
+          tuesday_0600, and at the end of the week the time is also bumped by
+          an hour, saturday_0600 becomes sunday_0700.
+
+        * Daily scheduler are incremented by an hour.
 
         The <scheduler> element can be omitted, in which case the build
         never runs automatically, but can still be triggered manually.
         Or you can use several, e.g. you could use two weekly schedulers
         that fire on different days to have a build run twice a week.
     -->
 
         The <scheduler> element can be omitted, in which case the build
         never runs automatically, but can still be triggered manually.
         Or you can use several, e.g. you could use two weekly schedulers
         that fire on different days to have a build run twice a week.
     -->
-    <scheduler>trunk_quick</scheduler>
+    <scheduler>monday_0600</scheduler>
 
     <!--
         The meaning of <sandbox> is specific to the build slave. There
 
     <!--
         The meaning of <sandbox> is specific to the build slave. There
         <configure/>
 
         <!--
         <configure/>
 
         <!--
-            Compile the library. For Windows builds use <compile-msw/>
-            instead which runs the make command in the 'build\msw'
-            subdirectory instead of the wxWidgets root.
-        -->
-        <compile/>
-
-        <!--
-            Compile subdirectories. There is also <compile-contrib/> for
-            branches that have contrib.
+            Compile the wxWidgets library, subdirectories and tests.
+
+            Takes the following attributes which can all be either 'true' or
+            'false':
+                wx          - build the library
+                samples     - build the samples
+                utils       - build the utils
+                demos       - build the demos
+                contrib     - build the contrib
+                tests       - build the tests
+                msw         - the library makefile is under build\msw
+                gui         - if 'false' builds only a subset of the above
+
+            The attributes usually default to the right values.
         -->
         -->
-        <compile-samples/>
-        <compile-utils/>
-        <compile-tests/>
+        <compile-all/>
 
         <!--
 
         <!--
-            Run the test suites. For Windows builds the command to run the
-            test suite must be overridden, e.g.:
-                <run-tests>
-                    <command>PATH=..\lib\vc_dll;%PATH%</command>
-                    <command>cd tests</command>
-                    <command>vc_msw\test</command>
-                    <command>vc_msw\test_gui</command>
-                </run-tests>
+            Run the test suites.
         -->
         <run-tests/>
     </steps>
         -->
         <run-tests/>
     </steps>
diff --git a/build/buildbot/config/include.xml b/build/buildbot/config/include.xml
deleted file mode 100644 (file)
index 03e17fd..0000000
+++ /dev/null
@@ -1,340 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
-    Name:       include.xml
-    Purpose:    Common declarations for buildbot
-    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"
-     xmlns:exsl="http://exslt.org/common"
-     xsl:version="1.0">
-
-<!--
-    Constants
--->
-<xsl:template name="SVN_URL">http://svn.wxwidgets.org/svn/wx/wxWidgets/</xsl:template>
-<xsl:template name="STABLE_BRANCH">branches/WX_2_8_BRANCH</xsl:template>
-<xsl:variable name="STABLE_BRANCH"><STABLE_BRANCH/></xsl:variable>
-
-<!--
-    checkout - build step for source checkout.
-
-    Usage: as <svn> with defaults for <baseURL> and <defaultBranch>
-
-    Typically just:
-        <checkout/>
-    for the trunk, or:
-        <checkout branch="branches/WX_2_8_BRANCH"/>
-    to checkout a branch.
--->
-<xsl:template name="checkout">
-    <xsl:param name="content"/>
-    <xsl:param name="branch" select="'trunk'"/>
-    <xsl:variable name="nodes" select="exsl:node-set($content)"/>
-    <svn>
-        <xsl:if test="not($nodes/svnurl)">
-            <xsl:if test="not($nodes/baseURL)">
-                <baseURL><SVN_URL/></baseURL>
-            </xsl:if>
-            <xsl:if test="not($nodes/defaultBranch)">
-                <defaultBranch><xsl:value-of select="$branch"/></defaultBranch>
-            </xsl:if>
-        </xsl:if>
-        <xsl:copy-of select="$content"/>
-    </svn>
-</xsl:template>
-
-<!--
-    configure - add the options attribute to <configure>
-
-    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 <xsl:value-of select="$options"/></command>
-        </copy-with-defaults>
-    </configure>
-</xsl:template>
-
-<!--
-    make - specify the make command.
-
-    Usage: <make>nmake -f makefile.vc SHARED=1</make>
-
-    Used as a child of <build> to specify the make command used by the
-    <compile> elements below, if omitted 'make' is used.
--->
-<xsl:template name="make"/>
-
-<!--
-    compile - modifiy <compile> to default to the command given by <make>
-
-    Usage: as <compile>
-
-    The <make> element of <build> spcecifies the make command used by all
-    compile build steps in the build. If <make> is not given 'make' is used.
-
-    The command for a particular compile build step can be further overridden
-    using its <command> element:
-        <compile>
-            <command>myscript</command>
-        </compile>
--->
-<xsl:template name="compile">
-    <xsl:param name="content"/>
-    <compile>
-        <copy-with-defaults content="{$content}">
-            <command><get name="make" default="make"/></command>
-        </copy-with-defaults>
-    </compile>
-</xsl:template>
-
-<!--
-    Compile build steps for the usual subdirectories.
-
-    Usage: as <compile>
-
-    Typically just:
-        <compile-msw/>
-        <compile-samples/>
-        <compile-utils/>
-        <compile-contrib/>
-        <compile-tests/>
-
-    By default the compile command produced is:
-        cd foobar && make
-    As above, the 'make' part can be overridden using the <make> element or
-    the whole command line can be replaced using <command>.
-
-    <compile-msw> and <compile-tests> halt the build on failure, the others
-    continue with the next step (can be overridden by <haltOnFailure>).
--->
-<xsl:template name="compile-msw">
-    <xsl:param name="content"/>
-    <compile-subdir dir="build\msw" halt="true">
-        <xsl:copy-of select="$content"/>
-    </compile-subdir>
-</xsl:template>
-
-<xsl:template name="compile-samples">
-    <xsl:param name="content"/>
-    <compile-subdir dir="samples">
-        <xsl:copy-of select="$content"/>
-    </compile-subdir>
-</xsl:template>
-
-<xsl:template name="compile-utils">
-    <xsl:param name="content"/>
-    <compile-subdir dir="utils">
-        <xsl:copy-of select="$content"/>
-    </compile-subdir>
-</xsl:template>
-
-<xsl:template name="compile-contrib">
-    <xsl:param name="content"/>
-    <compile-subdir dir="contrib">
-        <xsl:copy-of select="$content"/>
-    </compile-subdir>
-</xsl:template>
-
-<xsl:template name="compile-tests">
-    <xsl:param name="content"/>
-    <compile-subdir dir="tests" halt="true">
-        <xsl:copy-of select="$content"/>
-    </compile-subdir>
-</xsl:template>
-
-<!--
-    compile-subdir - build step to compile a subdirectory.
-
-    Usage: as <compile> plus the following attributes,
-           <compile-subdir dir="foobar" [ halt="true" ]/>
-
-    Compiles the named subdirectory 'foobar'. Continues with the next build
-    step on failure, unless the optional attibute 'halt="true"' is given.
-    The make command used is as described for the compile steps above.
--->
-<xsl:template name="compile-subdir">
-    <xsl:param name="content"/>
-    <xsl:param name="dir"/>
-    <xsl:param name="halt" select="'false'"/>
-    <compile>
-        <defaults content="{$content}">
-            <name>
-                compile <xsl:value-of select="$dir"/>
-            </name>
-            <description>
-                compiling <xsl:value-of select="$dir"/>
-            </description>
-            <descriptionDone>
-                compile <xsl:value-of select="$dir"/>
-            </descriptionDone>
-            <haltOnFailure>
-                <xsl:value-of select="$halt"/>
-            </haltOnFailure>
-            <warnOnFailure/>
-        </defaults>
-        <copy-with-defaults content="{$content}">
-            <command>cd <xsl:value-of select="$dir"/> &amp;&amp; <get name="make" default="make"/></command>
-        </copy-with-defaults>
-    </compile>
-</xsl:template>
-
-<!--
-    run-tests - build step to run the test suites.
-
-    Usage: as <test>
-
-    For unix builds typically just:
-        <run-tests/>
-    or for Windows builds, e.g.:
-        <run-tests>
-            <command>PATH=..\lib\vc_lib;%PATH%</command>
-            <command>cd tests &amp;&amp; vc_msw\test</command>
-        </run-tests>
--->
-<xsl:template name="run-tests">
-    <xsl:param name="content"/>
-    <test>
-        <defaults content="{$content}">
-            <description>running tests</description>
-            <descriptionDone>run tests</descriptionDone>
-            <warnOnFailure/>
-        </defaults>
-        <copy-with-defaults content="{$content}">
-            <command><xi:include href="run-tests.sh" parse="text"/></command>
-        </copy-with-defaults>
-    </test>
-</xsl:template>
-
-<!--
-    defaults - supply default content for an element.
-
-    Usage: <defaults content="{$content}">
-               <foo>foo</foo>
-               <bar>bar</bar>
-           </defaults>
-
-    Copies those child elements that do not already exist in $content.
--->
-<xsl:template name="defaults">
-    <xsl:param name="defaults"/>
-    <xsl:param name="content"/>
-
-    <xsl:variable name="def-nodes" select="exsl:node-set($defaults)"/>
-    <xsl:variable name="cont-nodes" select="exsl:node-set($content)"/>
-
-    <xsl:for-each select="$def-nodes/*">
-        <xsl:if test="not($cont-nodes/*[name() = name(current())])">
-            <xsl:copy-of select="."/>
-        </xsl:if>
-    </xsl:for-each>
-</xsl:template>
-
-<!--
-    copy-with-defaults - copy elements supplying defaults for any that are
-                         missing or empty.
-
-    Usage: <copy-with-defaults content="{$content}">
-               <foo>foo</foo>
-               <bar>bar</bar>
-           </copy-with-defaults>
-
-    Copies $content plus any child elements that do not exist in $content,
-    substituting empty elements in $content with any child elements of the
-    same name.
--->
-<xsl:template name="copy-with-defaults">
-    <xsl:param name="defaults"/>
-    <xsl:param name="content"/>
-
-    <xsl:variable name="def-nodes" select="exsl:node-set($defaults)"/>
-    <xsl:variable name="cont-nodes" select="exsl:node-set($content)"/>
-
-    <xsl:for-each select="$def-nodes/*">
-        <xsl:if test="not($cont-nodes/*[name() = name(current())])">
-            <xsl:copy-of select="."/>
-        </xsl:if>
-    </xsl:for-each>
-
-    <xsl:for-each select="$cont-nodes/*">
-        <xsl:choose>
-            <xsl:when test="not(node())">
-                <xsl:copy-of select="$def-nodes/*[name() = name(current())]"/>
-            </xsl:when>
-            <xsl:otherwise>
-                <xsl:copy-of select="."/>
-            </xsl:otherwise>
-        </xsl:choose>
-    </xsl:for-each>
-</xsl:template>
-
-<!--
-    get - gets the value of a named element inside a <build>.
-
-    Usage: <get name="foobar" [ default="value" ]/>
-
-    Used inside a <build> evaluates to the value of the build's <foobar>
-    element, or to the value of the optional 'default' attribute if there is
-    no such element.
--->
-<xsl:template name="get">
-    <xsl:param name="content"/>
-    <xsl:param name="name"/>
-    <xsl:param name="default"/>
-    <strip>
-        <xsl:choose>
-            <xsl:when test="ancestor-or-self::build/*[name() = $name]">
-                <xsl:apply-templates select="ancestor-or-self::build/*[name() = $name]/node()"/>
-            </xsl:when>
-            <xsl:otherwise>
-                <xsl:value-of select="$default"/>
-            </xsl:otherwise>
-        </xsl:choose>
-    </strip>
-</xsl:template>
-
-<!--
-    strip - strips leading and trailing whitespace
-
-    Usage: <strip>
-               foobar
-           </strip>
-
-    Strips leading and trailing whitespace if the content is text only,
-    otherwise copies the content unchanged.
--->
-<xsl:template name="strip">
-    <xsl:param name="content"/>
-    <xsl:variable name="len" select="string-length($content)"/>
-    <xsl:variable name="norm" select="normalize-space($content)"/>
-    <xsl:variable name="normlen" select="string-length($norm)"/>
-    <xsl:choose>
-        <xsl:when test="exsl:node-set($content)/*">
-            <xsl:copy-of select="$content"/>
-        </xsl:when>
-        <xsl:when test="substring($content, 1, 1) != substring($norm, 1, 1)">
-            <xsl:call-template name="strip">
-                <xsl:with-param name="content" select="substring($content, 2)"/>
-            </xsl:call-template>
-        </xsl:when>
-        <xsl:when test="substring($content, $len, 1) != substring($norm, $normlen, 1)">
-            <xsl:call-template name="strip">
-                <xsl:with-param name="content" select="substring($content, 1, $len - 1)"/>
-            </xsl:call-template>
-        </xsl:when>
-        <xsl:otherwise>
-            <xsl:value-of select="$content"/>
-        </xsl:otherwise>
-    </xsl:choose>
-</xsl:template>
-
-</bot>
diff --git a/build/buildbot/config/include/defs.xml b/build/buildbot/config/include/defs.xml
new file mode 100644 (file)
index 0000000..98e14a9
--- /dev/null
@@ -0,0 +1,742 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+    Name:       include/defs.xml
+    Purpose:    Common declarations for buildbot
+    Author:     Mike Wetherell
+    RCS-ID:     $Id$
+    Copyright:  (c) 2007 Mike Wetherell
+    Licence:    wxWidgets licence
+-->
+
+<bot xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+     xmlns:exsl="http://exslt.org/common"
+     xmlns:func="http://exslt.org/functions"
+     xmlns:get="local"
+     xsl:extension-element-prefixes="func"
+     xsl:version="1.0">
+
+<!--
+    Constants
+-->
+<xsl:template name="SVN_URL">http://svn.wxwidgets.org/svn/wx/wxWidgets/</xsl:template>
+<xsl:template name="STABLE_BRANCH">branches/WX_2_8_BRANCH</xsl:template>
+<xsl:variable name="STABLE_BRANCH"><STABLE_BRANCH/></xsl:variable>
+
+<!--
+    checkout - build step for source checkout.
+
+    Usage: as <svn> with defaults for <baseURL> and <defaultBranch>
+
+    Typically just:
+        <checkout/>
+    for the trunk, or:
+        <checkout branch="branches/WX_2_8_BRANCH"/>
+    to checkout a branch.
+-->
+<xsl:template name="checkout">
+    <xsl:param name="content"/>
+    <xsl:param name="branch" select="'trunk'"/>
+    <xsl:variable name="nodes" select="exsl:node-set($content)"/>
+    <svn>
+        <xsl:if test="not($nodes/svnurl)">
+            <xsl:if test="not($nodes/baseURL)">
+                <baseURL><SVN_URL/></baseURL>
+            </xsl:if>
+            <xsl:if test="not($nodes/defaultBranch)">
+                <defaultBranch><xsl:value-of select="$branch"/></defaultBranch>
+            </xsl:if>
+        </xsl:if>
+        <xsl:copy-of select="$content"/>
+    </svn>
+</xsl:template>
+
+<!--
+    configure - add the options attribute to <configure>
+
+    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 <xsl:value-of select="normalize-space($options)"/></command>
+        </copy-with-defaults>
+    </configure>
+</xsl:template>
+
+<!--
+    make - specify the make command.
+
+    Usage: <make>nmake -f makefile.vc SHARED=1</make>
+
+    Used as a child of <build> to specify the make command used by the
+    <compile> elements below, if omitted 'make' is used.
+-->
+<xsl:template name="make"/>
+
+<!--
+    compile - modifiy <compile> to default to the command given by <make>
+
+    Usage: as <compile>
+
+    The <make> element of <build> spcecifies the make command used by all
+    compile build steps in the build. If <make> is not given 'make' is used.
+
+    The command for a particular compile build step can be further overridden
+    using its <command> element:
+        <compile>
+            <command>myscript</command>
+        </compile>
+-->
+<xsl:template name="compile">
+    <xsl:param name="content"/>
+    <compile>
+        <copy-with-defaults content="{$content}">
+            <command><get name="make" default="make"/></command>
+        </copy-with-defaults>
+    </compile>
+</xsl:template>
+
+<!--
+    Adds build steps to compile the library and the usual subdirectories.
+
+    Usage: as <compile> with the additional attributes below.
+
+    Usually the attributes default to suitable values, so typical usage
+    is just <compile-all/>.
+
+    <compile-all [ gui = 'true'|'false' ]
+                 [ msw = 'true'|'false' ]
+                 [ wx = 'true'|'false' ]
+                 [ samples = 'true'|'false' ]
+                 [ utils = 'true'|'false' ]
+                 [ demos = 'true'|'false' ]
+                 [ contrib = 'true'|'false' ]
+                 [ tests = 'true'|'false' ] />
+
+    gui     - if 'true' then build fully the subdirectories specified,
+              otherwise only the wxBase subset of the directories are built.
+    msw     - if 'true' then build the directory 'build/msw' when building the
+              library instead of the root.
+    wx      - build the library itself.
+    samples, utils, demos, contrib, tests
+            - build subdirectories.
+-->
+<xsl:template name="compile-all">
+    <xsl:param name="content"/>
+
+    <xsl:param name="gui"><is-gui/></xsl:param>
+    <xsl:param name="msw"><is-msw/></xsl:param>
+
+    <xsl:param name="wx" select="'true'"/>
+    <xsl:param name="samples" select="'true'"/>
+    <xsl:param name="utils" select="'true'"/>
+    <xsl:param name="demos" select="$gui"/>
+    <xsl:param name="contrib"><has-contrib/></xsl:param>
+    <xsl:param name="tests"><has-tests/></xsl:param>
+
+    <xsl:param name="wx-dirs">
+        <get-dirs wx="{$wx}" gui="{$gui}" msw="{$msw}"/>
+    </xsl:param>
+    <xsl:param name="sample-dirs">
+        <get-dirs samples="{$samples}" gui="{$gui}" msw="{$msw}"/>
+    </xsl:param>
+    <xsl:param name="util-dirs">
+        <get-dirs utils="{$utils}" gui="{$gui}" msw="{$msw}"/>
+    </xsl:param>
+    <xsl:param name="demo-dirs">
+        <get-dirs demos="{$demos}" gui="{$gui}" msw="{$msw}"/>
+    </xsl:param>
+    <xsl:param name="contrib-dirs">
+        <get-dirs contrib="{$contrib}" gui="{$gui}" msw="{$msw}"/>
+    </xsl:param>
+    <xsl:param name="test-dirs">
+        <get-dirs tests="{$tests}" gui="{$gui}" msw="{$msw}"/>
+    </xsl:param>
+
+    <compile-subdirs dirs="{$wx-dirs}" halt="true">
+        <xsl:copy-of select="$content"/>
+    </compile-subdirs>
+    <compile-subdirs name="samples" dirs="{$sample-dirs}">
+        <xsl:copy-of select="$content"/>
+    </compile-subdirs>
+    <compile-subdirs name="utils" dirs="{$util-dirs}">
+        <xsl:copy-of select="$content"/>
+    </compile-subdirs>
+    <compile-subdirs name="demos" dirs="{$demo-dirs}">
+        <xsl:copy-of select="$content"/>
+    </compile-subdirs>
+    <compile-subdirs name="contrib" dirs="{$contrib-dirs}">
+        <xsl:copy-of select="$content"/>
+    </compile-subdirs>
+    <compile-subdirs name="tests" dirs="{$test-dirs}" halt="true">
+        <xsl:copy-of select="$content"/>
+    </compile-subdirs>
+</xsl:template>
+
+<!--
+    Helper for compile-all.
+    Returns the directories that need to be built for the various components:
+    wx (the library itself), samples, utils, demos, contrib and tests.
+-->
+<xsl:template name="get-dirs">
+    <xsl:param name="contents"/>
+
+    <xsl:param name="gui"/>
+    <xsl:param name="msw"/>
+
+    <xsl:param name="wx"/>
+    <xsl:param name="samples"/>
+    <xsl:param name="utils"/>
+    <xsl:param name="demos"/>
+    <xsl:param name="contrib"/>
+    <xsl:param name="tests"/>
+
+    <xsl:if test="$wx = 'true'">
+        <xsl:choose>
+            <xsl:when test="$msw = 'true'">build/msw</xsl:when>
+            <xsl:otherwise>.</xsl:otherwise>
+        </xsl:choose>
+        <xsl:text> </xsl:text>
+    </xsl:if>
+
+    <xsl:if test="$samples = 'true'">
+        <xsl:choose>
+            <xsl:when test="$gui = 'true'">samples</xsl:when>
+            <xsl:otherwise>samples/console</xsl:otherwise>
+        </xsl:choose>
+        <xsl:text> </xsl:text>
+    </xsl:if>
+
+    <xsl:if test="$utils = 'true'">
+        <xsl:choose>
+            <xsl:when test="$gui = 'true'">utils</xsl:when>
+            <xsl:otherwise>utils/tex2rtf/src ../../HelpGen/src</xsl:otherwise>
+        </xsl:choose>
+        <xsl:text> </xsl:text>
+    </xsl:if>
+
+    <xsl:if test="$demos = 'true' and $gui = 'true'">demos </xsl:if>
+
+    <xsl:if test="$contrib = 'true' and $gui = 'true'">contrib </xsl:if>
+
+    <xsl:if test="$tests = 'true'">tests</xsl:if>
+</xsl:template>
+
+<!--
+    compile-subdir - build step to compile a subdirectory.
+
+    Usage: as <compile> plus the following attributes,
+           <compile-subdir dir="foobar" [ halt="true" ]/>
+
+    Compiles the named subdirectory 'foobar'. Continues with the next build
+    step on failure, unless the optional attibute 'halt="true"' is given.
+    The make command used is as described for the compile step above.
+-->
+<xsl:template name="compile-subdir">
+    <xsl:param name="content"/>
+    <xsl:param name="dir"/>
+    <xsl:param name="halt" select="'false'"/>
+    <compile-subdirs name="{$dir}" dirs="{$dir}" halt="{$halt}">
+        <xsl:copy-of select="$content"/>
+    </compile-subdirs>
+</xsl:template>
+
+<!--
+    compile-subdirs - adds a compile build step for each directory in a list.
+
+    Usage: as <compile> plus the following attributes,
+           <compile-subdir dirs="foobar1 foobar2"
+                           [ name="foobars" ]
+                           [ sep=" " ]
+                           [ halt="true" ]/>
+
+    Compiles the named subdirectories. Continues with the next build
+    step on failure, unless the optional attibute 'halt="true"' is given.
+    The make command used is as described for the compile step above.
+    The 'name' attribute can be used to give a collective name for the
+    subdirectories, and the 'sep' attibute can be used to specify the
+    separator in the 'dirs' list (defaults to space).
+-->
+<xsl:template name="compile-subdirs">
+    <xsl:param name="content"/>
+    <xsl:param name="name"/>
+    <xsl:param name="dirs"/>
+    <xsl:param name="sep" select="' '"/>
+    <xsl:param name="halt" select="'false'"/>
+    <xsl:if test="translate($dirs, $sep, '')">
+        <compile>
+            <defaults content="{$content}">
+                <name>
+                    <xsl:value-of select="normalize-space(concat('compile ', $name))"/>
+                </name>
+                <description>
+                    <xsl:value-of select="normalize-space(concat('compiling ', $name))"/>
+                </description>
+                <descriptionDone>
+                    <xsl:value-of select="normalize-space(concat('compile ', $name))"/>
+                </descriptionDone>
+                <haltOnFailure>
+                    <xsl:value-of select="$halt"/>
+                </haltOnFailure>
+                <warnOnFailure/>
+            </defaults>
+            <copy-with-defaults content="{$content}">
+                <command>
+                    <compile-subdirs-cmd dirs="{$dirs}" sep="{$sep}"/>
+                </command>
+            </copy-with-defaults>
+        </compile>
+    </xsl:if>
+</xsl:template>
+
+<xsl:template name="compile-subdirs-cmd">
+    <xsl:param name="content"/>
+    <xsl:param name="dirs"/>
+    <xsl:param name="sep"/>
+    <xsl:choose>
+        <xsl:when test="contains($dirs, $sep)">
+            <xsl:variable name="before" select="substring-before($dirs, $sep)"/>
+            <xsl:variable name="after" select="substring-after($dirs, $sep)"/>
+
+            <xsl:call-template name="compile-subdirs-cmd">
+                <xsl:with-param name="dirs" select="$before"/>
+                <xsl:with-param name="sep" select="$sep"/>
+            </xsl:call-template>
+
+            <xsl:if test="$after and substring($after, 1, 1) != ' '">
+                <xsl:text> &amp;&amp; </xsl:text>
+            </xsl:if>
+
+            <xsl:call-template name="compile-subdirs-cmd">
+                <xsl:with-param name="dirs" select="$after"/>
+                <xsl:with-param name="sep" select="$sep"/>
+            </xsl:call-template>
+        </xsl:when>
+        <xsl:when test="string($dirs)">
+            <xsl:if test="$dirs != '.'">cd <xsl:value-of select="$dirs"/> &amp;&amp; </xsl:if>
+            <get name="make" default="make"/>
+        </xsl:when>
+    </xsl:choose>
+</xsl:template>
+
+<!--
+    run-tests - build step to run the test suites.
+
+    Usage: as <test>
+
+    Typically just:
+        <run-tests/>
+-->
+<xsl:template name="run-tests">
+    <xsl:param name="content"/>
+    <xsl:param name="msw"><is-msw/></xsl:param>
+    <test>
+        <defaults content="{$content}">
+            <description>running tests</description>
+            <descriptionDone>run tests</descriptionDone>
+            <warnOnFailure/>
+        </defaults>
+        <copy-with-defaults content="{$content}">
+            <command>
+                <xsl:choose>
+                    <xsl:when test="$msw = 'true'">
+                        <run-tests-win/>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <run-tests-unix/>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </command>
+        </copy-with-defaults>
+    </test>
+</xsl:template>
+
+<!--
+    We need to add something to the wxWidgets sources to run the tests with a
+    simple command so that these aren't necessary.
+-->
+<xsl:template name="run-tests-win">
+<normalize-space>
+cd tests &amp;&amp;
+(for /d %x in (..\lib\*_dll) do @PATH=%x;%PATH%) &amp;&amp;
+(for /d %x in (*) do @if exist %x\test.exe %x\test) &amp;&amp;
+(for /d %x in (*) do @if exist %x\test_gui.exe %x\test_gui)
+</normalize-space>
+</xsl:template>
+
+<xsl:template name="run-tests-unix">
+<normalize-space>
+cd tests &amp;&amp;
+./test &amp;&amp;
+if [ -x test_gui ]; then ./test_gui; fi
+</normalize-space>
+</xsl:template>
+
+<!--
+    defaults - supply default content for an element.
+
+    Usage: <defaults content="{$content}">
+               <foo>foo</foo>
+               <bar>bar</bar>
+           </defaults>
+
+    Copies those child elements that do not already exist in $content.
+-->
+<xsl:template name="defaults">
+    <xsl:param name="defaults"/>
+    <xsl:param name="content"/>
+
+    <xsl:variable name="def-nodes" select="exsl:node-set($defaults)"/>
+    <xsl:variable name="cont-nodes" select="exsl:node-set($content)"/>
+
+    <xsl:for-each select="$def-nodes/*">
+        <xsl:if test="not($cont-nodes/*[name() = name(current())])">
+            <xsl:copy-of select="."/>
+        </xsl:if>
+    </xsl:for-each>
+</xsl:template>
+
+<!--
+    copy-with-defaults - copy elements supplying defaults for any that are
+                         missing or empty.
+
+    Usage: <copy-with-defaults content="{$content}">
+               <foo>foo</foo>
+               <bar>bar</bar>
+           </copy-with-defaults>
+
+    Copies $content plus any child elements that do not exist in $content,
+    substituting empty elements in $content with any child elements of the
+    same name.
+-->
+<xsl:template name="copy-with-defaults">
+    <xsl:param name="defaults"/>
+    <xsl:param name="content"/>
+
+    <xsl:variable name="def-nodes" select="exsl:node-set($defaults)"/>
+    <xsl:variable name="cont-nodes" select="exsl:node-set($content)"/>
+
+    <xsl:for-each select="$def-nodes/*">
+        <xsl:if test="not($cont-nodes/*[name() = name(current())])">
+            <xsl:copy-of select="."/>
+        </xsl:if>
+    </xsl:for-each>
+
+    <xsl:for-each select="$cont-nodes/*">
+        <xsl:choose>
+            <xsl:when test="not(node())">
+                <xsl:copy-of select="$def-nodes/*[name() = name(current())]"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:copy-of select="."/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:for-each>
+</xsl:template>
+
+<!--
+    get - gets the text from a child element of the current build.
+
+    Usage: <get name="foobar" [ default="value" ]/>
+
+    Gets the text from the <foobar> element of the current build, or returns
+    $default if there is not such element.
+-->
+<xsl:template name="get">
+    <xsl:param name="content"/>
+    <xsl:param name="build" select="get:build()"/>
+    <xsl:param name="name"/>
+    <xsl:param name="default"/>
+    <xsl:variable name="property" select="get:property($name, $build)"/>
+    <strip>
+        <xsl:choose>
+            <xsl:when test="$property">
+                <xsl:apply-templates select="$property/node()"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:value-of select="$default"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </strip>
+</xsl:template>
+
+<!--
+    Accessors to get builds and their fields. XSLT code should use these
+    instead of traversing the input tree directly.
+-->
+<func:function name="get:build">
+    <func:result select="ancestor-or-self::build[last()]"/>
+</func:function>
+
+<func:function name="get:all-builds">
+    <func:result select="//build[not(ancestor::*[name() != name(/*)])]"/>
+</func:function>
+
+<func:function name="get:preceding-builds">
+    <func:result select="get:build()/preceding-sibling::build"/>
+</func:function>
+
+<func:function name="get:property">
+    <xsl:param name="name"/>
+    <xsl:param name="build" select="get:build()"/>
+    <func:result select="$build/*[name() = $name]"/>
+</func:function>
+
+<func:function name="get:step">
+    <xsl:param name="name"/>
+    <xsl:param name="build" select="get:build()"/>
+    <func:result select="get:property('steps', $build)/*[name() = $name]"/>
+</func:function>
+
+<!--
+    Returns true if this is an msw build.
+-->
+<xsl:template name="is-msw">
+    <xsl:param name="content"/>
+    <xsl:param name="build" select="get:build()"/>
+    <xsl:value-of select="not(get:step('configure', $build))"/>
+</xsl:template>
+
+<!--
+    Returns true if this a gui build.
+-->
+<xsl:template name="is-gui">
+    <xsl:param name="content"/>
+    <xsl:param name="build" select="get:build()"/>
+    <xsl:variable name="make"><get name="make" build="{$build}"/></xsl:variable>
+    <xsl:variable name="configure"><xsl:apply-templates select="get:step('configure', $build)"/></xsl:variable>
+    <xsl:value-of select="not(contains($make, 'USE_GUI=0') or contains($configure, '--disable-gui'))"/>
+</xsl:template>
+
+<!--
+    Returns true if the branch we're building has a contrib subdirectory.
+-->
+<xsl:template name="has-contrib">
+    <xsl:param name="content"/>
+    <xsl:param name="build" select="get:build()"/>
+    <xsl:variable name="checkout"><xsl:apply-templates select="get:step('checkout', $build)"/></xsl:variable>
+    <xsl:value-of select="contains($checkout, 'WX_2_') and not(contains($checkout, 'WX_2_9_'))"/>
+</xsl:template>
+
+<!--
+    Returns true if the build should build the test suite.
+-->
+<xsl:template name="has-tests">
+    <xsl:param name="content"/>
+    <xsl:param name="build" select="get:build()"/>
+    <xsl:variable name="configure"><xsl:apply-templates select="get:step('configure', $build)"/></xsl:variable>
+    <xsl:value-of select="get:step('run-tests', $build) or contains($configure, '--host=')"/>
+</xsl:template>
+
+<!--
+    strip - strips leading and trailing whitespace
+
+    Usage: <strip>
+               foobar
+           </strip>
+
+    Converts to text and strips leading and trailing whitespace.
+-->
+<xsl:template name="strip">
+    <xsl:param name="content"/>
+    <xsl:variable name="len" select="string-length($content)"/>
+    <xsl:variable name="norm" select="normalize-space($content)"/>
+    <xsl:variable name="normlen" select="string-length($norm)"/>
+    <xsl:choose>
+        <xsl:when test="substring($content, 1, 1) != substring($norm, 1, 1)">
+            <xsl:call-template name="strip">
+                <xsl:with-param name="content" select="substring($content, 2)"/>
+            </xsl:call-template>
+        </xsl:when>
+        <xsl:when test="substring($content, $len, 1) != substring($norm, $normlen, 1)">
+            <xsl:call-template name="strip">
+                <xsl:with-param name="content" select="substring($content, 1, $len - 1)"/>
+            </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+            <xsl:value-of select="$content"/>
+        </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<!--
+    normalize-space - normalises whitespace.
+
+    Usage: <normalize-space>
+               foobar
+           </normalize-space>
+
+    Converts to text, strips leading and trailing whitespace and replaces
+    sequences of whitespace characters by a single space.
+-->
+<xsl:template name="normalize-space">
+    <xsl:param name="content"/>
+    <xsl:value-of select="normalize-space($content)"/>
+</xsl:template>
+
+<!--
+    lower-case - converts to lower case.
+
+    Usage: <lower-case>FooBar</lower-case>
+-->
+<xsl:template name="lower-case">
+    <xsl:param name="content"/>
+    <xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable>
+    <xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
+    <xsl:value-of select="translate($content, $upper, $lower)"/>
+</xsl:template>
+
+<!--
+    Helpers to convert between day numbers and names.
+-->
+<xsl:template name="day-number">
+    <xsl:param name="content"/>
+    <xsl:param name="name"/>
+    <xsl:choose>
+        <xsl:when test="$name = 'sunday'">0</xsl:when>
+        <xsl:when test="$name = 'monday'">1</xsl:when>
+        <xsl:when test="$name = 'tuesday'">2</xsl:when>
+        <xsl:when test="$name = 'wednesday'">3</xsl:when>
+        <xsl:when test="$name = 'thursday'">4</xsl:when>
+        <xsl:when test="$name = 'friday'">5</xsl:when>
+        <xsl:when test="$name = 'saturday'">6</xsl:when>
+    </xsl:choose>
+</xsl:template>
+
+<xsl:template name="day-name">
+    <xsl:param name="content"/>
+    <xsl:param name="number"/>
+    <xsl:choose>
+        <xsl:when test="$number = '0'">sunday</xsl:when>
+        <xsl:when test="$number = '1'">monday</xsl:when>
+        <xsl:when test="$number = '2'">tuesday</xsl:when>
+        <xsl:when test="$number = '3'">wednesday</xsl:when>
+        <xsl:when test="$number = '4'">thursday</xsl:when>
+        <xsl:when test="$number = '5'">friday</xsl:when>
+        <xsl:when test="$number = '6'">saturday</xsl:when>
+    </xsl:choose>
+</xsl:template>
+
+<!--
+    Helpers to convert between time in the format 'hhmm' and an integer
+    count of the minutes since midnight.
+-->
+<xsl:template name="time-minutes">
+    <xsl:param name="content"/>
+    <xsl:param name="hhmm"/>
+    <xsl:if test="string-length($hhmm) = 4 and format-number($hhmm, '0000') = $hhmm">
+        <xsl:variable name="hour" select="substring($hhmm, 1, 2)"/>
+        <xsl:variable name="min" select="substring($hhmm, 3, 2)"/>
+        <xsl:if test="$hour >= 0 and $hour &lt; 24 and $min >= 0 and $min &lt; 60">
+            <xsl:value-of select="$hour * 60 + $min"/>
+        </xsl:if>
+    </xsl:if>
+</xsl:template>
+
+<xsl:template name="time-hhmm">
+    <xsl:param name="content"/>
+    <xsl:param name="minutes"/>
+    <xsl:value-of select="format-number(floor($minutes div 60) * 100 + $minutes mod 60, '0000')"/>
+</xsl:template>
+
+<!--
+    Create schedulers.
+-->
+<xsl:template name="nightly-schedulers">
+    <xsl:param name="content"/>
+    <xsl:param name="name"/>
+    <xsl:param name="day"><day-number name="{$name}"/></xsl:param>
+    <xsl:param name="hour" select="0"/>
+    <xsl:param name="minute" select="0"/>
+    <xsl:param name="step" select="30"/>
+
+    <xsl:if test="$hour &lt; 24">
+        <nightly>
+            <name>
+                <xsl:value-of select="concat($name, '_', format-number($hour, '00'), format-number($minute, '00'))"/>
+            </name>
+            <hour>
+                <xsl:value-of select="$hour"/>
+            </hour>
+            <minute>
+                <xsl:value-of select="$minute"/>
+            </minute>
+            <xsl:if test="$day != ''">
+                <dayOfWeek>
+                    <xsl:value-of select="$day"/>
+                </dayOfWeek>
+            </xsl:if>
+        </nightly>
+        <xsl:variable name="next" select="$hour * 60 + $minute + $step"/>
+        <xsl:call-template name="nightly-schedulers">
+            <xsl:with-param name="name" select="$name"/>
+            <xsl:with-param name="day" select="$day"/>
+            <xsl:with-param name="hour" select="floor($next div 60)"/>
+            <xsl:with-param name="minute" select="$next mod 60"/>
+            <xsl:with-param name="step" select="$step"/>
+        </xsl:call-template>
+    </xsl:if>
+</xsl:template>
+
+<!--
+    scheduler - provide default for the <scheduler> build element.
+-->
+<xsl:template name="scheduler">
+    <xsl:param name="content"/>
+    <xsl:param name="previous" select="get:property('scheduler', get:preceding-builds()[last()])"/>
+    <xsl:param name="step" select="60"/>
+
+    <xsl:choose>
+        <xsl:when test="exsl:node-set($content)/node()">
+            <scheduler>
+                <xsl:copy-of select="$content"/>
+            </scheduler>
+        </xsl:when>
+        <xsl:otherwise>
+            <xsl:for-each select="$previous">
+                <xsl:variable name="text">
+                    <xsl:apply-templates select="."/>
+                </xsl:variable>
+                <scheduler>
+                    <scheduler-subst text="{$text}" step="{$step}"/>
+                </scheduler>
+            </xsl:for-each>
+        </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<xsl:template name="scheduler-subst">
+    <xsl:param name="content"/>
+    <xsl:param name="text"/>
+    <xsl:param name="step"/>
+
+    <xsl:variable name="name" select="substring-before($text, '_')"/>
+    <xsl:variable name="hhmm" select="substring-after($text, '_')"/>
+    <xsl:variable name="day"><day-number name="{$name}"/></xsl:variable>
+    <xsl:variable name="mins"><time-minutes hhmm="{$hhmm}"/></xsl:variable>
+
+    <xsl:choose>
+        <xsl:when test="$mins = ''">
+            <xsl:value-of select="$text"/>
+        </xsl:when>
+        <xsl:when test="$day = ''">
+            <xsl:value-of select="$name"/>
+            <xsl:text>_</xsl:text>
+            <time-hhmm minutes="{$mins + $step}"/>
+        </xsl:when>
+        <xsl:otherwise>
+            <xsl:variable name="day-mins" select="24 * 60"/>
+            <xsl:variable name="week-mins" select="7 * $day-mins"/>
+            <xsl:variable name="tmp" select="($day + 1) * $day-mins + $mins"/>
+            <xsl:variable name="next" select="$tmp mod $week-mins + floor($tmp div $week-mins) * $step"/>
+            <day-name number="{floor($next div $day-mins)}"/>
+            <xsl:text>_</xsl:text>
+            <time-hhmm minutes="{$next mod $day-mins}"/>
+        </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+</bot>
diff --git a/build/buildbot/config/include/testdrive-unix.xml b/build/buildbot/config/include/testdrive-unix.xml
new file mode 100644 (file)
index 0000000..7ad24c8
--- /dev/null
@@ -0,0 +1,210 @@
+<?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>
+
+<!--
+    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 90M
+fi
+cd $BUILDDIR
+<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>
diff --git a/build/buildbot/config/include/testdrive-win.xml b/build/buildbot/config/include/testdrive-win.xml
new file mode 100644 (file)
index 0000000..867887d
--- /dev/null
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+    Name:       include/testdrive-win.xml
+    Purpose:    Declarations for the testdrive Windows 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>
+if exist "%BUILDDIR%" (rmdir /s/q "%BUILDDIR%" || exit 1)
+xcopy /s/q/i . "%BUILDDIR%" || (rmdir /s/q "%BUILDDIR%" &amp; exit 1)
+</command>
+</xsl:template>
+
+<!--
+    profile - see <steps>.
+-->
+<xsl:template name="profile">
+<command>
+set BUILDDIR=%USERPROFILE%\build
+</command>
+</xsl:template>
+
+<!--
+    prologue - see <steps>.
+-->
+<xsl:template name="prologue">
+    <xsl:param name="content"/>
+    <xsl:param name="build"/>
+    <xsl:variable name="name">
+        <lower-case>
+            <get name="name" build="{$build}"/>
+        </lower-case>
+    </xsl:variable>
+    <command>
+        <xsl:choose>
+            <xsl:when test="contains($name, 'vc++') or contains($name, 'msvc')">
+                <prologue-msvc/>
+            </xsl:when>
+            <xsl:when test="contains($name, 'cygwin')">
+                <prologue-cygwin/>
+            </xsl:when>
+            <xsl:otherwise>
+                <prologue-default/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </command>
+</xsl:template>
+
+<xsl:template name="prologue-msvc">
+call "C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\SetEnv.Cmd" /SRV64
+set LINK=bufferoverflowu.lib
+cd /d "%BUILDDIR%"
+</xsl:template>
+
+<xsl:template name="prologue-cygwin">
+call h:\cygwin\cyg-vars.bat
+cd /d "%BUILDDIR%"
+sh -c \
+</xsl:template>
+
+<xsl:template name="prologue-default">
+cd /d "%BUILDDIR%"
+</xsl:template>
+
+<!--
+    epilogue - see <steps>.
+-->
+<xsl:template name="epilogue">
+    <xsl:choose>
+        <xsl:when test="position() = last()">
+            <command>
+                <cleanup/>
+            </command>
+        </xsl:when>
+        <xsl:otherwise>
+            <if-del-on-fail>
+                <command>
+                    if ERRORLEVEL 1 (<cleanup/>)
+                </command>
+            </if-del-on-fail>
+        </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<xsl:template name="cleanup">
+cd /d "%USERPROFILE%" &amp; rmdir /s/q "%BUILDDIR%" &amp; exit %ERRORLEVEL%
+</xsl:template>
+
+</bot>
diff --git a/build/buildbot/config/include/testdrive.xml b/build/buildbot/config/include/testdrive.xml
new file mode 100644 (file)
index 0000000..e9f7c9f
--- /dev/null
@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+    Name:       include/testdrive.xml
+    Purpose:    Declarations for the testdrive build slaves
+    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"
+     xmlns:exsl="http://exslt.org/common"
+     xmlns:get="local"
+     xsl:version="1.0">
+
+<xi:include href="defs.xml"/>
+
+<!--
+    build - add a default <sandbox> element, the same as the previous build.
+-->
+<xsl:template name="build">
+    <xsl:param name="content"/>
+    <build>
+        <defaults content="{$content}">
+            <xsl:apply-templates select="get:property('sandbox', get:preceding-builds())[last()]"/>
+        </defaults>
+        <xsl:copy-of select="$content"/>
+    </build>
+</xsl:template>
+
+<!--
+    checkout - build step for source checkout.
+
+    Usage: as <svn> with additional <command> element and defaults for
+           <baseURL> and <defaultBranch>
+
+    Typically just:
+        <checkout/>
+    for the trunk, or:
+        <checkout branch="branches/WX_2_8_BRANCH"/>
+    to checkout a branch.
+-->
+<xsl:template name="checkout">
+    <xsl:param name="content"/>
+    <xsl:param name="branch" select="'trunk'"/>
+    <xsl:variable name="nodes" select="exsl:node-set($content)"/>
+    <testdrive-svn>
+        <xsl:if test="not($nodes/svnurl)">
+            <xsl:if test="not($nodes/baseURL)">
+                <baseURL><SVN_URL/></baseURL>
+            </xsl:if>
+            <xsl:if test="not($nodes/defaultBranch)">
+                <defaultBranch><xsl:value-of select="$branch"/></defaultBranch>
+            </xsl:if>
+        </xsl:if>
+        <xsl:if test="not($nodes/command)">
+            <profile/>
+            <post-checkout/>
+        </xsl:if>
+        <xsl:copy-of select="$content"/>
+    </testdrive-svn>
+</xsl:template>
+
+<!--
+    steps - overrides <steps> to prepend <profile/> and <prologue/> and
+            append <epilogue/> to the <command/> of each build step.
+
+    Usage: as <steps>
+
+    The differences between <profile/> and <prologue/> are:
+    1. <profile/> is also used by <checkout> for its post checkout command.
+    2. In <profile> the current node is the <steps> element.
+    3. In <prologue> the current node is the build step inside a generated
+       nodeset. The current build is passes as a parameter.
+-->
+<xsl:template name="steps">
+    <xsl:param name="content"/>
+    <xsl:variable name="profile"><profile/></xsl:variable>
+    <xsl:variable name="build" select="get:build()"/>
+    <steps>
+        <xsl:for-each select="exsl:node-set($content)/*">
+            <xsl:choose>
+                <xsl:when test="contains(name(), 'svn')">
+                    <xsl:copy-of select="."/>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:copy>
+                        <xsl:copy-of select="@*"/>
+                        <xsl:copy-of select="$profile"/>
+                        <prologue build="{$build}"/>
+                        <xsl:copy-of select="node()"/>
+                        <xsl:if test="not(command)">
+                            <command/>
+                        </xsl:if>
+                        <epilogue build="{$build}"/>
+                    </xsl:copy>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:for-each>
+    </steps>
+</xsl:template>
+
+<!--
+    if-del-on-fail - used in the context of a build step, copies its content
+                     if the build step should cleanup on failure.
+
+    Usage: <if-del-on-fail>foobar</if-del-on-fail>
+
+    On the testdrive the working directory is deleted after a build to save
+    space. If the step has <haltOnFailure/> (which is the default or
+    <configure> and <compile> steps) then this cleanup needs to happen
+    whenever the step fails.
+-->
+<xsl:template name="if-del-on-fail">
+    <xsl:param name="content"/>
+    <xsl:if test = "position() = last() or
+                    haltOnFailure = '' or
+                    haltOnFailure = 'true' or
+                    (not(haltOnFailure) and
+                        (name() = 'configure' or name() = 'compile'))">
+        <xsl:copy-of select="$content"/>
+    </xsl:if>
+</xsl:template>
+
+<!--
+    Add slave locks so that each testdrive machine only runs one bulid at a
+    time.
+-->
+<create-locks/>
+
+<xsl:template name="create-locks">
+    <xsl:variable name="rtf">
+        <xsl:apply-templates select="get:property('sandbox', get:all-builds())"/>
+    </xsl:variable>
+    <xsl:variable name="sandboxes" select="exsl:node-set($rtf)/sandbox"/>
+    <xsl:for-each select="$sandboxes">
+        <xsl:variable name="text" select="text()"/>
+        <xsl:variable name="position" select="position()"/>
+        <xsl:if test="not($sandboxes[text() = $text and position() &lt; $position])">
+            <slavelock>
+                <name><xsl:value-of select="node()"/></name>
+            </slavelock>
+        </xsl:if>
+    </xsl:for-each>
+</xsl:template>
+
+<xsl:template name="sandbox">
+    <xsl:param name="content"/>
+    <sandbox><xsl:copy-of select="$content"/></sandbox>
+    <lock><xsl:copy-of select="$content"/></lock>
+</xsl:template>
+
+</bot>
diff --git a/build/buildbot/config/testdrive-inc.xml b/build/buildbot/config/testdrive-inc.xml
deleted file mode 100644 (file)
index 71242d4..0000000
+++ /dev/null
@@ -1,300 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
-    Name:       testdrive-inc.xml
-    Purpose:    Declarations for the testdrive 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"
-     xmlns:exsl="http://exslt.org/common"
-     xsl:version="1.0">
-
-<xi:include href="include.xml" xpointer="xpointer(*/*)"/>
-
-<!--
-    checkout - build step for source checkout.
-
-    Usage: as <svn> with additional <command> element and defaults for
-           <baseURL> and <defaultBranch>
-
-    Typically just:
-        <checkout/>
-    for the trunk, or:
-        <checkout branch="branches/WX_2_8_BRANCH"/>
-    to checkout a branch.
--->
-<xsl:template name="checkout">
-    <xsl:param name="content"/>
-    <xsl:param name="branch" select="'trunk'"/>
-    <xsl:variable name="nodes" select="exsl:node-set($content)"/>
-    <testdrive-svn>
-        <xsl:if test="not($nodes/svnurl)">
-            <xsl:if test="not($nodes/baseURL)">
-                <baseURL><SVN_URL/></baseURL>
-            </xsl:if>
-            <xsl:if test="not($nodes/defaultBranch)">
-                <defaultBranch><xsl:value-of select="$branch"/></defaultBranch>
-            </xsl:if>
-        </xsl:if>
-        <xsl:if test="not($nodes/command)">
-            <profile/>
-            <post-checkout/>
-        </xsl:if>
-        <xsl:copy-of select="$content"/>
-    </testdrive-svn>
-</xsl:template>
-
-<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>
-
-<!--
-    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="$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>
-
-<!--
-    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>
-
-<!--
-    steps - overrides <steps> to prepend <profile/> and <prologue/> and
-            append <epilogue/> to the <command/> of each build step.
-
-    Usage: as <steps>
-
-    The differences between <profile/> and <prologue/> are:
-    1. <profile/> is also used by <checkout> for its post checkout command,
-       <proglogue/> isn't.
-    2. <profile/> has access to the build's fields, for example it can
-       use <get name="builddir"/>, while <prologue/> can't.
--->
-<xsl:template name="steps">
-    <xsl:param name="content"/>
-    <xsl:variable name="profile"><profile/></xsl:variable>
-    <steps>
-        <xsl:for-each select="exsl:node-set($content)/*">
-            <xsl:choose>
-                <xsl:when test="contains(name(), 'svn')">
-                    <xsl:copy-of select="."/>
-                </xsl:when>
-                <xsl:otherwise>
-                    <xsl:copy>
-                        <xsl:copy-of select="@*"/>
-                        <xsl:copy-of select="$profile"/>
-                        <prologue/>
-                        <xsl:copy-of select="node()"/>
-                        <xsl:if test="not(command)">
-                            <command/>
-                        </xsl:if>
-                        <epilogue/>
-                    </xsl:copy>
-                </xsl:otherwise>
-            </xsl:choose>
-        </xsl:for-each>
-    </steps>
-</xsl:template>
-
-<!--
-    profile - see <steps> above.
--->
-<xsl:template name="profile">
-<command>
-set -e
-uname -smnr
-umask 022
-LANG=C
-TOPDIR=<get name="builddir"/>
-BUILDDIR=$TOPDIR/build
-OPTDIR=$HOME/opt/<basename><get name="builddir"/></basename>
-</command>
-</xsl:template>
-
-<!--
-    prologue - see <steps> above.
--->
-<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 90M
-fi
-cd $BUILDDIR
-<if-del-on-fail>trap 'cd; rm -rf $BUILDDIR' EXIT</if-del-on-fail>
-</command>
-</xsl:template>
-
-<!--
-    epilogue - see <steps> above.
--->
-<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>
-
-<!--
-    if-del-on-fail - used in the context of a build step, copies its content
-                     if the build step should cleanup on failure.
-
-    Usage: <if-del-on-fail>foobar</if-del-on-fail>
-
-    On the testdrive the working directory is deleted after a build to save
-    space. If the step has <haltOnFailure/> (which is the default or
-    <configure> and <compile> steps) then this cleanup needs to happen
-    whenever the step fails.
--->
-<xsl:template name="if-del-on-fail">
-    <xsl:param name="content"/>
-    <xsl:if test = "position() = last() or
-                    haltOnFailure = '' or
-                    haltOnFailure = 'true' or
-                    (not(haltOnFailure) and
-                        (name() = 'configure' or name() = 'compile'))">
-        <xsl:copy-of select="$content"/>
-    </xsl:if>
-</xsl:template>
-
-<!--
-    Add slave locks so that each testdrive machine only runs one bulid at a
-    time
--->
-<xsl:for-each select="../build/sandbox">
-    <xsl:if test="not(../preceding-sibling::build[sandbox = current()])">
-        <slavelock>
-            <name><xsl:apply-templates select="node()"/></name>
-        </slavelock>
-    </xsl:if>
-</xsl:for-each>
-
-<xsl:template name="sandbox">
-    <xsl:param name="content"/>
-    <sandbox><xsl:copy-of select="$content"/></sandbox>
-    <lock><xsl:copy-of select="$content"/></lock>
-</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>
diff --git a/build/buildbot/config/testdrive-unix.xml b/build/buildbot/config/testdrive-unix.xml
new file mode 100644 (file)
index 0000000..1e92251
--- /dev/null
@@ -0,0 +1,408 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+    Name:       testdrive-unix.xml
+    Purpose:    Buildbot configuration for the unix HP Testdrive machines.
+    Author:     Mike Wetherell
+    RCS-ID:     $Id$
+    Copyright:  (c) 2007 Mike Wetherell
+    Licence:    wxWidgets licence
+-->
+
+<bot xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+     xmlns:xi="http://www.w3.org/2001/XInclude">
+
+<xi:include href="include/testdrive-unix.xml"/>
+
+<!--
+    Notes:
+
+    The list of available machines is here:
+        http://www.testdrive.hp.com/current.shtml
+    This file is for unix hosts only, for Windows see testdrive-win.xml.
+
+    <sandbox> specifies the remote machine that will run the job, or it can
+    be 'debug' in which case the sandbox will just echo the commands. If
+    omitted defaults to the same value as the previous build.
+
+    An extra build step <setup> can be used after <checkout> to set up ccache
+    and cppunit. Cppunit generally needs to be compiled by the same compiler
+    that will be used for wxWidgets, add configure options using the
+    'cppunit-options' attribute when needed, e.g.:
+        <setup cppunit-options="CC=cc CXX=CC"/>
+
+    Cross compilers available on the Linux x86 machines:
+        powerpc-apple-darwin8   Xcode 2.2.1 compiler and SDK
+        i686-apple-darwin8      Xcode 2.2.1 compiler and SDK
+        i386-mingw32            cppunit installed under $HOME/opt/mingw345
+        i686-pc-cygwin          cppunit, x11, motif and gtk
+
+    Please limit the number of quick builds to one unix, one Windows and one
+    Mac per branch. And please don't load up all the cpus of a remote machine
+    at once with make -j.
+-->
+
+<!-- 
+    Unix Quick Builds
+-->
+
+<build>
+    <name>Linux x86_64 wxGTK Trunk</name>
+    <sandbox>td162.testdrive.hp.com</sandbox>
+    <builddir>td_gtk</builddir>
+    <scheduler>trunk_quick</scheduler>
+
+    <steps>
+        <checkout/>
+        <setup/>
+        <configure/>
+        <compile-all/>
+        <run-tests/>
+    </steps>
+</build>
+
+<build>
+    <name>Linux x86_64 wxGTK Stable</name>
+    <sandbox>td166.testdrive.hp.com</sandbox>
+    <builddir>td_gtk_stable</builddir>
+    <scheduler>stable_quick</scheduler>
+
+    <steps>
+        <checkout branch="{$STABLE_BRANCH}"/>
+        <setup/>
+        <configure/>
+        <compile-all/>
+        <run-tests/>
+    </steps>
+</build>
+
+<!-- 
+    Mac Quick Builds
+-->
+
+<build>
+    <name>OSX 10.4 PowerPC wxMac Trunk</name>
+    <sandbox>td179.testdrive.hp.com</sandbox>
+    <builddir>td_mac</builddir>
+    <scheduler>trunk_quick</scheduler>
+
+    <steps>
+        <checkout/>
+        <setup cppunit-options="--host=powerpc-apple-darwin8"/>
+        <configure options="--host=powerpc-apple-darwin8"/>
+        <compile-all/>
+    </steps>
+</build>
+
+<build>
+    <name>OSX 10.4 Intel wxMac Stable</name>
+    <sandbox>td186.testdrive.hp.com</sandbox>
+    <builddir>td_mac_stable</builddir>
+    <scheduler>stable_quick</scheduler>
+
+    <steps>
+        <checkout branch="{$STABLE_BRANCH}"/>
+        <setup cppunit-options="--host=i686-apple-darwin8"/>
+        <configure options="--host=i686-apple-darwin8"/>
+        <compile-all/>
+    </steps>
+</build>
+
+<!-- 
+    Windows Quick Builds
+-->
+
+<build>
+    <name>MinGW32 wxMSW Trunk</name>
+    <sandbox>td185.testdrive.hp.com</sandbox>
+    <builddir>td_msw</builddir>
+    <scheduler>trunk_quick</scheduler>
+
+    <steps>
+        <checkout/>
+        <configure options="--host=i386-mingw32 --with-cppunit-prefix=$HOME/opt/mingw345"/>
+        <compile-all/>
+    </steps>
+</build>
+
+<build>
+    <name>MinGW32 wxMSW Stable</name>
+    <sandbox>td189.testdrive.hp.com</sandbox>
+    <builddir>td_msw_stable</builddir>
+    <scheduler>stable_quick</scheduler>
+
+    <steps>
+        <checkout branch="{$STABLE_BRANCH}"/>
+        <configure options="--host=i386-mingw32 --with-cppunit-prefix=$HOME/opt/mingw345"/>
+        <compile-all/>
+    </steps>
+</build>
+
+<!-- 
+    Daily builds
+-->
+
+<build>
+    <name>FreeBSD x86 wxX11 Trunk</name>
+    <sandbox>td152.testdrive.hp.com</sandbox>
+    <builddir>td_freebsd</builddir>
+    <scheduler>daily_0600</scheduler>
+
+    <steps>
+        <checkout/>
+        <setup/>
+        <configure options="--with-x11 --disable-unicode"/>
+        <compile-all/>
+        <run-tests/>
+    </steps>
+</build>
+
+<build>
+    <name>FreeBSD x86 wxX11 Stable</name>
+    <sandbox>td152.testdrive.hp.com</sandbox>
+    <builddir>td_freebsd_stable</builddir>
+    <scheduler/>
+
+    <steps>
+        <checkout branch="{$STABLE_BRANCH}"/>
+        <setup/>
+        <configure options="--with-x11"/>
+        <compile-all/>
+        <run-tests/>
+    </steps>
+</build>
+
+<build>
+    <name>HP-UX 11i PA-RISC gcc wxMotif Stable</name>
+    <sandbox>td192.testdrive.hp.com</sandbox>
+    <builddir>td_hpux_pa_stable</builddir>
+    <scheduler>daily_0600</scheduler>
+
+    <schedule></schedule>
+
+    <steps>
+        <checkout branch="{$STABLE_BRANCH}"/>
+        <setup/>
+        <configure/>
+        <compile-all/>
+        <run-tests/>
+    </steps>
+</build>
+
+<!--
+    Cygwin builds
+
+    x86 linux cross compiler with sysroot $HOME/cygwin containing cppunit
+    X11, motif and gtk+-2. For locations see cygwin-opts/cygwin-x-opts
+    below.
+-->
+    
+<!--  for wxBase or wxMSW -->
+<xsl:variable name="cygwin-opts">
+    --host=i686-pc-cygwin
+    --with-cppunit-prefix=$HOME/cygwin
+</xsl:variable>
+
+<!-- for wxX11, wxMotif, wxGTK -->
+<xsl:variable name="cygwin-x-opts">
+    <xsl:value-of select="$cygwin-opts"/>
+    --x-includes=$HOME/cygwin/usr/X11R6/include 
+    --x-libraries=$HOME/cygwin/usr/X11R6/lib 
+    PKG_CONFIG_PATH=$HOME/opt/cygwin/pkgconfig
+</xsl:variable>
+
+<build>
+    <name>Cygwin wxMSW Trunk</name>
+    <builddir>td_cygwin_msw</builddir>
+    <sandbox>td166.testdrive.hp.com</sandbox>
+    <scheduler>monday_0600</scheduler>
+
+    <steps>
+        <checkout/>
+        <configure options="{$cygwin-opts}"/>
+        <compile-all/>
+    </steps>
+</build>
+
+<build>
+    <name>Cygwin wxMSW Stable</name>
+    <builddir>td_cygwin_msw_stable</builddir>
+    <scheduler/>
+
+    <steps>
+        <checkout branch="{$STABLE_BRANCH}"/>
+        <configure options="{$cygwin-opts}"/>
+        <compile-all/>
+    </steps>
+</build>
+
+<build>
+    <name>Cygwin wxGTK Trunk</name>
+    <builddir>td_cygwin_gtk</builddir>
+    <scheduler/>
+
+    <steps>
+        <checkout/>
+        <configure options="- -with-gtk {$cygwin-x-opts}"/>
+        <compile-all/>
+    </steps>
+</build>
+
+<build>
+    <name>Cygwin wxGTK Stable</name>
+    <builddir>td_cygwin_gtk_stable</builddir>
+    <scheduler/>
+
+    <steps>
+        <checkout branch="{$STABLE_BRANCH}"/>
+        <configure options="- -with-gtk {$cygwin-x-opts}"/>
+        <compile-all/>
+    </steps>
+</build>
+
+<!--
+<build>
+    <name>Cygwin wxX11 Trunk</name>
+    <builddir>td_cygwin_x11</builddir>
+    <scheduler/>
+
+    <steps>
+        <checkout/>
+        <configure options="-
+-with-x11 {$cygwin-x-opts}"/>
+        <compile-all/>
+    </steps>
+</build>
+
+<build>
+    <name>Cygwin wxX11 Stable</name>
+    <builddir>td_cygwin_x11_stable</builddir>
+    <scheduler/>
+
+    <steps>
+        <checkout branch="{$STABLE_BRANCH}"/>
+        <configure options="-
+-with-x11 {$cygwin-x-opts}"/>
+        <compile-all/>
+    </steps>
+</build>
+
+<build>
+    <name>Cygwin wxMotif Trunk</name>
+    <builddir>td_cygwin_motif</builddir>
+    <scheduler/>
+
+    <steps>
+        <checkout/>
+        <configure options="-
+-with-motif {$cygwin-x-opts}"/>
+        <compile-all/>
+    </steps>
+</build>
+
+<build>
+    <name>Cygwin wxMotif Stable</name>
+    <builddir>td_cygwin_motif_stable</builddir>
+    <scheduler/>
+
+    <steps>
+        <checkout branch="{$STABLE_BRANCH}"/>
+        <configure options="-
+-with-motif {$cygwin-x-opts}"/>
+        <compile-all/>
+    </steps>
+</build>
+
+<build>
+    <name>Cygwin wxBase Trunk</name>
+    <builddir>td_cygwin_base</builddir>
+    <scheduler/>
+
+    <steps>
+        <checkout/>
+        <configure options="-
+-without-gui {$cygwin-opts}"/>
+        <compile-all/>
+    </steps>
+</build>
+
+<build>
+    <name>Cygwin wxBase Stable</name>
+    <builddir>td_cygwin_base_stable</builddir>
+    <scheduler/>
+
+    <steps>
+        <checkout branch="{$STABLE_BRANCH}"/>
+        <configure options="-
+-without-gui {$cygwin-opts}"/>
+        <compile-all/>
+    </steps>
+</build>
+
+-->
+
+<!--
+    Cygwin -mno-cygwin builds
+-->
+
+<xsl:variable name="nocygwin-opts">
+    --host=i686-pc-cygwin
+    --with-cppunit-prefix=$HOME/opt/nocygwin
+    CC='i686-pc-cygwin-gcc -mno-cygwin'
+    CXX='i686-pc-cygwin-g++ -mno-cygwin'
+</xsl:variable>
+
+<build>
+    <name>Cygwin no-cygwin wxMSW Trunk</name>
+    <builddir>td_nocygwin</builddir>
+    <sandbox>td166.testdrive.hp.com</sandbox>
+    <scheduler>monday_0600</scheduler>
+
+    <steps>
+        <checkout/>
+        <configure options="{$nocygwin-opts}"/>
+        <compile-all/>
+    </steps>
+</build>
+
+<build>
+    <name>Cygwin no-cygwin wxMSW Stable</name>
+    <builddir>td_nocygwin_stable</builddir>
+    <scheduler/>
+
+    <steps>
+        <checkout branch="{$STABLE_BRANCH}"/>
+        <configure options="{$nocygwin-opts}"/>
+        <compile-all/>
+    </steps>
+</build>
+
+<!--
+<build>
+    <name>Cygwin no-cygwin wxBase Trunk</name>
+    <builddir>td_nocygwin_base</builddir>
+    <scheduler/>
+
+    <steps>
+        <checkout/>
+        <configure options="-
+-without-gui {$nocygwin-opts}"/>
+        <compile-all/>
+    </steps>
+</build>
+
+<build>
+    <name>Cygwin no-cygwin wxBase Stable</name>
+    <builddir>td_nocygwin_base_stable</builddir>
+    <scheduler/>
+
+    <steps>
+        <checkout branch="{$STABLE_BRANCH}"/>
+        <configure options="-
+-without-gui {$nocygwin-opts}"/>
+        <compile-all/>
+    </steps>
+</build>
+-->
+
+</bot>
diff --git a/build/buildbot/config/testdrive.xml b/build/buildbot/config/testdrive.xml
deleted file mode 100644 (file)
index 58c3ecd..0000000
+++ /dev/null
@@ -1,252 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
-    Name:       testdrive.xml
-    Purpose:    Buildbot configuration for the HP Testdrive.
-    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"
-     xmlns:exsl="http://exslt.org/common"
-     xsl:version="1.0">
-
-<xi:include href="testdrive-inc.xml" xpointer="xpointer(*/*)"/>
-
-<!--
-    Notes:
-
-    The list of available machines is here:
-        http://www.testdrive.hp.com/current.shtml
-    Currently only unix hosts are supported, with hopefully one or more
-    Windows machines to follow.
-
-    <sandbox> specifies the remote machine that will run the job, or it can
-    be 'debug' in which case the sandbox will just echo the commands.
-
-    <builddir> specifies an absolute path on the remote machine for the
-    build, rather than the usual single directory name. The last component
-    also specifies a subdirectory on the master for logs, which as usual
-    must be unique across all slaves.
-
-    An extra build step <setup> can be used after <checkout> to set up ccache
-    and cppunit. Cppunit generally needs to be compiled by the same compiler
-    that will be used for wxWidgets, add configure options using the
-    'cppunit-options' attribute when needed, e.g.:
-        <setup cppunit-options="CC=cc CXX=CC"/>
-
-    Cross compilers available on the Linux x86 machines (more coming):
-        powerpc-apple-darwin8
-        i686-apple-darwin8
-        i386-mingw32    (with cppunit installed under $HOME/opt/mingw345)
-        i686-pc-cygwin  (with cppunit, x11, motif and gtk)
-
-    Please limit the number of quick builds to one unix, one Windows and one
-    Mac per branch. And please don't load up all the cpus of a remote machine
-    at once with make -j.
--->
-
-<!-- 
-    Unix Quick Builds
--->
-
-<build>
-    <name>Linux x86_64 wxGTK Trunk</name>
-    <sandbox>td162.testdrive.hp.com</sandbox>
-    <builddir>/tmp/wx/td_gtk</builddir>
-    <scheduler>trunk_quick</scheduler>
-
-    <steps>
-        <checkout/>
-
-        <setup/>
-        <configure/>
-
-        <compile/>
-        <compile-samples/>
-        <compile-utils/>
-        <compile-tests/>
-
-        <run-tests/>
-    </steps>
-</build>
-
-<build>
-    <name>Linux x86_64 wxGTK Stable</name>
-    <sandbox>td166.testdrive.hp.com</sandbox>
-    <builddir>/tmp/wx/td_gtk_stable</builddir>
-    <scheduler>stable_quick</scheduler>
-
-    <steps>
-        <checkout branch="{$STABLE_BRANCH}"/>
-
-        <setup/>
-        <configure/>
-
-        <compile/>
-        <compile-samples/>
-        <compile-utils/>
-        <compile-contrib/>
-        <compile-tests/>
-
-        <run-tests/>
-    </steps>
-</build>
-
-<!-- 
-    Mac Quick Builds
--->
-
-<build>
-    <name>OSX 10.4 PowerPC wxMac Trunk</name>
-    <sandbox>td179.testdrive.hp.com</sandbox>
-    <builddir>/tmp/wx/td_mac</builddir>
-    <scheduler>trunk_quick</scheduler>
-
-    <steps>
-        <checkout/>
-
-        <setup cppunit-options="--host=powerpc-apple-darwin8"/>
-        <configure options="--host=powerpc-apple-darwin8"/>
-
-        <compile/>
-        <compile-samples/>
-        <compile-utils/>
-        <compile-tests/>
-    </steps>
-</build>
-
-<build>
-    <name>OSX 10.4 Intel wxMac Stable</name>
-    <sandbox>td186.testdrive.hp.com</sandbox>
-    <builddir>/tmp/wx/td_mac_stable</builddir>
-    <scheduler>stable_quick</scheduler>
-
-    <steps>
-        <checkout branch="{$STABLE_BRANCH}"/>
-
-        <setup cppunit-options="--host=i686-apple-darwin8"/>
-        <configure options="--host=i686-apple-darwin8"/>
-
-        <compile/>
-        <compile-samples/>
-        <compile-utils/>
-        <compile-contrib/>
-        <compile-tests/>
-    </steps>
-</build>
-
-<!-- 
-    Windows Quick Builds
--->
-
-<build>
-    <name>MinGW32 wxMSW Trunk</name>
-    <sandbox>td185.testdrive.hp.com</sandbox>
-    <builddir>/tmp/wx/td_msw</builddir>
-    <scheduler>trunk_quick</scheduler>
-
-    <steps>
-        <checkout/>
-
-        <configure options="--host=i386-mingw32 --with-cppunit-prefix=$HOME/opt/mingw345"/>
-
-        <compile/>
-        <compile-samples/>
-        <compile-utils/>
-        <compile-tests/>
-    </steps>
-</build>
-
-<build>
-    <name>MinGW32 wxMSW Stable</name>
-    <sandbox>td189.testdrive.hp.com</sandbox>
-    <builddir>/tmp/wx/td_msw_stable</builddir>
-    <scheduler>stable_quick</scheduler>
-
-    <steps>
-        <checkout branch="{$STABLE_BRANCH}"/>
-
-        <configure options="--host=i386-mingw32 --with-cppunit-prefix=$HOME/opt/mingw345"/>
-
-        <compile/>
-        <compile-samples/>
-        <compile-utils/>
-        <compile-contrib/>
-        <compile-tests/>
-    </steps>
-</build>
-
-<!-- 
-    Daily builds
--->
-
-<build>
-    <name>FreeBSD x86 wxX11 Trunk</name>
-    <sandbox>td152.testdrive.hp.com</sandbox>
-    <builddir>/tmp/wx/td_freebsd</builddir>
-    <scheduler>daily_6am</scheduler>
-
-    <steps>
-        <checkout/>
-
-        <setup/>
-        <configure options="--with-x11 --disable-unicode"/>
-
-        <compile/>
-        <compile-samples/>
-        <compile-utils/>
-        <compile-tests/>
-
-        <run-tests/>
-    </steps>
-</build>
-
-<build>
-    <name>FreeBSD x86 wxX11 Stable</name>
-    <sandbox>td152.testdrive.hp.com</sandbox>
-    <builddir>/tmp/wx/td_freebsd_stable</builddir>
-    <scheduler>daily_6am</scheduler>
-
-    <steps>
-        <checkout branch="{$STABLE_BRANCH}"/>
-
-        <setup/>
-        <configure options="--with-x11"/>
-
-        <compile/>
-        <compile-samples/>
-        <compile-utils/>
-        <compile-contrib/>
-        <compile-tests/>
-
-        <run-tests/>
-    </steps>
-</build>
-
-<build>
-    <name>HP-UX 11i PA-RISC gcc wxMotif Stable</name>
-    <sandbox>td192.testdrive.hp.com</sandbox>
-    <builddir>/tmp/wx/td_hpux_pa_stable</builddir>
-    <scheduler>daily_6am</scheduler>
-
-    <steps>
-        <checkout branch="{$STABLE_BRANCH}"/>
-
-        <setup/>
-        <configure/>
-
-        <compile/>
-        <compile-samples/>
-        <compile-utils/>
-        <compile-contrib/>
-        <compile-tests/>
-
-        <run-tests/>
-    </steps>
-</build>
-
-</bot>
index ee429f0f60f5c592e8ff18078289a6cb0f022878..ca192823cc8d5d0d59c7cf1f9c0d6dc9ac92e6df 100644 (file)
 <output indent="yes"/>
 
 <variable
 <output indent="yes"/>
 
 <variable
-    name="top-level-base"
-    select="/*/xsl:import |
-            /*/xsl:include |
-            /*/xsl:attribute-set |
-            /*/xsl:character-map |
-            /*/xsl:decimal-format |
-            /*/xsl:function |
-            /*/xsl:import-schema |
-            /*/xsl:key |
-            /*/xsl:namespace-alias |
-            /*/xsl:output |
-            /*/xsl:param |
-            /*/xsl:preserve-space |
-            /*/xsl:strip-space |
-            /*/xsl:variable"/>
+    name="root"
+    select="//*[not(ancestor-or-self::*[name() != name(/*)])]"/>
 
 <variable
 
 <variable
-    name="top-level"
-    select="$top-level-base |
-            /*/xsl:template"/>
+    name="includes"
+    select="$root[position() > 1]"/>
 
 <variable
 
 <variable
-    name="top-level-copy"
-    select="$top-level-base |
-            /*/xsl:template
-                [not(following-sibling::xsl:template/@name = @name)]"/>
+    xmlns:func="http://exslt.org/functions"
+    name="top-level"
+    select="$root/xsl:import |
+            $root/xsl:include |
+            $root/xsl:attribute-set |
+            $root/xsl:character-map |
+            $root/xsl:decimal-format |
+            $root/xsl:function |
+            $root/xsl:import-schema |
+            $root/xsl:key |
+            $root/xsl:namespace-alias |
+            $root/xsl:output |
+            $root/xsl:param |
+            $root/xsl:preserve-space |
+            $root/xsl:strip-space |
+            $root/xsl:template |
+            $root/xsl:variable |
+            $root/func:function"/>
 
 <template match="/">
     <XSL:transform>
 
 <template match="/">
     <XSL:transform>
-        <copy-of select="/*/namespace::*"/>
+        <copy-of select="$root/namespace::*"/>
 
 
-        <for-each select="/*/@xsl:*">
+        <for-each select="$root/@xsl:*">
             <attribute name="{local-name()}">
                 <value-of select="."/>
             </attribute>
         </for-each>
 
             <attribute name="{local-name()}">
                 <value-of select="."/>
             </attribute>
         </for-each>
 
-        <apply-templates mode="copy-xsl" select="$top-level-copy"/>
+        <for-each select="$top-level">
+            <if test="not(../ancestor::*/*[name() = name(current()) and @name = current()/@name])">
+                <apply-templates mode="copy-xsl" select="."/>
+            </if>
+        </for-each>
+
         <apply-templates select="*"/>
     </XSL:transform>
 </template>
         <apply-templates select="*"/>
     </XSL:transform>
 </template>
         <call-template name="coord-pattern"/>
     </variable>
 
         <call-template name="coord-pattern"/>
     </variable>
 
+    <variable name="is-xsl">
+        <call-template name="is-xsl"/>
+    </variable>
+
     <XSL:template match="*[generate-id() = generate-id(document('', /){$pattern})]">
         <copy-of select="namespace::*"/>
         <choose>
     <XSL:template match="*[generate-id() = generate-id(document('', /){$pattern})]">
         <copy-of select="namespace::*"/>
         <choose>
-            <when test="/*/xsl:template[@name = name(current())]">
-                <call-template name="expand"/>
+            <when test="$root/xsl:template[@name = name(current())]">
+                <call-template name="expand">
+                    <with-param name="inside-xsl" select="$is-xsl = 'true'"/>
+                </call-template>
+            </when>
+            <when test="count($includes | .) = count($includes)">
+                <if test="node()">
+                    <XSL:apply-templates select="node()"/>
+                </if>
             </when>
             <when test="count($top-level | .) != count($top-level)">
                 <call-template name="create-context"/>
             </when>
             <when test="count($top-level | .) != count($top-level)">
                 <call-template name="create-context"/>
@@ -78,7 +94,7 @@
         </choose>
     </XSL:template>
 
         </choose>
     </XSL:template>
 
-    <if test="not(self::xsl:*)">
+    <if test="$is-xsl != 'true'">
         <apply-templates select="node()"/>
     </if>
 </template>
         <apply-templates select="node()"/>
     </if>
 </template>
     <copy/>
 </template>
 
     <copy/>
 </template>
 
-<template mode="copy-xsl" match="*[/*/xsl:template/@name = name()]">
+<template mode="copy-xsl" match="*[//xsl:template[not(ancestor::*[name() != name(/*)])]/@name = name()]">
     <choose>
         <when test="ancestor::xsl:template[@name = name(current())]">
             <XSL:choose>
     <choose>
         <when test="ancestor::xsl:template[@name = name(current())]">
             <XSL:choose>
             </XSL:choose>
         </when>
         <otherwise>
             </XSL:choose>
         </when>
         <otherwise>
-            <call-template name="expand"/>
+            <call-template name="expand">
+                <with-param name="inside-xsl" select="true()"/>
+            </call-template>
         </otherwise>
     </choose>
 </template>
         </otherwise>
     </choose>
 </template>
     </for-each>
 </template>
 
     </for-each>
 </template>
 
+<template name="is-xsl">
+    <param name="element" select="."/>
+    <choose>
+        <when test="$element/self::xsl:*">
+            <value-of select="true()"/>
+        </when>
+        <otherwise>
+            <variable name="namespace" select="namespace-uri($element)"/>
+            <variable name="extension-namespaces">
+                <for-each select="$element/ancestor-or-self::*/@xsl:extension-element-prefixes">
+                    <variable name="prefixes"
+                              select="concat(' ', normalize-space(.), ' ')"/>
+                    <variable name="namespaces"
+                              select="../namespace::*[contains($prefixes, concat(' ', name(), ' ')) or
+                                                      (name() = '' and contains($prefixes, ' #default '))]"/>
+                    <value-of select="$namespaces[. = $namespace]"/>
+                </for-each>
+            </variable>
+            <value-of select="$extension-namespaces != ''"/>
+        </otherwise>
+    </choose>
+</template>
+
 <template name="expand">
 <template name="expand">
-    <variable name="params" select="/*/xsl:template[@name = name(current())]/xsl:param"/>
+    <param name="inside-xsl"/>
+    <variable name="params" select="$root/xsl:template[@name = name(current())]/xsl:param"/>
 
     <XSL:call-template name="{name()}">
 
     <XSL:call-template name="{name()}">
-        <if test="$params">
+        <if test="node() and $params">
             <XSL:with-param name="{$params[1]/@name}">
                 <choose>
             <XSL:with-param name="{$params[1]/@name}">
                 <choose>
-                    <when test="ancestor-or-self::xsl:*">
+                    <when test="$inside-xsl">
                         <apply-templates mode="copy-xsl" select="node()"/>
                     </when>
                     <otherwise>
                         <apply-templates mode="copy-xsl" select="node()"/>
                     </when>
                     <otherwise>
         </if>
 
         <for-each select="@*">
         </if>
 
         <for-each select="@*">
-            <XSL:with-param name="{name()}">
-                <call-template name="avt">
-                    <with-param name="string" select="."/>
+            <variable name="expr">
+                <call-template name="before">
+                    <with-param name="string" select="substring-after(., '{')"/>
+                    <with-param name="target">}</with-param>
                 </call-template>
                 </call-template>
-            </XSL:with-param>
+            </variable>
+            <choose>
+                <when test="string-length($expr) = string-length(.) - 2">
+                    <XSL:with-param name="{name()}" select="{$expr}"/>
+                </when>
+                <otherwise>
+                    <XSL:with-param name="{name()}">
+                        <call-template name="avt">
+                            <with-param name="string" select="."/>
+                        </call-template>
+                    </XSL:with-param>
+                </otherwise>
+            </choose>
         </for-each>
     </XSL:call-template>
 </template>
         </for-each>
     </XSL:call-template>
 </template>
 
     <XSL:for-each select="{$parent-pattern}/*">
         <XSL:if test="count({$pattern} | .) = 1">
 
     <XSL:for-each select="{$parent-pattern}/*">
         <XSL:if test="count({$pattern} | .) = 1">
+            <variable name="is-xsl">
+                <call-template name="is-xsl">
+                    <with-param name="element" select="$elements[1]"/>
+                </call-template>
+            </variable>
             <choose>
             <choose>
-                <when test="$elements[1]/self::xsl:*">
+                <when test="$is-xsl = 'true'">
                     <apply-templates mode="copy-xsl" select="$elements[1]"/>
                     <if test="$elements[2]">
                         <call-template name="create-context">
                     <apply-templates mode="copy-xsl" select="$elements[1]"/>
                     <if test="$elements[2]">
                         <call-template name="create-context">