source: LFS/lfs.xsl@ 4cd2611

2.4
Last change on this file since 4cd2611 was 4cd2611, checked in by Pierre Labastie <pierre@…>, 6 years ago

The preceding merge added a
line concerning porg, which is not in version 2.4...

  • 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'">
198 <xsl:text>mkdir -pv $PKG_DEST/usr/lib/pkgconfig
199</xsl:text>
200 </xsl:if>
201 <xsl:apply-templates
202 select=".//screen[(not(@role) or
203 @role != 'nodump') and
204 (not(@revision) or
205 @revision=$revision)]/userinput[@remap = 'install']"/>
206 <xsl:if test="ancestor::chapter[@id != 'chapter-temporary-tools'] and
207 $pkgmngt = 'y' and
208 descendant::screen[not(@role) or
209 @role != 'nodump']/userinput[
210 @remap='install']">
211 <xsl:if test="../@id = 'ch-system-man-pages'">
212<!-- these files are provided by the shadow package -->
213 <xsl:text>rm -fv $PKG_DEST/usr/share/man/{man3/getspnam.3,man5/passwd.5}
214</xsl:text>
215 </xsl:if>
216<!-- Attr man/man2 pages are already installed by man-pages. As of
217 March 2013, they are the same pages.
218 November 2015: now they are more accurate
219 in man-pages, and the man5 section is also in man-pages... -->
220 <xsl:if test="../@id = 'ch-system-attr'">
221 <xsl:text>rm -fv $PKG_DEST/usr/share/man/man2/*
222rm -fv $PKG_DEST/usr/share/man/man5/*
223</xsl:text>
224 </xsl:if>
225<!-- nologin is installed by util-linux. remove it from shadow -->
226 <xsl:if test="../@id = 'ch-system-shadow'">
227 <xsl:text>rm -fv $PKG_DEST/usr/share/man/man8/nologin.8
228rm -fv $PKG_DEST/sbin/nologin
229</xsl:text>
230 </xsl:if>
231 <xsl:text>rm -fv $PKG_DEST/{,usr/}lib64
232rm -fv $PKG_DEST/usr/{man,doc,info}
233for dir in $PKG_DEST/usr/share/man/man{1..8}; do
234 [[ -z $(ls $dir) ]] &amp;&amp; rmdir -v $dir
235done
236for dir in $PKG_DEST/usr/share/{doc,info,man}; do
237 [[ -z $(ls $dir) ]] &amp;&amp; rmdir -v $dir
238done
239for dir in $PKG_DEST/usr/{lib,bin,sbin,include}; do
240 [[ -z $(ls $dir) ]] &amp;&amp; rmdir -v $dir
241done
242for dir in $PKG_DEST/{boot,etc,lib,bin,sbin}; do
243 [[ -z $(ls $dir) ]] &amp;&amp; rmdir -v $dir
244done
245PREV_SEC=${SECONDS}
246packInstall
247SECONDS=${PREV_SEC}
248rm -rf $PKG_DEST
249</xsl:text>
250 </xsl:if>
251 <xsl:if test="$testsuite='3' and
252 ../@id='ch-tools-glibc' and
253 @role='installation'">
254 <xsl:copy-of select="//userinput[@remap='locale-test']"/>
255 <xsl:text>&#xA;</xsl:text>
256 </xsl:if>
257 <xsl:if test="../@id='ch-system-glibc' and @role='installation'">
258 <xsl:choose>
259 <xsl:when test="$full-locale='y'">
260 <xsl:copy-of select="//userinput[@remap='locale-full']"/>
261 <xsl:text>&#xA;</xsl:text>
262 </xsl:when>
263 <xsl:otherwise>
264 <xsl:copy-of select="//userinput[@remap='locale-test']"/>
265 <xsl:text>&#xA;</xsl:text>
266 <xsl:if test="not(contains(string(//userinput[@remap='locale-test']),$lang)) and $lang!='C' and $lang!='POSIX'">
267 <xsl:text>if LOCALE=`grep "</xsl:text>
268 <xsl:value-of select="$lang"/>
269 <xsl:text>/" $PKGDIR/localedata/SUPPORTED`; then
270 CHARMAP=`echo $LOCALE | sed 's,[^/]*/\([^ ]*\) [\],\1,'`
271 INPUT=`echo $LOCALE | sed 's,[/.].*,,'`
272 LOCALE=`echo $LOCALE | sed 's,/.*,,'`
273 localedef -i $INPUT -f $CHARMAP $LOCALE
274fi
275</xsl:text>
276 </xsl:if>
277 </xsl:otherwise>
278 </xsl:choose>
279 </xsl:if>
280 <xsl:apply-templates
281 select=".//screen[
282 (not(@role) or
283 @role != 'nodump') and
284 (not(@revision) or
285 @revision=$revision)
286 ]/userinput[
287 not(@remap) or
288 @remap='adjust' or
289 @remap='test' and current()/../@id='ch-tools-dejagnu' or
290 @remap='test' and current()/../@id='ch-system-systemd'
291 ]"/>
292 </xsl:template>
293
294 <xsl:template match="sect1" mode="pkgmngt">
295 <xsl:param name="dirname" select="chapter05"/>
296 <!-- The build order -->
297 <xsl:param name="order" select="062"/>
298<!-- The file names -->
299 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
300 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
301 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
302 <!-- Creating dirs and files -->
303 <xsl:if test="count(descendant::screen/userinput) &gt; 0 and
304 count(descendant::screen/userinput) &gt;
305 count(descendant::screen[@role='nodump'])">
306 <exsl:document href="{$dirname}/{$order}-{position()}-{$filename}"
307 method="text">
308 <xsl:text>#!/bin/bash
309set +h
310set -e
311
312cd $PKGDIR
313</xsl:text>
314 <xsl:apply-templates
315 select=".//screen[not(@role) or
316 @role != 'nodump']/userinput[@remap != 'adjust']"
317 mode="pkgmngt"/>
318 <xsl:if test="$dirname = 'chapter06'">
319 <xsl:text>PREV_SEC=${SECONDS}
320packInstall
321SECONDS=${PREV_SEC}
322rm -rf $PKG_DEST
323</xsl:text>
324 </xsl:if>
325 <xsl:apply-templates
326 select=".//screen[not(@role) or
327 @role != 'nodump'
328 ]/userinput[not(@remap) or
329 @remap='adjust'
330 ]"
331 mode="pkgmngt"/>
332 <xsl:text>
333echo -e "\n\nTotalseconds: $SECONDS\n"
334exit
335</xsl:text>
336 </exsl:document>
337 </xsl:if>
338 </xsl:template>
339
340 <xsl:template match="userinput" mode="pkgmngt">
341 <xsl:apply-templates/>
342 <xsl:text>&#xA;</xsl:text>
343 </xsl:template>
344
345 <xsl:template match="userinput">
346 <xsl:choose>
347 <!-- Copying the kernel config file -->
348 <xsl:when test="string() = 'make mrproper'">
349 <xsl:text>make mrproper&#xA;</xsl:text>
350 <xsl:if test="ancestor::sect1[@id='ch-bootable-kernel']">
351 <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
352 </xsl:if>
353 </xsl:when>
354<!-- test instructions -->
355 <xsl:when test="@remap = 'test'">
356 <xsl:choose>
357 <xsl:when test="$testsuite = '0'"/>
358 <xsl:when test="$testsuite = '1' and
359 not(ancestor::sect1[@id='ch-system-gcc']) and
360 not(ancestor::sect1[@id='ch-system-glibc']) and
361 not(ancestor::sect1[@id='ch-system-gmp']) and
362 not(ancestor::sect1[@id='ch-system-mpfr']) and
363 not(ancestor::sect1[@id='ch-system-binutils'])"/>
364 <xsl:when test="$testsuite = '2' and
365 ancestor::chapter[@id='chapter-temporary-tools']"/>
366 <xsl:otherwise>
367 <xsl:choose>
368 <xsl:when test="$bomb-testsuite = 'n'">
369 <xsl:choose>
370 <!-- special case for glibc -->
371 <xsl:when test="contains(string(), 'glibc-check-log')">
372 <xsl:value-of
373 select="substring-before(string(),'2&gt;&amp;1')"/>
374 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
375 </xsl:when>
376 <!-- special case for procps-ng -->
377 <xsl:when test="contains(string(), 'pushd')">
378 <xsl:text>{ </xsl:text>
379 <xsl:apply-templates/>
380 <xsl:text>; } &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
381 </xsl:when>
382 <xsl:when test="contains(string(), 'make -k')">
383 <xsl:apply-templates/>
384 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
385 </xsl:when>
386 <xsl:when test="contains(string(), 'make')">
387 <xsl:value-of select="substring-before(string(),'make')"/>
388 <xsl:text>make -k</xsl:text>
389 <xsl:value-of select="substring-after(string(),'make')"/>
390 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
391 </xsl:when>
392 <xsl:otherwise>
393 <xsl:apply-templates/>
394 <xsl:if test="not(contains(string(), '&gt;&gt;'))">
395 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
396 </xsl:if>
397 <xsl:text>&#xA;</xsl:text>
398 </xsl:otherwise>
399 </xsl:choose>
400 </xsl:when>
401 <xsl:otherwise>
402 <!-- bomb-testsuite != 'n'-->
403 <xsl:choose>
404 <!-- special case for glibc -->
405 <xsl:when test="contains(string(), 'glibc-check-log')">
406 <xsl:value-of
407 select="substring-before(string(),'2&gt;&amp;1')"/>
408 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
409 </xsl:when>
410 <!-- special case for gmp -->
411 <xsl:when test="contains(string(), 'tee gmp-check-log')">
412 <xsl:text>(</xsl:text>
413 <xsl:apply-templates/>
414 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 &amp;&amp; exit $PIPESTATUS)&#xA;</xsl:text>
415 </xsl:when>
416 <!-- special case for procps-ng -->
417 <xsl:when test="contains(string(), 'pushd')">
418 <xsl:text>{ </xsl:text>
419 <xsl:apply-templates/>
420 <xsl:text>; } &gt;&gt; $TEST_LOG 2&gt;&amp;1&#xA;</xsl:text>
421 </xsl:when>
422 <xsl:when test="contains(string(), 'make -k')">
423 <xsl:apply-templates/>
424 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
425 </xsl:when>
426 <xsl:otherwise>
427 <xsl:apply-templates/>
428 <xsl:if test="not(contains(string(), '&gt;&gt;'))">
429 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
430 </xsl:if>
431 <xsl:text>&#xA;</xsl:text>
432 </xsl:otherwise>
433 </xsl:choose>
434 </xsl:otherwise>
435 </xsl:choose>
436 </xsl:otherwise>
437 </xsl:choose>
438 </xsl:when>
439<!-- End of test instructions -->
440 <!-- Don't stop on strip run -->
441 <xsl:when test="contains(string(),'strip ')">
442 <xsl:apply-templates/>
443 <xsl:text> || true&#xA;</xsl:text>
444 </xsl:when>
445<!-- Package management -->
446<!-- Add $PKG_DEST to installation commands -->
447 <xsl:when test="@remap='install' and
448 not(ancestor::chapter[
449 @id='chapter-temporary-tools'
450 ])">
451 <xsl:choose>
452 <xsl:when test="$pkgmngt='n'">
453 <xsl:choose>
454 <xsl:when test="contains(string(),'firmware,udev')">
455 <xsl:text>if [[ ! -d /lib/udev/devices ]] ; then&#xA;</xsl:text>
456 <xsl:apply-templates/>
457 <xsl:text>&#xA;fi&#xA;</xsl:text>
458 </xsl:when>
459 <xsl:otherwise>
460 <xsl:apply-templates/>
461 <xsl:text>&#xA;</xsl:text>
462 </xsl:otherwise>
463 </xsl:choose>
464 </xsl:when>
465 <xsl:otherwise><!--pkgmngt = 'y'-->
466 <xsl:choose>
467 <xsl:when test="./literal">
468 <xsl:call-template name="outputpkgdest">
469 <xsl:with-param name="outputstring" select="text()[1]"/>
470 </xsl:call-template>
471 <xsl:apply-templates select="literal"/>
472 <xsl:call-template name="outputpkgdest">
473 <xsl:with-param name="outputstring" select="text()[2]"/>
474 </xsl:call-template>
475 </xsl:when>
476 <xsl:otherwise>
477 <xsl:call-template name="outputpkgdest">
478 <xsl:with-param name="outputstring" select="string()"/>
479 </xsl:call-template>
480 </xsl:otherwise>
481 </xsl:choose>
482 </xsl:otherwise>
483 </xsl:choose>
484 </xsl:when>
485 <!-- if package management, we should make an independant package for
486 tzdata. -->
487 <xsl:when test="contains(string(),'tzdata') and $pkgmngt='y'">
488 <xsl:text>
489OLD_PKG_DEST=$PKG_DEST
490OLD_PKGDIR=$PKGDIR
491PKG_DEST=$(dirname $OLD_PKG_DEST)/001-tzdata
492PKGDIR=$(dirname $PKGDIR)/tzdata-</xsl:text>
493 <xsl:copy-of select="substring-before(
494 substring-after(string(),'tzdata'),
495 '.tar')"/>
496 <xsl:text>
497</xsl:text>
498 <xsl:copy-of select="substring-before(string(),'ZONEINFO=')"/>
499 <xsl:text>ZONEINFO=$PKG_DEST</xsl:text>
500 <xsl:copy-of select="substring-after(string(),'ZONEINFO=')"/>
501 <xsl:text>
502PREV_SEC=${SECONDS}
503packInstall
504SECONDS=${PREV_SEC}
505rm -rf $PKG_DEST
506PKG_DEST=$OLD_PKG_DEST
507unset OLD_PKG_DEST
508PKGDIR=$OLD_PKGDIR
509unset OLD_PKGDIR
510</xsl:text>
511 </xsl:when><!-- addition for tzdata + package management -->
512 <!-- End addition for package management -->
513 <!-- The rest of commands -->
514 <xsl:otherwise>
515 <xsl:apply-templates/>
516 <xsl:text>&#xA;</xsl:text>
517 </xsl:otherwise>
518 </xsl:choose>
519 </xsl:template>
520
521 <xsl:template match="replaceable">
522 <xsl:choose>
523 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
524 <xsl:value-of select="$timezone"/>
525 </xsl:when>
526 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
527 <xsl:value-of select="$page"/>
528 </xsl:when>
529 <xsl:when test="contains(string(.),'&lt;ll&gt;_&lt;CC&gt;')">
530 <xsl:value-of select="$lang"/>
531 </xsl:when>
532 <xsl:otherwise>
533 <xsl:text>**EDITME</xsl:text>
534 <xsl:apply-templates/>
535 <xsl:text>EDITME**</xsl:text>
536 </xsl:otherwise>
537 </xsl:choose>
538 </xsl:template>
539
540 <xsl:template name="outputpkgdest">
541 <xsl:param name="outputstring" select="foo"/>
542 <xsl:choose>
543 <xsl:when test="contains($outputstring,'make ')">
544 <xsl:choose>
545 <xsl:when test="not(starts-with($outputstring,'make'))">
546 <xsl:call-template name="outputpkgdest">
547 <xsl:with-param name="outputstring"
548 select="substring-before($outputstring,'make')"/>
549 </xsl:call-template>
550 <xsl:call-template name="outputpkgdest">
551 <xsl:with-param
552 name="outputstring"
553 select="substring-after($outputstring,
554 substring-before($outputstring,'make'))"/>
555 </xsl:call-template>
556 </xsl:when>
557 <xsl:otherwise>
558 <xsl:choose>
559<!-- special cases (no DESTDIR) here -->
560 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
561 <xsl:text>make install_root=$PKG_DEST -j1</xsl:text>
562 <xsl:value-of
563 select="substring-before(substring-after(string(),'make'),
564 'install')"/>
565 <xsl:text>install&#xA;</xsl:text>
566 </xsl:when>
567 <xsl:when test="ancestor::sect1[@id='ch-system-bzip2']">
568 <xsl:text>make PREFIX=$PKG_DEST/usr install&#xA;</xsl:text>
569 </xsl:when>
570 <xsl:when test="ancestor::sect1[@id='ch-system-sysklogd']">
571 <xsl:text>make BINDIR=$PKG_DEST/sbin prefix=$PKG_DEST install&#xA;</xsl:text>
572 </xsl:when>
573 <xsl:when test="ancestor::sect1[@id='ch-system-iproute2']">
574 <xsl:text>make DESTDIR=$PKG_DEST DOCDIR=</xsl:text>
575 <xsl:value-of
576 select="substring-before(substring-after(string(),'DOCDIR='),
577 'install')"/>
578 <xsl:text>install&#xA;</xsl:text>
579 </xsl:when>
580 <xsl:when test="ancestor::sect1[@id='ch-system-sysvinit']">
581 <xsl:text>make ROOT=$PKG_DEST</xsl:text>
582 <xsl:value-of
583 select="substring-before(substring-after(string(),'make'),
584 'install')"/>
585 <xsl:text>install&#xA;</xsl:text>
586 </xsl:when>
587 <xsl:when test="ancestor::sect1[@id='ch-bootable-kernel']">
588 <xsl:text>make INSTALL_MOD_PATH=$PKG_DEST</xsl:text>
589 <xsl:value-of
590 select="substring-before(substring-after(string(),'make'),
591 'install')"/>
592 <xsl:text>install&#xA;</xsl:text>
593 </xsl:when>
594 <xsl:when test="ancestor::sect1[@id='ch-system-attr']">
595 <xsl:text>DIST_ROOT=$PKG_DEST make</xsl:text>
596 <xsl:call-template name="outputpkgdest">
597 <xsl:with-param name="outputstring"
598 select="substring-after($outputstring,'make')"/>
599 </xsl:call-template>
600 </xsl:when>
601 <xsl:otherwise>
602 <xsl:text>make DESTDIR=$PKG_DEST</xsl:text>
603 <xsl:call-template name="outputpkgdest">
604 <xsl:with-param
605 name="outputstring"
606 select="substring-after($outputstring,'make')"/>
607 </xsl:call-template>
608 </xsl:otherwise>
609 </xsl:choose>
610 </xsl:otherwise>
611 </xsl:choose>
612 </xsl:when>
613 <xsl:when test="contains($outputstring,'ninja install')">
614 <xsl:choose>
615 <xsl:when test="not(starts-with($outputstring,'ninja install'))">
616 <xsl:call-template name="outputpkgdest">
617 <xsl:with-param name="outputstring"
618 select="substring-before($outputstring,'ninja install')"/>
619 </xsl:call-template>
620 <xsl:call-template name="outputpkgdest">
621 <xsl:with-param
622 name="outputstring"
623 select="substring-after($outputstring,
624 substring-before($outputstring,'ninja install'))"/>
625 </xsl:call-template>
626 </xsl:when>
627 <xsl:otherwise> <!-- "ninja" is the first word and is followed by
628 "install"-->
629 <xsl:text>DESTDIR=$PKG_DEST ninja</xsl:text>
630 <xsl:call-template name="outputpkgdest">
631 <xsl:with-param
632 name="outputstring"
633 select="substring-after($outputstring,'ninja')"/>
634 </xsl:call-template>
635 </xsl:otherwise>
636 </xsl:choose>
637 </xsl:when>
638 <xsl:otherwise> <!-- no make nor ninja in this string -->
639 <xsl:choose>
640 <xsl:when test="contains($outputstring,'&gt;/') and
641 not(contains(substring-before($outputstring,'&gt;/'),' /'))">
642 <xsl:value-of select="substring-before($outputstring,'&gt;/')"/>
643 <xsl:text>&gt;$PKG_DEST/</xsl:text>
644 <xsl:call-template name="outputpkgdest">
645 <xsl:with-param name="outputstring" select="substring-after($outputstring,'&gt;/')"/>
646 </xsl:call-template>
647 </xsl:when>
648 <xsl:when test="contains($outputstring,' /')">
649 <xsl:value-of select="substring-before($outputstring,' /')"/>
650 <xsl:text> $PKG_DEST/</xsl:text>
651 <xsl:call-template name="outputpkgdest">
652 <xsl:with-param name="outputstring" select="substring-after($outputstring,' /')"/>
653 </xsl:call-template>
654 </xsl:when>
655 <xsl:otherwise>
656 <xsl:value-of select="$outputstring"/>
657 <xsl:text>&#xA;</xsl:text>
658 </xsl:otherwise>
659 </xsl:choose>
660 </xsl:otherwise>
661 </xsl:choose>
662 </xsl:template>
663</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.