]>
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 | unarchive - post fetch <command> run by <fetch> | |
37 | ||
38 | Usage: <unarchive/> | |
39 | ||
40 | The command is executed in the $HOME directory on the remote machine, | |
41 | it is used to extract the fetched archive to the build directory. | |
42 | --> | |
43 | <xsl:template name="unarchive"> | |
44 | <command> | |
45 | mkdir -p $TOPDIR | |
46 | chown $USER $TOPDIR | |
47 | rm -rf $BUILDDIR | |
48 | SOURCE=`echo $SOURCE | sed "s|^[^/]|$HOME/&|"` | |
49 | cd $TOPDIR | |
50 | case $SOURCE in | |
51 | *.tar.gz) | |
52 | gunzip -c $SOURCE | tar xf - | |
53 | ;; | |
54 | *.tar.bz2) | |
55 | bunzip2 -c $SOURCE | tar xf - | |
56 | ;; | |
57 | *.zip) | |
58 | unzip $SOURCE | |
59 | ;; | |
60 | esac | |
61 | mv wx* $BUILDDIR | |
62 | </command> | |
63 | </xsl:template> | |
64 | ||
65 | <!-- | |
66 | configure - make disable-precomp-headers a default configure option for | |
67 | the testdrive, and post process the Makefiles to use ccache. | |
68 | ||
69 | Usage: <configure options="-with-foobar"/> | |
70 | --> | |
71 | <xsl:template name="configure"> | |
72 | <xsl:param name="content"/> | |
73 | <xsl:param name="options"/> | |
74 | <configure> | |
75 | <copy-with-defaults content="{$content}"> | |
76 | <command>./configure --disable-precomp-headers <xsl:value-of select="normalize-space($options)"/></command> | |
77 | </copy-with-defaults> | |
78 | <command>find . -name Makefile | xargs perl -pi -e 's/^(?:CC|CXX) = /$&ccache /'</command> | |
79 | </configure> | |
80 | </xsl:template> | |
81 | ||
82 | <!-- | |
83 | setup - a build step that makes sure any prerequisites are set up for | |
84 | the current testdrive build. | |
85 | ||
86 | Usage: <setup/> | |
87 | <setup cppunit-options="-host=i686-apple-darwin8"/> | |
88 | ||
89 | One of the things it sets up is cppunit. There is more than one compiler | |
90 | available on some of the testdrive machines, and generally speaking | |
91 | cppuint needs to be compiled by the same one that will be used for the | |
92 | build. | |
93 | --> | |
94 | <xsl:template name="setup"> | |
95 | <xsl:param name="content"/> | |
96 | <xsl:param name="options"/> | |
97 | <xsl:param name="ccache-configure" select="'./configure INSTALL=./install-sh\ -c --prefix=$HOME --bindir=$OPTDIR/bin'"/> | |
98 | <xsl:param name="ccache-options"/> | |
99 | <xsl:param name="cppunit-configure" select="'./configure INSTALL=config/install-sh\ -c --prefix=$HOME --bindir=$OPTDIR/bin --libdir=$OPTDIR/lib --disable-static'"/> | |
100 | <xsl:param name="cppunit-options"/> | |
101 | <shellcommand> | |
102 | <description>setting up</description> | |
103 | <descriptionDone>set up</descriptionDone> | |
104 | <haltOnFailure/> | |
105 | <command> | |
106 | MINSPACE=1000000 | |
107 | DSPACE=`df -Pk $BUILDDIR | tail -1 | awk '{ print $4 }'` | |
108 | if [ $DSPACE -lt $MINSPACE ]; then | |
109 | echo "Disk space low, skipping build" | |
110 | exit 1 | |
111 | fi | |
112 | if [ -z "$CCACHE_DIR" ]; then | |
113 | gunzip -c $HOME/src/ccache-*.tar.gz | tar xf - | |
114 | cd ccache-* | |
115 | <xsl:value-of select="concat($ccache-configure, ' ', $ccache-options, ' ', $options)"/> | |
116 | make | |
117 | strip ccache | |
118 | make install | |
119 | cd $BUILDDIR | |
120 | rm -r ccache-* | |
121 | fi | |
122 | if { cppunit-config --version || "$CPPUNIT_CONFIG" --version; } 2>/dev/null; then | |
123 | HAVE_CPPUNIT=1 | |
124 | fi | |
125 | if [ -z "$HAVE_CPPUNIT" ]; then | |
126 | gunzip -c $HOME/src/cppunit-*.tar.gz | tar xf - | |
127 | cd cppunit-* | |
128 | <xsl:value-of select="concat($cppunit-configure, ' ', $cppunit-options, ' ', $options)"/> | |
129 | make install-strip | |
130 | chmod +x $OPTDIR/bin/cppunit-config | |
131 | cd $BUILDDIR | |
132 | rm -rf cppunit-* | |
133 | fi | |
134 | </command> | |
135 | </shellcommand> | |
136 | </xsl:template> | |
137 | ||
138 | <!-- | |
139 | profile - see <steps>. | |
140 | --> | |
141 | <xsl:template name="profile"> | |
142 | <command> | |
143 | set -e | |
144 | uname -smnr | |
145 | umask 022 | |
146 | LANG=C | |
147 | TOPDIR=<get-builddir/> | |
148 | BUILDDIR=$TOPDIR/build | |
149 | OPTDIR=$HOME/opt/<basename><get name="builddir"/></basename> | |
150 | </command> | |
151 | </xsl:template> | |
152 | ||
153 | <!-- | |
154 | prologue - see <steps>. | |
155 | --> | |
156 | <xsl:template name="prologue"> | |
157 | <command> | |
158 | INSTALLDIR=$TOPDIR/install | |
159 | case `uname -sm` in | |
160 | Linux*86*) PATH=$HOME/linux-x86/bin:$PATH ;; | |
161 | esac | |
162 | PATH=$OPTDIR/bin:$PATH | |
163 | LD_LIBRARY_PATH=$BUILDDIR/lib:$OPTDIR/lib:$LD_LIBRARY_PATH | |
164 | export LD_LIBRARY_PATH | |
165 | if { ccache -V; } >/dev/null 2>&1; then | |
166 | CCACHE_DIR=$TOPDIR/ccache | |
167 | export CCACHE_DIR | |
168 | ccache -M 90M | |
169 | fi | |
170 | cd $BUILDDIR | |
171 | if [ -f wx-config ]; then | |
172 | `./wx-config --cxx` --version | |
173 | fi | |
174 | <if-del-on-fail>trap 'cd; rm -rf $BUILDDIR' EXIT</if-del-on-fail> | |
175 | </command> | |
176 | </xsl:template> | |
177 | ||
178 | <!-- | |
179 | epilogue - see <steps>. | |
180 | --> | |
181 | <xsl:template name="epilogue"> | |
182 | <xsl:if test="position() != last()"> | |
183 | <if-del-on-fail> | |
184 | <command>trap '' EXIT</command> | |
185 | </if-del-on-fail> | |
186 | </xsl:if> | |
187 | </xsl:template> | |
188 | ||
189 | <!-- | |
190 | builddir - override <builddir> to accept a full path | |
191 | ||
192 | Usage: <builddir>/tmp/wx/foobar</builddir> | |
193 | ||
194 | Normally builddir is a single directory name not a full path. Override | |
195 | to allow a working directory to be selected on the remote testdrive | |
196 | machine. | |
197 | ||
198 | The actual builddir (i.e. last part 'foobar') as usual must be unique | |
199 | across all the builds of all the slaves. | |
200 | --> | |
201 | <xsl:template name="builddir"> | |
202 | <xsl:param name="content"/> | |
203 | <builddir> | |
204 | <basename><xsl:copy-of select="$content"/></basename> | |
205 | </builddir> | |
206 | </xsl:template> | |
207 | ||
208 | <!-- | |
209 | Put builds under /tmp/wx on the remote machines by default. | |
210 | ||
211 | If the <builddir> element specifies a full path then returns that | |
212 | as-is, otherwise prepends '/tmp/wx/'. | |
213 | --> | |
214 | <xsl:template name="get-builddir"> | |
215 | <xsl:variable name="builddir"><get name="builddir"/></xsl:variable> | |
216 | <xsl:if test="substring($builddir, 1, 1) != '/'"> | |
217 | <xsl:text>/tmp/wx/</xsl:text> | |
218 | </xsl:if> | |
219 | <xsl:value-of select="$builddir"/> | |
220 | </xsl:template> | |
221 | ||
222 | <!-- | |
223 | basename - returns the final component of a path | |
224 | ||
225 | Usage: <basename>/foo/bar</basename> | |
226 | ||
227 | Evaluates to 'bar'. | |
228 | --> | |
229 | <xsl:template name="basename"> | |
230 | <xsl:param name="path"/> | |
231 | <xsl:choose> | |
232 | <xsl:when test="contains($path, '/')"> | |
233 | <xsl:call-template name="basename"> | |
234 | <xsl:with-param name="path" select="substring-after($path, '/')"/> | |
235 | </xsl:call-template> | |
236 | </xsl:when> | |
237 | <xsl:otherwise> | |
238 | <xsl:value-of select="$path"/> | |
239 | </xsl:otherwise> | |
240 | </xsl:choose> | |
241 | </xsl:template> | |
242 | ||
243 | </bot> |