source: BLFS/xsl/scripts.xsl@ 945ccaa

ablfs-more legacy trunk
Last change on this file since 945ccaa was 945ccaa, checked in by Pierre Labastie <pierre@…>, 8 years ago

Merge the new_features branch (manully, thanks to svn)

  • Property mode set to 100644
File size: 22.3 KB
RevLine 
[e576789]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
[56178ba]8<!-- $Id$ -->
[e576789]9
10<!-- XSLT stylesheet to create shell scripts from "linear build" BLFS books. -->
11
[70d73d1]12<!-- Check whether the book is sysv or systemd -->
13 <xsl:variable name="rev">
14 <xsl:choose>
15 <xsl:when test="//bookinfo/title/phrase[@revision='systemd']">
16 systemd
17 </xsl:when>
18 <xsl:otherwise>
19 sysv
20 </xsl:otherwise>
21 </xsl:choose>
22 </xsl:variable>
23
[945ccaa]24 <!-- Wrap "root" commands inside a wrapper function, allowing
25 "porg style" package management -->
26 <xsl:param name="wrap-install" select="'n'"/>
27
[e576789]28 <!-- Build as user (y) or as root (n)? -->
29 <xsl:param name="sudo" select="'y'"/>
30
31 <xsl:template match="/">
32 <xsl:apply-templates select="//sect1"/>
33 </xsl:template>
34
35<!--=================== Master chunks code ======================-->
36
37 <xsl:template match="sect1">
38
[70d73d1]39 <xsl:if test="@id != 'bootscripts' and @id != 'systemd-units'">
[e576789]40 <!-- The file names -->
41 <xsl:variable name="filename" select="@id"/>
42
43 <!-- The build order -->
44 <xsl:variable name="position" select="position()"/>
45 <xsl:variable name="order">
46 <xsl:choose>
47 <xsl:when test="string-length($position) = 1">
48 <xsl:text>00</xsl:text>
49 <xsl:value-of select="$position"/>
50 </xsl:when>
51 <xsl:when test="string-length($position) = 2">
52 <xsl:text>0</xsl:text>
53 <xsl:value-of select="$position"/>
54 </xsl:when>
55 <xsl:otherwise>
56 <xsl:value-of select="$position"/>
57 </xsl:otherwise>
58 </xsl:choose>
59 </xsl:variable>
60
61 <!-- Depuration code -->
62 <xsl:message>
63 <xsl:text>SCRIPT is </xsl:text>
64 <xsl:value-of select="concat($order,'-z-',$filename)"/>
65 <xsl:text>&#xA; FTPDIR is </xsl:text>
66 <xsl:value-of select="$filename"/>
67 <xsl:text>&#xA;&#xA;</xsl:text>
68 </xsl:message>
69
70 <!-- Creating the scripts -->
71 <exsl:document href="{$order}-z-{$filename}" method="text">
72 <xsl:text>#!/bin/bash&#xA;set -e&#xA;&#xA;</xsl:text>
73 <xsl:choose>
74 <!-- Package page -->
[642722f]75 <xsl:when test="sect2[@role='package']">
[945ccaa]76 <!-- We build in a subdirectory, whose name may be needed
77 if using package management (see envars.conf), so
78 "export" it -->
79 <xsl:text>export PKG_DIR=</xsl:text>
[e576789]80 <xsl:value-of select="$filename"/>
[39dc04a]81 <xsl:text>
82SRC_DIR=${SRC_ARCHIVE}${SRC_SUBDIRS:+/${PKG_DIR}}
83BUILD_DIR=${BUILD_ROOT}${BUILD_SUBDIRS:+/${PKG_DIR}}
84mkdir -p $SRC_DIR
85mkdir -p $BUILD_DIR
86
87</xsl:text>
[e576789]88 <!-- Download code and build commands -->
89 <xsl:apply-templates select="sect2"/>
90 <!-- Clean-up -->
[39dc04a]91 <xsl:text>cd $BUILD_DIR
92[[ -n "$KEEP_FILES" ]] || </xsl:text>
[e576789]93 <!-- In some case, some files in the build tree are owned
94 by root -->
[642722f]95 <xsl:if test="$sudo='y'">
96 <xsl:text>sudo </xsl:text>
[e576789]97 </xsl:if>
[642722f]98 <xsl:text>rm -rf $UNPACKDIR unpacked&#xA;&#xA;</xsl:text>
[e576789]99 </xsl:when>
100 <!-- Non-package page -->
101 <xsl:otherwise>
102 <xsl:apply-templates select=".//screen"/>
103 </xsl:otherwise>
104 </xsl:choose>
105 <xsl:text>exit</xsl:text>
106 </exsl:document>
107 </xsl:if>
108 </xsl:template>
109
110<!--======================= Sub-sections code =======================-->
111
112 <xsl:template match="sect2">
113 <xsl:choose>
114 <xsl:when test="@role = 'package'">
[39dc04a]115 <xsl:text>cd $SRC_DIR
116</xsl:text>
[642722f]117 <!-- Download information is in bridgehead tags -->
[e576789]118 <xsl:apply-templates select="bridgehead[@renderas='sect3']"/>
119 <xsl:text>&#xA;</xsl:text>
120 </xsl:when>
[967b819]121 <xsl:when test="@role = 'qt4-prefix' or @role = 'qt5-prefix'">
122 <xsl:apply-templates select=".//screen"/>
123 </xsl:when>
[e576789]124 <xsl:when test="@role = 'installation'">
125 <xsl:text>
[39dc04a]126cd $BUILD_DIR
[07f7eff]127find . -maxdepth 1 -mindepth 1 -type d | xargs </xsl:text>
128 <xsl:if test="$sudo='y'">
129 <xsl:text>sudo </xsl:text>
130 </xsl:if>
131 <xsl:text>rm -rf
[67992a0]132case $PACKAGE in
[e6967a1]133 *.tar.gz|*.tar.bz2|*.tar.xz|*.tgz|*.tar.lzma)
[39dc04a]134 tar -xvf $SRC_DIR/$PACKAGE &gt; unpacked
[6eaae5e]135 UNPACKDIR=`grep '[^./]\+' unpacked | head -n1 | sed 's@^\./@@;s@/.*@@'`
136 ;;
137 *.tar.lz)
[39dc04a]138 bsdtar -xvf $SRC_DIR/$PACKAGE 2&gt; unpacked
[6eaae5e]139 UNPACKDIR=`head -n1 unpacked | cut -d" " -f2 | sed 's@^\./@@;s@/.*@@'`
[67992a0]140 ;;
141 *.zip)
[39dc04a]142 zipinfo -1 $SRC_DIR/$PACKAGE &gt; unpacked
[67992a0]143 UNPACKDIR="$(sed 's@/.*@@' unpacked | uniq )"
144 if test $(wc -w &lt;&lt;&lt; $UNPACKDIR) -eq 1; then
[39dc04a]145 unzip $SRC_DIR/$PACKAGE
[67992a0]146 else
147 UNPACKDIR=${PACKAGE%.zip}
[39dc04a]148 unzip -d $UNPACKDIR $SRC_DIR/$PACKAGE
[67992a0]149 fi
150 ;;
151 *)
152 UNPACKDIR=$PKG_DIR-build
153 mkdir $UNPACKDIR
[9da16d9]154 cp $SRC_DIR/$PACKAGE $UNPACKDIR
155 cp $(find . -mindepth 1 -maxdepth 1 -type l) $UNPACKDIR
[67992a0]156 ;;
157esac
[945ccaa]158export UNPACKDIR
[67992a0]159cd $UNPACKDIR&#xA;
160</xsl:text>
[e576789]161 <xsl:apply-templates select=".//screen | .//para/command"/>
162 <xsl:if test="$sudo = 'y'">
163 <xsl:text>sudo /sbin/</xsl:text>
164 </xsl:if>
165 <xsl:text>ldconfig&#xA;&#xA;</xsl:text>
166 </xsl:when>
167 <xsl:when test="@role = 'configuration'">
168 <xsl:apply-templates select=".//screen" mode="config"/>
169 </xsl:when>
170 </xsl:choose>
171 </xsl:template>
172
173<!--==================== Download code =======================-->
174
[642722f]175 <!-- template for extracting the filename from an url in the form:
176 proto://internet.name/dir1/.../dirn/filename?condition.
177 Needed, because substring-after(...,'/') returns only the
178 substring after the first '/'. -->
[e576789]179 <xsl:template name="package_name">
180 <xsl:param name="url" select="foo"/>
181 <xsl:param name="sub-url" select="substring-after($url,'/')"/>
182 <xsl:choose>
183 <xsl:when test="contains($sub-url,'/')">
184 <xsl:call-template name="package_name">
185 <xsl:with-param name="url" select="$sub-url"/>
186 </xsl:call-template>
187 </xsl:when>
188 <xsl:otherwise>
189 <xsl:choose>
190 <xsl:when test="contains($sub-url,'?')">
191 <xsl:value-of select="substring-before($sub-url,'?')"/>
192 </xsl:when>
193 <xsl:otherwise>
194 <xsl:value-of select="$sub-url"/>
195 </xsl:otherwise>
196 </xsl:choose>
197 </xsl:otherwise>
198 </xsl:choose>
199 </xsl:template>
200
[642722f]201 <!-- Generates the code to download a package, an additional package or
202 a patch. -->
203 <xsl:template name="download-file">
204 <xsl:param name="httpurl" select="''"/>
205 <xsl:param name="ftpurl" select="''"/>
206 <xsl:param name="md5" select="''"/>
207 <xsl:param name="varname" select="''"/>
208 <xsl:variable name="package">
209 <xsl:call-template name="package_name">
210 <xsl:with-param name="url">
[e576789]211 <xsl:choose>
[642722f]212 <xsl:when test="string-length($httpurl) &gt; 10">
213 <xsl:value-of select="$httpurl"/>
[e576789]214 </xsl:when>
215 <xsl:otherwise>
[642722f]216 <xsl:value-of select="$ftpurl"/>
[e576789]217 </xsl:otherwise>
218 </xsl:choose>
[642722f]219 </xsl:with-param>
220 </xsl:call-template>
221 </xsl:variable>
222 <xsl:variable name="first_letter"
223 select="translate(substring($package,1,1),
224 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
225 'abcdefghijklmnopqrstuvwxyz')"/>
226 <xsl:text>&#xA;</xsl:text>
227 <xsl:value-of select="$varname"/>
228 <xsl:text>=</xsl:text>
229 <xsl:value-of select="$package"/>
230 <xsl:text>&#xA;if [[ ! -f $</xsl:text>
231 <xsl:value-of select="$varname"/>
[8dc4646]232 <xsl:text> ]] ; then
233 if [[ -f $SRC_ARCHIVE/$</xsl:text>
[642722f]234 <xsl:value-of select="$varname"/>
235 <xsl:text> ]] ; then&#xA;</xsl:text>
236 <xsl:text> cp $SRC_ARCHIVE/$</xsl:text>
237 <xsl:value-of select="$varname"/>
238 <xsl:text> $</xsl:text>
239 <xsl:value-of select="$varname"/>
[8dc4646]240 <xsl:text>
241 else&#xA;</xsl:text>
[342c862]242 <!-- Download from upstream http -->
[642722f]243 <xsl:if test="string-length($httpurl) &gt; 10">
[8dc4646]244 <xsl:text> wget -T 30 -t 5 </xsl:text>
[642722f]245 <xsl:value-of select="$httpurl"/>
[342c862]246 <xsl:text> ||&#xA;</xsl:text>
[642722f]247 </xsl:if>
[342c862]248 <!-- Download from upstream ftp -->
[642722f]249 <xsl:if test="string-length($ftpurl) &gt; 10">
[8dc4646]250 <xsl:text> wget -T 30 -t 5 </xsl:text>
[642722f]251 <xsl:value-of select="$ftpurl"/>
[342c862]252 <xsl:text> ||&#xA;</xsl:text>
[642722f]253 </xsl:if>
[342c862]254 <!-- The FTP_SERVER mirror as a last resort -->
[8dc4646]255 <xsl:text> wget -T 30 -t 5 ${FTP_SERVER}svn/</xsl:text>
[342c862]256 <xsl:value-of select="$first_letter"/>
257 <xsl:text>/$</xsl:text>
258 <xsl:value-of select="$varname"/>
[8dc4646]259 <xsl:text><!--
260 cp $</xsl:text>
[642722f]261 <xsl:value-of select="$varname"/>
[8dc4646]262 <xsl:text> $SRC_ARCHIVE-->
263 fi
[e576789]264fi
265</xsl:text>
[642722f]266 <xsl:if test="string-length($md5) &gt; 10">
267 <xsl:text>echo "</xsl:text>
268 <xsl:value-of select="$md5"/>
269 <xsl:text>&#x20;&#x20;$</xsl:text>
270 <xsl:value-of select="$varname"/>
271 <xsl:text>" | md5sum -c -
[39dc04a]272</xsl:text>
273 </xsl:if>
274<!-- link additional packages into $BUILD_DIR, because they are supposed to
275 be there-->
276 <xsl:if test="string($varname) != 'PACKAGE'">
[8dc4646]277 <xsl:text>[[ "$SRC_DIR" != "$BUILD_DIR" ]] &amp;&amp; ln -sf $SRC_DIR/$</xsl:text>
[39dc04a]278 <xsl:value-of select="$varname"/>
279 <xsl:text> $BUILD_DIR
[e576789]280</xsl:text>
[642722f]281 </xsl:if>
282 </xsl:template>
283
284 <!-- Extract the MD5 sum information -->
285 <xsl:template match="para" mode="md5">
286 <xsl:choose>
287 <xsl:when test="contains(substring-after(string(),'sum: '),'&#xA;')">
288 <xsl:value-of select="substring-before(substring-after(string(),'sum: '),'&#xA;')"/>
[e576789]289 </xsl:when>
[642722f]290 <xsl:otherwise>
291 <xsl:value-of select="substring-after(string(),'sum: ')"/>
292 </xsl:otherwise>
[e576789]293 </xsl:choose>
294 </xsl:template>
295
[642722f]296 <!-- We have several templates itemizedlist, depending on whether we
297 expect the package information, or additional package(s) or patch(es)
298 information. Select the appropriate mode here. -->
299 <xsl:template match="bridgehead">
[e576789]300 <xsl:choose>
[642722f]301 <!-- Special case for Openjdk -->
302 <xsl:when test="contains(string(),'Source Package Information')">
303 <xsl:apply-templates
304 select="following-sibling::itemizedlist[1]//simplelist">
305 <xsl:with-param name="varname" select="'PACKAGE'"/>
306 </xsl:apply-templates>
307 <xsl:apply-templates select="following-sibling::itemizedlist
308 [preceding-sibling::bridgehead[1]=current()
309 and position() &gt;1]//simplelist">
310 <xsl:with-param name="varname" select="'PACKAGE1'"/>
311 </xsl:apply-templates>
[e576789]312 </xsl:when>
[642722f]313 <!-- Package information -->
314 <xsl:when test="contains(string(),'Package Information')">
315 <xsl:apply-templates select="following-sibling::itemizedlist
316 [preceding-sibling::bridgehead[1]=current()]"
317 mode="package"/>
[e576789]318 </xsl:when>
[642722f]319 <!-- Additional package information -->
[ba57e61]320 <!-- special case for llvm -->
321 <xsl:when test="contains(string(),'Optional Download')">
322 <xsl:apply-templates select="following-sibling::itemizedlist"
323 mode="additional"/>
324 </xsl:when>
325 <!-- All other additional packages have "Additional" -->
[642722f]326 <xsl:when test="contains(string(),'Additional')">
327 <xsl:apply-templates select="following-sibling::itemizedlist"
328 mode="additional"/>
[e576789]329 </xsl:when>
[642722f]330 <!-- Do not do anything if the dev has created another type of
331 bridgehead. -->
332 <xsl:otherwise/>
[e576789]333 </xsl:choose>
334 </xsl:template>
335
[642722f]336 <!-- Call the download code template with appropriate parameters -->
337 <xsl:template match="itemizedlist" mode="package">
338 <xsl:call-template name="download-file">
339 <xsl:with-param name="httpurl">
340 <xsl:value-of select="./listitem[1]/para/ulink/@url"/>
341 </xsl:with-param>
342 <xsl:with-param name="ftpurl">
343 <xsl:value-of select="./listitem/para[contains(string(),'FTP')]/ulink/@url"/>
344 </xsl:with-param>
345 <xsl:with-param name="md5">
346 <xsl:apply-templates select="./listitem/para[contains(string(),'MD5')]"
347 mode="md5"/>
348 </xsl:with-param>
349 <xsl:with-param name="varname" select="'PACKAGE'"/>
350 </xsl:call-template>
[e576789]351 </xsl:template>
352
[642722f]353 <xsl:template match="itemizedlist" mode="additional">
354 <!-- The normal layout is "one listitem"<->"one url", but some devs
355 find amusing to have FTP and/or MD5sum listitems, or to
356 enclose the download information inside a simplelist tag... -->
357 <xsl:for-each select="listitem[.//ulink]">
358 <xsl:choose>
359 <!-- hopefully, there was a HTTP line before -->
360 <xsl:when test="contains(string(./para),'FTP')"/>
361 <xsl:when test=".//simplelist">
362 <xsl:apply-templates select=".//simplelist">
363 <xsl:with-param name="varname" select="'PACKAGE1'"/>
364 </xsl:apply-templates>
365 </xsl:when>
366 <xsl:otherwise>
367 <xsl:call-template name="download-file">
368 <xsl:with-param name="httpurl">
369 <xsl:value-of select="./para/ulink/@url"/>
370 </xsl:with-param>
371 <xsl:with-param name="ftpurl">
372 <xsl:value-of
373 select="following-sibling::listitem[1]/
374 para[contains(string(),'FTP')]/ulink/@url"/>
375 </xsl:with-param>
376 <xsl:with-param name="md5">
377 <xsl:apply-templates
378 select="following-sibling::listitem[position()&lt;3]/
379 para[contains(string(),'MD5')]"
380 mode="md5"/>
381 </xsl:with-param>
382 <xsl:with-param name="varname">
383 <xsl:choose>
384 <xsl:when test="contains(./para/ulink/@url,'.patch')">
385 <xsl:text>PATCH</xsl:text>
386 </xsl:when>
387 <xsl:otherwise>
388 <xsl:text>PACKAGE1</xsl:text>
389 </xsl:otherwise>
390 </xsl:choose>
391 </xsl:with-param>
392 </xsl:call-template>
393 </xsl:otherwise>
394 </xsl:choose>
395 </xsl:for-each>
[e576789]396 </xsl:template>
397
[642722f]398 <!-- the simplelist case. Hopefully, the layout is one member for
399 url, one for md5 and others for various information, that we do not
400 use -->
401 <xsl:template match="simplelist">
402 <xsl:param name="varname" select="'PACKAGE1'"/>
403 <xsl:call-template name="download-file">
404 <xsl:with-param name="httpurl" select=".//ulink/@url"/>
405 <xsl:with-param name="md5">
406 <xsl:value-of select="substring-after(member[contains(string(),'MD5')],'sum: ')"/>
407 </xsl:with-param>
408 <xsl:with-param name="varname" select="$varname"/>
409 </xsl:call-template>
410 </xsl:template>
[e576789]411<!--======================== Commands code ==========================-->
412
413 <xsl:template match="screen">
414 <xsl:if test="child::* = userinput and not(@role = 'nodump')">
415 <xsl:choose>
416 <xsl:when test="@role = 'root'">
[945ccaa]417 <xsl:if test="not(preceding-sibling::screen[1][@role='root'])">
418 <xsl:if test="$sudo = 'y'">
419 <xsl:text>sudo -E sh &lt;&lt; ROOT_EOF&#xA;</xsl:text>
420 </xsl:if>
421 <xsl:if test="$wrap-install = 'y' and
422 ancestor::sect2[@role='installation']">
423 <xsl:text>if [ -r "$PACK_INSTALL" ]; then
424 source $PACK_INSTALL
425 export -f wrapInstall
426 export -f packInstall
427fi
428wrapInstall '
429</xsl:text>
430 </xsl:if>
[e576789]431 </xsl:if>
432 <xsl:apply-templates mode="root"/>
[945ccaa]433 <xsl:if test="not(following-sibling::screen[1][@role='root'])">
434 <xsl:if test="$wrap-install = 'y' and
435 ancestor::sect2[@role='installation']">
436 <xsl:text>'&#xA;packInstall</xsl:text>
437 </xsl:if>
438 <xsl:if test="$sudo = 'y'">
439 <xsl:text>&#xA;ROOT_EOF</xsl:text>
440 </xsl:if>
[e576789]441 </xsl:if>
442 </xsl:when>
443 <xsl:otherwise>
444 <xsl:apply-templates select="userinput"/>
445 </xsl:otherwise>
446 </xsl:choose>
447 <xsl:text>&#xA;</xsl:text>
448 </xsl:if>
449 </xsl:template>
450
[70d73d1]451 <xsl:template name="set-bootpkg-dir">
452 <xsl:param name="bootpkg" select="'bootscripts'"/>
453 <xsl:param name="url" select="''"/>
454 <xsl:text>[[ ! -d $SRC_DIR/blfs-</xsl:text>
455 <xsl:copy-of select="$bootpkg"/>
456 <xsl:text> ]] &amp;&amp; mkdir $SRC_DIR/blfs-</xsl:text>
457 <xsl:copy-of select="$bootpkg"/>
458 <xsl:text>
459pushd $SRC_DIR/blfs-</xsl:text>
460 <xsl:copy-of select="$bootpkg"/>
461 <xsl:text>
[e576789]462URL=</xsl:text>
[70d73d1]463 <xsl:value-of select="$url"/>
464 <xsl:text>
[e576789]465BOOTPACKG=$(basename $URL)
[bbcdeab]466if [[ ! -f $BOOTPACKG ]] ; then
467 if [[ -f $SRC_ARCHIVE/$PKG_DIR/$BOOTPACKG ]] ; then
468 cp $SRC_ARCHIVE/$PKG_DIR/$BOOTPACKG $BOOTPACKG
469 elif [[ -f $SRC_ARCHIVE/$BOOTPACKG ]] ; then
470 cp $SRC_ARCHIVE/$BOOTPACKG $BOOTPACKG
471 else
472 wget -T 30 -t 5 $URL
473 cp $BOOTPACKG $SRC_ARCHIVE
474 fi
475 rm -f unpacked
476fi
477
[e576789]478if [[ -e unpacked ]] ; then
[f079f8f]479 BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
480 if ! [[ -d $BOOTUNPACKDIR ]]; then
[e576789]481 rm unpacked
482 tar -xvf $BOOTPACKG > unpacked
[f079f8f]483 BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
[e576789]484 fi
485else
486 tar -xvf $BOOTPACKG > unpacked
[f079f8f]487 BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
[e576789]488fi
[f079f8f]489cd $BOOTUNPACKDIR
[e576789]490</xsl:text>
[70d73d1]491 </xsl:template>
492
493 <xsl:template match="screen" mode="config">
494 <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts']">
495 <xsl:call-template name="set-bootpkg-dir">
496 <xsl:with-param name="bootpkg" select="'bootscripts'"/>
497 <xsl:with-param name="url"
498 select="id('bootscripts')//itemizedlist//ulink/@url"/>
499 </xsl:call-template>
500 </xsl:if>
501 <xsl:if test="preceding-sibling::para[1]/xref[@linkend='systemd-units']">
502 <xsl:call-template name="set-bootpkg-dir">
503 <xsl:with-param name="bootpkg" select="'systemd-units'"/>
504 <xsl:with-param name="url"
505 select="id('systemd-units')//itemizedlist//ulink/@url"/>
506 </xsl:call-template>
[e576789]507 </xsl:if>
508 <xsl:apply-templates select='.'/>
[70d73d1]509 <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts' or
510 @linkend='systemd-units']">
[e576789]511 <xsl:text>
512popd</xsl:text>
513 </xsl:if>
514 <xsl:text>&#xA;</xsl:text>
515 </xsl:template>
516
517 <xsl:template match="para/command">
[a743e57]518 <xsl:variable name="ns" select="normalize-space(string())"/>
519 <xsl:if test="(contains($ns,'test') or
520 contains($ns,'check'))">
[e576789]521 <xsl:text>#</xsl:text>
[a743e57]522 <xsl:value-of select="substring-before($ns,'make ')"/>
[9c5ea2f]523 <xsl:text>make </xsl:text>
[a743e57]524 <xsl:if test="not(contains($ns,'-k'))">
[9c5ea2f]525 <xsl:text>-k </xsl:text>
526 </xsl:if>
[a743e57]527 <xsl:value-of select="substring-after($ns,'make ')"/>
[e576789]528 <xsl:text> || true&#xA;</xsl:text>
529 </xsl:if>
530 </xsl:template>
531
532 <xsl:template match="userinput">
533 <xsl:apply-templates/>
534 </xsl:template>
535
536 <xsl:template match="text()" mode="root">
537 <xsl:call-template name="output-root">
538 <xsl:with-param name="out-string" select="string()"/>
539 </xsl:call-template>
540 </xsl:template>
541
[945ccaa]542 <xsl:variable name="APOS">'</xsl:variable>
543
[e576789]544 <xsl:template name="output-root">
545 <xsl:param name="out-string" select="''"/>
546 <xsl:choose>
[9c5ea2f]547 <xsl:when test="contains($out-string,'make ')">
[e576789]548 <xsl:call-template name="output-root">
549 <xsl:with-param name="out-string"
[9c5ea2f]550 select="substring-before($out-string,'make ')"/>
[e576789]551 </xsl:call-template>
[9c5ea2f]552 <xsl:text>make -j1 </xsl:text>
[e576789]553 <xsl:call-template name="output-root">
554 <xsl:with-param name="out-string"
[9c5ea2f]555 select="substring-after($out-string,'make ')"/>
[e576789]556 </xsl:call-template>
557 </xsl:when>
558 <xsl:when test="contains($out-string,'$') and $sudo = 'y'">
559 <xsl:call-template name="output-root">
560 <xsl:with-param name="out-string"
561 select="substring-before($out-string,'$')"/>
562 </xsl:call-template>
563 <xsl:text>\$</xsl:text>
564 <xsl:call-template name="output-root">
565 <xsl:with-param name="out-string"
566 select="substring-after($out-string,'$')"/>
567 </xsl:call-template>
568 </xsl:when>
569 <xsl:when test="contains($out-string,'`') and $sudo = 'y'">
570 <xsl:call-template name="output-root">
571 <xsl:with-param name="out-string"
572 select="substring-before($out-string,'`')"/>
573 </xsl:call-template>
574 <xsl:text>\`</xsl:text>
575 <xsl:call-template name="output-root">
576 <xsl:with-param name="out-string"
577 select="substring-after($out-string,'`')"/>
578 </xsl:call-template>
579 </xsl:when>
580 <xsl:when test="contains($out-string,'\') and $sudo = 'y'">
581 <xsl:call-template name="output-root">
582 <xsl:with-param name="out-string"
583 select="substring-before($out-string,'\')"/>
584 </xsl:call-template>
585 <xsl:text>\\</xsl:text>
586 <xsl:call-template name="output-root">
587 <xsl:with-param name="out-string"
588 select="substring-after($out-string,'\')"/>
589 </xsl:call-template>
590 </xsl:when>
[945ccaa]591 <xsl:when test="contains($out-string,string($APOS))
592 and $wrap-install = 'y'
593 and ancestor::sect2[@role='installation']">
594 <xsl:call-template name="output-root">
595 <xsl:with-param name="out-string"
596 select="substring-before($out-string,string($APOS))"/>
597 </xsl:call-template>
598 <xsl:text>'\''</xsl:text>
599 <xsl:call-template name="output-root">
600 <xsl:with-param name="out-string"
601 select="substring-after($out-string,string($APOS))"/>
602 </xsl:call-template>
603 </xsl:when>
[e576789]604 <xsl:otherwise>
605 <xsl:value-of select="$out-string"/>
606 </xsl:otherwise>
607 </xsl:choose>
608 </xsl:template>
609
610 <xsl:template match="replaceable">
611 <xsl:text>**EDITME</xsl:text>
612 <xsl:apply-templates/>
613 <xsl:text>EDITME**</xsl:text>
614 </xsl:template>
615
616 <xsl:template match="replaceable" mode="root">
617 <xsl:text>**EDITME</xsl:text>
618 <xsl:apply-templates/>
619 <xsl:text>EDITME**</xsl:text>
620 </xsl:template>
621
622</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.