source: LFS/lfs.xsl@ 72063a4

2.4
Last change on this file since 72063a4 was 72063a4, checked in by Pierre Labastie <pierre@…>, 7 years ago

merge trunk r4040 and r4044 to 2.4 branch

  • Property mode set to 100644
File size: 27.4 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2
3<!-- $Id$ -->
4
5<xsl:stylesheet
6 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
7 xmlns:exsl="http://exslt.org/common"
8 extension-element-prefixes="exsl"
9 version="1.0">
10
11 <!-- which revision attribute to include: can only be sysv or systemd,
12 but we leave checking to the caller-->
13 <xsl:param name="revision" select="'sysv'"/>
14
15 <!-- use package management ?
16 n = no, original behavior
17 y = yes, add PKG_DEST to scripts in install commands of chapter06-08
18 -->
19 <xsl:param name="pkgmngt" select="'n'"/>
20
21 <!-- Run test suites?
22 0 = none
23 1 = only chapter06 Glibc, GCC and Binutils testsuites
24 2 = all chapter06 testsuites
25 3 = all chapter05 and chapter06 testsuites
26 -->
27 <xsl:param name="testsuite" select="'1'"/>
28
29 <!-- Bomb on test suites failures?
30 n = no, I want to build the full system and review the logs
31 y = yes, bomb at the first test suite failure to can review the build dir
32 -->
33 <xsl:param name="bomb-testsuite" select="'n'"/>
34
35 <!-- Install vim-lang package? OBSOLETE should always be 'n'-->
36 <xsl:param name="vim-lang" select="'n'"/>
37
38 <!-- Time zone -->
39 <xsl:param name="timezone" select="'GMT'"/>
40
41 <!-- Page size -->
42 <xsl:param name="page" select="'letter'"/>
43
44 <!-- Locale settings -->
45 <xsl:param name="lang" select="'C'"/>
46
47 <!-- Install the whole set of locales -->
48 <xsl:param name="full-locale" select="'n'"/>
49
50 <xsl:template match="/">
51 <xsl:apply-templates select="//sect1[not(@revision) or
52 @revision=$revision]"/>
53 </xsl:template>
54
55 <xsl:template match="sect1">
56<!-- Since this xsl:if tag encloses the whole template, it would
57 be much better to transpose this condition to the select part
58 of the "calling" apply-template. But that would change the numbering,
59 so that it would be difficult to compare to previous versions. So for
60 version 2.4, let us keep this -->
61 <xsl:if test="(../@id='chapter-temporary-tools' or
62 ../@id='chapter-building-system' or
63 ../@id='chapter-bootscripts' or
64 ../@id='chapter-bootable') and
65 (sect2[not(@revision) or @revision=$revision]//..|.)/
66 screen[(not(@role) or @role != 'nodump') and
67 (not(@revision) or @revision=$revision)]/
68 userinput[not(starts-with(string(),'chroot'))]">
69<!-- The last condition is a hack to allow previous versions of the
70 book where the chroot commands did not have role="nodump".
71 It only works if the chroot command is the only one on the page -->
72 <!-- The dirs names -->
73 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
74 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
75 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
76 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
77 <!-- The file names -->
78 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
79 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
80 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
81 <!-- The build order -->
82 <xsl:variable name="position" select="position()"/>
83 <xsl:variable name="order">
84 <xsl:choose>
85 <xsl:when test="string-length($position) = 1">
86 <xsl:text>00</xsl:text>
87 <xsl:value-of select="$position"/>
88 </xsl:when>
89 <xsl:when test="string-length($position) = 2">
90 <xsl:text>0</xsl:text>
91 <xsl:value-of select="$position"/>
92 </xsl:when>
93 <xsl:otherwise>
94 <xsl:value-of select="$position"/>
95 </xsl:otherwise>
96 </xsl:choose>
97 </xsl:variable>
98 <!-- Inclusion of package manager scriptlets -->
99 <xsl:if test="@id='ch-tools-stripping' and $pkgmngt='y'">
100 <xsl:apply-templates
101 select="document('packageManager.xml')//sect1[contains(@id,'ch-tools')]"
102 mode="pkgmngt">
103 <xsl:with-param name="order" select="$order"/>
104 <xsl:with-param name="dirname" select="$dirname"/>
105 </xsl:apply-templates>
106 </xsl:if>
107 <xsl:if test="@id='ch-system-strippingagain' and $pkgmngt='y'">
108 <xsl:apply-templates
109 select="document('packageManager.xml')//sect1[contains(@id,'ch-system')]"
110 mode="pkgmngt">
111 <xsl:with-param name="order" select="$order"/>
112 <xsl:with-param name="dirname" select="$dirname"/>
113 </xsl:apply-templates>
114 </xsl:if>
115 <!-- Creating dirs and files -->
116 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
117 <xsl:choose>
118 <xsl:when test="@id='ch-system-creatingdirs' or
119 @id='ch-system-createfiles' or
120 @id='ch-system-strippingagain'">
121 <xsl:text>#!/tools/bin/bash&#xA;set +h&#xA;</xsl:text>
122 </xsl:when>
123 <xsl:otherwise>
124 <xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
125 </xsl:otherwise>
126 </xsl:choose>
127 <xsl:if test="not(@id='ch-tools-stripping') and
128 not(@id='ch-system-strippingagain')">
129 <xsl:text>set -e&#xA;</xsl:text>
130 </xsl:if>
131 <xsl:text>&#xA;</xsl:text>
132 <xsl:if test="sect2[@role='installation']">
133 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
134 </xsl:if>
135 <xsl:apply-templates select="sect2[not(@revision) or
136 @revision=$revision] |
137 screen[(not(@role) or
138 @role!='nodump') and
139 (not(@revision) or
140 @revision=$revision)]/userinput"/>
141 <xsl:if test="@id='ch-system-creatingdirs' and $pkgmngt='y'">
142 <xsl:apply-templates
143 select="document('packageManager.xml')//sect1[
144 @id='ch-pkgmngt-creatingdirs'
145 ]//userinput"
146 mode="pkgmngt"/>
147 </xsl:if>
148 <xsl:if test="@id='ch-system-createfiles' and $pkgmngt='y'">
149 <xsl:apply-templates
150 select="document('packageManager.xml')//sect1[
151 @id='ch-pkgmngt-createfiles'
152 ]//userinput"
153 mode="pkgmngt"/>
154 </xsl:if>
155 <xsl:text>echo -e "\n\nTotalseconds: $SECONDS\n"&#xA;</xsl:text>
156 <xsl:text>exit&#xA;</xsl:text>
157 </exsl:document>
158 </xsl:if>
159 </xsl:template>
160
161 <xsl:template match="sect2">
162 <xsl:apply-templates
163 select=".//screen[(not(@role) or
164 @role != 'nodump') and
165 (not(@revision) or
166 @revision=$revision)]/userinput[
167 @remap = 'pre' or
168 @remap = 'configure' or
169 @remap = 'make' or
170 @remap = 'test' and
171 not(current()/../@id='ch-tools-dejagnu') and
172 not(current()/../@id='ch-system-systemd')]"/>
173 <xsl:if
174 test="ancestor::chapter[@id != 'chapter-temporary-tools'] and
175 $pkgmngt = 'y' and
176 descendant::screen[not(@role) or
177 @role != 'nodump']/userinput[
178 @remap='install']">
179 <xsl:text>mkdir -pv $PKG_DEST/{boot,etc,lib,bin,sbin}
180mkdir -pv $PKG_DEST/usr/{lib,bin,sbin,include}
181mkdir -pv $PKG_DEST/usr/share/{doc,info,man}
182mkdir -pv $PKG_DEST/usr/share/man/man{1..8}
183ln -sv share/{man,doc,info} $PKG_DEST/usr
184case $(uname -m) in
185 x86_64) ln -sv lib $PKG_DEST/lib64 &amp;&amp; ln -sv lib $PKG_DEST/usr/lib64 ;;
186esac
187</xsl:text>
188 </xsl:if>
189 <xsl:if test="../@id = 'ch-system-glibc' and
190 @role='installation' and
191 $pkgmngt = 'y'">
192 <xsl:text>mkdir -pv $PKG_DEST/usr/include/{rpc,rpcsvc}
193</xsl:text>
194 </xsl:if>
195 <xsl:if test="../@id = 'ch-system-libelf' and
196 @role='installation' and
197 $pkgmngt = 'y' and
198 $wrap-install = 'n'">
199 <xsl:text>mkdir -pv $PKG_DEST/usr/lib/pkgconfig
200</xsl:text>
201 </xsl:if>
202 <xsl:apply-templates
203 select=".//screen[(not(@role) or
204 @role != 'nodump') and
205 (not(@revision) or
206 @revision=$revision)]/userinput[@remap = 'install']"/>
207 <xsl:if test="ancestor::chapter[@id != 'chapter-temporary-tools'] and
208 $pkgmngt = 'y' and
209 descendant::screen[not(@role) or
210 @role != 'nodump']/userinput[
211 @remap='install']">
212 <xsl:if test="../@id = 'ch-system-man-pages'">
213<!-- these files are provided by the shadow package -->
214 <xsl:text>rm -fv $PKG_DEST/usr/share/man/{man3/getspnam.3,man5/passwd.5}
215</xsl:text>
216 </xsl:if>
217<!-- Attr man/man2 pages are already installed by man-pages. As of
218 March 2013, they are the same pages.
219 November 2015: now they are more accurate
220 in man-pages, and the man5 section is also in man-pages... -->
221 <xsl:if test="../@id = 'ch-system-attr'">
222 <xsl:text>rm -fv $PKG_DEST/usr/share/man/man2/*
223rm -fv $PKG_DEST/usr/share/man/man5/*
224</xsl:text>
225 </xsl:if>
226<!-- nologin is installed by util-linux. remove it from shadow -->
227 <xsl:if test="../@id = 'ch-system-shadow'">
228 <xsl:text>rm -fv $PKG_DEST/usr/share/man/man8/nologin.8
229rm -fv $PKG_DEST/sbin/nologin
230</xsl:text>
231 </xsl:if>
232 <xsl:text>rm -fv $PKG_DEST/{,usr/}lib64
233rm -fv $PKG_DEST/usr/{man,doc,info}
234for dir in $PKG_DEST/usr/share/man/man{1..8}; do
235 [[ -z $(ls $dir) ]] &amp;&amp; rmdir -v $dir
236done
237for dir in $PKG_DEST/usr/share/{doc,info,man}; do
238 [[ -z $(ls $dir) ]] &amp;&amp; rmdir -v $dir
239done
240for dir in $PKG_DEST/usr/{lib,bin,sbin,include}; do
241 [[ -z $(ls $dir) ]] &amp;&amp; rmdir -v $dir
242done
243for dir in $PKG_DEST/{boot,etc,lib,bin,sbin}; do
244 [[ -z $(ls $dir) ]] &amp;&amp; rmdir -v $dir
245done
246PREV_SEC=${SECONDS}
247packInstall
248SECONDS=${PREV_SEC}
249rm -rf $PKG_DEST
250</xsl:text>
251 </xsl:if>
252 <xsl:if test="$testsuite='3' and
253 ../@id='ch-tools-glibc' and
254 @role='installation'">
255 <xsl:copy-of select="//userinput[@remap='locale-test']"/>
256 <xsl:text>&#xA;</xsl:text>
257 </xsl:if>
258 <xsl:if test="../@id='ch-system-glibc' and @role='installation'">
259 <xsl:choose>
260 <xsl:when test="$full-locale='y'">
261 <xsl:copy-of select="//userinput[@remap='locale-full']"/>
262 <xsl:text>&#xA;</xsl:text>
263 </xsl:when>
264 <xsl:otherwise>
265 <xsl:copy-of select="//userinput[@remap='locale-test']"/>
266 <xsl:text>&#xA;</xsl:text>
267 <xsl:if test="not(contains(string(//userinput[@remap='locale-test']),$lang)) and $lang!='C' and $lang!='POSIX'">
268 <xsl:text>if LOCALE=`grep "</xsl:text>
269 <xsl:value-of select="$lang"/>
270 <xsl:text>/" $PKGDIR/localedata/SUPPORTED`; then
271 CHARMAP=`echo $LOCALE | sed 's,[^/]*/\([^ ]*\) [\],\1,'`
272 INPUT=`echo $LOCALE | sed 's,[/.].*,,'`
273 LOCALE=`echo $LOCALE | sed 's,/.*,,'`
274 localedef -i $INPUT -f $CHARMAP $LOCALE
275fi
276</xsl:text>
277 </xsl:if>
278 </xsl:otherwise>
279 </xsl:choose>
280 </xsl:if>
281 <xsl:apply-templates
282 select=".//screen[
283 (not(@role) or
284 @role != 'nodump') and
285 (not(@revision) or
286 @revision=$revision)
287 ]/userinput[
288 not(@remap) or
289 @remap='adjust' or
290 @remap='test' and current()/../@id='ch-tools-dejagnu' or
291 @remap='test' and current()/../@id='ch-system-systemd'
292 ]"/>
293 </xsl:template>
294
295 <xsl:template match="sect1" mode="pkgmngt">
296 <xsl:param name="dirname" select="chapter05"/>
297 <!-- The build order -->
298 <xsl:param name="order" select="062"/>
299<!-- The file names -->
300 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
301 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
302 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
303 <!-- Creating dirs and files -->
304 <xsl:if test="count(descendant::screen/userinput) &gt; 0 and
305 count(descendant::screen/userinput) &gt;
306 count(descendant::screen[@role='nodump'])">
307 <exsl:document href="{$dirname}/{$order}-{position()}-{$filename}"
308 method="text">
309 <xsl:text>#!/bin/bash
310set +h
311set -e
312
313cd $PKGDIR
314</xsl:text>
315 <xsl:apply-templates
316 select=".//screen[not(@role) or
317 @role != 'nodump']/userinput[@remap != 'adjust']"
318 mode="pkgmngt"/>
319 <xsl:if test="$dirname = 'chapter06'">
320 <xsl:text>PREV_SEC=${SECONDS}
321packInstall
322SECONDS=${PREV_SEC}
323rm -rf $PKG_DEST
324</xsl:text>
325 </xsl:if>
326 <xsl:apply-templates
327 select=".//screen[not(@role) or
328 @role != 'nodump'
329 ]/userinput[not(@remap) or
330 @remap='adjust'
331 ]"
332 mode="pkgmngt"/>
333 <xsl:text>
334echo -e "\n\nTotalseconds: $SECONDS\n"
335exit
336</xsl:text>
337 </exsl:document>
338 </xsl:if>
339 </xsl:template>
340
341 <xsl:template match="userinput" mode="pkgmngt">
342 <xsl:apply-templates/>
343 <xsl:text>&#xA;</xsl:text>
344 </xsl:template>
345
346 <xsl:template match="userinput">
347 <xsl:choose>
348 <!-- Copying the kernel config file -->
349 <xsl:when test="string() = 'make mrproper'">
350 <xsl:text>make mrproper&#xA;</xsl:text>
351 <xsl:if test="ancestor::sect1[@id='ch-bootable-kernel']">
352 <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
353 </xsl:if>
354 </xsl:when>
355<!-- test instructions -->
356 <xsl:when test="@remap = 'test'">
357 <xsl:choose>
358 <xsl:when test="$testsuite = '0'"/>
359 <xsl:when test="$testsuite = '1' and
360 not(ancestor::sect1[@id='ch-system-gcc']) and
361 not(ancestor::sect1[@id='ch-system-glibc']) and
362 not(ancestor::sect1[@id='ch-system-gmp']) and
363 not(ancestor::sect1[@id='ch-system-mpfr']) and
364 not(ancestor::sect1[@id='ch-system-binutils'])"/>
365 <xsl:when test="$testsuite = '2' and
366 ancestor::chapter[@id='chapter-temporary-tools']"/>
367 <xsl:otherwise>
368 <xsl:choose>
369 <xsl:when test="$bomb-testsuite = 'n'">
370 <xsl:choose>
371 <!-- special case for glibc -->
372 <xsl:when test="contains(string(), 'glibc-check-log')">
373 <xsl:value-of
374 select="substring-before(string(),'2&gt;&amp;1')"/>
375 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
376 </xsl:when>
377 <!-- special case for procps-ng -->
378 <xsl:when test="contains(string(), 'pushd')">
379 <xsl:text>{ </xsl:text>
380 <xsl:apply-templates/>
381 <xsl:text>; } &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
382 </xsl:when>
383 <xsl:when test="contains(string(), 'make -k')">
384 <xsl:apply-templates/>
385 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
386 </xsl:when>
387 <xsl:when test="contains(string(), 'make')">
388 <xsl:value-of select="substring-before(string(),'make')"/>
389 <xsl:text>make -k</xsl:text>
390 <xsl:value-of select="substring-after(string(),'make')"/>
391 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
392 </xsl:when>
393 <xsl:otherwise>
394 <xsl:apply-templates/>
395 <xsl:if test="not(contains(string(), '&gt;&gt;'))">
396 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
397 </xsl:if>
398 <xsl:text>&#xA;</xsl:text>
399 </xsl:otherwise>
400 </xsl:choose>
401 </xsl:when>
402 <xsl:otherwise>
403 <!-- bomb-testsuite != 'n'-->
404 <xsl:choose>
405 <!-- special case for glibc -->
406 <xsl:when test="contains(string(), 'glibc-check-log')">
407 <xsl:value-of
408 select="substring-before(string(),'2&gt;&amp;1')"/>
409 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
410 </xsl:when>
411 <!-- special case for gmp -->
412 <xsl:when test="contains(string(), 'tee gmp-check-log')">
413 <xsl:text>(</xsl:text>
414 <xsl:apply-templates/>
415 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 &amp;&amp; exit $PIPESTATUS)&#xA;</xsl:text>
416 </xsl:when>
417 <!-- special case for procps-ng -->
418 <xsl:when test="contains(string(), 'pushd')">
419 <xsl:text>{ </xsl:text>
420 <xsl:apply-templates/>
421 <xsl:text>; } &gt;&gt; $TEST_LOG 2&gt;&amp;1&#xA;</xsl:text>
422 </xsl:when>
423 <xsl:when test="contains(string(), 'make -k')">
424 <xsl:apply-templates/>
425 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
426 </xsl:when>
427 <xsl:otherwise>
428 <xsl:apply-templates/>
429 <xsl:if test="not(contains(string(), '&gt;&gt;'))">
430 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
431 </xsl:if>
432 <xsl:text>&#xA;</xsl:text>
433 </xsl:otherwise>
434 </xsl:choose>
435 </xsl:otherwise>
436 </xsl:choose>
437 </xsl:otherwise>
438 </xsl:choose>
439 </xsl:when>
440<!-- End of test instructions -->
441 <!-- Don't stop on strip run -->
442 <xsl:when test="contains(string(),'strip ')">
443 <xsl:apply-templates/>
444 <xsl:text> || true&#xA;</xsl:text>
445 </xsl:when>
446<!-- Package management -->
447<!-- Add $PKG_DEST to installation commands -->
448 <xsl:when test="@remap='install' and
449 not(ancestor::chapter[
450 @id='chapter-temporary-tools'
451 ])">
452 <xsl:choose>
453 <xsl:when test="$pkgmngt='n'">
454 <xsl:choose>
455 <xsl:when test="contains(string(),'firmware,udev')">
456 <xsl:text>if [[ ! -d /lib/udev/devices ]] ; then&#xA;</xsl:text>
457 <xsl:apply-templates/>
458 <xsl:text>&#xA;fi&#xA;</xsl:text>
459 </xsl:when>
460 <xsl:otherwise>
461 <xsl:apply-templates/>
462 <xsl:text>&#xA;</xsl:text>
463 </xsl:otherwise>
464 </xsl:choose>
465 </xsl:when>
466 <xsl:otherwise><!--pkgmngt = 'y'-->
467 <xsl:choose>
468 <xsl:when test="./literal">
469 <xsl:call-template name="outputpkgdest">
470 <xsl:with-param name="outputstring" select="text()[1]"/>
471 </xsl:call-template>
472 <xsl:apply-templates select="literal"/>
473 <xsl:call-template name="outputpkgdest">
474 <xsl:with-param name="outputstring" select="text()[2]"/>
475 </xsl:call-template>
476 </xsl:when>
477 <xsl:otherwise>
478 <xsl:call-template name="outputpkgdest">
479 <xsl:with-param name="outputstring" select="string()"/>
480 </xsl:call-template>
481 </xsl:otherwise>
482 </xsl:choose>
483 </xsl:otherwise>
484 </xsl:choose>
485 </xsl:when>
486 <!-- if package management, we should make an independant package for
487 tzdata. -->
488 <xsl:when test="contains(string(),'tzdata') and $pkgmngt='y'">
489 <xsl:text>
490OLD_PKG_DEST=$PKG_DEST
491OLD_PKGDIR=$PKGDIR
492PKG_DEST=$(dirname $OLD_PKG_DEST)/001-tzdata
493PKGDIR=$(dirname $PKGDIR)/tzdata-</xsl:text>
494 <xsl:copy-of select="substring-before(
495 substring-after(string(),'tzdata'),
496 '.tar')"/>
497 <xsl:text>
498</xsl:text>
499 <xsl:copy-of select="substring-before(string(),'ZONEINFO=')"/>
500 <xsl:text>ZONEINFO=$PKG_DEST</xsl:text>
501 <xsl:copy-of select="substring-after(string(),'ZONEINFO=')"/>
502 <xsl:text>
503PREV_SEC=${SECONDS}
504packInstall
505SECONDS=${PREV_SEC}
506rm -rf $PKG_DEST
507PKG_DEST=$OLD_PKG_DEST
508unset OLD_PKG_DEST
509PKGDIR=$OLD_PKGDIR
510unset OLD_PKGDIR
511</xsl:text>
512 </xsl:when><!-- addition for tzdata + package management -->
513 <!-- End addition for package management -->
514 <!-- The rest of commands -->
515 <xsl:otherwise>
516 <xsl:apply-templates/>
517 <xsl:text>&#xA;</xsl:text>
518 </xsl:otherwise>
519 </xsl:choose>
520 </xsl:template>
521
522 <xsl:template match="replaceable">
523 <xsl:choose>
524 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
525 <xsl:value-of select="$timezone"/>
526 </xsl:when>
527 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
528 <xsl:value-of select="$page"/>
529 </xsl:when>
530 <xsl:when test="contains(string(.),'&lt;ll&gt;_&lt;CC&gt;')">
531 <xsl:value-of select="$lang"/>
532 </xsl:when>
533 <xsl:otherwise>
534 <xsl:text>**EDITME</xsl:text>
535 <xsl:apply-templates/>
536 <xsl:text>EDITME**</xsl:text>
537 </xsl:otherwise>
538 </xsl:choose>
539 </xsl:template>
540
541 <xsl:template name="outputpkgdest">
542 <xsl:param name="outputstring" select="foo"/>
543 <xsl:choose>
544 <xsl:when test="contains($outputstring,'make ')">
545 <xsl:choose>
546 <xsl:when test="not(starts-with($outputstring,'make'))">
547 <xsl:call-template name="outputpkgdest">
548 <xsl:with-param name="outputstring"
549 select="substring-before($outputstring,'make')"/>
550 </xsl:call-template>
551 <xsl:call-template name="outputpkgdest">
552 <xsl:with-param
553 name="outputstring"
554 select="substring-after($outputstring,
555 substring-before($outputstring,'make'))"/>
556 </xsl:call-template>
557 </xsl:when>
558 <xsl:otherwise>
559 <xsl:choose>
560<!-- special cases (no DESTDIR) here -->
561 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
562 <xsl:text>make install_root=$PKG_DEST -j1</xsl:text>
563 <xsl:value-of
564 select="substring-before(substring-after(string(),'make'),
565 'install')"/>
566 <xsl:text>install&#xA;</xsl:text>
567 </xsl:when>
568 <xsl:when test="ancestor::sect1[@id='ch-system-bzip2']">
569 <xsl:text>make PREFIX=$PKG_DEST/usr install&#xA;</xsl:text>
570 </xsl:when>
571 <xsl:when test="ancestor::sect1[@id='ch-system-sysklogd']">
572 <xsl:text>make BINDIR=$PKG_DEST/sbin prefix=$PKG_DEST install&#xA;</xsl:text>
573 </xsl:when>
574 <xsl:when test="ancestor::sect1[@id='ch-system-iproute2']">
575 <xsl:text>make DESTDIR=$PKG_DEST DOCDIR=</xsl:text>
576 <xsl:value-of
577 select="substring-before(substring-after(string(),'DOCDIR='),
578 'install')"/>
579 <xsl:text>install&#xA;</xsl:text>
580 </xsl:when>
581 <xsl:when test="ancestor::sect1[@id='ch-system-sysvinit']">
582 <xsl:text>make ROOT=$PKG_DEST</xsl:text>
583 <xsl:value-of
584 select="substring-before(substring-after(string(),'make'),
585 'install')"/>
586 <xsl:text>install&#xA;</xsl:text>
587 </xsl:when>
588 <xsl:when test="ancestor::sect1[@id='ch-bootable-kernel']">
589 <xsl:text>make INSTALL_MOD_PATH=$PKG_DEST</xsl:text>
590 <xsl:value-of
591 select="substring-before(substring-after(string(),'make'),
592 'install')"/>
593 <xsl:text>install&#xA;</xsl:text>
594 </xsl:when>
595 <xsl:when test="ancestor::sect1[@id='ch-system-attr']">
596 <xsl:text>DIST_ROOT=$PKG_DEST make</xsl:text>
597 <xsl:call-template name="outputpkgdest">
598 <xsl:with-param name="outputstring"
599 select="substring-after($outputstring,'make')"/>
600 </xsl:call-template>
601 </xsl:when>
602 <xsl:otherwise>
603 <xsl:text>make DESTDIR=$PKG_DEST</xsl:text>
604 <xsl:call-template name="outputpkgdest">
605 <xsl:with-param
606 name="outputstring"
607 select="substring-after($outputstring,'make')"/>
608 </xsl:call-template>
609 </xsl:otherwise>
610 </xsl:choose>
611 </xsl:otherwise>
612 </xsl:choose>
613 </xsl:when>
614 <xsl:when test="contains($outputstring,'ninja install')">
615 <xsl:choose>
616 <xsl:when test="not(starts-with($outputstring,'ninja install'))">
617 <xsl:call-template name="outputpkgdest">
618 <xsl:with-param name="outputstring"
619 select="substring-before($outputstring,'ninja install')"/>
620 </xsl:call-template>
621 <xsl:call-template name="outputpkgdest">
622 <xsl:with-param
623 name="outputstring"
624 select="substring-after($outputstring,
625 substring-before($outputstring,'ninja install'))"/>
626 </xsl:call-template>
627 </xsl:when>
628 <xsl:otherwise> <!-- "ninja" is the first word and is followed by
629 "install"-->
630 <xsl:text>DESTDIR=$PKG_DEST ninja</xsl:text>
631 <xsl:call-template name="outputpkgdest">
632 <xsl:with-param
633 name="outputstring"
634 select="substring-after($outputstring,'ninja')"/>
635 </xsl:call-template>
636 </xsl:otherwise>
637 </xsl:choose>
638 </xsl:when>
639 <xsl:otherwise> <!-- no make nor ninja in this string -->
640 <xsl:choose>
641 <xsl:when test="contains($outputstring,'&gt;/') and
642 not(contains(substring-before($outputstring,'&gt;/'),' /'))">
643 <xsl:value-of select="substring-before($outputstring,'&gt;/')"/>
644 <xsl:text>&gt;$PKG_DEST/</xsl:text>
645 <xsl:call-template name="outputpkgdest">
646 <xsl:with-param name="outputstring" select="substring-after($outputstring,'&gt;/')"/>
647 </xsl:call-template>
648 </xsl:when>
649 <xsl:when test="contains($outputstring,' /')">
650 <xsl:value-of select="substring-before($outputstring,' /')"/>
651 <xsl:text> $PKG_DEST/</xsl:text>
652 <xsl:call-template name="outputpkgdest">
653 <xsl:with-param name="outputstring" select="substring-after($outputstring,' /')"/>
654 </xsl:call-template>
655 </xsl:when>
656 <xsl:otherwise>
657 <xsl:value-of select="$outputstring"/>
658 <xsl:text>&#xA;</xsl:text>
659 </xsl:otherwise>
660 </xsl:choose>
661 </xsl:otherwise>
662 </xsl:choose>
663 </xsl:template>
664</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.