source: LFS/lfs.xsl@ 9440e4a

ablfs-more trunk
Last change on this file since 9440e4a was a9360e1, checked in by Pierre Labastie <pierre.labastie@…>, 12 months ago

Fix MAKEFLAGS for binutils-pass1

We need a special case for binutils-pass1 in case REALSBU is set
to y. Use variables JOBSBP1 in shell and jobs-bp1 in .xsl.

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