[e576789] | 1 | <?xml version="1.0"?>
|
---|
| 2 |
|
---|
| 3 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
| 4 | xmlns:exsl="http://exslt.org/common"
|
---|
| 5 | extension-element-prefixes="exsl"
|
---|
| 6 | version="1.0">
|
---|
| 7 |
|
---|
[56178ba] | 8 | <!-- $Id$ -->
|
---|
[e576789] | 9 |
|
---|
| 10 | <!-- XSLT stylesheet to create shell scripts from "linear build" BLFS books. -->
|
---|
| 11 |
|
---|
[c048987] | 12 | <!-- parameters and global variables -->
|
---|
| 13 | <!-- Check whether the book is sysv or systemd -->
|
---|
[70d73d1] | 14 | <xsl:variable name="rev">
|
---|
| 15 | <xsl:choose>
|
---|
| 16 | <xsl:when test="//bookinfo/title/phrase[@revision='systemd']">
|
---|
| 17 | systemd
|
---|
| 18 | </xsl:when>
|
---|
| 19 | <xsl:otherwise>
|
---|
| 20 | sysv
|
---|
| 21 | </xsl:otherwise>
|
---|
| 22 | </xsl:choose>
|
---|
| 23 | </xsl:variable>
|
---|
| 24 |
|
---|
[945ccaa] | 25 | <!-- Wrap "root" commands inside a wrapper function, allowing
|
---|
| 26 | "porg style" package management -->
|
---|
| 27 | <xsl:param name="wrap-install" select="'n'"/>
|
---|
| 28 |
|
---|
[67c3df4] | 29 | <!-- list of packages needing stats -->
|
---|
| 30 | <xsl:param name="list-stat" select="''"/>
|
---|
| 31 |
|
---|
[dc7fd7b] | 32 | <!-- Remove libtool .la files -->
|
---|
| 33 | <xsl:param name="del-la-files" select="'y'"/>
|
---|
| 34 |
|
---|
[e576789] | 35 | <!-- Build as user (y) or as root (n)? -->
|
---|
| 36 | <xsl:param name="sudo" select="'y'"/>
|
---|
| 37 |
|
---|
[625cb14] | 38 | <!-- Localization in the form ll_CC.charmap@modifier (to be used in
|
---|
| 39 | bash shell startup scripts). ll, CC, and charmap must be present:
|
---|
| 40 | no way to use "C" or "POSIX". -->
|
---|
| 41 | <xsl:param name="language" select="'en_US.UTF-8'"/>
|
---|
| 42 |
|
---|
| 43 | <!-- Break it in pieces -->
|
---|
| 44 | <xsl:variable name="lang-ll">
|
---|
| 45 | <xsl:copy-of select="substring-before($language,'_')"/>
|
---|
| 46 | </xsl:variable>
|
---|
| 47 | <xsl:variable name="lang-CC">
|
---|
| 48 | <xsl:copy-of
|
---|
| 49 | select="substring-before(substring-after($language,'_'),'.')"/>
|
---|
| 50 | </xsl:variable>
|
---|
| 51 | <xsl:variable name="lang-charmap">
|
---|
| 52 | <xsl:choose>
|
---|
| 53 | <xsl:when test="contains($language,'@')">
|
---|
| 54 | <xsl:copy-of
|
---|
| 55 | select="substring-before(substring-after($language,'.'),'@')"/>
|
---|
| 56 | </xsl:when>
|
---|
| 57 | <xsl:otherwise>
|
---|
| 58 | <xsl:copy-of select="substring-after($language,'.')"/>
|
---|
| 59 | </xsl:otherwise>
|
---|
| 60 | </xsl:choose>
|
---|
| 61 | </xsl:variable>
|
---|
| 62 | <xsl:variable name="lang-modifier">
|
---|
| 63 | <xsl:choose>
|
---|
| 64 | <xsl:when test="contains($language,'@')">
|
---|
| 65 | <xsl:copy-of select="concat('@',substring-after($language,'@'))"/>
|
---|
| 66 | </xsl:when>
|
---|
| 67 | <xsl:otherwise>
|
---|
| 68 | <xsl:copy-of select="''"/>
|
---|
| 69 | </xsl:otherwise>
|
---|
| 70 | </xsl:choose>
|
---|
| 71 | </xsl:variable>
|
---|
| 72 |
|
---|
[dc7fd7b] | 73 | <!-- simple instructions for removing .la files. -->
|
---|
| 74 | <xsl:variable name="la-files-instr">
|
---|
| 75 |
|
---|
| 76 | for libdir in /lib /usr/lib $(find /opt -name lib); do
|
---|
[2969cdf] | 77 | find $libdir -name \*.la \
|
---|
| 78 | ! -path \*ImageMagick\* \
|
---|
| 79 | -delete
|
---|
[dc7fd7b] | 80 | done
|
---|
| 81 |
|
---|
| 82 | </xsl:variable>
|
---|
[67c3df4] | 83 |
|
---|
[c048987] | 84 | <xsl:variable name="list-stat-norm"
|
---|
| 85 | select="concat(' ', normalize-space($list-stat),' ')"/>
|
---|
| 86 |
|
---|
| 87 | <!-- To be able to use the single quote in tests -->
|
---|
| 88 | <xsl:variable name="APOS">'</xsl:variable>
|
---|
| 89 |
|
---|
| 90 | <!-- end parameters and global variables -->
|
---|
| 91 |
|
---|
| 92 | <!-- include the templates for the screen children of role="install" sect2 -->
|
---|
| 93 | <xsl:include href="gen-install.xsl"/>
|
---|
| 94 |
|
---|
| 95 | <!--=================== Begin processing ========================-->
|
---|
[67c3df4] | 96 |
|
---|
[e576789] | 97 | <xsl:template match="/">
|
---|
[c048987] | 98 | <xsl:apply-templates select="//sect1[@id != 'bootscripts' and
|
---|
| 99 | @id != 'systemd-units']"/>
|
---|
[e576789] | 100 | </xsl:template>
|
---|
| 101 |
|
---|
| 102 | <!--=================== Master chunks code ======================-->
|
---|
| 103 |
|
---|
| 104 | <xsl:template match="sect1">
|
---|
| 105 |
|
---|
[c048987] | 106 | <!-- The file names -->
|
---|
| 107 | <xsl:variable name="filename" select="@id"/>
|
---|
[e576789] | 108 |
|
---|
[c048987] | 109 | <!-- The build order -->
|
---|
| 110 | <xsl:variable name="position" select="position()"/>
|
---|
| 111 | <xsl:variable name="order">
|
---|
| 112 | <xsl:choose>
|
---|
| 113 | <xsl:when test="string-length($position) = 1">
|
---|
| 114 | <xsl:text>00</xsl:text>
|
---|
| 115 | <xsl:value-of select="$position"/>
|
---|
| 116 | </xsl:when>
|
---|
| 117 | <xsl:when test="string-length($position) = 2">
|
---|
| 118 | <xsl:text>0</xsl:text>
|
---|
| 119 | <xsl:value-of select="$position"/>
|
---|
| 120 | </xsl:when>
|
---|
| 121 | <xsl:otherwise>
|
---|
| 122 | <xsl:value-of select="$position"/>
|
---|
| 123 | </xsl:otherwise>
|
---|
| 124 | </xsl:choose>
|
---|
| 125 | </xsl:variable>
|
---|
[e576789] | 126 |
|
---|
| 127 | <!-- Depuration code -->
|
---|
[c048987] | 128 | <xsl:message>
|
---|
| 129 | <xsl:text>SCRIPT is </xsl:text>
|
---|
| 130 | <xsl:value-of select="concat($order,'-z-',$filename)"/>
|
---|
| 131 | <xsl:text>
 FTPDIR is </xsl:text>
|
---|
| 132 | <xsl:value-of select="$filename"/>
|
---|
| 133 | <xsl:text>

</xsl:text>
|
---|
| 134 | </xsl:message>
|
---|
| 135 |
|
---|
| 136 | <!-- Creating the scripts -->
|
---|
| 137 | <exsl:document href="{$order}-z-{$filename}" method="text">
|
---|
| 138 | <xsl:text>#!/bin/bash
|
---|
[eabfc59] | 139 | set -e
|
---|
| 140 | unset MAKELEVEL
|
---|
[c048987] | 141 | <!-- the above is needed for some packages -->
|
---|
[eabfc59] | 142 | </xsl:text>
|
---|
[c048987] | 143 | <xsl:choose>
|
---|
| 144 | <!-- Package page -->
|
---|
| 145 | <xsl:when test="sect2[@role='package']">
|
---|
| 146 | <!-- We build in a subdirectory, whose name may be needed
|
---|
| 147 | if using package management (see envars.conf), so
|
---|
| 148 | "export" it -->
|
---|
| 149 | <xsl:text>export JH_PKG_DIR=</xsl:text>
|
---|
| 150 | <xsl:value-of select="$filename"/>
|
---|
| 151 | <xsl:text>
|
---|
[1fa0dee] | 152 | SRC_DIR=${JH_SRC_ARCHIVE}${JH_SRC_SUBDIRS:+/${JH_PKG_DIR}}
|
---|
| 153 | BUILD_DIR=${JH_BUILD_ROOT}${JH_BUILD_SUBDIRS:+/${JH_PKG_DIR}}
|
---|
[39dc04a] | 154 | mkdir -p $SRC_DIR
|
---|
| 155 | mkdir -p $BUILD_DIR
|
---|
| 156 |
|
---|
| 157 | </xsl:text>
|
---|
[67c3df4] | 158 |
|
---|
| 159 | <!-- If stats are requested, include some definitions and intitializations -->
|
---|
[c048987] | 160 | <xsl:if test="contains($list-stat-norm,concat(' ',@id,' '))">
|
---|
| 161 | <xsl:text>INFOLOG=$(pwd)/info-${JH_PKG_DIR}
|
---|
[9e0c4b6] | 162 | TESTLOG=$(pwd)/test-${JH_PKG_DIR}
|
---|
[67c3df4] | 163 | unset MAKEFLAGS
|
---|
| 164 | #MAKEFLAGS=-j4
|
---|
| 165 | echo MAKEFLAGS: $MAKEFLAGS > $INFOLOG
|
---|
[c048987] | 166 | : > $TESTLOG
|
---|
[67c3df4] | 167 | PKG_DEST=${BUILD_DIR}/dest
|
---|
| 168 | rm -rf $PKG_DEST
|
---|
| 169 |
|
---|
| 170 | </xsl:text>
|
---|
[c048987] | 171 | </xsl:if>
|
---|
| 172 | <!-- Download code and build commands -->
|
---|
| 173 | <xsl:apply-templates select="sect2"/>
|
---|
| 174 | <!-- Clean-up -->
|
---|
| 175 | <xsl:text>cd $BUILD_DIR
|
---|
[1fa0dee] | 176 | [[ -n "$JH_KEEP_FILES" ]] || </xsl:text>
|
---|
[c048987] | 177 | <!-- In some case, some files in the build tree are owned
|
---|
| 178 | by root -->
|
---|
| 179 | <xsl:if test="$sudo='y'">
|
---|
| 180 | <xsl:text>sudo </xsl:text>
|
---|
| 181 | </xsl:if>
|
---|
| 182 | <xsl:text>rm -rf $JH_UNPACKDIR unpacked

</xsl:text>
|
---|
| 183 | </xsl:when>
|
---|
| 184 | <!-- Non-package page -->
|
---|
| 185 | <xsl:otherwise>
|
---|
| 186 | <xsl:apply-templates select=".//screen" mode="not-pack"/>
|
---|
| 187 | </xsl:otherwise>
|
---|
| 188 | </xsl:choose>
|
---|
| 189 | <xsl:text>exit</xsl:text>
|
---|
| 190 | </exsl:document>
|
---|
[e576789] | 191 | </xsl:template>
|
---|
| 192 |
|
---|
| 193 | <!--======================= Sub-sections code =======================-->
|
---|
| 194 |
|
---|
| 195 | <xsl:template match="sect2">
|
---|
| 196 | <xsl:choose>
|
---|
[c048987] | 197 |
|
---|
[e576789] | 198 | <xsl:when test="@role = 'package'">
|
---|
[39dc04a] | 199 | <xsl:text>cd $SRC_DIR
|
---|
| 200 | </xsl:text>
|
---|
[642722f] | 201 | <!-- Download information is in bridgehead tags -->
|
---|
[e576789] | 202 | <xsl:apply-templates select="bridgehead[@renderas='sect3']"/>
|
---|
| 203 | <xsl:text>
</xsl:text>
|
---|
[c048987] | 204 | </xsl:when><!-- @role="package" -->
|
---|
| 205 |
|
---|
[967b819] | 206 | <xsl:when test="@role = 'qt4-prefix' or @role = 'qt5-prefix'">
|
---|
[625cb14] | 207 | <xsl:apply-templates select=".//screen[./userinput]"/>
|
---|
[967b819] | 208 | </xsl:when>
|
---|
[c048987] | 209 |
|
---|
[e576789] | 210 | <xsl:when test="@role = 'installation'">
|
---|
| 211 | <xsl:text>
|
---|
[39dc04a] | 212 | cd $BUILD_DIR
|
---|
[07f7eff] | 213 | find . -maxdepth 1 -mindepth 1 -type d | xargs </xsl:text>
|
---|
| 214 | <xsl:if test="$sudo='y'">
|
---|
| 215 | <xsl:text>sudo </xsl:text>
|
---|
| 216 | </xsl:if>
|
---|
| 217 | <xsl:text>rm -rf
|
---|
[67c3df4] | 218 |
|
---|
| 219 | </xsl:text>
|
---|
| 220 | <!-- If stats are requested, insert the start size -->
|
---|
| 221 | <xsl:if test="contains($list-stat-norm,concat(' ',../@id,' '))">
|
---|
| 222 | <xsl:text>echo Start Size: $(sudo du -skx --exclude home /) >> $INFOLOG
|
---|
| 223 |
|
---|
| 224 | </xsl:text>
|
---|
| 225 | </xsl:if>
|
---|
| 226 |
|
---|
| 227 | <xsl:text>case $PACKAGE in
|
---|
[e6967a1] | 228 | *.tar.gz|*.tar.bz2|*.tar.xz|*.tgz|*.tar.lzma)
|
---|
[39dc04a] | 229 | tar -xvf $SRC_DIR/$PACKAGE > unpacked
|
---|
[1fa0dee] | 230 | JH_UNPACKDIR=`grep '[^./]\+' unpacked | head -n1 | sed 's@^\./@@;s@/.*@@'`
|
---|
[6eaae5e] | 231 | ;;
|
---|
| 232 | *.tar.lz)
|
---|
[39dc04a] | 233 | bsdtar -xvf $SRC_DIR/$PACKAGE 2> unpacked
|
---|
[1fa0dee] | 234 | JH_UNPACKDIR=`head -n1 unpacked | cut -d" " -f2 | sed 's@^\./@@;s@/.*@@'`
|
---|
[67992a0] | 235 | ;;
|
---|
| 236 | *.zip)
|
---|
[39dc04a] | 237 | zipinfo -1 $SRC_DIR/$PACKAGE > unpacked
|
---|
[1fa0dee] | 238 | JH_UNPACKDIR="$(sed 's@/.*@@' unpacked | uniq )"
|
---|
| 239 | if test $(wc -w <<< $JH_UNPACKDIR) -eq 1; then
|
---|
[39dc04a] | 240 | unzip $SRC_DIR/$PACKAGE
|
---|
[67992a0] | 241 | else
|
---|
[1fa0dee] | 242 | JH_UNPACKDIR=${PACKAGE%.zip}
|
---|
| 243 | unzip -d $JH_UNPACKDIR $SRC_DIR/$PACKAGE
|
---|
[67992a0] | 244 | fi
|
---|
| 245 | ;;
|
---|
| 246 | *)
|
---|
[1fa0dee] | 247 | JH_UNPACKDIR=$JH_PKG_DIR-build
|
---|
| 248 | mkdir $JH_UNPACKDIR
|
---|
| 249 | cp $SRC_DIR/$PACKAGE $JH_UNPACKDIR
|
---|
| 250 | cp $(find . -mindepth 1 -maxdepth 1 -type l) $JH_UNPACKDIR
|
---|
[67992a0] | 251 | ;;
|
---|
| 252 | esac
|
---|
[1fa0dee] | 253 | export JH_UNPACKDIR
|
---|
| 254 | cd $JH_UNPACKDIR

|
---|
[67992a0] | 255 | </xsl:text>
|
---|
[67c3df4] | 256 | <!-- If stats are requested, insert the start time -->
|
---|
| 257 | <xsl:if test="contains($list-stat-norm,concat(' ',../@id,' '))">
|
---|
| 258 | <xsl:text>echo Start Time: ${SECONDS} >> $INFOLOG
|
---|
| 259 |
|
---|
| 260 | </xsl:text>
|
---|
| 261 | </xsl:if>
|
---|
| 262 |
|
---|
[625cb14] | 263 | <xsl:apply-templates
|
---|
[c048987] | 264 | mode="installation"
|
---|
[625cb14] | 265 | select=".//screen[not(@role = 'nodump') and ./userinput] |
|
---|
[c048987] | 266 | .//para/command[contains(text(),'check') or
|
---|
| 267 | contains(text(),'test')]"/>
|
---|
[e576789] | 268 | <xsl:if test="$sudo = 'y'">
|
---|
| 269 | <xsl:text>sudo /sbin/</xsl:text>
|
---|
| 270 | </xsl:if>
|
---|
| 271 | <xsl:text>ldconfig

</xsl:text>
|
---|
[c048987] | 272 | </xsl:when><!-- @role="installation" -->
|
---|
| 273 |
|
---|
[e576789] | 274 | <xsl:when test="@role = 'configuration'">
|
---|
[625cb14] | 275 | <xsl:apply-templates mode="config"
|
---|
| 276 | select=".//screen[not(@role = 'nodump') and ./userinput]"/>
|
---|
[c048987] | 277 | </xsl:when><!-- @role="configuration" -->
|
---|
| 278 |
|
---|
[e576789] | 279 | </xsl:choose>
|
---|
| 280 | </xsl:template>
|
---|
| 281 |
|
---|
| 282 | <!--==================== Download code =======================-->
|
---|
| 283 |
|
---|
[642722f] | 284 | <!-- template for extracting the filename from an url in the form:
|
---|
| 285 | proto://internet.name/dir1/.../dirn/filename?condition.
|
---|
| 286 | Needed, because substring-after(...,'/') returns only the
|
---|
| 287 | substring after the first '/'. -->
|
---|
[e576789] | 288 | <xsl:template name="package_name">
|
---|
| 289 | <xsl:param name="url" select="foo"/>
|
---|
| 290 | <xsl:param name="sub-url" select="substring-after($url,'/')"/>
|
---|
| 291 | <xsl:choose>
|
---|
| 292 | <xsl:when test="contains($sub-url,'/')">
|
---|
| 293 | <xsl:call-template name="package_name">
|
---|
| 294 | <xsl:with-param name="url" select="$sub-url"/>
|
---|
| 295 | </xsl:call-template>
|
---|
| 296 | </xsl:when>
|
---|
| 297 | <xsl:otherwise>
|
---|
| 298 | <xsl:choose>
|
---|
| 299 | <xsl:when test="contains($sub-url,'?')">
|
---|
| 300 | <xsl:value-of select="substring-before($sub-url,'?')"/>
|
---|
| 301 | </xsl:when>
|
---|
| 302 | <xsl:otherwise>
|
---|
| 303 | <xsl:value-of select="$sub-url"/>
|
---|
| 304 | </xsl:otherwise>
|
---|
| 305 | </xsl:choose>
|
---|
| 306 | </xsl:otherwise>
|
---|
| 307 | </xsl:choose>
|
---|
| 308 | </xsl:template>
|
---|
| 309 |
|
---|
[642722f] | 310 | <!-- Generates the code to download a package, an additional package or
|
---|
| 311 | a patch. -->
|
---|
| 312 | <xsl:template name="download-file">
|
---|
| 313 | <xsl:param name="httpurl" select="''"/>
|
---|
| 314 | <xsl:param name="ftpurl" select="''"/>
|
---|
| 315 | <xsl:param name="md5" select="''"/>
|
---|
| 316 | <xsl:param name="varname" select="''"/>
|
---|
| 317 | <xsl:variable name="package">
|
---|
| 318 | <xsl:call-template name="package_name">
|
---|
| 319 | <xsl:with-param name="url">
|
---|
[e576789] | 320 | <xsl:choose>
|
---|
[642722f] | 321 | <xsl:when test="string-length($httpurl) > 10">
|
---|
| 322 | <xsl:value-of select="$httpurl"/>
|
---|
[e576789] | 323 | </xsl:when>
|
---|
| 324 | <xsl:otherwise>
|
---|
[642722f] | 325 | <xsl:value-of select="$ftpurl"/>
|
---|
[e576789] | 326 | </xsl:otherwise>
|
---|
| 327 | </xsl:choose>
|
---|
[642722f] | 328 | </xsl:with-param>
|
---|
| 329 | </xsl:call-template>
|
---|
| 330 | </xsl:variable>
|
---|
| 331 | <xsl:variable name="first_letter"
|
---|
| 332 | select="translate(substring($package,1,1),
|
---|
| 333 | 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
---|
| 334 | 'abcdefghijklmnopqrstuvwxyz')"/>
|
---|
| 335 | <xsl:text>
</xsl:text>
|
---|
| 336 | <xsl:value-of select="$varname"/>
|
---|
| 337 | <xsl:text>=</xsl:text>
|
---|
| 338 | <xsl:value-of select="$package"/>
|
---|
| 339 | <xsl:text>
if [[ ! -f $</xsl:text>
|
---|
| 340 | <xsl:value-of select="$varname"/>
|
---|
[8dc4646] | 341 | <xsl:text> ]] ; then
|
---|
[1fa0dee] | 342 | if [[ -f $JH_SRC_ARCHIVE/$</xsl:text>
|
---|
[642722f] | 343 | <xsl:value-of select="$varname"/>
|
---|
| 344 | <xsl:text> ]] ; then
</xsl:text>
|
---|
[1fa0dee] | 345 | <xsl:text> cp $JH_SRC_ARCHIVE/$</xsl:text>
|
---|
[642722f] | 346 | <xsl:value-of select="$varname"/>
|
---|
| 347 | <xsl:text> $</xsl:text>
|
---|
| 348 | <xsl:value-of select="$varname"/>
|
---|
[8dc4646] | 349 | <xsl:text>
|
---|
| 350 | else
</xsl:text>
|
---|
[342c862] | 351 | <!-- Download from upstream http -->
|
---|
[642722f] | 352 | <xsl:if test="string-length($httpurl) > 10">
|
---|
[8dc4646] | 353 | <xsl:text> wget -T 30 -t 5 </xsl:text>
|
---|
[642722f] | 354 | <xsl:value-of select="$httpurl"/>
|
---|
[342c862] | 355 | <xsl:text> ||
</xsl:text>
|
---|
[642722f] | 356 | </xsl:if>
|
---|
[342c862] | 357 | <!-- Download from upstream ftp -->
|
---|
[642722f] | 358 | <xsl:if test="string-length($ftpurl) > 10">
|
---|
[8dc4646] | 359 | <xsl:text> wget -T 30 -t 5 </xsl:text>
|
---|
[642722f] | 360 | <xsl:value-of select="$ftpurl"/>
|
---|
[342c862] | 361 | <xsl:text> ||
</xsl:text>
|
---|
[642722f] | 362 | </xsl:if>
|
---|
[342c862] | 363 | <!-- The FTP_SERVER mirror as a last resort -->
|
---|
[1fa0dee] | 364 | <xsl:text> wget -T 30 -t 5 ${JH_FTP_SERVER}svn/</xsl:text>
|
---|
[342c862] | 365 | <xsl:value-of select="$first_letter"/>
|
---|
| 366 | <xsl:text>/$</xsl:text>
|
---|
| 367 | <xsl:value-of select="$varname"/>
|
---|
[1fa0dee] | 368 | <xsl:text>
|
---|
[8dc4646] | 369 | fi
|
---|
[e576789] | 370 | fi
|
---|
| 371 | </xsl:text>
|
---|
[642722f] | 372 | <xsl:if test="string-length($md5) > 10">
|
---|
| 373 | <xsl:text>echo "</xsl:text>
|
---|
| 374 | <xsl:value-of select="$md5"/>
|
---|
| 375 | <xsl:text>  $</xsl:text>
|
---|
| 376 | <xsl:value-of select="$varname"/>
|
---|
| 377 | <xsl:text>" | md5sum -c -
|
---|
[39dc04a] | 378 | </xsl:text>
|
---|
| 379 | </xsl:if>
|
---|
| 380 | <!-- link additional packages into $BUILD_DIR, because they are supposed to
|
---|
| 381 | be there-->
|
---|
| 382 | <xsl:if test="string($varname) != 'PACKAGE'">
|
---|
[8dc4646] | 383 | <xsl:text>[[ "$SRC_DIR" != "$BUILD_DIR" ]] && ln -sf $SRC_DIR/$</xsl:text>
|
---|
[39dc04a] | 384 | <xsl:value-of select="$varname"/>
|
---|
| 385 | <xsl:text> $BUILD_DIR
|
---|
[e576789] | 386 | </xsl:text>
|
---|
[642722f] | 387 | </xsl:if>
|
---|
| 388 | </xsl:template>
|
---|
| 389 |
|
---|
| 390 | <!-- Extract the MD5 sum information -->
|
---|
| 391 | <xsl:template match="para" mode="md5">
|
---|
| 392 | <xsl:choose>
|
---|
| 393 | <xsl:when test="contains(substring-after(string(),'sum: '),'
')">
|
---|
| 394 | <xsl:value-of select="substring-before(substring-after(string(),'sum: '),'
')"/>
|
---|
[e576789] | 395 | </xsl:when>
|
---|
[642722f] | 396 | <xsl:otherwise>
|
---|
| 397 | <xsl:value-of select="substring-after(string(),'sum: ')"/>
|
---|
| 398 | </xsl:otherwise>
|
---|
[e576789] | 399 | </xsl:choose>
|
---|
| 400 | </xsl:template>
|
---|
| 401 |
|
---|
[642722f] | 402 | <!-- We have several templates itemizedlist, depending on whether we
|
---|
| 403 | expect the package information, or additional package(s) or patch(es)
|
---|
| 404 | information. Select the appropriate mode here. -->
|
---|
| 405 | <xsl:template match="bridgehead">
|
---|
[e576789] | 406 | <xsl:choose>
|
---|
[642722f] | 407 | <!-- Special case for Openjdk -->
|
---|
| 408 | <xsl:when test="contains(string(),'Source Package Information')">
|
---|
| 409 | <xsl:apply-templates
|
---|
| 410 | select="following-sibling::itemizedlist[1]//simplelist">
|
---|
| 411 | <xsl:with-param name="varname" select="'PACKAGE'"/>
|
---|
| 412 | </xsl:apply-templates>
|
---|
| 413 | <xsl:apply-templates select="following-sibling::itemizedlist
|
---|
| 414 | [preceding-sibling::bridgehead[1]=current()
|
---|
| 415 | and position() >1]//simplelist">
|
---|
| 416 | <xsl:with-param name="varname" select="'PACKAGE1'"/>
|
---|
| 417 | </xsl:apply-templates>
|
---|
[e576789] | 418 | </xsl:when>
|
---|
[642722f] | 419 | <!-- Package information -->
|
---|
| 420 | <xsl:when test="contains(string(),'Package Information')">
|
---|
| 421 | <xsl:apply-templates select="following-sibling::itemizedlist
|
---|
| 422 | [preceding-sibling::bridgehead[1]=current()]"
|
---|
| 423 | mode="package"/>
|
---|
[e576789] | 424 | </xsl:when>
|
---|
[642722f] | 425 | <!-- Additional package information -->
|
---|
[ba57e61] | 426 | <!-- special case for llvm -->
|
---|
| 427 | <xsl:when test="contains(string(),'Optional Download')">
|
---|
| 428 | <xsl:apply-templates select="following-sibling::itemizedlist"
|
---|
| 429 | mode="additional"/>
|
---|
| 430 | </xsl:when>
|
---|
| 431 | <!-- All other additional packages have "Additional" -->
|
---|
[642722f] | 432 | <xsl:when test="contains(string(),'Additional')">
|
---|
| 433 | <xsl:apply-templates select="following-sibling::itemizedlist"
|
---|
| 434 | mode="additional"/>
|
---|
[e576789] | 435 | </xsl:when>
|
---|
[642722f] | 436 | <!-- Do not do anything if the dev has created another type of
|
---|
| 437 | bridgehead. -->
|
---|
| 438 | <xsl:otherwise/>
|
---|
[e576789] | 439 | </xsl:choose>
|
---|
| 440 | </xsl:template>
|
---|
| 441 |
|
---|
[642722f] | 442 | <!-- Call the download code template with appropriate parameters -->
|
---|
| 443 | <xsl:template match="itemizedlist" mode="package">
|
---|
| 444 | <xsl:call-template name="download-file">
|
---|
| 445 | <xsl:with-param name="httpurl">
|
---|
| 446 | <xsl:value-of select="./listitem[1]/para/ulink/@url"/>
|
---|
| 447 | </xsl:with-param>
|
---|
| 448 | <xsl:with-param name="ftpurl">
|
---|
| 449 | <xsl:value-of select="./listitem/para[contains(string(),'FTP')]/ulink/@url"/>
|
---|
| 450 | </xsl:with-param>
|
---|
| 451 | <xsl:with-param name="md5">
|
---|
| 452 | <xsl:apply-templates select="./listitem/para[contains(string(),'MD5')]"
|
---|
| 453 | mode="md5"/>
|
---|
| 454 | </xsl:with-param>
|
---|
| 455 | <xsl:with-param name="varname" select="'PACKAGE'"/>
|
---|
| 456 | </xsl:call-template>
|
---|
[e576789] | 457 | </xsl:template>
|
---|
| 458 |
|
---|
[642722f] | 459 | <xsl:template match="itemizedlist" mode="additional">
|
---|
| 460 | <!-- The normal layout is "one listitem"<->"one url", but some devs
|
---|
| 461 | find amusing to have FTP and/or MD5sum listitems, or to
|
---|
| 462 | enclose the download information inside a simplelist tag... -->
|
---|
| 463 | <xsl:for-each select="listitem[.//ulink]">
|
---|
| 464 | <xsl:choose>
|
---|
| 465 | <!-- hopefully, there was a HTTP line before -->
|
---|
| 466 | <xsl:when test="contains(string(./para),'FTP')"/>
|
---|
| 467 | <xsl:when test=".//simplelist">
|
---|
| 468 | <xsl:apply-templates select=".//simplelist">
|
---|
| 469 | <xsl:with-param name="varname" select="'PACKAGE1'"/>
|
---|
| 470 | </xsl:apply-templates>
|
---|
| 471 | </xsl:when>
|
---|
| 472 | <xsl:otherwise>
|
---|
| 473 | <xsl:call-template name="download-file">
|
---|
| 474 | <xsl:with-param name="httpurl">
|
---|
| 475 | <xsl:value-of select="./para/ulink/@url"/>
|
---|
| 476 | </xsl:with-param>
|
---|
| 477 | <xsl:with-param name="ftpurl">
|
---|
| 478 | <xsl:value-of
|
---|
| 479 | select="following-sibling::listitem[1]/
|
---|
| 480 | para[contains(string(),'FTP')]/ulink/@url"/>
|
---|
| 481 | </xsl:with-param>
|
---|
| 482 | <xsl:with-param name="md5">
|
---|
| 483 | <xsl:apply-templates
|
---|
| 484 | select="following-sibling::listitem[position()<3]/
|
---|
| 485 | para[contains(string(),'MD5')]"
|
---|
| 486 | mode="md5"/>
|
---|
| 487 | </xsl:with-param>
|
---|
| 488 | <xsl:with-param name="varname">
|
---|
| 489 | <xsl:choose>
|
---|
| 490 | <xsl:when test="contains(./para/ulink/@url,'.patch')">
|
---|
| 491 | <xsl:text>PATCH</xsl:text>
|
---|
| 492 | </xsl:when>
|
---|
| 493 | <xsl:otherwise>
|
---|
| 494 | <xsl:text>PACKAGE1</xsl:text>
|
---|
| 495 | </xsl:otherwise>
|
---|
| 496 | </xsl:choose>
|
---|
| 497 | </xsl:with-param>
|
---|
| 498 | </xsl:call-template>
|
---|
| 499 | </xsl:otherwise>
|
---|
| 500 | </xsl:choose>
|
---|
| 501 | </xsl:for-each>
|
---|
[e576789] | 502 | </xsl:template>
|
---|
| 503 |
|
---|
[642722f] | 504 | <!-- the simplelist case. Hopefully, the layout is one member for
|
---|
| 505 | url, one for md5 and others for various information, that we do not
|
---|
| 506 | use -->
|
---|
| 507 | <xsl:template match="simplelist">
|
---|
| 508 | <xsl:param name="varname" select="'PACKAGE1'"/>
|
---|
| 509 | <xsl:call-template name="download-file">
|
---|
| 510 | <xsl:with-param name="httpurl" select=".//ulink/@url"/>
|
---|
| 511 | <xsl:with-param name="md5">
|
---|
| 512 | <xsl:value-of select="substring-after(member[contains(string(),'MD5')],'sum: ')"/>
|
---|
| 513 | </xsl:with-param>
|
---|
| 514 | <xsl:with-param name="varname" select="$varname"/>
|
---|
| 515 | </xsl:call-template>
|
---|
| 516 | </xsl:template>
|
---|
[625cb14] | 517 |
|
---|
| 518 | <!--====================== Non package code =========================-->
|
---|
| 519 |
|
---|
| 520 | <xsl:template match="screen" mode="not-pack">
|
---|
| 521 | <xsl:choose>
|
---|
| 522 | <xsl:when test="ancestor::sect1[@id='postlfs-config-vimrc']">
|
---|
| 523 | <xsl:text>
|
---|
| 524 | cat > ~/.vimrc <<EOF
|
---|
| 525 | </xsl:text>
|
---|
| 526 | <xsl:apply-templates/>
|
---|
| 527 | <xsl:text>
|
---|
| 528 | EOF
|
---|
| 529 | </xsl:text>
|
---|
| 530 | </xsl:when>
|
---|
| 531 | <xsl:otherwise>
|
---|
| 532 | <xsl:apply-templates select="." mode="config"/>
|
---|
| 533 | </xsl:otherwise>
|
---|
| 534 | </xsl:choose>
|
---|
| 535 | </xsl:template>
|
---|
[e576789] | 536 | <!--======================== Commands code ==========================-->
|
---|
[c048987] | 537 | <!-- Code for installation instructions is in gen-install.xsl -->
|
---|
[e576789] | 538 |
|
---|
| 539 | <xsl:template match="screen">
|
---|
[c048987] | 540 | <xsl:choose>
|
---|
| 541 | <!-- instructions run as root (configuration mainly) -->
|
---|
| 542 | <xsl:when test="@role = 'root'">
|
---|
| 543 | <xsl:if test="not(preceding-sibling::screen[1][@role='root'])">
|
---|
| 544 | <xsl:if test="$sudo = 'y'">
|
---|
| 545 | <xsl:text>sudo -E sh << ROOT_EOF
</xsl:text>
|
---|
[67c3df4] | 546 | </xsl:if>
|
---|
[c048987] | 547 | </xsl:if>
|
---|
| 548 | <xsl:apply-templates mode="root"/>
|
---|
| 549 | <xsl:if test="not(following-sibling::screen[1][@role='root'])">
|
---|
| 550 | <xsl:if test="$sudo = 'y'">
|
---|
| 551 | <xsl:text>
ROOT_EOF</xsl:text>
|
---|
[67c3df4] | 552 | </xsl:if>
|
---|
[c048987] | 553 | </xsl:if>
|
---|
| 554 | </xsl:when>
|
---|
[67c3df4] | 555 | <!-- then all the instructions run as user -->
|
---|
[c048987] | 556 | <xsl:otherwise>
|
---|
| 557 | <xsl:apply-templates select="userinput"/>
|
---|
| 558 | </xsl:otherwise>
|
---|
| 559 | </xsl:choose>
|
---|
| 560 | <xsl:text>
</xsl:text>
|
---|
[e576789] | 561 | </xsl:template>
|
---|
| 562 |
|
---|
[70d73d1] | 563 | <xsl:template name="set-bootpkg-dir">
|
---|
| 564 | <xsl:param name="bootpkg" select="'bootscripts'"/>
|
---|
| 565 | <xsl:param name="url" select="''"/>
|
---|
[973c767] | 566 | <xsl:text>BOOTPKG_DIR=blfs-</xsl:text>
|
---|
[70d73d1] | 567 | <xsl:copy-of select="$bootpkg"/>
|
---|
| 568 | <xsl:text>
|
---|
[1fa0dee] | 569 | BOOTSRC_DIR=${JH_SRC_ARCHIVE}${JH_SRC_SUBDIRS:+/${BOOTPKG_DIR}}
|
---|
| 570 | BOOTBUILD_DIR=${JH_BUILD_ROOT}${JH_BUILD_SUBDIRS:+/${BOOTPKG_DIR}}
|
---|
[973c767] | 571 | mkdir -p $BOOTSRC_DIR
|
---|
| 572 | mkdir -p $BOOTBUILD_DIR
|
---|
| 573 |
|
---|
| 574 | pushd $BOOTSRC_DIR
|
---|
[e576789] | 575 | URL=</xsl:text>
|
---|
[70d73d1] | 576 | <xsl:value-of select="$url"/>
|
---|
| 577 | <xsl:text>
|
---|
[e576789] | 578 | BOOTPACKG=$(basename $URL)
|
---|
[bbcdeab] | 579 | if [[ ! -f $BOOTPACKG ]] ; then
|
---|
[1fa0dee] | 580 | if [[ -f $JH_SRC_ARCHIVE/$BOOTPACKG ]] ; then
|
---|
| 581 | cp $JH_SRC_ARCHIVE/$BOOTPACKG $BOOTPACKG
|
---|
[bbcdeab] | 582 | else
|
---|
| 583 | wget -T 30 -t 5 $URL
|
---|
| 584 | fi
|
---|
[973c767] | 585 | rm -f $BOOTBUILD_DIR/unpacked
|
---|
[bbcdeab] | 586 | fi
|
---|
| 587 |
|
---|
[973c767] | 588 | cd $BOOTBUILD_DIR
|
---|
[e576789] | 589 | if [[ -e unpacked ]] ; then
|
---|
[f079f8f] | 590 | BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
|
---|
| 591 | if ! [[ -d $BOOTUNPACKDIR ]]; then
|
---|
[973c767] | 592 | tar -xvf $BOOTSRC_DIR/$BOOTPACKG > unpacked
|
---|
[f079f8f] | 593 | BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
|
---|
[e576789] | 594 | fi
|
---|
| 595 | else
|
---|
[973c767] | 596 | tar -xvf $BOOTSRC_DIR/$BOOTPACKG > unpacked
|
---|
[f079f8f] | 597 | BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
|
---|
[e576789] | 598 | fi
|
---|
[f079f8f] | 599 | cd $BOOTUNPACKDIR
|
---|
[e576789] | 600 | </xsl:text>
|
---|
[70d73d1] | 601 | </xsl:template>
|
---|
| 602 |
|
---|
| 603 | <xsl:template match="screen" mode="config">
|
---|
| 604 | <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts']">
|
---|
| 605 | <xsl:call-template name="set-bootpkg-dir">
|
---|
| 606 | <xsl:with-param name="bootpkg" select="'bootscripts'"/>
|
---|
| 607 | <xsl:with-param name="url"
|
---|
| 608 | select="id('bootscripts')//itemizedlist//ulink/@url"/>
|
---|
| 609 | </xsl:call-template>
|
---|
| 610 | </xsl:if>
|
---|
| 611 | <xsl:if test="preceding-sibling::para[1]/xref[@linkend='systemd-units']">
|
---|
| 612 | <xsl:call-template name="set-bootpkg-dir">
|
---|
| 613 | <xsl:with-param name="bootpkg" select="'systemd-units'"/>
|
---|
| 614 | <xsl:with-param name="url"
|
---|
| 615 | select="id('systemd-units')//itemizedlist//ulink/@url"/>
|
---|
| 616 | </xsl:call-template>
|
---|
[e576789] | 617 | </xsl:if>
|
---|
| 618 | <xsl:apply-templates select='.'/>
|
---|
[70d73d1] | 619 | <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts' or
|
---|
| 620 | @linkend='systemd-units']">
|
---|
[e576789] | 621 | <xsl:text>
|
---|
| 622 | popd</xsl:text>
|
---|
| 623 | </xsl:if>
|
---|
| 624 | <xsl:text>
</xsl:text>
|
---|
| 625 | </xsl:template>
|
---|
| 626 |
|
---|
[c048987] | 627 | <xsl:template match="command" mode="installation">
|
---|
[a743e57] | 628 | <xsl:variable name="ns" select="normalize-space(string())"/>
|
---|
[c048987] | 629 | <xsl:variable name="first"
|
---|
| 630 | select="not(
|
---|
| 631 | boolean(
|
---|
| 632 | preceding-sibling::command[contains(text(),'check') or
|
---|
| 633 | contains(text(),'test')]))"/>
|
---|
| 634 | <xsl:variable name="last"
|
---|
| 635 | select="not(
|
---|
| 636 | boolean(
|
---|
| 637 | following-sibling::command[contains(text(),'check') or
|
---|
| 638 | contains(text(),'test')]))"/>
|
---|
| 639 | <xsl:choose>
|
---|
| 640 | <xsl:when test="contains($list-stat-norm,
|
---|
| 641 | concat(' ',ancestor::sect1/@id,' '))">
|
---|
| 642 | <xsl:if test="$first">
|
---|
[67c3df4] | 643 | <xsl:text>
|
---|
| 644 | echo Time after make: ${SECONDS} >> $INFOLOG
|
---|
| 645 | echo Size after make: $(sudo du -skx --exclude home /) >> $INFOLOG
|
---|
| 646 | echo Time before test: ${SECONDS} >> $INFOLOG
|
---|
[c048987] | 647 |
|
---|
[67c3df4] | 648 | </xsl:text>
|
---|
[c048987] | 649 | </xsl:if>
|
---|
| 650 | </xsl:when>
|
---|
| 651 | <xsl:otherwise>
|
---|
| 652 | <xsl:text>#</xsl:text>
|
---|
| 653 | </xsl:otherwise>
|
---|
| 654 | </xsl:choose>
|
---|
| 655 | <xsl:choose>
|
---|
| 656 | <xsl:when test="contains($ns,'make')">
|
---|
| 657 | <xsl:value-of select="substring-before($ns,'make ')"/>
|
---|
| 658 | <xsl:text>make </xsl:text>
|
---|
| 659 | <xsl:if test="not(contains($ns,'-k'))">
|
---|
| 660 | <xsl:text>-k </xsl:text>
|
---|
| 661 | </xsl:if>
|
---|
| 662 | <xsl:value-of select="substring-after($ns,'make ')"/>
|
---|
| 663 | </xsl:when>
|
---|
| 664 | <xsl:otherwise>
|
---|
| 665 | <xsl:copy-of select="$ns"/>
|
---|
| 666 | </xsl:otherwise>
|
---|
| 667 | </xsl:choose>
|
---|
| 668 | <xsl:if test="contains($list-stat-norm,
|
---|
| 669 | concat(' ',ancestor::sect1/@id,' '))">
|
---|
| 670 | <xsl:text> >> $TESTLOG 2>&1</xsl:text>
|
---|
[e576789] | 671 | </xsl:if>
|
---|
[c048987] | 672 | <xsl:text> || true
</xsl:text>
|
---|
| 673 | <xsl:if test="contains($list-stat-norm,
|
---|
| 674 | concat(' ',ancestor::sect1/@id,' ')) and $last">
|
---|
| 675 | <xsl:text>
|
---|
| 676 | echo Time after test: ${SECONDS} >> $INFOLOG
|
---|
| 677 | echo Size after test: $(sudo du -skx --exclude home /) >> $INFOLOG
|
---|
| 678 | echo Time before install: ${SECONDS} >> $INFOLOG
|
---|
| 679 |
|
---|
| 680 | </xsl:text>
|
---|
| 681 | </xsl:if>
|
---|
[e576789] | 682 | </xsl:template>
|
---|
| 683 |
|
---|
| 684 | <xsl:template match="userinput">
|
---|
| 685 | <xsl:apply-templates/>
|
---|
| 686 | </xsl:template>
|
---|
| 687 |
|
---|
| 688 | <xsl:template match="text()" mode="root">
|
---|
| 689 | <xsl:call-template name="output-root">
|
---|
| 690 | <xsl:with-param name="out-string" select="string()"/>
|
---|
| 691 | </xsl:call-template>
|
---|
| 692 | </xsl:template>
|
---|
| 693 |
|
---|
| 694 | <xsl:template name="output-root">
|
---|
| 695 | <xsl:param name="out-string" select="''"/>
|
---|
| 696 | <xsl:choose>
|
---|
[9c5ea2f] | 697 | <xsl:when test="contains($out-string,'make ')">
|
---|
[e576789] | 698 | <xsl:call-template name="output-root">
|
---|
| 699 | <xsl:with-param name="out-string"
|
---|
[9c5ea2f] | 700 | select="substring-before($out-string,'make ')"/>
|
---|
[e576789] | 701 | </xsl:call-template>
|
---|
[9c5ea2f] | 702 | <xsl:text>make -j1 </xsl:text>
|
---|
[e576789] | 703 | <xsl:call-template name="output-root">
|
---|
| 704 | <xsl:with-param name="out-string"
|
---|
[9c5ea2f] | 705 | select="substring-after($out-string,'make ')"/>
|
---|
[e576789] | 706 | </xsl:call-template>
|
---|
| 707 | </xsl:when>
|
---|
| 708 | <xsl:when test="contains($out-string,'$') and $sudo = 'y'">
|
---|
| 709 | <xsl:call-template name="output-root">
|
---|
| 710 | <xsl:with-param name="out-string"
|
---|
| 711 | select="substring-before($out-string,'$')"/>
|
---|
| 712 | </xsl:call-template>
|
---|
| 713 | <xsl:text>\$</xsl:text>
|
---|
| 714 | <xsl:call-template name="output-root">
|
---|
| 715 | <xsl:with-param name="out-string"
|
---|
| 716 | select="substring-after($out-string,'$')"/>
|
---|
| 717 | </xsl:call-template>
|
---|
| 718 | </xsl:when>
|
---|
| 719 | <xsl:when test="contains($out-string,'`') and $sudo = 'y'">
|
---|
| 720 | <xsl:call-template name="output-root">
|
---|
| 721 | <xsl:with-param name="out-string"
|
---|
| 722 | select="substring-before($out-string,'`')"/>
|
---|
| 723 | </xsl:call-template>
|
---|
| 724 | <xsl:text>\`</xsl:text>
|
---|
| 725 | <xsl:call-template name="output-root">
|
---|
| 726 | <xsl:with-param name="out-string"
|
---|
| 727 | select="substring-after($out-string,'`')"/>
|
---|
| 728 | </xsl:call-template>
|
---|
| 729 | </xsl:when>
|
---|
| 730 | <xsl:when test="contains($out-string,'\') and $sudo = 'y'">
|
---|
| 731 | <xsl:call-template name="output-root">
|
---|
| 732 | <xsl:with-param name="out-string"
|
---|
| 733 | select="substring-before($out-string,'\')"/>
|
---|
| 734 | </xsl:call-template>
|
---|
| 735 | <xsl:text>\\</xsl:text>
|
---|
| 736 | <xsl:call-template name="output-root">
|
---|
| 737 | <xsl:with-param name="out-string"
|
---|
| 738 | select="substring-after($out-string,'\')"/>
|
---|
| 739 | </xsl:call-template>
|
---|
| 740 | </xsl:when>
|
---|
| 741 | <xsl:otherwise>
|
---|
| 742 | <xsl:value-of select="$out-string"/>
|
---|
| 743 | </xsl:otherwise>
|
---|
| 744 | </xsl:choose>
|
---|
| 745 | </xsl:template>
|
---|
| 746 |
|
---|
| 747 | <xsl:template match="replaceable">
|
---|
[625cb14] | 748 | <xsl:choose>
|
---|
| 749 | <!-- When adding a user to a group, the book uses "username" in a replaceable
|
---|
| 750 | tag. Replace by the user name only if not running as root -->
|
---|
| 751 | <xsl:when test="contains(string(),'username') and $sudo='y'">
|
---|
| 752 | <xsl:text>$USER</xsl:text>
|
---|
| 753 | </xsl:when>
|
---|
| 754 | <!-- The next three entries are for gpm. I guess those settings are OK
|
---|
| 755 | for a laptop or desktop. -->
|
---|
| 756 | <xsl:when test="contains(string(),'yourprotocol')">
|
---|
| 757 | <xsl:text>imps2</xsl:text>
|
---|
| 758 | </xsl:when>
|
---|
| 759 | <xsl:when test="contains(string(),'yourdevice')">
|
---|
| 760 | <xsl:text>/dev/input/mice</xsl:text>
|
---|
| 761 | </xsl:when>
|
---|
| 762 | <xsl:when test="contains(string(),'additional options')"/>
|
---|
| 763 | <!-- the book has four fields for language. The language param is
|
---|
| 764 | broken into four pieces above. We use the results here. -->
|
---|
| 765 | <xsl:when test="contains(string(),'<ll>')">
|
---|
| 766 | <xsl:copy-of select="$lang-ll"/>
|
---|
| 767 | </xsl:when>
|
---|
| 768 | <xsl:when test="contains(string(),'<CC>')">
|
---|
| 769 | <xsl:copy-of select="$lang-CC"/>
|
---|
| 770 | </xsl:when>
|
---|
| 771 | <xsl:when test="contains(string(),'<charmap>')">
|
---|
| 772 | <xsl:copy-of select="$lang-charmap"/>
|
---|
| 773 | </xsl:when>
|
---|
| 774 | <xsl:when test="contains(string(),'@modifier')">
|
---|
| 775 | <xsl:copy-of select="$lang-modifier"/>
|
---|
| 776 | </xsl:when>
|
---|
| 777 | <!-- At several places, the number of jobs is given as "N" in a replaceable
|
---|
| 778 | tag. We either detect "N" alone or <N> Replace N with 4. -->
|
---|
| 779 | <xsl:when test="contains(string(),'<N>') or string()='N'">
|
---|
| 780 | <xsl:text>4</xsl:text>
|
---|
| 781 | </xsl:when>
|
---|
| 782 | <!-- Mercurial config file uses user_name. Replace only if non root.
|
---|
| 783 | Add a bogus mail field. That works for the proposed tests anyway. -->
|
---|
| 784 | <xsl:when test="contains(string(),'user_name') and $sudo='y'">
|
---|
| 785 | <xsl:text>$USER ${USER}@mail.bogus</xsl:text>
|
---|
| 786 | </xsl:when>
|
---|
| 787 | <!-- Use the config for Gtk+3 as is -->
|
---|
| 788 | <xsl:when test="ancestor::sect1[@id='gtk3']">
|
---|
| 789 | <xsl:copy-of select="string()"/>
|
---|
| 790 | </xsl:when>
|
---|
| 791 | <!-- Give 1Gb to fop. Hopefully, nobody has less RAM nowadays. -->
|
---|
| 792 | <xsl:when test="contains(string(),'RAM_Installed')">
|
---|
| 793 | <xsl:text>1024</xsl:text>
|
---|
| 794 | </xsl:when>
|
---|
| 795 | <xsl:otherwise>
|
---|
[e576789] | 796 | <xsl:text>**EDITME</xsl:text>
|
---|
| 797 | <xsl:apply-templates/>
|
---|
| 798 | <xsl:text>EDITME**</xsl:text>
|
---|
[625cb14] | 799 | </xsl:otherwise>
|
---|
| 800 | </xsl:choose>
|
---|
[e576789] | 801 | </xsl:template>
|
---|
| 802 |
|
---|
| 803 | <xsl:template match="replaceable" mode="root">
|
---|
[625cb14] | 804 | <xsl:apply-templates select="."/>
|
---|
[e576789] | 805 | </xsl:template>
|
---|
| 806 |
|
---|
[67c3df4] | 807 | <xsl:template name="output-destdir">
|
---|
| 808 | <xsl:apply-templates
|
---|
| 809 | select="userinput|following-sibling::screen[@role='root']/userinput"
|
---|
| 810 | mode="destdir"/>
|
---|
| 811 | <xsl:text>
|
---|
| 812 | echo Time after install: ${SECONDS} >> $INFOLOG
|
---|
| 813 | echo Size after install: $(sudo du -skx --exclude home /) >> $INFOLOG
|
---|
| 814 | </xsl:text>
|
---|
| 815 | </xsl:template>
|
---|
| 816 |
|
---|
| 817 | <xsl:template match="userinput" mode="destdir">
|
---|
| 818 | <xsl:choose>
|
---|
| 819 | <xsl:when test="./literal">
|
---|
| 820 | <xsl:call-template name="outputpkgdest">
|
---|
| 821 | <xsl:with-param name="outputstring" select="text()[1]"/>
|
---|
| 822 | </xsl:call-template>
|
---|
| 823 | <xsl:apply-templates select="literal"/>
|
---|
| 824 | <xsl:call-template name="outputpkgdest">
|
---|
| 825 | <xsl:with-param name="outputstring" select="text()[2]"/>
|
---|
| 826 | </xsl:call-template>
|
---|
| 827 | </xsl:when>
|
---|
| 828 | <xsl:otherwise>
|
---|
| 829 | <xsl:call-template name="outputpkgdest">
|
---|
| 830 | <xsl:with-param name="outputstring" select="string()"/>
|
---|
| 831 | </xsl:call-template>
|
---|
| 832 | </xsl:otherwise>
|
---|
| 833 | </xsl:choose>
|
---|
| 834 | <xsl:text>
</xsl:text>
|
---|
| 835 | </xsl:template>
|
---|
| 836 |
|
---|
| 837 | <xsl:template name="outputpkgdest">
|
---|
| 838 | <xsl:param name="outputstring" select="'foo'"/>
|
---|
| 839 | <xsl:choose>
|
---|
| 840 | <xsl:when test="contains($outputstring,'make ')">
|
---|
| 841 | <xsl:choose>
|
---|
| 842 | <xsl:when test="not(starts-with($outputstring,'make'))">
|
---|
| 843 | <xsl:call-template name="outputpkgdest">
|
---|
| 844 | <xsl:with-param name="outputstring"
|
---|
| 845 | select="substring-before($outputstring,'make')"/>
|
---|
| 846 | </xsl:call-template>
|
---|
| 847 | <xsl:call-template name="outputpkgdest">
|
---|
| 848 | <xsl:with-param
|
---|
| 849 | name="outputstring"
|
---|
| 850 | select="substring-after($outputstring,
|
---|
| 851 | substring-before($outputstring,'make'))"/>
|
---|
| 852 | </xsl:call-template>
|
---|
| 853 | </xsl:when>
|
---|
| 854 | <xsl:otherwise>
|
---|
| 855 | <xsl:text>make DESTDIR=$PKG_DEST</xsl:text>
|
---|
| 856 | <xsl:call-template name="outputpkgdest">
|
---|
| 857 | <xsl:with-param
|
---|
| 858 | name="outputstring"
|
---|
| 859 | select="substring-after($outputstring,'make')"/>
|
---|
| 860 | </xsl:call-template>
|
---|
| 861 | </xsl:otherwise>
|
---|
| 862 | </xsl:choose>
|
---|
| 863 | </xsl:when>
|
---|
| 864 | <xsl:when test="contains($outputstring,'ninja install')">
|
---|
| 865 | <xsl:choose>
|
---|
| 866 | <xsl:when test="not(starts-with($outputstring,'ninja install'))">
|
---|
| 867 | <xsl:call-template name="outputpkgdest">
|
---|
| 868 | <xsl:with-param name="outputstring"
|
---|
| 869 | select="substring-before($outputstring,'ninja install')"/>
|
---|
| 870 | </xsl:call-template>
|
---|
| 871 | <xsl:call-template name="outputpkgdest">
|
---|
| 872 | <xsl:with-param
|
---|
| 873 | name="outputstring"
|
---|
| 874 | select="substring-after($outputstring,
|
---|
| 875 | substring-before($outputstring,'ninja install'))"/>
|
---|
| 876 | </xsl:call-template>
|
---|
| 877 | </xsl:when>
|
---|
| 878 | <xsl:otherwise>
|
---|
| 879 | <xsl:text>DESTDIR=$PKG_DEST ninja</xsl:text>
|
---|
| 880 | <xsl:call-template name="outputpkgdest">
|
---|
| 881 | <xsl:with-param
|
---|
| 882 | name="outputstring"
|
---|
| 883 | select="substring-after($outputstring,'ninja')"/>
|
---|
| 884 | </xsl:call-template>
|
---|
| 885 | </xsl:otherwise>
|
---|
| 886 | </xsl:choose>
|
---|
| 887 | </xsl:when>
|
---|
| 888 | <xsl:otherwise> <!-- no make nor ninja in this string -->
|
---|
| 889 | <xsl:choose>
|
---|
| 890 | <xsl:when test="contains($outputstring,'>/') and
|
---|
| 891 | not(contains(substring-before($outputstring,'>/'),' /'))">
|
---|
| 892 | <xsl:value-of select="substring-before($outputstring,'>/')"/>
|
---|
| 893 | <xsl:text>>$PKG_DEST/</xsl:text>
|
---|
| 894 | <xsl:call-template name="outputpkgdest">
|
---|
| 895 | <xsl:with-param name="outputstring" select="substring-after($outputstring,'>/')"/>
|
---|
| 896 | </xsl:call-template>
|
---|
| 897 | </xsl:when>
|
---|
| 898 | <xsl:when test="contains($outputstring,' /')">
|
---|
| 899 | <xsl:value-of select="substring-before($outputstring,' /')"/>
|
---|
| 900 | <xsl:text> $PKG_DEST/</xsl:text>
|
---|
| 901 | <xsl:call-template name="outputpkgdest">
|
---|
| 902 | <xsl:with-param name="outputstring" select="substring-after($outputstring,' /')"/>
|
---|
| 903 | </xsl:call-template>
|
---|
| 904 | </xsl:when>
|
---|
| 905 | <xsl:otherwise>
|
---|
| 906 | <xsl:value-of select="$outputstring"/>
|
---|
| 907 | </xsl:otherwise>
|
---|
| 908 | </xsl:choose>
|
---|
| 909 | </xsl:otherwise>
|
---|
| 910 | </xsl:choose>
|
---|
| 911 | </xsl:template>
|
---|
| 912 |
|
---|
[e576789] | 913 | </xsl:stylesheet>
|
---|