Changeset 7072e1f for LFS/lfs.xsl
- Timestamp:
- 02/01/2012 11:29:37 PM (13 years ago)
- Branches:
- 2.4, ablfs, ablfs-more, legacy, new_features, trunk
- Children:
- 2c9a16b
- Parents:
- f5dc6d7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LFS/lfs.xsl
rf5dc6d7 r7072e1f 1 <?xml version="1.0"?> 2 <!DOCTYPE xsl:stylesheet [ 3 <!ENTITY % general-entities SYSTEM "FAKEDIR/general.ent"> 4 %general-entities; 5 ]> 1 <?xml version="1.0" encoding="ISO-8859-1"?> 6 2 7 3 <!-- $Id$ --> 8 4 9 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 10 xmlns:exsl="http://exslt.org/common" 11 extension-element-prefixes="exsl" 12 version="1.0"> 13 14 <!-- XSLT stylesheet to create shell scripts from LFS books. --> 15 5 <xsl:stylesheet 6 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 7 xmlns:exsl="http://exslt.org/common" 8 extension-element-prefixes="exsl" 9 version="1.0"> 10 11 <!-- use package management ? 12 n = no, original behavior 13 y = yes, add PKG_DEST to scripts in install commands of chapter06-08 14 --> 15 <xsl:param name="pkgmngt" select="n"/> 16 16 17 <!-- Run test suites? 17 18 0 = none … … 28 29 <xsl:param name="bomb-testsuite" select="n"/> 29 30 30 <!-- Install vim-lang package? -->31 <xsl:param name="vim-lang" select=" y"/>32 31 <!-- Install vim-lang package? OBSOLETE should always be 'n'--> 32 <xsl:param name="vim-lang" select="n"/> 33 33 34 <!-- Time zone --> 34 35 <xsl:param name="timezone" select="GMT"/> 35 36 36 37 <!-- Page size --> 37 38 <xsl:param name="page" select="letter"/> 38 39 39 40 <!-- Locale settings --> 40 41 <xsl:param name="lang" select="C"/> 41 42 42 43 <xsl:template match="/"> 43 44 <xsl:apply-templates select="//sect1"/> 44 45 </xsl:template> 45 46 46 47 <xsl:template match="sect1"> 47 <xsl:if test="(../@id='chapter-temporary-tools' or48 <xsl:if test="(../@id='chapter-temporary-tools' or 48 49 ../@id='chapter-building-system' or 49 50 ../@id='chapter-bootscripts' or … … 51 52 count(descendant::screen/userinput) > 0 and 52 53 count(descendant::screen/userinput) > 53 count(descendant::screen[@role='nodump'])">54 count(descendant::screen[@role='nodump'])"> 54 55 <!-- The dirs names --> 55 56 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/> … … 57 58 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/> 58 59 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/> 59 <!-- The file names --> 60 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/> 61 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/> 62 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/> 63 <!-- The build order --> 64 <xsl:variable name="position" select="position()"/> 65 <xsl:variable name="order"> 66 <xsl:choose> 67 <xsl:when test="string-length($position) = 1"> 68 <xsl:text>00</xsl:text> 69 <xsl:value-of select="$position"/> 70 </xsl:when> 71 <xsl:when test="string-length($position) = 2"> 72 <xsl:text>0</xsl:text> 73 <xsl:value-of select="$position"/> 74 </xsl:when> 75 <xsl:otherwise> 76 <xsl:value-of select="$position"/> 77 </xsl:otherwise> 78 </xsl:choose> 79 </xsl:variable> 80 <!-- Creating dirs and files --> 81 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text"> 82 <xsl:choose> 83 <xsl:when test="@id='ch-system-creatingdirs' or 84 @id='ch-system-createfiles' or 85 @id='ch-system-strippingagain'"> 86 <xsl:text>#!/tools/bin/bash
set +h
</xsl:text> 87 </xsl:when> 88 <xsl:otherwise> 89 <xsl:text>#!/bin/bash
set +h
</xsl:text> 90 </xsl:otherwise> 91 </xsl:choose> 92 <xsl:if test="not(@id='ch-tools-stripping') and 93 not(@id='ch-system-strippingagain')"> 94 <xsl:text>set -e
</xsl:text> 60 <!-- The file names --> 61 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/> 62 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/> 63 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/> 64 <!-- The build order --> 65 <xsl:variable name="position" select="position()"/> 66 <xsl:variable name="order"> 67 <xsl:choose> 68 <xsl:when test="string-length($position) = 1"> 69 <xsl:text>00</xsl:text> 70 <xsl:value-of select="$position"/> 71 </xsl:when> 72 <xsl:when test="string-length($position) = 2"> 73 <xsl:text>0</xsl:text> 74 <xsl:value-of select="$position"/> 75 </xsl:when> 76 <xsl:otherwise> 77 <xsl:value-of select="$position"/> 78 </xsl:otherwise> 79 </xsl:choose> 80 </xsl:variable> 81 <!-- Inclusion of package manager scriptlets --> 82 <xsl:if test="@id='ch-tools-stripping' and $pkgmngt='y'"> 83 <xsl:apply-templates 84 select="document('packageManager.xml')//sect1[@id='ch-tools-pkgmngt']" 85 mode="pkgmngt"> 86 <xsl:with-param name="order" select="concat($order,'-1')"/> 87 <xsl:with-param name="dirname" select="$dirname"/> 88 </xsl:apply-templates> 89 </xsl:if> 90 <xsl:if test="@id='ch-system-strippingagain' and $pkgmngt='y'"> 91 <xsl:apply-templates 92 select="document('packageManager.xml')//sect1[@id='ch-system-pkgmngt']" 93 mode="pkgmngt"> 94 <xsl:with-param name="order" select="concat($order,'-1')"/> 95 <xsl:with-param name="dirname" select="$dirname"/> 96 </xsl:apply-templates> 97 </xsl:if> 98 <!-- Creating dirs and files --> 99 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text"> 100 <xsl:choose> 101 <xsl:when test="@id='ch-system-creatingdirs' or 102 @id='ch-system-createfiles' or 103 @id='ch-system-strippingagain'"> 104 <xsl:text>#!/tools/bin/bash
set +h
</xsl:text> 105 </xsl:when> 106 <xsl:otherwise> 107 <xsl:text>#!/bin/bash
set +h
</xsl:text> 108 </xsl:otherwise> 109 </xsl:choose> 110 <xsl:if test="not(@id='ch-tools-stripping') and 111 not(@id='ch-system-strippingagain')"> 112 <xsl:text>set -e
</xsl:text> 113 </xsl:if> 114 <xsl:text>
</xsl:text> 115 <xsl:if test="sect2[@role='installation']"> 116 <xsl:text>cd $PKGDIR
</xsl:text> 117 </xsl:if> 118 <xsl:apply-templates 119 select=".//screen[not(@role) or 120 @role != 'nodump']/userinput[ 121 @remap = 'pre' or 122 @remap = 'configure' or 123 @remap = 'make' or 124 @remap = 'test' and 125 not(current()/@id='ch-tools-dejagnu')]"/> 126 <xsl:if 127 test="ancestor::chapter[@id != 'chapter-temporary-tools'] and 128 $pkgmngt = 'y' and 129 descendant::screen[not(@role) or 130 @role != 'nodump']/userinput[ 131 @remap='install']"> 132 <xsl:text>mkdir -pv $PKG_DEST/{boot,etc,lib,bin,sbin} 133 mkdir -pv $PKG_DEST/usr/{lib,bin,sbin,include} 134 mkdir -pv $PKG_DEST/usr/share/{doc,info,man} 135 mkdir -pv $PKG_DEST/usr/share/man/man{1..8} 136 ln -sv share/{man,doc,info} $PKG_DEST/usr 137 case $(uname -m) in 138 x86_64) ln -sv lib $PKG_DEST/lib64 && ln -sv lib $PKG_DEST/usr/lib64 ;; 139 esac 140 </xsl:text> 141 </xsl:if> 142 <xsl:if test="@id = 'ch-system-glibc' and 143 $pkgmngt = 'y'"> 144 <xsl:text>mkdir -pv $PKG_DEST/usr/include/{rpc,rpcsvc} 145 </xsl:text> 146 </xsl:if> 147 <xsl:apply-templates 148 select=".//screen[not(@role) or 149 @role != 'nodump']/userinput[@remap = 'install']"/> 150 <xsl:if test="ancestor::chapter[@id != 'chapter-temporary-tools'] and 151 $pkgmngt = 'y' and 152 descendant::screen[not(@role) or 153 @role != 'nodump']/userinput[ 154 @remap='install']"> 155 <xsl:if test="@id = 'ch-system-man-pages'"> 156 <!-- those files are provided by the shadow package --> 157 <xsl:text>rm -fv $PKG_DEST/usr/share/man/{man3/getspnam.3,man5/passwd.5} 158 </xsl:text> 95 159 </xsl:if> 160 <xsl:text>rm -fv $PKG_DEST/{,usr/}lib64 161 rm -fv $PKG_DEST/usr/{man,doc,info} 162 for dir in $PKG_DEST/usr/share/man/man{1..8}; do 163 [[ -z $(ls $dir) ]] && rmdir -v $dir 164 done 165 for dir in $PKG_DEST/usr/share/{doc,info,man}; do 166 [[ -z $(ls $dir) ]] && rmdir -v $dir 167 done 168 for dir in $PKG_DEST/usr/{lib,bin,sbin,include}; do 169 [[ -z $(ls $dir) ]] && rmdir -v $dir 170 done 171 for dir in $PKG_DEST/{boot,etc,lib,bin,sbin}; do 172 [[ -z $(ls $dir) ]] && rmdir -v $dir 173 done 174 packInstall 175 rm -rf $PKG_DEST 176 </xsl:text> 177 </xsl:if> 178 <xsl:if test="$testsuite='3' and @id='ch-tools-glibc' or @id='ch-system-glibc'"> 179 <xsl:copy-of select="//userinput[@remap='locale-test']"/> 96 180 <xsl:text>
</xsl:text> 97 <xsl:if test="sect2[@role='installation']"> 98 <xsl:text>cd $PKGDIR
</xsl:text> 99 <xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'"> 100 <xsl:text>tar -xvf ../vim-&vim-version;-lang.* --strip-components=1
</xsl:text> 101 </xsl:if> 102 </xsl:if> 103 <xsl:apply-templates select=".//screen"/> 104 <xsl:if test="$testsuite='3' and @id='ch-tools-glibc'"> 105 <xsl:copy-of select="//userinput[@remap='locale-test']"/> 106 <xsl:text>
</xsl:text> 107 </xsl:if> 108 <xsl:if test="not(@id='ch-system-chroot') and 109 not(@id='ch-system-revisedchroot')"> 110 <xsl:text>echo -e "\n\nTotalseconds: $SECONDS\n"
</xsl:text> 111 </xsl:if> 112 <xsl:text>exit
</xsl:text> 113 </exsl:document> 181 </xsl:if> 182 <xsl:apply-templates 183 select=".//screen[ 184 not(@role) or 185 @role != 'nodump' 186 ]/userinput[ 187 not(@remap) or 188 @remap='adjust' or 189 @remap='test' and current()/@id='ch-tools-dejagnu' 190 ]"/> 191 <xsl:if test="@id='ch-system-creatingdirs'"> 192 <xsl:apply-templates 193 select="document('packageManager.xml')//sect1[ 194 @id='ch-system-pkgmngt-creatingdirs' 195 ]//userinput"/> 196 </xsl:if> 197 <xsl:if test="@id='ch-system-createfiles'"> 198 <xsl:apply-templates 199 select="document('packageManager.xml')//sect1[ 200 @id='ch-system-pkgmngt-createfiles' 201 ]//userinput"/> 202 </xsl:if> 203 <xsl:if test="not(@id='ch-system-chroot') and 204 not(@id='ch-system-revisedchroot')"> 205 <xsl:text>echo -e "\n\nTotalseconds: $SECONDS\n"
</xsl:text> 206 </xsl:if> 207 <xsl:text>exit
</xsl:text> 208 </exsl:document> 114 209 </xsl:if> 115 210 </xsl:template> 116 211 117 <xsl:template match="screen"> 118 <xsl:if test="child::* = userinput and not(@role = 'nodump')"> 119 <xsl:apply-templates select="userinput" mode="screen"/> 120 </xsl:if> 121 </xsl:template> 122 123 <xsl:template match="userinput" mode="screen"> 212 <xsl:template match="sect1" mode="pkgmngt"> 213 <xsl:param name="dirname" select="chapter05"/> 214 <!-- The build order --> 215 <xsl:param name="order" select="062-1"/> 216 <!-- The file names --> 217 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/> 218 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/> 219 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/> 220 <!-- Creating dirs and files --> 221 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text"> 222 <xsl:text>#!/bin/bash 223 set +h 224 set -e 225 226 cd $PKGDIR 227 </xsl:text> 228 <xsl:apply-templates 229 select=".//screen[not(@role) or @role != 'nodump']/userinput[@remap != 'adjust']" 230 mode="pkgmngt"/> 231 <xsl:if test="@id = 'ch-system-pkgmngt'"> 232 <xsl:text>packInstall 233 rm -rf $PKG_DEST 234 </xsl:text> 235 </xsl:if> 236 <xsl:apply-templates 237 select=".//screen[ 238 not(@role) or 239 @role != 'nodump' 240 ]/userinput[ 241 not(@remap) or 242 @remap='adjust' 243 ]" 244 mode="pkgmngt"/> 245 <xsl:text> 246 echo -e "\n\nTotalseconds: $SECONDS\n" 247 exit 248 </xsl:text> 249 </exsl:document> 250 </xsl:template> 251 252 <xsl:template match="userinput" mode="pkgmngt"> 253 <xsl:apply-templates/> 254 <xsl:text>
</xsl:text> 255 </xsl:template> 256 257 <xsl:template match="userinput"> 124 258 <xsl:choose> 125 <!-- Estandarized package formats -->126 <xsl:when test="contains(string(),'tar.gz')">127 <xsl:value-of select="substring-before(string(),'tar.gz')"/>128 <xsl:text>tar.*</xsl:text>129 <xsl:value-of select="substring-after(string(),'tar.gz')"/>130 <xsl:text>
</xsl:text>131 </xsl:when>132 <!-- Avoiding a race condition in a patch -->133 <xsl:when test="contains(string(),'debian_fixes')">134 <xsl:value-of select="substring-before(string(),'patch')"/>135 <xsl:text>patch -Z</xsl:text>136 <xsl:value-of select="substring-after(string(),'patch')"/>137 <xsl:text>
</xsl:text>138 </xsl:when>139 <!-- Fix Udev reinstallation after a build failure -->140 <xsl:when test="contains(string(),'firmware,udev')">141 <xsl:text>if [[ ! -d /lib/udev/devices ]] ; then
</xsl:text>142 <xsl:apply-templates/>143 <xsl:text>
fi
</xsl:text>144 </xsl:when>145 259 <!-- Copying the kernel config file --> 146 260 <xsl:when test="string() = 'make mrproper'"> 147 261 <xsl:text>make mrproper
</xsl:text> 148 262 <xsl:if test="ancestor::sect1[@id='ch-bootable-kernel']"> 149 263 <xsl:text>cp -v ../kernel-config .config
</xsl:text> 150 264 </xsl:if> 151 265 </xsl:when> 152 <!-- The Bash, Coreutils, and Module-Init-Tools test suites are optional --> 153 <xsl:when test="(ancestor::sect1[@id='ch-system-coreutils'] or 154 ancestor::sect1[@id='ch-system-bash'] or 155 ancestor::sect1[@id='ch-system-module-init-tools']) 156 and @remap = 'test'"> 157 <xsl:choose> 158 <xsl:when test="$testsuite = '0' or $testsuite = '1'"/> 159 <xsl:otherwise> 160 <xsl:if test="not(contains(string(),'check')) and 161 not(contains(string(),'make tests'))"> 162 <xsl:apply-templates/> 163 <xsl:text>
</xsl:text> 164 </xsl:if> 165 <!-- Coreutils and Module-Init-Tools --> 166 <xsl:if test="contains(string(),'check')"> 167 <xsl:choose> 168 <xsl:when test="$bomb-testsuite = 'n'"> 169 <xsl:value-of select="substring-before(string(),'check')"/> 170 <xsl:text>-k check</xsl:text> 171 <xsl:value-of select="substring-after(string(),'check')"/> 172 <xsl:text> >> $TEST_LOG 2>&1 || true
</xsl:text> 173 </xsl:when> 174 <xsl:otherwise> 175 <xsl:apply-templates/> 176 <xsl:text> >> $TEST_LOG 2>&1</xsl:text> 177 <xsl:if test="contains(string(),' -k ')"> 178 <xsl:text> || true</xsl:text> 179 </xsl:if> 180 <xsl:text>
</xsl:text> 181 </xsl:otherwise> 182 </xsl:choose> 183 </xsl:if> 184 <!-- Bash --> 185 <xsl:if test="contains(string(),'make tests')"> 186 <xsl:choose> 187 <xsl:when test="$bomb-testsuite = 'n'"> 188 <xsl:value-of select="substring-before(string(),'tests')"/> 189 <xsl:text>-k tests</xsl:text> 190 <xsl:value-of select="substring-after(string(),'tests')"/> 191 <xsl:text> >> $TEST_LOG 2>&1 || true
</xsl:text> 192 </xsl:when> 193 <xsl:otherwise> 194 <xsl:apply-templates/> 195 <xsl:text> >> $TEST_LOG 2>&1</xsl:text> 196 <xsl:if test="contains(string(),' -k ')"> 197 <xsl:text> || true</xsl:text> 198 </xsl:if> 199 <xsl:text>
</xsl:text> 200 </xsl:otherwise> 201 </xsl:choose> 202 </xsl:if> 203 </xsl:otherwise> 204 </xsl:choose> 205 </xsl:when> 206 <!-- Fixing toolchain test suites run --> 207 <xsl:when test="(string() = 'make check' or 208 string() = 'make -k check') and 209 (ancestor::sect1[@id='ch-system-gcc'] or 210 ancestor::sect1[@id='ch-system-glibc'] or 211 ancestor::sect1[@id='ch-system-binutils'] or 212 ancestor::sect1[@id='ch-tools-gcc-pass2'])"> 213 <xsl:choose> 214 <xsl:when test="(($testsuite = '1' or $testsuite = '2') and 215 ancestor::chapter[@id='chapter-building-system']) or 216 $testsuite = '3'"> 217 <xsl:choose> 218 <xsl:when test="$bomb-testsuite = 'n'"> 219 <xsl:text>make -k check >> $TEST_LOG 2>&1 || true
</xsl:text> 220 </xsl:when> 221 <xsl:otherwise> 222 <xsl:apply-templates/> 223 <xsl:text> >> $TEST_LOG 2>&1</xsl:text> 224 <xsl:if test="contains(string(),' -k ')"> 225 <xsl:text> || true</xsl:text> 226 </xsl:if> 227 <xsl:text>
</xsl:text> 228 </xsl:otherwise> 229 </xsl:choose> 230 </xsl:when> 231 </xsl:choose> 232 </xsl:when> 233 <xsl:when test="contains(string(),'glibc-check-log')"> 234 <xsl:choose> 235 <xsl:when test="$testsuite != '0'"> 236 <xsl:value-of select="substring-before(string(),'2>&1')"/> 237 <xsl:text>>> $TEST_LOG 2>&1 || true
</xsl:text> 238 </xsl:when> 239 </xsl:choose> 240 </xsl:when> 241 <xsl:when test="contains(string(),'test_summary') or 242 contains(string(),'expect -c')"> 243 <xsl:choose> 244 <xsl:when test="(($testsuite = '1' or $testsuite = '2') and 245 ancestor::chapter[@id='chapter-building-system']) or 246 $testsuite = '3'"> 247 <xsl:apply-templates/> 248 <xsl:text> >> $TEST_LOG
</xsl:text> 249 </xsl:when> 250 </xsl:choose> 251 </xsl:when> 252 <!-- The rest of testsuites --> 253 <xsl:when test="@remap = 'test'"> 266 <!-- test instructions --> 267 <xsl:when test="@remap = 'test'"> 254 268 <xsl:choose> 255 269 <xsl:when test="$testsuite = '0'"/> … … 257 271 not(ancestor::sect1[@id='ch-system-gcc']) and 258 272 not(ancestor::sect1[@id='ch-system-glibc']) and 273 not(ancestor::sect1[@id='ch-system-gmp']) and 274 not(ancestor::sect1[@id='ch-system-mpfr']) and 259 275 not(ancestor::sect1[@id='ch-system-binutils'])"/> 260 276 <xsl:when test="$testsuite = '2' and … … 263 279 <xsl:choose> 264 280 <xsl:when test="$bomb-testsuite = 'n'"> 265 <xsl:value-of select="substring-before(string(),'make')"/> 266 <xsl:text>make -k</xsl:text> 267 <xsl:value-of select="substring-after(string(),'make')"/> 268 <xsl:text> >> $TEST_LOG 2>&1 || true
</xsl:text> 281 <xsl:choose> 282 <!-- special case for glibc --> 283 <xsl:when test="contains(string(), 'glibc-check-log')"> 284 <xsl:value-of 285 select="substring-before(string(),'2>&1')"/> 286 <xsl:text>>> $TEST_LOG 2>&1 || true
</xsl:text> 287 </xsl:when> 288 <xsl:when test="contains(string(), 'make -k')"> 289 <xsl:apply-templates/> 290 <xsl:text> >> $TEST_LOG 2>&1 || true
</xsl:text> 291 </xsl:when> 292 <xsl:when test="contains(string(), 'make')"> 293 <xsl:value-of select="substring-before(string(),'make')"/> 294 <xsl:text>make -k</xsl:text> 295 <xsl:value-of select="substring-after(string(),'make')"/> 296 <xsl:text> >> $TEST_LOG 2>&1 || true
</xsl:text> 297 </xsl:when> 298 <xsl:otherwise> 299 <xsl:apply-templates/> 300 <xsl:if test="not(contains(string(), '>>'))"> 301 <xsl:text> >> $TEST_LOG 2>&1</xsl:text> 302 </xsl:if> 303 <xsl:text>
</xsl:text> 304 </xsl:otherwise> 305 </xsl:choose> 269 306 </xsl:when> 270 307 <xsl:otherwise> 271 <xsl:apply-templates/> 272 <xsl:text> >> $TEST_LOG 2>&1</xsl:text> 273 <xsl:if test="contains(string(),' -k ')"> 274 <xsl:text> || true</xsl:text> 275 </xsl:if> 276 <xsl:text>
</xsl:text> 308 <!-- bomb-testsuite != 'n'--> 309 <xsl:choose> 310 <!-- special case for glibc --> 311 <xsl:when test="contains(string(), 'glibc-check-log')"> 312 <xsl:value-of 313 select="substring-before(string(),'2>&1')"/> 314 <xsl:text>>> $TEST_LOG 2>&1 
</xsl:text> 315 </xsl:when> 316 <xsl:otherwise> 317 <xsl:apply-templates/> 318 <xsl:if test="not(contains(string(), '>>'))"> 319 <xsl:text> >> $TEST_LOG 2>&1</xsl:text> 320 </xsl:if> 321 <xsl:text>
</xsl:text> 322 </xsl:otherwise> 323 </xsl:choose> 277 324 </xsl:otherwise> 278 325 </xsl:choose> … … 280 327 </xsl:choose> 281 328 </xsl:when> 329 <!-- End of test instructions --> 282 330 <!-- Don't stop on strip run --> 283 331 <xsl:when test="contains(string(),'strip ')"> … … 285 333 <xsl:text> || true
</xsl:text> 286 334 </xsl:when> 335 <!-- Package management --> 336 <!-- Add $PKG_DEST to installation commands --> 337 <xsl:when test="@remap='install' and 338 not(ancestor::chapter[ 339 @id='chapter-temporary-tools' 340 ])"> 341 <xsl:choose> 342 <xsl:when test="$pkgmngt='n'"> 343 <xsl:choose> 344 <xsl:when test="contains(string(),'firmware,udev')"> 345 <xsl:text>if [[ ! -d /lib/udev/devices ]] ; then
</xsl:text> 346 <xsl:apply-templates/> 347 <xsl:text>
fi
</xsl:text> 348 </xsl:when> 349 <xsl:otherwise> 350 <xsl:apply-templates/> 351 <xsl:text>
</xsl:text> 352 </xsl:otherwise> 353 </xsl:choose> 354 </xsl:when> 355 <xsl:otherwise><!--pkgmngt = 'y'--> 356 <xsl:choose> 357 <xsl:when test="./literal"> 358 <xsl:call-template name="outputpkgdest"> 359 <xsl:with-param name="outputstring" 360 select="text()[1]"/> 361 </xsl:call-template> 362 <xsl:apply-templates select="literal"/> 363 <xsl:call-template name="outputpkgdest"> 364 <xsl:with-param name="outputstring" 365 select="text()[2]"/> 366 </xsl:call-template> 367 </xsl:when> 368 <xsl:otherwise> 369 <xsl:call-template name="outputpkgdest"> 370 <xsl:with-param name="outputstring" select="string()"/> 371 </xsl:call-template> 372 </xsl:otherwise> 373 </xsl:choose> 374 </xsl:otherwise> 375 </xsl:choose> 376 </xsl:when> 377 <!-- End addition for package management --> 287 378 <!-- The rest of commands --> 288 379 <xsl:otherwise> … … 292 383 </xsl:choose> 293 384 </xsl:template> 294 385 295 386 <xsl:template match="replaceable"> 296 387 <xsl:choose> … … 311 402 </xsl:choose> 312 403 </xsl:template> 313 404 405 <xsl:template name="outputpkgdest"> 406 <xsl:param name="outputstring" select="foo"/> 407 <xsl:choose> 408 <xsl:when test="contains($outputstring,'make ')"> 409 <xsl:choose> 410 <xsl:when test="not(starts-with($outputstring,'make'))"> 411 <xsl:call-template name="outputpkgdest"> 412 <xsl:with-param name="outputstring" 413 select="substring-before($outputstring,'make')"/> 414 </xsl:call-template> 415 <xsl:call-template name="outputpkgdest"> 416 <xsl:with-param 417 name="outputstring" 418 select="substring-after($outputstring, 419 substring-before($outputstring,'make'))"/> 420 </xsl:call-template> 421 </xsl:when> 422 <xsl:otherwise> 423 <xsl:choose> 424 <!-- special cases (no DESTDIR) here --> 425 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']"> 426 <xsl:text>make install_root=$PKG_DEST -j1</xsl:text> 427 <xsl:value-of 428 select="substring-before(substring-after(string(),'make'), 429 'install')"/> 430 <xsl:text>install
</xsl:text> 431 </xsl:when> 432 <xsl:when test="ancestor::sect1[@id='ch-system-bzip2']"> 433 <xsl:text>make PREFIX=$PKG_DEST/usr install
</xsl:text> 434 </xsl:when> 435 <xsl:when test="ancestor::sect1[@id='ch-system-sysklogd']"> 436 <xsl:text>make BINDIR=$PKG_DEST/sbin prefix=$PKG_DEST install
</xsl:text> 437 </xsl:when> 438 <xsl:when test="ancestor::sect1[@id='ch-system-iproute2']"> 439 <xsl:text>make DESTDIR=$PKG_DEST</xsl:text> 440 <xsl:value-of 441 select="substring-before(substring-after(string(),'DESTDIR='), 442 'install')"/> 443 <xsl:text>install
</xsl:text> 444 </xsl:when> 445 <xsl:when test="ancestor::sect1[@id='ch-system-sysvinit']"> 446 <xsl:text>make ROOT=$PKG_DEST</xsl:text> 447 <xsl:value-of 448 select="substring-before(substring-after(string(),'make'), 449 'install')"/> 450 <xsl:text>install
</xsl:text> 451 </xsl:when> 452 <xsl:when test="ancestor::sect1[@id='ch-bootable-kernel']"> 453 <xsl:text>make INSTALL_MOD_PATH=$PKG_DEST</xsl:text> 454 <xsl:value-of 455 select="substring-before(substring-after(string(),'make'), 456 'install')"/> 457 <xsl:text>install
</xsl:text> 458 </xsl:when> 459 <xsl:otherwise> 460 <xsl:text>make DESTDIR=$PKG_DEST</xsl:text> 461 <xsl:call-template name="outputpkgdest"> 462 <xsl:with-param 463 name="outputstring" 464 select="substring-after($outputstring,'make')"/> 465 </xsl:call-template> 466 </xsl:otherwise> 467 </xsl:choose> 468 </xsl:otherwise> 469 </xsl:choose> 470 </xsl:when> 471 <xsl:otherwise> <!-- no make in this string --> 472 <xsl:choose> 473 <xsl:when test="contains($outputstring,'>/') and 474 not(contains(substring-before($outputstring,'>/'),' /'))"> 475 <xsl:value-of select="substring-before($outputstring,'>/')"/> 476 <xsl:text>>$PKG_DEST/</xsl:text> 477 <xsl:call-template name="outputpkgdest"> 478 <xsl:with-param name="outputstring" select="substring-after($outputstring,'>/')"/> 479 </xsl:call-template> 480 </xsl:when> 481 <xsl:when test="contains($outputstring,' /')"> 482 <xsl:value-of select="substring-before($outputstring,' /')"/> 483 <xsl:text> $PKG_DEST/</xsl:text> 484 <xsl:call-template name="outputpkgdest"> 485 <xsl:with-param name="outputstring" select="substring-after($outputstring,' /')"/> 486 </xsl:call-template> 487 </xsl:when> 488 <xsl:otherwise> 489 <xsl:value-of select="$outputstring"/> 490 <xsl:text>
</xsl:text> 491 </xsl:otherwise> 492 </xsl:choose> 493 </xsl:otherwise> 494 </xsl:choose> 495 </xsl:template> 314 496 </xsl:stylesheet>
Note:
See TracChangeset
for help on using the changeset viewer.