source: BLFS/xsl/scripts.xsl@ 5573313

ablfs
Last change on this file since 5573313 was 6631b83, checked in by Pierre Labastie <pierre@…>, 13 years ago

Code to copy back the tarball to SRC_ARCHIVE and
to account for the possibility of new-line in md5sums strings
in scripts.xsl

  • Property mode set to 100644
File size: 19.9 KB
Line 
1<?xml version="1.0"?>
2
3<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:exsl="http://exslt.org/common"
5 extension-element-prefixes="exsl"
6 version="1.0">
7
8<!-- $Id: scripts.xsl 34 2012-02-21 16:05:09Z labastie $ -->
9
10<!-- XSLT stylesheet to create shell scripts from "linear build" BLFS books. -->
11
12 <!-- Build as user (y) or as root (n)? -->
13 <xsl:param name="sudo" select="y"/>
14
15 <xsl:template match="/">
16 <xsl:apply-templates select="//sect1"/>
17 </xsl:template>
18
19<!--=================== Master chunks code ======================-->
20
21 <xsl:template match="sect1">
22
23 <xsl:if test="@id != 'bootscripts'">
24 <!-- The file names -->
25 <xsl:variable name="filename" select="@id"/>
26
27 <!-- The build order -->
28 <xsl:variable name="position" select="position()"/>
29 <xsl:variable name="order">
30 <xsl:choose>
31 <xsl:when test="string-length($position) = 1">
32 <xsl:text>00</xsl:text>
33 <xsl:value-of select="$position"/>
34 </xsl:when>
35 <xsl:when test="string-length($position) = 2">
36 <xsl:text>0</xsl:text>
37 <xsl:value-of select="$position"/>
38 </xsl:when>
39 <xsl:otherwise>
40 <xsl:value-of select="$position"/>
41 </xsl:otherwise>
42 </xsl:choose>
43 </xsl:variable>
44
45 <!-- Depuration code -->
46 <xsl:message>
47 <xsl:text>SCRIPT is </xsl:text>
48 <xsl:value-of select="concat($order,'-z-',$filename)"/>
49 <xsl:text>&#xA; FTPDIR is </xsl:text>
50 <xsl:value-of select="$filename"/>
51 <xsl:text>&#xA;&#xA;</xsl:text>
52 </xsl:message>
53
54 <!-- Creating the scripts -->
55 <exsl:document href="{$order}-z-{$filename}" method="text">
56 <xsl:text>#!/bin/bash&#xA;set -e&#xA;&#xA;</xsl:text>
57 <xsl:choose>
58 <!-- Package page -->
59 <xsl:when test="sect2[@role='package'] and not(@id = 'xorg7-app' or
60 @id = 'xorg7-data' or @id = 'xorg7-driver' or
61 @id = 'xorg7-font' or @id = 'xorg7-lib' or
62 @id = 'xorg7-proto' or @id = 'xorg7-util')">
63 <!-- Variables -->
64 <!-- These three lines could be important if SRC_ARCHIVE,
65 FTP_SERVER and SRCDIR were not set in the environment.
66 But they are not tested for length or anything later,
67 so not needed
68 <xsl:text>SRC_ARCHIVE=$SRC_ARCHIVE&#xA;</xsl:text>
69 <xsl:text>FTP_SERVER=$FTP_SERVER&#xA;</xsl:text>
70 <xsl:text>SRC_DIR=$SRC_DIR&#xA;&#xA;</xsl:text>-->
71 <xsl:text>&#xA;PKG_DIR=</xsl:text>
72 <xsl:value-of select="$filename"/>
73 <xsl:text>&#xA;</xsl:text>
74 <!-- Download code and build commands -->
75 <xsl:apply-templates select="sect2"/>
76 <!-- Clean-up -->
77 <!-- xorg7-server used to require mesalib tree being present.
78 That is no more true
79 <xsl:if test="not(@id='mesalib')"> -->
80 <xsl:text>cd $SRC_DIR/$PKG_DIR&#xA;</xsl:text>
81 <!-- In some case, some files in the build tree are owned
82 by root -->
83 <xsl:if test="$sudo='y'">
84 <xsl:text>sudo </xsl:text>
85 </xsl:if>
86 <xsl:text>rm -rf $UNPACKDIR unpacked&#xA;&#xA;</xsl:text>
87 <!-- Same reason as preceding comment
88 </xsl:if>
89 <xsl:if test="@id='xorg7-server'">
90 <xsl:text>cd $SRC_DIR/MesaLib
91UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
92rm -rf $UNPACKDIR unpacked&#xA;&#xA;</xsl:text>
93 </xsl:if> -->
94 </xsl:when>
95 <!-- Xorg7 pseudo-packages -->
96 <xsl:when test="contains(@id,'xorg7') and not(@id = 'xorg7-server')">
97 <xsl:text># Useless SRC_DIR=$SRC_DIR
98
99cd $SRC_DIR
100mkdir -p xc
101cd xc&#xA;</xsl:text>
102 <xsl:apply-templates select="sect2" mode="xorg7"/>
103 </xsl:when>
104 <!-- Non-package page -->
105 <xsl:otherwise>
106 <xsl:apply-templates select=".//screen"/>
107 </xsl:otherwise>
108 </xsl:choose>
109 <xsl:text>exit</xsl:text>
110 </exsl:document>
111 </xsl:if>
112 </xsl:template>
113
114<!--======================= Sub-sections code =======================-->
115
116 <xsl:template match="sect2">
117 <xsl:choose>
118 <xsl:when test="@role = 'package'">
119 <xsl:text>mkdir -p $SRC_DIR/$PKG_DIR&#xA;</xsl:text>
120 <xsl:text>cd $SRC_DIR/$PKG_DIR&#xA;</xsl:text>
121 <xsl:apply-templates select="bridgehead[@renderas='sect3']"/>
122 <xsl:text>&#xA;</xsl:text>
123 </xsl:when>
124 <xsl:when test="@role = 'installation'">
125 <xsl:text>
126if [ "${PACKAGE%.zip}" = "${PACKAGE}" ]; then
127 if [[ -e unpacked ]] ; then
128 UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
129 [[ -n $UNPACKDIR ]] &amp;&amp; [[ -d $UNPACKDIR ]] &amp;&amp; rm -rf $UNPACKDIR
130 fi
131 tar -xvf $PACKAGE > unpacked
132 UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
133else
134 UNPACKDIR=${PACKAGE%.zip}
135 [[ -n $UNPACKDIR ]] &amp;&amp; [[ -d $UNPACKDIR ]] &amp;&amp; rm -rf $UNPACKDIR
136 unzip -d $UNPACKDIR ${PACKAGE}
137fi
138cd $UNPACKDIR&#xA;</xsl:text>
139 <xsl:apply-templates select=".//screen | .//para/command"/>
140 <xsl:if test="$sudo = 'y'">
141 <xsl:text>sudo /sbin/</xsl:text>
142 </xsl:if>
143 <xsl:text>ldconfig&#xA;&#xA;</xsl:text>
144 </xsl:when>
145 <xsl:when test="@role = 'configuration'">
146 <xsl:apply-templates select=".//screen" mode="config"/>
147 </xsl:when>
148 </xsl:choose>
149 </xsl:template>
150
151 <xsl:template match="sect2" mode="xorg7">
152 <xsl:choose>
153 <xsl:when test="@role = 'package'">
154 <xsl:apply-templates select="itemizedlist/listitem/para" mode="xorg7"/>
155 </xsl:when>
156 <xsl:when test="not(@role)">
157<!-- Useless <xsl:text>SRC_ARCHIVE=$SRC_ARCHIVE
158FTP_SERVER=$FTP_SERVER&#xA;</xsl:text> -->
159 <xsl:apply-templates select=".//screen" mode="sect-ver"/>
160 <xsl:text>mkdir -p ${section}&#xA;cd ${section}&#xA;</xsl:text>
161 <xsl:apply-templates select="../sect2[@role='package']/itemizedlist/listitem/para" mode="xorg7-patch"/>
162 <xsl:text>for line in $(grep -v '^#' ../${sect_ver}.wget) ; do
163 if [[ ! -f ${line} ]] ; then
164 if [[ -f $SRC_ARCHIVE/Xorg/${section}/${line} ]] ; then
165 cp $SRC_ARCHIVE/Xorg/${section}/${line} ${line}
166 elif [[ -f $SRC_ARCHIVE/Xorg/${line} ]] ; then
167 cp $SRC_ARCHIVE/Xorg/${line} ${line}
168 elif [[ -f $SRC_ARCHIVE/${section}/${line} ]] ; then
169 cp $SRC_ARCHIVE/${section}/${line} ${line}
170 elif [[ -f $SRC_ARCHIVE/${line} ]] ; then
171 cp $SRC_ARCHIVE/${line} ${line}
172 else
173 wget -T 30 -t 5 ${FTP_X_SERVER}pub/individual/${section}/${line} || \
174 wget -T 30 -t 5 http://xorg.freedesktop.org/releases/individual/${section}/${line}
175 fi
176 fi
177done
178md5sum -c ../${sect_ver}.md5
179cp ../${sect_ver}.wget ../${sect_ver}.wget.orig
180cp ../${sect_ver}.md5 ../${sect_ver}.md5.orig&#xA;</xsl:text>
181 </xsl:when>
182 <xsl:when test="@role = 'installation'">
183 <xsl:text>for package in $(grep -v '^#' ../${sect_ver}.wget) ; do
184 packagedir=$(echo $package | sed 's/.tar.bz2//')
185 tar -xf ${package}
186 cd ${packagedir}&#xA;</xsl:text>
187 <xsl:apply-templates select=".//screen | .//para/command"/>
188 <xsl:text> cd ..
189 rm -rf ${packagedir}
190 sed -i "/${package}/d" ../${sect_ver}.wget
191 sed -i "/${package}/d" ../${sect_ver}.md5
192done
193mv ../${sect_ver}.wget.orig ../${sect_ver}.wget
194mv ../${sect_ver}.md5.orig ../${sect_ver}.md5&#xA;</xsl:text>
195 <xsl:if test="$sudo = 'y'">
196 <xsl:text>sudo /sbin/</xsl:text>
197 </xsl:if>
198 <xsl:text>ldconfig&#xA;&#xA;</xsl:text>
199 </xsl:when>
200 <xsl:when test="@role = 'configuration'">
201 <xsl:apply-templates select=".//screen"/>
202 <xsl:text>&#xA;</xsl:text>
203 </xsl:when>
204 </xsl:choose>
205 </xsl:template>
206
207<!--==================== Download code =======================-->
208
209 <xsl:template name="package_name">
210 <xsl:param name="url" select="foo"/>
211 <xsl:param name="sub-url" select="substring-after($url,'/')"/>
212 <xsl:choose>
213 <xsl:when test="contains($sub-url,'/')">
214 <xsl:call-template name="package_name">
215 <xsl:with-param name="url" select="$sub-url"/>
216 </xsl:call-template>
217 </xsl:when>
218 <xsl:otherwise>
219 <xsl:choose>
220 <xsl:when test="contains($sub-url,'?')">
221 <xsl:value-of select="substring-before($sub-url,'?')"/>
222 </xsl:when>
223 <xsl:otherwise>
224 <xsl:value-of select="$sub-url"/>
225 </xsl:otherwise>
226 </xsl:choose>
227 </xsl:otherwise>
228 </xsl:choose>
229 </xsl:template>
230
231 <xsl:template match="bridgehead">
232 <xsl:choose>
233 <xsl:when test="string()='Package Information'">
234 <xsl:variable name="url">
235 <xsl:choose>
236 <xsl:when
237 test="string-length(
238 following-sibling::itemizedlist[1]/listitem[1]/para/ulink/@url)
239 &gt; 10">
240 <xsl:value-of select=
241 "following-sibling::itemizedlist[1]/listitem[1]/para/ulink/@url"/>
242 </xsl:when>
243 <xsl:otherwise>
244 <xsl:value-of select=
245 "following-sibling::itemizedlist[1]/listitem[2]/para/ulink/@url"/>
246 </xsl:otherwise>
247 </xsl:choose>
248 </xsl:variable>
249 <xsl:variable name="package">
250 <xsl:call-template name="package_name">
251 <xsl:with-param name="url" select="$url"/>
252 </xsl:call-template>
253 </xsl:variable>
254 <xsl:variable
255 name="first_letter"
256 select="translate(substring($package,1,1),
257 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
258 'abcdefghijklmnopqrstuvwxyz')"/>
259 <xsl:text>PACKAGE=</xsl:text>
260 <xsl:value-of select="$package"/>
261 <xsl:text>&#xA;if [[ ! -f $PACKAGE ]] ; then&#xA;</xsl:text>
262 <!-- SRC_ARCHIVE may have subdirectories or not -->
263 <xsl:text> if [[ -f $SRC_ARCHIVE/$PKG_DIR/$PACKAGE ]] ; then&#xA;</xsl:text>
264 <xsl:text> cp $SRC_ARCHIVE/$PKG_DIR/$PACKAGE $PACKAGE&#xA;</xsl:text>
265 <xsl:text> elif [[ -f $SRC_ARCHIVE/$PACKAGE ]] ; then&#xA;</xsl:text>
266 <xsl:text> cp $SRC_ARCHIVE/$PACKAGE $PACKAGE&#xA; else&#xA;</xsl:text>
267 <!-- The FTP_SERVER mirror -->
268 <xsl:text> wget -T 30 -t 5 ${FTP_SERVER}svn/</xsl:text>
269 <xsl:value-of select="$first_letter"/>
270 <xsl:text>/$PACKAGE</xsl:text>
271 <xsl:apply-templates
272 select="following-sibling::itemizedlist[1]/listitem/para"
273 mode="package"/>
274 </xsl:when>
275 <xsl:when test="string()='Additional Downloads'">
276 <xsl:apply-templates
277 select="following-sibling::itemizedlist[1]/listitem/para"
278 mode="additional"/>
279 </xsl:when>
280 <xsl:otherwise/>
281 </xsl:choose>
282 </xsl:template>
283
284 <xsl:template match="para" mode="package">
285 <xsl:choose>
286 <xsl:when test="contains(string(),'HTTP')">
287 <!-- Upstream HTTP URL -->
288 <xsl:if test="string-length(ulink/@url) &gt; '10'">
289 <xsl:text> || \&#xA; wget -T 30 -t 5 </xsl:text>
290 <xsl:choose>
291 <xsl:when test="contains(ulink/@url,'?')">
292 <xsl:value-of select="substring-before(ulink/@url,'?')"/>
293 </xsl:when>
294 <xsl:otherwise>
295 <xsl:value-of select="ulink/@url"/>
296 </xsl:otherwise>
297 </xsl:choose>
298 <xsl:if test="not(contains(string(parent::listitem/following-sibling::listitem[1]/para),'FTP'))">
299 <xsl:text>
300 cp $PACKAGE $SRC_ARCHIVE
301 fi
302fi
303</xsl:text>
304 </xsl:if>
305 </xsl:if>
306 </xsl:when>
307 <xsl:when test="contains(string(),'FTP')">
308 <!-- Upstream FTP URL -->
309 <xsl:if test="string-length(ulink/@url) &gt; '10'">
310 <xsl:text> || \&#xA; wget -T 30 -t 5 </xsl:text>
311 <xsl:value-of select="ulink/@url"/>
312 </xsl:if>
313 <xsl:text>
314 cp $PACKAGE $SRC_ARCHIVE
315 fi
316fi
317</xsl:text>
318 </xsl:when>
319 <xsl:when test="contains(string(),'MD5')">
320<!-- some md5 sums are written with a LF -->
321 <xsl:variable name="md5">
322 <xsl:choose>
323 <xsl:when test="contains(substring-after(string(),'sum: '),'&#xA;')">
324 <xsl:value-of select="substring-before(substring-after(string(),'sum: '),'&#xA;')"/>
325 </xsl:when>
326 <xsl:otherwise>
327 <xsl:value-of select="substring-after(string(),'sum: ')"/>
328 </xsl:otherwise>
329 </xsl:choose>
330 </xsl:variable>
331 <xsl:text>echo "</xsl:text>
332 <xsl:value-of select="$md5"/>
333 <xsl:text>&#x20;&#x20;$PACKAGE" | md5sum -c -&#xA;</xsl:text>
334 </xsl:when>
335 </xsl:choose>
336 </xsl:template>
337
338 <xsl:template match="para" mode="additional">
339 <xsl:choose>
340 <xsl:when test="contains(string(ulink/@url),'.patch')">
341 <xsl:variable name="patch">
342 <xsl:call-template name="package_name">
343 <xsl:with-param name="url" select="ulink/@url"/>
344 </xsl:call-template>
345 </xsl:variable>
346 <xsl:text>PATCH=</xsl:text>
347 <xsl:value-of select="$patch"/>
348 <xsl:text>&#xA;if [[ ! -f $PATCH ]] ; then&#xA;</xsl:text>
349 <!-- SRC_ARCHIVE may have subdirectories or not -->
350 <xsl:text> if [[ -f $SRC_ARCHIVE/$PKG_DIR/$PATCH ]] ; then&#xA;</xsl:text>
351 <xsl:text> cp $SRC_ARCHIVE/$PKG_DIR/$PATCH $PATCH&#xA;</xsl:text>
352 <xsl:text> elif [[ -f $SRC_ARCHIVE/$PATCH ]] ; then&#xA;</xsl:text>
353 <xsl:text> cp $SRC_ARCHIVE/$PATCH $PATCH&#xA; else&#xA;</xsl:text>
354 <xsl:text>wget -T 30 -t 5 </xsl:text>
355 <xsl:value-of select="ulink/@url"/>
356 <xsl:text>&#xA;</xsl:text>
357 <xsl:text>
358 cp $PATCH $SRC_ARCHIVE
359 fi
360fi
361</xsl:text>
362 </xsl:when>
363 <xsl:when test="ulink">
364 <xsl:if test="string-length(ulink/@url) &gt; '10'">
365 <xsl:variable name="package">
366 <xsl:call-template name="package_name">
367 <xsl:with-param name="url" select="ulink/@url"/>
368 </xsl:call-template>
369 </xsl:variable>
370 <xsl:variable
371 name="first_letter"
372 select="translate(substring($package,1,1),
373 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
374 'abcdefghijklmnopqrstuvwxyz')"/>
375 <xsl:text>PACKAGE1=</xsl:text>
376 <xsl:value-of select="$package"/>
377 <xsl:text>&#xA;if [[ ! -f $PACKAGE1 ]] ; then&#xA;</xsl:text>
378 <!-- SRC_ARCHIVE may have subdirectories or not -->
379 <xsl:text> if [[ -f $SRC_ARCHIVE/$PKG_DIR/$PACKAGE1 ]] ; then&#xA;</xsl:text>
380 <xsl:text> cp $SRC_ARCHIVE/$PKG_DIR/$PACKAGE1 $PACKAGE1&#xA;</xsl:text>
381 <xsl:text> elif [[ -f $SRC_ARCHIVE/$PACKAGE1 ]] ; then&#xA;</xsl:text>
382 <xsl:text> cp $SRC_ARCHIVE/$PACKAGE1 $PACKAGE1&#xA; else&#xA;</xsl:text>
383 <!-- The FTP_SERVER mirror -->
384 <xsl:text> wget -T 30 -t 5 ${FTP_SERVER}svn/</xsl:text>
385 <xsl:value-of select="$first_letter"/>
386 <xsl:text>/$PACKAGE1</xsl:text>
387 <xsl:text> || \&#xA; wget -T 30 -t 5 </xsl:text>
388 <xsl:value-of select="ulink/@url"/>
389 <xsl:text>
390 cp $PACKAGE1 $SRC_ARCHIVE
391 fi
392fi
393</xsl:text>
394 </xsl:if>
395 </xsl:when>
396 <xsl:when test="contains(string(),'MD5')">
397<!-- some md5 sums are written with a LF -->
398 <xsl:variable name="md5">
399 <xsl:choose>
400 <xsl:when test="contains(substring-after(string(),'sum: '),'&#xA;')">
401 <xsl:value-of select="substring-before(substring-after(string(),'sum: '),'&#xA;')"/>
402 </xsl:when>
403 <xsl:otherwise>
404 <xsl:value-of select="substring-after(string(),'sum: ')"/>
405 </xsl:otherwise>
406 </xsl:choose>
407 </xsl:variable>
408 <xsl:text>echo "</xsl:text>
409 <xsl:value-of select="$md5"/>
410 <xsl:text>&#x20;&#x20;$PACKAGE1" | md5sum -c -&#xA;</xsl:text>
411 </xsl:when>
412 </xsl:choose>
413 </xsl:template>
414
415 <xsl:template match="itemizedlist/listitem/para" mode="xorg7">
416 <xsl:if test="contains(string(ulink/@url),'.md5') or
417 contains(string(ulink/@url),'.wget')">
418 <xsl:text>wget -T 30 -t 5 </xsl:text>
419 <xsl:value-of select="ulink/@url"/>
420 <xsl:text>&#xA;</xsl:text>
421 </xsl:if>
422 </xsl:template>
423
424 <xsl:template match="itemizedlist/listitem/para" mode="xorg7-patch">
425 <xsl:if test="contains(string(ulink/@url),'.patch')">
426 <xsl:text>wget -T 30 -t 5 </xsl:text>
427 <xsl:value-of select="ulink/@url"/>
428 <xsl:text>&#xA;</xsl:text>
429 </xsl:if>
430 </xsl:template>
431
432<!--======================== Commands code ==========================-->
433
434 <xsl:template match="screen">
435 <xsl:if test="child::* = userinput and not(@role = 'nodump')">
436 <xsl:choose>
437 <xsl:when test="@role = 'root'">
438 <xsl:if test="$sudo = 'y'">
439 <xsl:text>sudo sh -c '</xsl:text>
440 </xsl:if>
441 <xsl:apply-templates select="userinput" mode="root"/>
442 <xsl:if test="$sudo = 'y'">
443 <xsl:text>'</xsl:text>
444 </xsl:if>
445 </xsl:when>
446 <xsl:otherwise>
447 <xsl:apply-templates select="userinput"/>
448 </xsl:otherwise>
449 </xsl:choose>
450 <xsl:text>&#xA;</xsl:text>
451 </xsl:if>
452 </xsl:template>
453
454 <xsl:template match="screen" mode="config">
455 <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts']">
456 <xsl:text>[[ ! -d $SRC_DIR/blfs-bootscripts ]] &amp;&amp; mkdir $SRC_DIR/blfs-bootscripts
457pushd $SRC_DIR/blfs-bootscripts
458URL=</xsl:text>
459 <xsl:value-of select="id('bootscripts')//itemizedlist//ulink/@url"/><xsl:text>
460BOOTPACKG=$(basename $URL)
461[[ ! -f "$BOOTPACKG" ]] &amp;&amp; { wget -T 30 -t 5 $URL; rm -f unpacked; }
462if [[ -e unpacked ]] ; then
463 UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
464 if ! [[ -d $UNPACKDIR ]]; then
465 rm unpacked
466 tar -xvf $BOOTPACKG > unpacked
467 UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
468 fi
469else
470 tar -xvf $BOOTPACKG > unpacked
471 UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
472fi
473cd $UNPACKDIR
474</xsl:text>
475 </xsl:if>
476 <xsl:apply-templates select='.'/>
477 <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts']">
478 <xsl:text>
479popd</xsl:text>
480 </xsl:if>
481 <xsl:text>&#xA;</xsl:text>
482 </xsl:template>
483
484 <xsl:template match="screen" mode="sect-ver">
485 <xsl:text>section=</xsl:text>
486 <xsl:value-of select="substring-before(substring-after(string(),'mkdir '),' &amp;')"/>
487 <xsl:text>&#xA;sect_ver=</xsl:text>
488 <xsl:value-of select="substring-before(substring-after(string(),'-c ../'),'.md5')"/>
489 <xsl:text>&#xA;</xsl:text>
490 </xsl:template>
491
492 <xsl:template match="para/command">
493 <xsl:if test="(contains(string(),'test') or
494 contains(string(),'check'))">
495 <xsl:text>#</xsl:text>
496 <xsl:value-of select="substring-before(string(),'make')"/>
497 <xsl:text>make -k</xsl:text>
498 <xsl:value-of select="substring-after(string(),'make')"/>
499 <xsl:text> || true&#xA;</xsl:text>
500 </xsl:if>
501 </xsl:template>
502
503 <xsl:template match="userinput">
504 <xsl:apply-templates/>
505 </xsl:template>
506
507 <xsl:template match="userinput" mode="root">
508 <xsl:for-each select="child::node()">
509 <xsl:choose>
510 <xsl:when test="self::text() and contains(string(),'make')">
511 <xsl:value-of select="substring-before(string(),'make')"/>
512 <xsl:text>make -j1</xsl:text>
513 <xsl:value-of select="substring-after(string(),'make')"/>
514 </xsl:when>
515 <xsl:otherwise>
516 <xsl:apply-templates select="self::node()"/>
517 </xsl:otherwise>
518 </xsl:choose>
519 </xsl:for-each>
520 </xsl:template>
521
522 <xsl:template match="replaceable">
523<!-- Not needed anymore
524 <xsl:choose>
525 <xsl:when test="ancestor::sect1[@id='xorg7-server']">
526 <xsl:text>$SRC_DIR/MesaLib</xsl:text>
527 </xsl:when>
528 <xsl:otherwise> -->
529 <xsl:text>**EDITME</xsl:text>
530 <xsl:apply-templates/>
531 <xsl:text>EDITME**</xsl:text>
532<!-- </xsl:otherwise>
533 </xsl:choose> -->
534 </xsl:template>
535
536</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.