]>
Commit | Line | Data |
---|---|---|
1 | <?xml version="1.0" encoding="utf-8"?> | |
2 | ||
3 | <!-- | |
4 | Name: include/testdrive-unix.xml | |
5 | Purpose: Declarations for the testdrive unix build slave | |
6 | Author: Mike Wetherell | |
7 | RCS-ID: $Id$ | |
8 | Copyright: (c) 2007 Mike Wetherell | |
9 | Licence: wxWidgets licence | |
10 | --> | |
11 | ||
12 | <bot xmlns:xi="http://www.w3.org/2001/XInclude" | |
13 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
14 | xsl:version="1.0"> | |
15 | ||
16 | <xi:include href="testdrive.xml"/> | |
17 | ||
18 | <!-- | |
19 | post-checkout - post checkout <command> run by <checkout> | |
20 | ||
21 | Usage: <post-checkout/> | |
22 | ||
23 | The command is executed inside the shared checkout dir, and normally it | |
24 | is used to make a private copy. | |
25 | --> | |
26 | <xsl:template name="post-checkout"> | |
27 | <command> | |
28 | mkdir -p $TOPDIR | |
29 | chown $USER $TOPDIR | |
30 | rm -rf $BUILDDIR | |
31 | cp -pR . $BUILDDIR || { cd; rm -rf $BUILDDIR; exit 1; } | |
32 | </command> | |
33 | </xsl:template> | |
34 | ||
35 | <!-- | |
36 | configure - make disable-precomp-headers a default configure option for | |
37 | the testdrive, and post process the Makefiles to use ccache. | |
38 | ||
39 | Usage: <configure options="-with-foobar"/> | |
40 | --> | |
41 | <xsl:template name="configure"> | |
42 | <xsl:param name="content"/> | |
43 | <xsl:param name="options"/> | |
44 | <configure> | |
45 | <copy-with-defaults content="{$content}"> | |
46 | <command>./configure --disable-precomp-headers <xsl:value-of select="normalize-space($options)"/></command> | |
47 | </copy-with-defaults> | |
48 | <command>find . -name Makefile | xargs perl -pi -e 's/^(?:CC|CXX) = /$&ccache /'</command> | |
49 | </configure> | |
50 | </xsl:template> | |
51 | ||
52 | <!-- | |
53 | setup - a build step that makes sure any prerequisites are set up for | |
54 | the current testdrive build. | |
55 | ||
56 | Usage: <setup/> | |
57 | <setup cppunit-options="-host=i686-apple-darwin8"/> | |
58 | ||
59 | One of the things it sets up is cppunit. There is more than one compiler | |
60 | available on some of the testdrive machines, and generally speaking | |
61 | cppuint needs to be compiled by the same one that will be used for the | |
62 | build. | |
63 | --> | |
64 | <xsl:template name="setup"> | |
65 | <xsl:param name="content"/> | |
66 | <xsl:param name="options"/> | |
67 | <xsl:param name="ccache-configure" select="'./configure INSTALL=./install-sh\ -c --prefix=$HOME --bindir=$OPTDIR/bin'"/> | |
68 | <xsl:param name="ccache-options"/> | |
69 | <xsl:param name="cppunit-configure" select="'./configure INSTALL=config/install-sh\ -c --prefix=$HOME --bindir=$OPTDIR/bin --libdir=$OPTDIR/lib --disable-static'"/> | |
70 | <xsl:param name="cppunit-options"/> | |
71 | <shellcommand> | |
72 | <description>setting up</description> | |
73 | <descriptionDone>set up</descriptionDone> | |
74 | <haltOnFailure/> | |
75 | <command> | |
76 | MINSPACE=1000000 | |
77 | DSPACE=`df -Pk $BUILDDIR | tail -1 | awk '{ print $4 }'` | |
78 | if [ $DSPACE -lt $MINSPACE ]; then | |
79 | echo "Disk space low, skipping build" | |
80 | exit 1 | |
81 | fi | |
82 | if [ -z "$CCACHE_DIR" ]; then | |
83 | gunzip -c $HOME/src/ccache-*.tar.gz | tar xf - | |
84 | cd ccache-* | |
85 | <xsl:value-of select="concat($ccache-configure, ' ', $ccache-options, ' ', $options)"/> | |
86 | make | |
87 | strip ccache | |
88 | make install | |
89 | cd $BUILDDIR | |
90 | rm -r ccache-* | |
91 | fi | |
92 | if { cppunit-config --version || "$CPPUNIT_CONFIG" --version; } 2>/dev/null; then | |
93 | HAVE_CPPUNIT=1 | |
94 | fi | |
95 | if [ -z "$HAVE_CPPUNIT" ]; then | |
96 | gunzip -c $HOME/src/cppunit-*.tar.gz | tar xf - | |
97 | cd cppunit-* | |
98 | <xsl:value-of select="concat($cppunit-configure, ' ', $cppunit-options, ' ', $options)"/> | |
99 | make install-strip | |
100 | chmod +x $OPTDIR/bin/cppunit-config | |
101 | cd $BUILDDIR | |
102 | rm -rf cppunit-* | |
103 | fi | |
104 | </command> | |
105 | </shellcommand> | |
106 | </xsl:template> | |
107 | ||
108 | <!-- | |
109 | profile - see <steps>. | |
110 | --> | |
111 | <xsl:template name="profile"> | |
112 | <command> | |
113 | set -e | |
114 | uname -smnr | |
115 | umask 022 | |
116 | LANG=C | |
117 | TOPDIR=<get-builddir/> | |
118 | BUILDDIR=$TOPDIR/build | |
119 | OPTDIR=$HOME/opt/<basename><get name="builddir"/></basename> | |
120 | </command> | |
121 | </xsl:template> | |
122 | ||
123 | <!-- | |
124 | prologue - see <steps>. | |
125 | --> | |
126 | <xsl:template name="prologue"> | |
127 | <command> | |
128 | INSTALLDIR=$TOPDIR/install | |
129 | case `uname -sm` in | |
130 | Linux*86*) PATH=$HOME/linux-x86/bin:$PATH ;; | |
131 | esac | |
132 | PATH=$OPTDIR/bin:$PATH | |
133 | LD_LIBRARY_PATH=$BUILDDIR/lib:$OPTDIR/lib:$LD_LIBRARY_PATH | |
134 | export LD_LIBRARY_PATH | |
135 | if { ccache -V; } >/dev/null 2>&1; then | |
136 | CCACHE_DIR=$TOPDIR/ccache | |
137 | export CCACHE_DIR | |
138 | ccache -M 90M | |
139 | fi | |
140 | cd $BUILDDIR | |
141 | <if-del-on-fail>trap 'cd; rm -rf $BUILDDIR' EXIT</if-del-on-fail> | |
142 | </command> | |
143 | </xsl:template> | |
144 | ||
145 | <!-- | |
146 | epilogue - see <steps>. | |
147 | --> | |
148 | <xsl:template name="epilogue"> | |
149 | <xsl:if test="position() != last()"> | |
150 | <if-del-on-fail> | |
151 | <command>trap '' EXIT</command> | |
152 | </if-del-on-fail> | |
153 | </xsl:if> | |
154 | </xsl:template> | |
155 | ||
156 | <!-- | |
157 | builddir - override <builddir> to accept a full path | |
158 | ||
159 | Usage: <builddir>/tmp/wx/foobar</builddir> | |
160 | ||
161 | Normally builddir is a single directory name not a full path. Override | |
162 | to allow a working directory to be selected on the remote testdrive | |
163 | machine. | |
164 | ||
165 | The actual builddir (i.e. last part 'foobar') as usual must be unique | |
166 | across all the builds of all the slaves. | |
167 | --> | |
168 | <xsl:template name="builddir"> | |
169 | <xsl:param name="content"/> | |
170 | <builddir> | |
171 | <basename><xsl:copy-of select="$content"/></basename> | |
172 | </builddir> | |
173 | </xsl:template> | |
174 | ||
175 | <!-- | |
176 | Put builds under /tmp/wx on the remote machines by default. | |
177 | ||
178 | If the <builddir> element specifies a full path then returns that | |
179 | as-is, otherwise prepends '/tmp/wx/'. | |
180 | --> | |
181 | <xsl:template name="get-builddir"> | |
182 | <xsl:variable name="builddir"><get name="builddir"/></xsl:variable> | |
183 | <xsl:if test="substring($builddir, 1, 1) != '/'"> | |
184 | <xsl:text>/tmp/wx/</xsl:text> | |
185 | </xsl:if> | |
186 | <xsl:value-of select="$builddir"/> | |
187 | </xsl:template> | |
188 | ||
189 | <!-- | |
190 | basename - returns the final component of a path | |
191 | ||
192 | Usage: <basename>/foo/bar</basename> | |
193 | ||
194 | Evaluates to 'bar'. | |
195 | --> | |
196 | <xsl:template name="basename"> | |
197 | <xsl:param name="path"/> | |
198 | <xsl:choose> | |
199 | <xsl:when test="contains($path, '/')"> | |
200 | <xsl:call-template name="basename"> | |
201 | <xsl:with-param name="path" select="substring-after($path, '/')"/> | |
202 | </xsl:call-template> | |
203 | </xsl:when> | |
204 | <xsl:otherwise> | |
205 | <xsl:value-of select="$path"/> | |
206 | </xsl:otherwise> | |
207 | </xsl:choose> | |
208 | </xsl:template> | |
209 | ||
210 | </bot> |