source: LFS/lfs.xsl@ 645ec47

ablfs-more trunk
Last change on this file since 645ec47 was 1352172, checked in by Pierre Labastie <pierre.labastie@…>, 11 months ago

Merge branch 'trunk' into xry111/parallelism

  • Property mode set to 100644
File size: 51.3 KB
RevLine 
[7072e1f]1<?xml version="1.0" encoding="ISO-8859-1"?>
[db181c47]2
[7072e1f]3<xsl:stylesheet
4 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5 xmlns:exsl="http://exslt.org/common"
6 extension-element-prefixes="exsl"
7 version="1.0">
[557fe91]8
[945ccaa]9<!-- Parameters -->
10
[7072e1f]11 <!-- use package management ?
12 n = no, original behavior
[55e82d2]13 y = yes, add PKG_DEST to scripts in install commands of chapter08-10
[7072e1f]14 -->
[945ccaa]15 <xsl:param name="pkgmngt" select="'n'"/>
16
17 <!-- Package management with "porg style" ?
18 n = no, same as pkgmngt description above
[55e82d2]19 y = yes, wrap install commands of chapter08-10 into a bash function.
[945ccaa]20 note that pkgmngt must be 'y' in this case
21 -->
22 <xsl:param name="wrap-install" select='"n"'/>
[2e1c1c3]23
[31d6944]24 <!-- Run test suites?
25 0 = none
[4c36783]26 1 = only chapter08 critical testsuites
27 2 (or more) = all chapter08 testsuites
[28f4756]28 -->
[31d6944]29 <xsl:param name="testsuite" select="1"/>
[01e51a1]30
[1b02a9a]31 <!-- Parallelism (LFS >= 12.1) -->
32 <xsl:param name="jobs_1" select="1"/>
33 <xsl:param name="jobs_2" select="1"/>
34
[085435e]35 <!-- Install non wide character ncurses 5? -->
36 <xsl:param name="ncurses5" select="'n'"/>
[2e1c1c3]37
[dc7fd7b]38 <!-- Should we strip excutables and libraries? -->
39 <xsl:param name='strip' select="'n'"/>
40
41 <!-- Should we remove .la files after chapter 5 and chapter 6? -->
42 <xsl:param name='del-la-files' select="'y'"/>
43
[877cc6a]44 <!-- Time zone -->
[945ccaa]45 <xsl:param name="timezone" select="'GMT'"/>
[2e1c1c3]46
[877cc6a]47 <!-- Page size -->
[945ccaa]48 <xsl:param name="page" select="'letter'"/>
[2e1c1c3]49
[877cc6a]50 <!-- Locale settings -->
[945ccaa]51 <xsl:param name="lang" select="'C'"/>
[b339c94]52
53 <!-- Install the whole set of locales -->
[945ccaa]54 <xsl:param name='full-locale' select='"n"'/>
[2e1c1c3]55
[945ccaa]56 <!-- Hostname -->
57 <xsl:param name='hostname' select='"HOSTNAME"'/>
58
59 <!-- Network parameters: interface, ip, gateway, prefix, broadcast, domain
60 and nameservers -->
61 <xsl:param name='interface' select="'eth0'"/>
62 <xsl:param name='ip' select='"10.0.2.9"'/>
63 <xsl:param name='gateway' select='"10.0.2.2"'/>
64 <xsl:param name='prefix' select='24'/>
65 <xsl:param name='broadcast' select='"10.0.2.255"'/>
66 <xsl:param name='domain' select='"lfs.org"'/>
67 <xsl:param name='nameserver1' select='"10.0.2.3"'/>
68 <xsl:param name='nameserver2' select='"8.8.8.8"'/>
69
[3b43e17b]70 <!-- Console parameters: font, fontmap, unicode (y/n), keymap, local (y:
71 hardware clock set to local time/n:hardware clock set to UTC)
72 and log-level -->
73 <xsl:param name='font' select="'lat0-16'"/>
74 <xsl:param name='keymap' select="'us'"/>
75 <xsl:param name='local' select="'n'"/>
76 <xsl:param name='log-level' select="'4'"/>
77
[2758d94]78 <!-- The scripts root is needed for printing disk usage -->
79 <xsl:param name='script-root' select="'jhalfs'"/>
80
[945ccaa]81<!-- End parameters -->
82
[4762fb9]83<!-- bashdir is used at the beginning of chapter 6, for the #! line.
84 If we created a /tools directory in chapter 4, bash is in /tools/bin,
85otherwise it is in /bin.-->
86 <xsl:variable name="bashdir">
87 <xsl:choose>
[a2b5689]88 <xsl:when test="//sect1[@id='ch-preps-creatingtoolsdir']">
[4762fb9]89 <xsl:text>/tools</xsl:text>
90 </xsl:when>
91 <xsl:otherwise>
92 <xsl:text></xsl:text>
93 </xsl:otherwise>
94 </xsl:choose>
95 </xsl:variable>
[36f5dce]96
97<!-- Start of templates -->
[557fe91]98 <xsl:template match="/">
[36f5dce]99 <xsl:apply-templates select="//chapter[
100 @id='chapter-final-preps' or
101 @id='chapter-cross-tools' or
102 @id='chapter-temporary-tools' or
103 @id='chapter-chroot-temporary-tools' or
104 @id='chapter-building-system' or
105 @id='chapter-config' or
106 @id='chapter-bootscripts' or
107 @id='chapter-bootable']"/>
[557fe91]108 </xsl:template>
[2e1c1c3]109
[36f5dce]110 <xsl:template match="chapter">
111 <xsl:apply-templates select="./sect1[
[13e52a5]112 .//screen[not(@role) or @role != 'nodump']/
[36f5dce]113 userinput[not(starts-with(string(),'chroot'))]]">
114 <xsl:with-param name="chap-num" select="position()+3"/>
115 </xsl:apply-templates>
116<!-- The last condition is a hack to allow old versions of the
[d68eb1b]117 book where the chroot commands did not have role="nodump".
118 It only works if the chroot command is the only one on the page -->
[36f5dce]119 </xsl:template>
120
121 <xsl:template match="sect1">
122 <xsl:param name="chap-num" select="'1'"/>
123 <!-- The dirs names -->
124 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
125 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
126 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
127 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
[7072e1f]128 <!-- The file names -->
129 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
130 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
131 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
132 <!-- The build order -->
133 <xsl:variable name="position" select="position()"/>
134 <xsl:variable name="order">
[36f5dce]135 <xsl:value-of select="$chap-num"/>
136 <xsl:if test="string-length($position) = 1">
137 <xsl:text>0</xsl:text>
138 </xsl:if>
139 <xsl:value-of select="$position"/>
[7072e1f]140 </xsl:variable>
141 <!-- Creating dirs and files -->
142 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
[4762fb9]143 <xsl:text>#!</xsl:text>
144 <xsl:if test="@id='ch-system-creatingdirs' or
145 @id='ch-system-createfiles' or
[33a4e41]146 @id='ch-system-strippingagain' or
[bcae37d]147 @id='ch-system-stripping'">
[4762fb9]148 <xsl:copy-of select="$bashdir"/>
149 </xsl:if>
150 <xsl:text>/bin/bash&#xA;set +h&#xA;</xsl:text>
[7072e1f]151 <xsl:if test="not(@id='ch-tools-stripping') and
[33a4e41]152 not(@id='ch-system-strippingagain') and
[bcae37d]153 not(@id='ch-system-stripping')">
[7072e1f]154 <xsl:text>set -e&#xA;</xsl:text>
155 </xsl:if>
156 <xsl:text>&#xA;</xsl:text>
[a131250]157 <xsl:if test="ancestor::chapter/@id != 'chapter-final-preps'">
158 <xsl:call-template name="start-script">
159 <xsl:with-param name="order" select="$order"/>
160 </xsl:call-template>
161 </xsl:if>
[13e52a5]162 <xsl:apply-templates
163 select="sect2 |
164 screen[not(@role) or @role!='nodump']/userinput"/>
[49f8b03]165 <xsl:if test="contains(@id,'creatingdirs') and $pkgmngt='y'">
[f0a31de]166 <xsl:apply-templates
167 select="document('packageManager.xml')//sect1[
168 @id='ch-pkgmngt-creatingdirs'
[e6e0c85]169 ]//userinput"
170 mode="pkgmngt"/>
[f0a31de]171 </xsl:if>
[3484658]172 <xsl:if test="contains(@id,'createfiles') and $pkgmngt='y'">
[f0a31de]173 <xsl:apply-templates
174 select="document('packageManager.xml')//sect1[
175 @id='ch-pkgmngt-createfiles'
[e6e0c85]176 ]//userinput"
177 mode="pkgmngt"/>
[f0a31de]178 </xsl:if>
[a131250]179 <xsl:if test="ancestor::chapter/@id != 'chapter-final-preps'">
180 <xsl:text>echo -e "\n\nTotalseconds: $SECONDS\n"&#xA;</xsl:text>
181 <xsl:call-template name="end-script"/>
182 </xsl:if>
[f0a31de]183 <xsl:text>exit&#xA;</xsl:text>
184 </exsl:document>
[49f8b03]185 <!-- Inclusion of package manager scriptlets -->
186 <xsl:if test="$pkgmngt='y' and
[33a4e41]187 following-sibling::sect1[1][@id='ch-tools-stripping' or @id='ch-tools-cleanup']">
[55e82d2]188 <xsl:apply-templates
189 select="document('packageManager.xml')//sect1[
190 contains(@id,'ch-chroot')]"
191 mode="pkgmngt">
192 <xsl:with-param name="order" select="$order+1"/>
193 <xsl:with-param name="dirname" select="$dirname"/>
194 </xsl:apply-templates>
[49f8b03]195 </xsl:if>
196 <xsl:if test="$pkgmngt='y' and
[33a4e41]197 following-sibling::sect1[2][@id='ch-system-strippingagain' or @id='ch-system-stripping']">
[49f8b03]198 <xsl:apply-templates
199 select="document('packageManager.xml')//sect1[
200 contains(@id,'ch-system')]"
201 mode="pkgmngt">
202 <xsl:with-param name="order" select="$order+1"/>
203 <xsl:with-param name="dirname" select="$dirname"/>
204 </xsl:apply-templates>
205 </xsl:if>
[f0a31de]206 </xsl:template>
207
208 <xsl:template match="sect2">
209 <xsl:apply-templates
[13e52a5]210 select=".//screen[not(@role) or @role != 'nodump']/userinput[
[f0a31de]211 @remap = 'pre' or
212 @remap = 'configure' or
213 @remap = 'make' or
214 @remap = 'test' and
[f2e80ac]215 not(current()/../@id='ch-tools-dejagnu') and
216 not(current()/../@id='ch-system-systemd')]"/>
[f0a31de]217 <xsl:if
[49f8b03]218 test="ancestor::chapter[@id = 'chapter-building-system' or
219 @id = 'chapter-config' or
[f017b22]220 @id = 'chapter-bootscripts' or
[49f8b03]221 @id = 'chapter-bootable'] and
[f0a31de]222 $pkgmngt = 'y' and
223 descendant::screen[not(@role) or
224 @role != 'nodump']/userinput[
225 @remap='install']">
[945ccaa]226 <xsl:choose>
227 <xsl:when test="$wrap-install='y'">
228 <xsl:text>wrapInstall '
229</xsl:text>
230 </xsl:when>
231 <xsl:otherwise>
[adbd09b]232<!-- We cannot know which directory(ies) are needed by the package. Create a
[55e82d2]233 reasonable bunch of them. Should be close to "Creating Directories".
234 Create also symlinks from /lib, /bin, /sbin to their counterpart
235 in usr, so that the package only has files in /usr-->
236 <xsl:text>mkdir -pv $PKG_DEST/{boot,etc}
[adbd09b]237mkdir -pv $PKG_DEST/usr/{bin,include,lib/pkgconfig,sbin}
[2758d94]238mkdir -pv $PKG_DEST/usr/share/{doc,info,bash-completion/completions}
[7072e1f]239mkdir -pv $PKG_DEST/usr/share/man/man{1..8}
240case $(uname -m) in
[adbd09b]241 x86_64) mkdir -v $PKG_DEST/lib64 ;;
[7072e1f]242esac
[55e82d2]243ln -sv usr/sbin $PKG_DEST
244ln -sv usr/bin $PKG_DEST
245ln -sv usr/lib $PKG_DEST
[7072e1f]246</xsl:text>
[945ccaa]247 </xsl:otherwise>
248 </xsl:choose>
[f0a31de]249 </xsl:if>
250 <xsl:apply-templates
[13e52a5]251 select=".//screen[not(@role) or @role != 'nodump']/
252 userinput[@remap = 'install']"/>
[49f8b03]253 <xsl:if test="ancestor::chapter[@id = 'chapter-building-system' or
254 @id = 'chapter-config' or
[f017b22]255 @id = 'chapter-bootscripts' or
[49f8b03]256 @id = 'chapter-bootable'] and
[f0a31de]257 descendant::screen[not(@role) or
258 @role != 'nodump']/userinput[
259 @remap='install']">
[945ccaa]260 <xsl:choose>
[dc7fd7b]261 <xsl:when test="$pkgmngt='n'"/>
[945ccaa]262 <xsl:when test="$wrap-install='y'">
263 <xsl:if test="../@id = 'ch-system-man-pages'">
[560bef1]264<!-- these files are provided by the shadow package -->
[945ccaa]265 <xsl:text>rm -fv /usr/share/man/{man3/getspnam.3,man5/passwd.5}
266</xsl:text>
267 </xsl:if>
268<!-- nologin is installed by util-linux. remove it from shadow -->
269 <xsl:if test="../@id = 'ch-system-shadow'">
270 <xsl:text>rm -fv /usr/share/man/man8/nologin.8
271rm -fv /sbin/nologin
272</xsl:text>
273 </xsl:if>
274 <xsl:text>'
[9bbb9c8]275PREV_SEC=${SECONDS}
[945ccaa]276packInstall
[9bbb9c8]277SECONDS=${PREV_SEC}
[945ccaa]278</xsl:text>
279 </xsl:when>
280 <xsl:otherwise>
281 <xsl:if test="../@id = 'ch-system-man-pages'">
282<!-- these files are provided by the shadow package -->
283 <xsl:text>rm -fv $PKG_DEST/usr/share/man/{man3/getspnam.3,man5/passwd.5}
[a983256]284</xsl:text>
[945ccaa]285 </xsl:if>
[a983256]286<!-- nologin is installed by util-linux. remove it from shadow -->
[945ccaa]287 <xsl:if test="../@id = 'ch-system-shadow'">
288 <xsl:text>rm -fv $PKG_DEST/usr/share/man/man8/nologin.8
[a983256]289rm -fv $PKG_DEST/sbin/nologin
[7072e1f]290</xsl:text>
[945ccaa]291 </xsl:if>
[55e82d2]292<!-- remove empty directories and symlinks-->
[adbd09b]293 <xsl:text>for dir in $PKG_DEST/usr/share/man/man{1..8} \
[2758d94]294 $PKG_DEST/usr/share/bash-completion{/completions,} \
295 $PKG_DEST/usr/share/{doc,info,man,} \
[adbd09b]296 $PKG_DEST/usr/lib/pkgconfig \
297 $PKG_DEST/usr/{lib,bin,sbin,include} \
[55e82d2]298 $PKG_DEST/{boot,etc}; do
[adbd09b]299 [ -d "$dir" ] &amp;&amp; [ -z "$(ls $dir)" ] &amp;&amp; rmdir -v $dir
[7072e1f]300done
[adbd09b]301[ -d $PKG_DEST/lib64 ] &amp;&amp; [ -z "$(ls $PKG_DEST/lib64)" ] &amp;&amp;
302 rmdir -v $PKG_DEST/lib64
[55e82d2]303rm -v $PKG_DEST/{lib,bin,sbin}
[46c6113]304<!-- prevent overwriting symlinks: if a package install something in
305 these directories, it'll be lost if not using package management,
306 since they are symlinks to tmpfs. So, remove it too if using PM. -->
307rm -rf $PKG_DEST/var/{run,lock}
308<!-- Remove /var if it is empty, then -->
309[ -d $PKG_DEST/var ] &amp;&amp; [ -z "$(ls $PKG_DEST/var)" ] &amp;&amp; rmdir -v $PKG_DEST/var
[9bbb9c8]310PREV_SEC=${SECONDS}
[7072e1f]311packInstall
[9bbb9c8]312SECONDS=${PREV_SEC}
[7072e1f]313rm -rf $PKG_DEST
314</xsl:text>
[945ccaa]315 </xsl:otherwise>
316 </xsl:choose>
[f0a31de]317 </xsl:if>
318 <xsl:if test="../@id='ch-system-glibc' and @role='installation'">
319 <xsl:choose>
320 <xsl:when test="$full-locale='y'">
[cfdb089]321 <xsl:for-each select="//userinput[@remap='locale-full']">
322 <xsl:copy-of select="."/>
323 <xsl:text>&#xA;</xsl:text>
324 </xsl:for-each>
[f0a31de]325 </xsl:when>
326 <xsl:otherwise>
327 <xsl:copy-of select="//userinput[@remap='locale-test']"/>
328 <xsl:text>&#xA;</xsl:text>
329 <xsl:if test="not(contains(string(//userinput[@remap='locale-test']),$lang)) and $lang!='C' and $lang!='POSIX'">
330 <xsl:text>if LOCALE=`grep "</xsl:text>
331 <xsl:value-of select="$lang"/>
332 <xsl:text>/" $PKGDIR/localedata/SUPPORTED`; then
[b339c94]333 CHARMAP=`echo $LOCALE | sed 's,[^/]*/\([^ ]*\) [\],\1,'`
334 INPUT=`echo $LOCALE | sed 's,[/.].*,,'`
335 LOCALE=`echo $LOCALE | sed 's,/.*,,'`
336 localedef -i $INPUT -f $CHARMAP $LOCALE
337fi
338</xsl:text>
[f0a31de]339 </xsl:if>
340 </xsl:otherwise>
341 </xsl:choose>
[c4cf6de]342 </xsl:if>
[f0a31de]343 <xsl:apply-templates
[13e52a5]344 select=".//screen[not(@role) or @role != 'nodump']/userinput[
[f2e80ac]345 not(@remap) or
346 @remap='adjust' or
347 @remap='test' and current()/../@id='ch-tools-dejagnu' or
348 @remap='test' and current()/../@id='ch-system-systemd'
[13e52a5]349 ]"/>
[085435e]350 <xsl:if test="../@id='ch-system-ncurses' and $ncurses5='y'">
351 <xsl:apply-templates select=".//screen[@role='nodump']"/>
352 </xsl:if>
[557fe91]353 </xsl:template>
354
[f0a31de]355 <xsl:template match="sect1" mode="pkgmngt">
[2758d94]356 <xsl:param name="dirname" select="'chapter05'"/>
[7072e1f]357 <!-- The build order -->
[2758d94]358 <xsl:param name="order" select="'062'"/>
[7072e1f]359<!-- The file names -->
360 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
361 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
362 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
[3ac3ae1]363 <xsl:variable name="pos">
364 <xsl:if test="string-length(position()) = 1">
365 <xsl:text>0</xsl:text>
366 </xsl:if>
367 <xsl:value-of select="position()"/>
368 </xsl:variable>
[7072e1f]369 <!-- Creating dirs and files -->
[8099885]370 <xsl:if test="count(descendant::screen/userinput) &gt; 0 and
371 count(descendant::screen/userinput) &gt;
372 count(descendant::screen[@role='nodump'])">
[3ac3ae1]373 <exsl:document href="{$dirname}/{$order}-{$pos}-{$filename}"
[8099885]374 method="text">
375 <xsl:text>#!/bin/bash
[7072e1f]376set +h
377set -e
378</xsl:text>
[2758d94]379 <xsl:call-template name="start-script">
[88a8275]380 <xsl:with-param name="order" select="concat($order,'-',$pos)"/>
[2758d94]381 </xsl:call-template>
[8099885]382 <xsl:apply-templates
383 select=".//screen[not(@role) or
384 @role != 'nodump']/userinput[@remap != 'adjust']"
[7072e1f]385 mode="pkgmngt"/>
[49f8b03]386 <xsl:if test="$dirname = 'chapter06' or $dirname = 'chapter08'">
[9bbb9c8]387 <xsl:text>PREV_SEC=${SECONDS}
388packInstall
389SECONDS=${PREV_SEC}
[945ccaa]390rm -rf "$PKG_DEST"
[7072e1f]391</xsl:text>
[8099885]392 </xsl:if>
393 <xsl:apply-templates
394 select=".//screen[not(@role) or
395 @role != 'nodump'
396 ]/userinput[not(@remap) or
397 @remap='adjust'
[7072e1f]398 ]"
399 mode="pkgmngt"/>
[8099885]400 <xsl:text>
[7072e1f]401echo -e "\n\nTotalseconds: $SECONDS\n"
[2758d94]402</xsl:text>
403 <xsl:call-template name="end-script"/>
404 <xsl:text>exit
[7072e1f]405</xsl:text>
[8099885]406 </exsl:document>
407 </xsl:if>
[557fe91]408 </xsl:template>
409
[7072e1f]410 <xsl:template match="userinput" mode="pkgmngt">
411 <xsl:apply-templates/>
412 <xsl:text>&#xA;</xsl:text>
413 </xsl:template>
[2e1c1c3]414
[7072e1f]415 <xsl:template match="userinput">
[3eb60fa]416 <xsl:choose>
[fd691b4]417 <!-- Copying the kernel config file -->
418 <xsl:when test="string() = 'make mrproper'">
419 <xsl:text>make mrproper&#xA;</xsl:text>
[7072e1f]420 <xsl:if test="ancestor::sect1[@id='ch-bootable-kernel']">
[bcfb3bf]421 <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
[3b27f93]422 <xsl:text>timeout 60 make oldconfig ||\&#xA;</xsl:text>
423 <xsl:text>{ echo kernel config is not up to date; exit 124; }&#xA;</xsl:text>
[bcfb3bf]424 </xsl:if>
[92568bf]425 </xsl:when>
[7072e1f]426<!-- test instructions -->
[1d5f3e3]427 <xsl:when test="@remap = 'test'">
[5a8939e]428 <xsl:call-template name="comment-test">
429 <xsl:with-param name="instructions" select="string()"/>
430 </xsl:call-template>
[4afcedb]431 </xsl:when>
[7072e1f]432<!-- End of test instructions -->
[dc7fd7b]433<!-- If the instructions contain "strip ", it may mean they contain also .la
434 file removal (and possibly other clean up). We therefore call a template
435 to comment them out appropriately and also to not stop if stripping
436 fails. -->
437 <xsl:when test="contains(string(),'strip ') or
438 contains(string(),'\*.la')">
439 <xsl:call-template name="comment-strip">
440 <xsl:with-param name="instructions" select="string()"/>
441 </xsl:call-template>
[1f025ca]442 </xsl:when>
[f017b22]443<!-- Package management for installation chapters -->
[7072e1f]444<!-- Add $PKG_DEST to installation commands -->
[323ae3e]445<!-- Also add -j1 to make install -->
[7072e1f]446 <xsl:when test="@remap='install' and
[f017b22]447 ancestor::chapter[@id='chapter-building-system' or
448 @id = 'chapter-config' or
449 @id = 'chapter-bootscripts' or
450 @id = 'chapter-bootable']">
[7072e1f]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>
[323ae3e]459 <xsl:when test="contains(string(),'make ')">
460 <xsl:copy-of select="substring-before(string(), 'make ')"/>
461 <xsl:text>make -j1 </xsl:text>
462 <xsl:copy-of select="substring-after(string(), 'make ')"/>
463 <xsl:text>&#xA;</xsl:text>
464 </xsl:when>
[7072e1f]465 <xsl:otherwise>
466 <xsl:apply-templates/>
467 <xsl:text>&#xA;</xsl:text>
468 </xsl:otherwise>
469 </xsl:choose>
470 </xsl:when>
[945ccaa]471 <xsl:when test="$wrap-install='y'">
472 <xsl:choose>
473 <xsl:when test="./literal">
474 <xsl:call-template name="output-wrap">
475 <xsl:with-param name="commands" select="text()[1]"/>
476 </xsl:call-template>
477 <xsl:apply-templates select="literal"/>
478 <xsl:call-template name="output-wrap">
479 <xsl:with-param name="commands" select="text()[2]"/>
480 </xsl:call-template>
481 </xsl:when>
482 <xsl:otherwise>
483 <xsl:call-template name="output-wrap">
484 <xsl:with-param name="commands" select="string()"/>
485 </xsl:call-template>
486 </xsl:otherwise>
487 </xsl:choose>
488 <xsl:text>&#xA;</xsl:text>
489 </xsl:when>
490 <xsl:otherwise><!--pkgmngt = 'y' and wrap-install='n'-->
[7072e1f]491 <xsl:choose>
492 <xsl:when test="./literal">
493 <xsl:call-template name="outputpkgdest">
[560bef1]494 <xsl:with-param name="outputstring" select="text()[1]"/>
[7072e1f]495 </xsl:call-template>
496 <xsl:apply-templates select="literal"/>
497 <xsl:call-template name="outputpkgdest">
[560bef1]498 <xsl:with-param name="outputstring" select="text()[2]"/>
[7072e1f]499 </xsl:call-template>
500 </xsl:when>
501 <xsl:otherwise>
502 <xsl:call-template name="outputpkgdest">
503 <xsl:with-param name="outputstring" select="string()"/>
504 </xsl:call-template>
505 </xsl:otherwise>
506 </xsl:choose>
[ad747ed]507 <xsl:text>&#xA;</xsl:text>
[7072e1f]508 </xsl:otherwise>
509 </xsl:choose>
[323ae3e]510 </xsl:when> <!-- @remap='install' and not temporary tools -->
[57ef0c1]511 <!-- if package management, we should make an independant package for
512 tzdata. -->
513 <xsl:when test="contains(string(),'tzdata') and $pkgmngt='y'">
514 <xsl:text>
[945ccaa]515OLD_PKG_DEST="$PKG_DEST"
[57ef0c1]516OLD_PKGDIR=$PKGDIR
[56d8426]517PKG_DEST=$(dirname $OLD_PKG_DEST)/001-tzdata
[57ef0c1]518PKGDIR=$(dirname $PKGDIR)/tzdata-</xsl:text>
519 <xsl:copy-of select="substring-before(
520 substring-after(string(),'tzdata'),
521 '.tar')"/>
522 <xsl:text>
523</xsl:text>
[945ccaa]524 <xsl:choose>
525 <xsl:when test="$wrap-install='n'">
526 <xsl:copy-of select="substring-before(string(),'ZONEINFO=')"/>
527 <xsl:text>ZONEINFO=$PKG_DEST</xsl:text>
528 <xsl:copy-of select="substring-after(string(),'ZONEINFO=')"/>
529 <xsl:text>
[9bbb9c8]530PREV_SEC=${SECONDS}
[57ef0c1]531packInstall
[9bbb9c8]532SECONDS=${PREV_SEC}
[57ef0c1]533rm -rf $PKG_DEST
[945ccaa]534</xsl:text>
535 </xsl:when>
536 <xsl:otherwise><!-- wrap-install='y' -->
537 <xsl:copy-of select="substring-before(string(),'ZONEINFO=')"/>
538 <xsl:text>
539wrapInstall '
540ZONEINFO=</xsl:text>
541 <xsl:copy-of select="substring-after(string(),'ZONEINFO=')"/>
542 <xsl:text>'
[9bbb9c8]543PREV_SEC=${SECONDS}
[945ccaa]544packInstall
[9bbb9c8]545SECONDS=${PREV_SEC}
[945ccaa]546</xsl:text>
547 </xsl:otherwise>
548 </xsl:choose>
549 <xsl:text>
[57ef0c1]550PKG_DEST=$OLD_PKG_DEST
551unset OLD_PKG_DEST
552PKGDIR=$OLD_PKGDIR
553unset OLD_PKGDIR
554</xsl:text>
555 </xsl:when><!-- addition for tzdata + package management -->
[7072e1f]556 <!-- End addition for package management -->
[f017b22]557 <!-- add -j1 to make install in non final chapters -->
558 <xsl:when test="ancestor::chapter[@id='chapter-temporary-tools' or
559 @id='chapter-chroot-temporary-tools' or
560 @id='chapter-cross-tools'] and
[323ae3e]561 @remap='install'">
562 <xsl:choose>
563 <xsl:when test="contains(string(),'make ')">
564 <xsl:copy-of select="substring-before(string(), 'make ')"/>
565 <xsl:text>make -j1 </xsl:text>
566 <xsl:copy-of select="substring-after(string(), 'make ')"/>
567 </xsl:when>
568 <xsl:otherwise>
569 <xsl:apply-templates/>
570 </xsl:otherwise>
571 </xsl:choose>
572 <xsl:text>&#xA;</xsl:text>
[f017b22]573 </xsl:when><!-- temp chapters install -->
[fd691b4]574 <!-- The rest of commands -->
[1f025ca]575 <xsl:otherwise>
576 <xsl:apply-templates/>
[fd691b4]577 <xsl:text>&#xA;</xsl:text>
[1f025ca]578 </xsl:otherwise>
579 </xsl:choose>
580 </xsl:template>
[2e1c1c3]581
[557fe91]582 <xsl:template match="replaceable">
[a41ce58]583 <xsl:choose>
[2a54650]584 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
[877cc6a]585 <xsl:value-of select="$timezone"/>
[2a54650]586 </xsl:when>
[a41ce58]587 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
[877cc6a]588 <xsl:value-of select="$page"/>
[a41ce58]589 </xsl:when>
[81a7fb8]590 <xsl:when test="contains(string(.),'&lt;ll&gt;_&lt;CC&gt;')">
591 <xsl:value-of select="$lang"/>
592 </xsl:when>
[945ccaa]593 <xsl:when test="contains(string(.),'Domain')">
594 <xsl:value-of select="$domain"/>
595 </xsl:when>
596 <xsl:when test="contains(string(.),'primary')">
597 <xsl:value-of select="$nameserver1"/>
598 </xsl:when>
599 <xsl:when test="contains(string(.),'secondary')">
600 <xsl:value-of select="$nameserver2"/>
601 </xsl:when>
602 <xsl:when test="contains(string(.),'192.168.1.1')">
603 <xsl:value-of select="$ip"/>
604 </xsl:when>
605 <xsl:when test="contains(string(.),'192.168.0.2')">
606 <xsl:value-of select="$ip"/>
607 </xsl:when>
[f5e658d]608 <xsl:when test="contains(string(.),'eth0')">
609 <xsl:value-of select="$interface"/>
610 </xsl:when>
[945ccaa]611<!-- Only adapted to LFS-20170310 and later -->
612 <xsl:when test="contains(string(.),'HOSTNAME')">
613 <xsl:value-of select="$hostname"/>
614 </xsl:when>
615 <xsl:when test="contains(string(.),'FQDN')">
616 <xsl:value-of select="$hostname"/>
617 <xsl:text>.</xsl:text>
618 <xsl:value-of select="$domain"/>
619 </xsl:when>
620 <xsl:when test="contains(string(.),'alias')"/>
621 <xsl:when test="contains(string(.),'&lt;lfs&gt;')">
622 <xsl:value-of select="$hostname"/>
623 </xsl:when>
[1b02a9a]624 <xsl:when test="contains(string(.),'$(nproc || echo 1)')">
625 <xsl:value-of select="$jobs_1"/>
626 </xsl:when>
627 <xsl:when test="contains(string(.),'$(nproc)')">
628 <xsl:value-of select="$jobs_2"/>
629 </xsl:when>
[a41ce58]630 <xsl:otherwise>
631 <xsl:text>**EDITME</xsl:text>
632 <xsl:apply-templates/>
633 <xsl:text>EDITME**</xsl:text>
634 </xsl:otherwise>
635 </xsl:choose>
[557fe91]636 </xsl:template>
[2e1c1c3]637
[945ccaa]638 <xsl:template match="literal">
639 <xsl:choose>
640 <xsl:when test="contains(string(),'ONBOOT')">
641 <xsl:call-template name="outputnet">
642 <xsl:with-param name="netstring" select="string()"/>
643 </xsl:call-template>
644 </xsl:when>
645 <xsl:when test="contains(string(),'[Match]')">
646 <xsl:call-template name="outputsysdnet">
647 <xsl:with-param name="netstring" select="string()"/>
648 </xsl:call-template>
649 </xsl:when>
[3b43e17b]650 <xsl:when test="contains(string(),'0.0 0 0.0')">
651 <xsl:copy-of select="substring-before(string(),'LOCAL')"/>
652 <xsl:if test="$local='y'"><xsl:text>LOCAL</xsl:text></xsl:if>
653 <xsl:if test="$local='n'"><xsl:text>UTC</xsl:text></xsl:if>
654 </xsl:when>
655 <xsl:when test="contains(string(),'UTC=1')">
656 <xsl:copy-of select="substring-before(string(),'1')"/>
657 <xsl:if test="$local='y'"><xsl:text>0</xsl:text></xsl:if>
658 <xsl:if test="$local='n'"><xsl:text>1</xsl:text></xsl:if>
659 <xsl:copy-of select="substring-after(string(),'1')"/>
660 </xsl:when>
661 <xsl:when test="contains(string(),'bg_bds-')">
662 <xsl:call-template name="outputsysvconsole">
663 <xsl:with-param name="consolestring" select="string()"/>
664 </xsl:call-template>
665 </xsl:when>
666 <xsl:when test="contains(string(),'de-latin1')">
667 <xsl:call-template name="outputsysdconsole">
668 <xsl:with-param name="consolestring" select="string()"/>
669 </xsl:call-template>
670 </xsl:when>
[945ccaa]671 <xsl:otherwise>
672 <xsl:apply-templates/>
673 </xsl:otherwise>
674 </xsl:choose>
675 </xsl:template>
676
677 <xsl:template name="outputnet">
678 <xsl:param name="netstring" select="''"/>
679 <!-- We suppose that book example has the following values:
680 - interface: eth0
681 - ip: 192.168.1.2
682 - gateway: 192.168.1.1
683 - prefix: 24
684 - broadcast: 192.168.1.255
685 Change below if book changes -->
686 <xsl:choose>
687 <xsl:when test="contains($netstring,'eth0')">
688 <xsl:call-template name="outputnet">
689 <xsl:with-param name="netstring"
690 select="substring-before($netstring,'eth0')"/>
691 </xsl:call-template>
692 <xsl:value-of select="$interface"/>
693 <xsl:call-template name="outputnet">
694 <xsl:with-param name="netstring"
695 select="substring-after($netstring,'eth0')"/>
696 </xsl:call-template>
697 </xsl:when>
698 <xsl:when test="contains($netstring,'192.168.1.1')">
699 <xsl:call-template name="outputnet">
700 <xsl:with-param name="netstring"
701 select="substring-before($netstring,'192.168.1.1')"/>
702 </xsl:call-template>
703 <xsl:value-of select="$gateway"/>
704 <xsl:call-template name="outputnet">
705 <xsl:with-param name="netstring"
706 select="substring-after($netstring,'192.168.1.1')"/>
707 </xsl:call-template>
708 </xsl:when>
709 <!-- must test this before the following, because 192.168.1.255 contains
710 192.168.1.2! -->
711 <xsl:when test="contains($netstring,'192.168.1.255')">
712 <xsl:call-template name="outputnet">
713 <xsl:with-param name="netstring"
714 select="substring-before($netstring,'192.168.1.255')"/>
715 </xsl:call-template>
716 <xsl:value-of select="$broadcast"/>
717 <xsl:call-template name="outputnet">
718 <xsl:with-param name="netstring"
719 select="substring-after($netstring,'192.168.1.255')"/>
720 </xsl:call-template>
721 </xsl:when>
722 <xsl:when test="contains($netstring,'192.168.1.2')">
723 <xsl:call-template name="outputnet">
724 <xsl:with-param name="netstring"
725 select="substring-before($netstring,'192.168.1.2')"/>
726 </xsl:call-template>
727 <xsl:value-of select="$ip"/>
728 <xsl:call-template name="outputnet">
729 <xsl:with-param name="netstring"
730 select="substring-after($netstring,'192.168.1.2')"/>
731 </xsl:call-template>
732 </xsl:when>
733 <xsl:when test="contains($netstring,'24')">
734 <xsl:call-template name="outputnet">
735 <xsl:with-param name="netstring"
736 select="substring-before($netstring,'24')"/>
737 </xsl:call-template>
738 <xsl:value-of select="$prefix"/>
739 <xsl:call-template name="outputnet">
740 <xsl:with-param name="netstring"
741 select="substring-after($netstring,'24')"/>
742 </xsl:call-template>
743 </xsl:when>
744 <xsl:otherwise>
745 <xsl:value-of select="$netstring"/>
746 </xsl:otherwise>
747 </xsl:choose>
748 </xsl:template>
749
750 <xsl:template name="outputsysdnet">
751 <xsl:param name="netstring" select="''"/>
752 <!-- We suppose that book example has the following values:
[5af9ab4]753 - interface: <network-device-name>
[945ccaa]754 - ip: 192.168.0.2
755 - gateway: 192.168.0.1
756 - prefix: 24
757 - DNS: 192.168.0.1
758 - Domain: <Your Domain Name>
759 and gateway comes before DNS. Change below if book changes -->
760 <xsl:choose>
[5af9ab4]761 <xsl:when test="contains($netstring,'&lt;network-device-name&gt;')">
[945ccaa]762 <xsl:call-template name="outputsysdnet">
763 <xsl:with-param name="netstring"
[5af9ab4]764 select="substring-before($netstring,'&lt;network-device-name&gt;')"/>
[945ccaa]765 </xsl:call-template>
766 <xsl:value-of select="$interface"/>
767 <xsl:call-template name="outputsysdnet">
768 <xsl:with-param name="netstring"
[5af9ab4]769 select="substring-after($netstring,'&lt;network-device-name&gt;')"/>
[945ccaa]770 </xsl:call-template>
771 </xsl:when>
772 <xsl:when test="contains($netstring,'192.168.0.1') and
773 contains($netstring,'Gateway')">
774 <xsl:call-template name="outputsysdnet">
775 <xsl:with-param name="netstring"
776 select="substring-before($netstring,'192.168.0.1')"/>
777 </xsl:call-template>
778 <xsl:value-of select="$gateway"/>
779 <xsl:call-template name="outputsysdnet">
780 <xsl:with-param name="netstring"
781 select="substring-after($netstring,'192.168.0.1')"/>
782 </xsl:call-template>
783 </xsl:when>
784 <xsl:when test="contains($netstring,'192.168.0.1') and
785 not(contains($netstring,'Gateway'))">
786 <xsl:call-template name="outputsysdnet">
787 <xsl:with-param name="netstring"
788 select="substring-before($netstring,'192.168.0.1')"/>
789 </xsl:call-template>
790 <xsl:value-of select="$nameserver1"/>
791 <xsl:text>
792DNS=</xsl:text>
793 <xsl:value-of select="$nameserver2"/>
794 <xsl:call-template name="outputsysdnet">
795 <xsl:with-param name="netstring"
796 select="substring-after($netstring,'192.168.0.1')"/>
797 </xsl:call-template>
798 </xsl:when>
799 <xsl:when test="contains($netstring,'192.168.0.2')">
800 <xsl:call-template name="outputsysdnet">
801 <xsl:with-param name="netstring"
802 select="substring-before($netstring,'192.168.0.2')"/>
803 </xsl:call-template>
804 <xsl:value-of select="$ip"/>
805 <xsl:call-template name="outputsysdnet">
806 <xsl:with-param name="netstring"
807 select="substring-after($netstring,'192.168.0.2')"/>
808 </xsl:call-template>
809 </xsl:when>
810 <xsl:when test="contains($netstring,'24')">
811 <xsl:call-template name="outputsysdnet">
812 <xsl:with-param name="netstring"
813 select="substring-before($netstring,'24')"/>
814 </xsl:call-template>
815 <xsl:value-of select="$prefix"/>
816 <xsl:call-template name="outputsysdnet">
817 <xsl:with-param name="netstring"
818 select="substring-after($netstring,'24')"/>
819 </xsl:call-template>
820 </xsl:when>
821 <xsl:when test="contains($netstring,'&lt;Your Domain Name&gt;')">
822 <xsl:call-template name="outputsysdnet">
823 <xsl:with-param name="netstring"
824 select="substring-before($netstring,'&lt;Your Domain Name&gt;')"/>
825 </xsl:call-template>
826 <xsl:value-of select="$domain"/>
827 <xsl:call-template name="outputsysdnet">
828 <xsl:with-param name="netstring"
829 select="substring-after($netstring,'&lt;Your Domain Name&gt;')"/>
830 </xsl:call-template>
831 </xsl:when>
832 <xsl:otherwise>
833 <xsl:value-of select="$netstring"/>
[3b43e17b]834 </xsl:otherwise>
835 </xsl:choose>
836 </xsl:template>
837
838 <xsl:template name="outputsysvconsole">
839 <!-- We suppose that book example has the following values:
840 - KEYMAP: bg_bds-utf8
841 - FONT: LatArCyrHeb-16
842 Change below if book changes -->
843 <xsl:param name="consolestring" select="''"/>
844 <xsl:choose>
845 <xsl:when test="contains($consolestring,'bg_bds-utf8')">
846 <xsl:call-template name="outputsysvconsole">
847 <xsl:with-param
848 name="consolestring"
849 select="substring-before($consolestring,'bg_bds-utf8')"/>
850 </xsl:call-template>
851 <xsl:value-of select="$keymap"/>
852 <xsl:call-template name="outputsysvconsole">
853 <xsl:with-param
854 name="consolestring"
855 select="substring-after($consolestring,'bg_bds-utf8')"/>
856 </xsl:call-template>
857 </xsl:when>
858 <xsl:when test="contains($consolestring,'LatArCyrHeb-16')">
859 <xsl:call-template name="outputsysvconsole">
860 <xsl:with-param
861 name="consolestring"
862 select="substring-before($consolestring,'LatArCyrHeb-16')"/>
863 </xsl:call-template>
864 <xsl:value-of select="$font"/>
865 <xsl:text>"
[3142368]866LOGLEVEL="</xsl:text>
[3b43e17b]867 <xsl:copy-of select="$log-level"/>
868 <xsl:call-template name="outputsysvconsole">
869 <xsl:with-param
870 name="consolestring"
871 select="substring-after($consolestring,'LatArCyrHeb-16')"/>
872 </xsl:call-template>
873 </xsl:when>
874 <xsl:otherwise>
875 <xsl:copy-of select="$consolestring"/>
876 </xsl:otherwise>
877 </xsl:choose>
878 </xsl:template>
879
880 <xsl:template name="outputsysdconsole">
881 <!-- We suppose that book example has the following values:
882 - KEYMAP: de-latin1
883 - FONT: Lat2-Terminus16
884 Change below if book changes -->
885 <xsl:param name="consolestring" select="''"/>
886 <xsl:choose>
887 <xsl:when test="contains($consolestring,'de-latin1')">
888 <xsl:call-template name="outputsysdconsole">
889 <xsl:with-param
890 name="consolestring"
891 select="substring-before($consolestring,'de-latin1')"/>
892 </xsl:call-template>
893 <xsl:value-of select="$keymap"/>
894 <xsl:call-template name="outputsysdconsole">
895 <xsl:with-param
896 name="consolestring"
897 select="substring-after($consolestring,'de-latin1')"/>
898 </xsl:call-template>
899 </xsl:when>
900 <xsl:when test="contains($consolestring,'Lat2-Terminus16')">
901 <xsl:call-template name="outputsysdconsole">
902 <xsl:with-param
903 name="consolestring"
904 select="substring-before($consolestring,'Lat2-Terminus16')"/>
905 </xsl:call-template>
906 <xsl:value-of select="$font"/>
907 <xsl:call-template name="outputsysdconsole">
908 <xsl:with-param
909 name="consolestring"
910 select="substring-after($consolestring,'Lat2-Terminus16')"/>
911 </xsl:call-template>
912 </xsl:when>
913 <xsl:otherwise>
914 <xsl:copy-of select="$consolestring"/>
[945ccaa]915 </xsl:otherwise>
916 </xsl:choose>
917 </xsl:template>
918
[7072e1f]919 <xsl:template name="outputpkgdest">
920 <xsl:param name="outputstring" select="foo"/>
921 <xsl:choose>
922 <xsl:when test="contains($outputstring,'make ')">
923 <xsl:choose>
924 <xsl:when test="not(starts-with($outputstring,'make'))">
925 <xsl:call-template name="outputpkgdest">
926 <xsl:with-param name="outputstring"
927 select="substring-before($outputstring,'make')"/>
928 </xsl:call-template>
929 <xsl:call-template name="outputpkgdest">
930 <xsl:with-param
931 name="outputstring"
932 select="substring-after($outputstring,
933 substring-before($outputstring,'make'))"/>
934 </xsl:call-template>
935 </xsl:when>
936 <xsl:otherwise>
937 <xsl:choose>
938<!-- special cases (no DESTDIR) here -->
939 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
940 <xsl:text>make install_root=$PKG_DEST -j1</xsl:text>
941 <xsl:value-of
942 select="substring-before(substring-after(string(),'make'),
943 'install')"/>
944 <xsl:text>install&#xA;</xsl:text>
945 </xsl:when>
946 <xsl:when test="ancestor::sect1[@id='ch-system-bzip2']">
[323ae3e]947 <xsl:text>make -j1 PREFIX=$PKG_DEST/usr install&#xA;</xsl:text>
[7072e1f]948 </xsl:when>
949 <xsl:when test="ancestor::sect1[@id='ch-system-sysklogd']">
[323ae3e]950 <xsl:text>make -j1 BINDIR=$PKG_DEST/sbin prefix=$PKG_DEST install&#xA;</xsl:text>
[7072e1f]951 </xsl:when>
[b5d1c50]952 <xsl:when test="ancestor::sect1[@id='ch-system-iproute2'] and
953 contains($outputstring,'DOCDIR')">
954 <xsl:text>make -j1 DESTDIR=$PKG_DEST DOCDIR=</xsl:text>
955 <xsl:value-of
956 select="substring-before(substring-after(string(),'DOCDIR='),
957 'install')"/>
958 <xsl:text>install&#xA;</xsl:text>
[7072e1f]959 </xsl:when>
960 <xsl:when test="ancestor::sect1[@id='ch-system-sysvinit']">
[323ae3e]961 <xsl:text>make -j1 ROOT=$PKG_DEST</xsl:text>
[7072e1f]962 <xsl:value-of
963 select="substring-before(substring-after(string(),'make'),
964 'install')"/>
965 <xsl:text>install&#xA;</xsl:text>
966 </xsl:when>
967 <xsl:when test="ancestor::sect1[@id='ch-bootable-kernel']">
[323ae3e]968 <xsl:text>make -j1 INSTALL_MOD_PATH=$PKG_DEST</xsl:text>
[7072e1f]969 <xsl:value-of
970 select="substring-before(substring-after(string(),'make'),
971 'install')"/>
972 <xsl:text>install&#xA;</xsl:text>
973 </xsl:when>
974 <xsl:otherwise>
[323ae3e]975 <xsl:text>make -j1 DESTDIR=$PKG_DEST</xsl:text>
[e6e0c85]976 <xsl:call-template name="outputpkgdest">
[560bef1]977 <xsl:with-param
[7072e1f]978 name="outputstring"
979 select="substring-after($outputstring,'make')"/>
[560bef1]980 </xsl:call-template>
[7072e1f]981 </xsl:otherwise>
982 </xsl:choose>
983 </xsl:otherwise>
984 </xsl:choose>
985 </xsl:when>
[1cb4c76]986 <xsl:when test="contains($outputstring,'ninja install')">
[4696ddd]987 <xsl:choose>
[1cb4c76]988 <xsl:when test="not(starts-with($outputstring,'ninja install'))">
[4696ddd]989 <xsl:call-template name="outputpkgdest">
990 <xsl:with-param name="outputstring"
[1cb4c76]991 select="substring-before($outputstring,'ninja install')"/>
[4696ddd]992 </xsl:call-template>
993 <xsl:call-template name="outputpkgdest">
994 <xsl:with-param
995 name="outputstring"
996 select="substring-after($outputstring,
[1cb4c76]997 substring-before($outputstring,'ninja install'))"/>
[4696ddd]998 </xsl:call-template>
999 </xsl:when>
[1cb4c76]1000 <xsl:otherwise> <!-- "ninja" is the first word and is followed by
1001 "install"-->
[4696ddd]1002 <xsl:text>DESTDIR=$PKG_DEST ninja</xsl:text>
1003 <xsl:call-template name="outputpkgdest">
1004 <xsl:with-param
1005 name="outputstring"
1006 select="substring-after($outputstring,'ninja')"/>
1007 </xsl:call-template>
1008 </xsl:otherwise>
1009 </xsl:choose>
1010 </xsl:when>
1011 <xsl:otherwise> <!-- no make nor ninja in this string -->
[7072e1f]1012 <xsl:choose>
1013 <xsl:when test="contains($outputstring,'&gt;/') and
1014 not(contains(substring-before($outputstring,'&gt;/'),' /'))">
1015 <xsl:value-of select="substring-before($outputstring,'&gt;/')"/>
1016 <xsl:text>&gt;$PKG_DEST/</xsl:text>
1017 <xsl:call-template name="outputpkgdest">
1018 <xsl:with-param name="outputstring" select="substring-after($outputstring,'&gt;/')"/>
1019 </xsl:call-template>
1020 </xsl:when>
1021 <xsl:when test="contains($outputstring,' /')">
1022 <xsl:value-of select="substring-before($outputstring,' /')"/>
1023 <xsl:text> $PKG_DEST/</xsl:text>
1024 <xsl:call-template name="outputpkgdest">
1025 <xsl:with-param name="outputstring" select="substring-after($outputstring,' /')"/>
1026 </xsl:call-template>
1027 </xsl:when>
1028 <xsl:otherwise>
1029 <xsl:value-of select="$outputstring"/>
1030 </xsl:otherwise>
1031 </xsl:choose>
1032 </xsl:otherwise>
1033 </xsl:choose>
1034 </xsl:template>
[945ccaa]1035
1036 <xsl:variable name="APOS">'</xsl:variable>
1037 <xsl:template name="output-wrap">
1038 <xsl:param name="commands" select="''"/>
1039 <xsl:choose>
1040 <xsl:when test="contains($commands,string($APOS))">
1041 <xsl:call-template name="output-wrap">
1042 <xsl:with-param name="commands"
1043 select="substring-before($commands,string($APOS))"/>
1044 </xsl:call-template>
1045 <xsl:text>'\''</xsl:text>
1046 <xsl:call-template name="output-wrap">
1047 <xsl:with-param name="commands"
1048 select="substring-after($commands,string($APOS))"/>
1049 </xsl:call-template>
1050 </xsl:when>
1051 <xsl:otherwise>
1052 <xsl:value-of select="$commands"/>
1053 </xsl:otherwise>
1054 </xsl:choose>
1055 </xsl:template>
1056
[dc7fd7b]1057 <xsl:template name="comment-strip">
1058 <xsl:param name="instructions" select="''"/>
1059 <xsl:choose>
1060 <xsl:when test="contains($instructions,'&#xA;')">
1061 <xsl:call-template name="comment-strip">
1062 <xsl:with-param name="instructions"
1063 select="substring-before($instructions,'&#xA;')"/>
1064 </xsl:call-template>
1065 <xsl:call-template name="comment-strip">
1066 <xsl:with-param name="instructions"
1067 select="substring-after($instructions,'&#xA;')"/>
1068 </xsl:call-template>
1069 </xsl:when>
1070 <xsl:when test="contains($instructions,'\*.la')">
1071 <xsl:if test="$del-la-files='n'">
1072 <xsl:text># </xsl:text>
1073 </xsl:if>
1074 <xsl:value-of select="$instructions"/>
1075 <xsl:text>&#xA;</xsl:text>
1076 </xsl:when>
1077 <xsl:when test="contains($instructions,'strip ')">
1078 <xsl:if test="$strip='n'">
1079 <xsl:text># </xsl:text>
1080 </xsl:if>
1081 <xsl:value-of select="$instructions"/>
1082 <xsl:text> || true&#xA;</xsl:text>
1083 </xsl:when>
1084 <xsl:otherwise>
1085 <xsl:value-of select="$instructions"/>
1086 <xsl:text>&#xA;</xsl:text>
1087 </xsl:otherwise>
1088 </xsl:choose>
1089 </xsl:template>
1090
[5a8939e]1091 <xsl:template name="comment-test">
1092 <xsl:param name="instructions" select="''"/>
[6caa5b8]1093 <xsl:param name="eof-seen" select="false()"/>
[5a8939e]1094 <xsl:choose>
[1b02a9a]1095 <xsl:when test="contains($instructions, '$(nproc)')">
1096 <xsl:call-template name="comment-test">
1097 <xsl:with-param
1098 name="instructions"
1099 select="concat(substring-before($instructions, '$(nproc)'), $jobs_2, substring-after($instructions, '$(nproc)'))"/>
1100 <xsl:with-param name="eof-seen" select="$eof-seen"/>
1101 </xsl:call-template>
1102 </xsl:when>
[5a8939e]1103 <xsl:when test="contains($instructions,'&#xA;')">
1104 <xsl:call-template name="comment-test">
1105 <xsl:with-param name="instructions"
1106 select="substring-before($instructions,'&#xA;')"/>
[6caa5b8]1107 <xsl:with-param name="eof-seen" select="$eof-seen"/>
[5a8939e]1108 </xsl:call-template>
[6caa5b8]1109 <xsl:choose>
1110 <xsl:when test="contains(substring-before($instructions,'&#xA;'),
1111 'EOF')">
1112 <xsl:call-template name="comment-test">
1113 <xsl:with-param name="instructions"
1114 select="substring-after($instructions,'&#xA;')"/>
1115 <xsl:with-param name="eof-seen" select="not($eof-seen)"/>
1116 </xsl:call-template>
1117 </xsl:when>
1118 <xsl:otherwise>
1119 <xsl:call-template name="comment-test">
1120 <xsl:with-param name="instructions"
1121 select="substring-after($instructions,'&#xA;')"/>
1122 <xsl:with-param name="eof-seen" select="$eof-seen"/>
1123 </xsl:call-template>
1124 </xsl:otherwise>
1125 </xsl:choose>
[5a8939e]1126 </xsl:when>
1127 <xsl:otherwise>
1128 <xsl:if test="$testsuite = '0' or
1129 $testsuite = '1' and
1130 not(ancestor::sect1[@id='ch-system-gcc']) and
1131 not(ancestor::sect1[@id='ch-system-glibc']) and
1132 not(ancestor::sect1[@id='ch-system-gmp']) and
1133 not(ancestor::sect1[@id='ch-system-mpfr']) and
[4c36783]1134 not(ancestor::sect1[@id='ch-system-binutils'])">
[5a8939e]1135 <xsl:text># </xsl:text>
1136 </xsl:if>
1137 <xsl:choose>
[594ff3d]1138 <xsl:when test="contains(string(), 'make -k')">
1139 <xsl:value-of select="$instructions"/>
1140 <xsl:if test="not($eof-seen)">
1141 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true</xsl:text>
1142 </xsl:if>
1143 <xsl:text>&#xA;</xsl:text>
1144 </xsl:when>
1145 <xsl:when test="contains($instructions, 'make')">
1146 <xsl:value-of select="substring-before($instructions, 'make')"/>
1147 <xsl:text>make -k</xsl:text>
1148 <xsl:value-of select="substring-after($instructions, 'make')"/>
1149 <xsl:if test="not($eof-seen)">
1150 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true</xsl:text>
1151 </xsl:if>
1152 <xsl:text>&#xA;</xsl:text>
[5a8939e]1153 </xsl:when>
1154 <xsl:otherwise>
[594ff3d]1155 <xsl:value-of select="$instructions"/>
1156 <xsl:if
1157 test="not(contains($instructions, '&gt;&gt;')) and
1158 not($eof-seen) and
1159 substring($instructions,
1160 string-length($instructions)) != '\'">
1161 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true</xsl:text>
1162 </xsl:if>
1163 <xsl:text>&#xA;</xsl:text>
1164 </xsl:otherwise>
[5a8939e]1165 </xsl:choose>
1166 </xsl:otherwise>
1167 </xsl:choose>
1168 </xsl:template>
1169
[2758d94]1170 <xsl:template name="basename">
1171 <xsl:param name="path" select="''"/>
1172 <xsl:choose>
1173 <xsl:when test="contains($path,'/') and substring-after($path,'/')!=''">
1174 <xsl:call-template name="basename">
1175 <xsl:with-param name="path" select="substring-after($path,'/')"/>
1176 </xsl:call-template>
1177 </xsl:when>
1178 <xsl:when test="contains($path,'/') and substring-after($path,'/')=''">
1179 <xsl:value-of select="substring-before($path,'/')"/>
1180 </xsl:when>
1181 <xsl:otherwise>
1182 <xsl:value-of select="$path"/>
1183 </xsl:otherwise>
1184 </xsl:choose>
1185 </xsl:template>
1186
1187 <xsl:template name="start-script">
1188 <xsl:param name="order" select="'073'"/>
1189 <xsl:text>
[5451eae]1190<!-- save the timer, so that unpacking, and du is not counted -->
1191PREV_SEC=${SECONDS}
1192 <!-- get the location of the system root -->
[1dce189]1193ROOT=</xsl:text>
1194 <xsl:choose>
[123105f]1195 <xsl:when test="starts-with(./@id, 'ch-tools') or
1196 contains (./@id, 'kernfs')">
[1dce189]1197 <xsl:text>$LFS/
1198</xsl:text>
1199 </xsl:when>
1200 <xsl:otherwise>
1201 <xsl:text>/
1202</xsl:text>
1203 </xsl:otherwise>
1204 </xsl:choose>
1205 <xsl:text>
[5451eae]1206SCRIPT_ROOT=</xsl:text>
1207 <xsl:copy-of select="$script-root"/>
1208 <xsl:text>
1209</xsl:text>
1210 <xsl:if test="sect2[@role='installation']">
1211 <xsl:text>
[2758d94]1212SRC_DIR=${ROOT}sources
1213<!-- Set variables, for use by the Makefile and package manager -->
1214VERSION=</xsl:text><!-- needed for Makefile, and may be used in PackInstall-->
[5451eae]1215 <xsl:copy-of select=".//sect1info/productnumber/text()"/>
1216 <xsl:text>
[2758d94]1217PKG_DEST=${SRC_DIR}/</xsl:text>
[5451eae]1218 <xsl:copy-of select="$order"/>
1219 <xsl:text>-</xsl:text>
1220 <xsl:copy-of select=".//sect1info/productname/text()"/>
1221 <xsl:text>
1222<!-- Get the tarball name from sect1info -->
[2758d94]1223PACKAGE=</xsl:text>
[5451eae]1224 <xsl:call-template name="basename">
1225 <xsl:with-param name="path" select=".//sect1info/address/text()"/>
1226 </xsl:call-template>
[49f8b03]1227 <xsl:if test = "( ../@id = 'chapter-building-system' or
[f017b22]1228 ../@id = 'chapter-config' or
1229 ../@id = 'chapter-bootscripts' or
1230 ../@id = 'chapter-bootable' or
[49f8b03]1231 starts-with(@id,'ch-system') ) and $pkgmngt = 'y'">
1232<!-- the last alternative for old books where some sections in
1233 chapter-config had ch-system -->
[5451eae]1234 <xsl:text>
[2758d94]1235source ${ROOT}${SCRIPT_ROOT}/packInstall.sh
1236export -f packInstall</xsl:text>
[5451eae]1237 <xsl:if test="$wrap-install='y'">
1238 <xsl:text>
[2758d94]1239export -f wrapInstall
1240</xsl:text>
[5451eae]1241 </xsl:if>
[2758d94]1242 </xsl:if>
1243<!-- Get the build directory name and clean remnants of previous attempts -->
[5451eae]1244 <xsl:text>
[2758d94]1245cd $SRC_DIR
1246PKGDIR=$(tar -tf $PACKAGE | head -n1 | sed 's@^./@@;s@/.*@@')
1247export PKGDIR VERSION PKG_DEST
1248
1249if [ -d "$PKGDIR" ]; then rm -rf $PKGDIR; fi
[55e82d2]1250if [ -d "$PKG_DEST" ]; then rm -rf $PKG_DEST; fi
[2758d94]1251if [ -d "${PKGDIR%-*}-build" ]; then rm -rf ${PKGDIR%-*}-build; fi
[5451eae]1252</xsl:text>
1253 </xsl:if>
1254 <xsl:text>
1255echo "KB: $(du -skx --exclude=lost+found --exclude=var/lib --exclude=$SCRIPT_ROOT $ROOT)"
1256</xsl:text>
1257 <xsl:if test="sect2[@role='installation']">
1258 <xsl:text>
[2758d94]1259<!-- At last unpack and change directory -->
1260tar -xf $PACKAGE
1261cd $PKGDIR
[5451eae]1262</xsl:text>
1263 </xsl:if>
1264 <xsl:text>SECONDS=${PREV_SEC}
[2758d94]1265
1266# Start of LFS book script
1267</xsl:text>
1268 </xsl:template>
1269
1270 <xsl:template name="end-script">
1271 <xsl:text>
1272# End of LFS book script
1273
[5451eae]1274echo "KB: $(du -skx --exclude=lost+found --exclude=var/lib --exclude=$SCRIPT_ROOT $ROOT)"
1275</xsl:text>
1276 <xsl:if test="sect2[@role='installation']">
1277 <xsl:text>cd $SRC_DIR
[2758d94]1278rm -rf $PKGDIR
1279if [ -d "${PKGDIR%-*}-build" ]; then rm -rf ${PKGDIR%-*}-build; fi
1280</xsl:text>
[5451eae]1281 </xsl:if>
[2758d94]1282 </xsl:template>
1283
[557fe91]1284</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.