[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 |
|
---|
[70d73d1] | 12 | <!-- Check whether the book is sysv or systemd -->
|
---|
| 13 | <xsl:variable name="rev">
|
---|
| 14 | <xsl:choose>
|
---|
| 15 | <xsl:when test="//bookinfo/title/phrase[@revision='systemd']">
|
---|
| 16 | systemd
|
---|
| 17 | </xsl:when>
|
---|
| 18 | <xsl:otherwise>
|
---|
| 19 | sysv
|
---|
| 20 | </xsl:otherwise>
|
---|
| 21 | </xsl:choose>
|
---|
| 22 | </xsl:variable>
|
---|
| 23 |
|
---|
[945ccaa] | 24 | <!-- Wrap "root" commands inside a wrapper function, allowing
|
---|
| 25 | "porg style" package management -->
|
---|
| 26 | <xsl:param name="wrap-install" select="'n'"/>
|
---|
| 27 |
|
---|
[67c3df4] | 28 | <!-- list of packages needing stats -->
|
---|
| 29 | <xsl:param name="list-stat" select="''"/>
|
---|
| 30 |
|
---|
[dc7fd7b] | 31 | <!-- Remove libtool .la files -->
|
---|
| 32 | <xsl:param name="del-la-files" select="'y'"/>
|
---|
| 33 |
|
---|
[e576789] | 34 | <!-- Build as user (y) or as root (n)? -->
|
---|
| 35 | <xsl:param name="sudo" select="'y'"/>
|
---|
| 36 |
|
---|
[dc7fd7b] | 37 | <!-- simple instructions for removing .la files. -->
|
---|
| 38 | <xsl:variable name="la-files-instr">
|
---|
| 39 |
|
---|
| 40 | for libdir in /lib /usr/lib $(find /opt -name lib); do
|
---|
[2969cdf] | 41 | find $libdir -name \*.la \
|
---|
| 42 | ! -path \*ImageMagick\* \
|
---|
| 43 | -delete
|
---|
[dc7fd7b] | 44 | done
|
---|
| 45 |
|
---|
| 46 | </xsl:variable>
|
---|
[67c3df4] | 47 |
|
---|
| 48 | <xsl:variable name="list-stat-norm"
|
---|
| 49 | select="concat(' ', normalize-space($list-stat),' ')"/>
|
---|
| 50 |
|
---|
[e576789] | 51 | <xsl:template match="/">
|
---|
| 52 | <xsl:apply-templates select="//sect1"/>
|
---|
| 53 | </xsl:template>
|
---|
| 54 |
|
---|
| 55 | <!--=================== Master chunks code ======================-->
|
---|
| 56 |
|
---|
| 57 | <xsl:template match="sect1">
|
---|
| 58 |
|
---|
[70d73d1] | 59 | <xsl:if test="@id != 'bootscripts' and @id != 'systemd-units'">
|
---|
[e576789] | 60 | <!-- The file names -->
|
---|
| 61 | <xsl:variable name="filename" select="@id"/>
|
---|
| 62 |
|
---|
| 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 |
|
---|
| 81 | <!-- Depuration code -->
|
---|
| 82 | <xsl:message>
|
---|
| 83 | <xsl:text>SCRIPT is </xsl:text>
|
---|
| 84 | <xsl:value-of select="concat($order,'-z-',$filename)"/>
|
---|
| 85 | <xsl:text>
 FTPDIR is </xsl:text>
|
---|
| 86 | <xsl:value-of select="$filename"/>
|
---|
| 87 | <xsl:text>

</xsl:text>
|
---|
| 88 | </xsl:message>
|
---|
| 89 |
|
---|
| 90 | <!-- Creating the scripts -->
|
---|
| 91 | <exsl:document href="{$order}-z-{$filename}" method="text">
|
---|
| 92 | <xsl:text>#!/bin/bash
set -e

</xsl:text>
|
---|
| 93 | <xsl:choose>
|
---|
| 94 | <!-- Package page -->
|
---|
[642722f] | 95 | <xsl:when test="sect2[@role='package']">
|
---|
[945ccaa] | 96 | <!-- We build in a subdirectory, whose name may be needed
|
---|
| 97 | if using package management (see envars.conf), so
|
---|
| 98 | "export" it -->
|
---|
[1fa0dee] | 99 | <xsl:text>export JH_PKG_DIR=</xsl:text>
|
---|
[e576789] | 100 | <xsl:value-of select="$filename"/>
|
---|
[39dc04a] | 101 | <xsl:text>
|
---|
[1fa0dee] | 102 | SRC_DIR=${JH_SRC_ARCHIVE}${JH_SRC_SUBDIRS:+/${JH_PKG_DIR}}
|
---|
| 103 | BUILD_DIR=${JH_BUILD_ROOT}${JH_BUILD_SUBDIRS:+/${JH_PKG_DIR}}
|
---|
[39dc04a] | 104 | mkdir -p $SRC_DIR
|
---|
| 105 | mkdir -p $BUILD_DIR
|
---|
| 106 |
|
---|
| 107 | </xsl:text>
|
---|
[67c3df4] | 108 |
|
---|
| 109 | <!-- If stats are requested, include some definitions and intitializations -->
|
---|
| 110 | <xsl:if test="contains($list-stat-norm,concat(' ',@id,' '))">
|
---|
[9e0c4b6] | 111 | <xsl:text>INFOLOG=$(pwd)/info-${JH_PKG_DIR}
|
---|
| 112 | TESTLOG=$(pwd)/test-${JH_PKG_DIR}
|
---|
[67c3df4] | 113 | unset MAKEFLAGS
|
---|
| 114 | #MAKEFLAGS=-j4
|
---|
| 115 | echo MAKEFLAGS: $MAKEFLAGS > $INFOLOG
|
---|
| 116 | > $TESTLOG
|
---|
| 117 | PKG_DEST=${BUILD_DIR}/dest
|
---|
| 118 | rm -rf $PKG_DEST
|
---|
| 119 |
|
---|
| 120 | </xsl:text>
|
---|
| 121 | </xsl:if>
|
---|
[e576789] | 122 | <!-- Download code and build commands -->
|
---|
| 123 | <xsl:apply-templates select="sect2"/>
|
---|
| 124 | <!-- Clean-up -->
|
---|
[39dc04a] | 125 | <xsl:text>cd $BUILD_DIR
|
---|
[1fa0dee] | 126 | [[ -n "$JH_KEEP_FILES" ]] || </xsl:text>
|
---|
[e576789] | 127 | <!-- In some case, some files in the build tree are owned
|
---|
| 128 | by root -->
|
---|
[642722f] | 129 | <xsl:if test="$sudo='y'">
|
---|
| 130 | <xsl:text>sudo </xsl:text>
|
---|
[e576789] | 131 | </xsl:if>
|
---|
[1fa0dee] | 132 | <xsl:text>rm -rf $JH_UNPACKDIR unpacked

</xsl:text>
|
---|
[e576789] | 133 | </xsl:when>
|
---|
| 134 | <!-- Non-package page -->
|
---|
| 135 | <xsl:otherwise>
|
---|
| 136 | <xsl:apply-templates select=".//screen"/>
|
---|
| 137 | </xsl:otherwise>
|
---|
| 138 | </xsl:choose>
|
---|
| 139 | <xsl:text>exit</xsl:text>
|
---|
| 140 | </exsl:document>
|
---|
| 141 | </xsl:if>
|
---|
| 142 | </xsl:template>
|
---|
| 143 |
|
---|
| 144 | <!--======================= Sub-sections code =======================-->
|
---|
| 145 |
|
---|
| 146 | <xsl:template match="sect2">
|
---|
| 147 | <xsl:choose>
|
---|
| 148 | <xsl:when test="@role = 'package'">
|
---|
[39dc04a] | 149 | <xsl:text>cd $SRC_DIR
|
---|
| 150 | </xsl:text>
|
---|
[642722f] | 151 | <!-- Download information is in bridgehead tags -->
|
---|
[e576789] | 152 | <xsl:apply-templates select="bridgehead[@renderas='sect3']"/>
|
---|
| 153 | <xsl:text>
</xsl:text>
|
---|
| 154 | </xsl:when>
|
---|
[967b819] | 155 | <xsl:when test="@role = 'qt4-prefix' or @role = 'qt5-prefix'">
|
---|
| 156 | <xsl:apply-templates select=".//screen"/>
|
---|
| 157 | </xsl:when>
|
---|
[e576789] | 158 | <xsl:when test="@role = 'installation'">
|
---|
| 159 | <xsl:text>
|
---|
[39dc04a] | 160 | cd $BUILD_DIR
|
---|
[07f7eff] | 161 | find . -maxdepth 1 -mindepth 1 -type d | xargs </xsl:text>
|
---|
| 162 | <xsl:if test="$sudo='y'">
|
---|
| 163 | <xsl:text>sudo </xsl:text>
|
---|
| 164 | </xsl:if>
|
---|
| 165 | <xsl:text>rm -rf
|
---|
[67c3df4] | 166 |
|
---|
| 167 | </xsl:text>
|
---|
| 168 | <!-- If stats are requested, insert the start size -->
|
---|
| 169 | <xsl:if test="contains($list-stat-norm,concat(' ',../@id,' '))">
|
---|
| 170 | <xsl:text>echo Start Size: $(sudo du -skx --exclude home /) >> $INFOLOG
|
---|
| 171 |
|
---|
| 172 | </xsl:text>
|
---|
| 173 | </xsl:if>
|
---|
| 174 |
|
---|
| 175 | <xsl:text>case $PACKAGE in
|
---|
[e6967a1] | 176 | *.tar.gz|*.tar.bz2|*.tar.xz|*.tgz|*.tar.lzma)
|
---|
[39dc04a] | 177 | tar -xvf $SRC_DIR/$PACKAGE > unpacked
|
---|
[1fa0dee] | 178 | JH_UNPACKDIR=`grep '[^./]\+' unpacked | head -n1 | sed 's@^\./@@;s@/.*@@'`
|
---|
[6eaae5e] | 179 | ;;
|
---|
| 180 | *.tar.lz)
|
---|
[39dc04a] | 181 | bsdtar -xvf $SRC_DIR/$PACKAGE 2> unpacked
|
---|
[1fa0dee] | 182 | JH_UNPACKDIR=`head -n1 unpacked | cut -d" " -f2 | sed 's@^\./@@;s@/.*@@'`
|
---|
[67992a0] | 183 | ;;
|
---|
| 184 | *.zip)
|
---|
[39dc04a] | 185 | zipinfo -1 $SRC_DIR/$PACKAGE > unpacked
|
---|
[1fa0dee] | 186 | JH_UNPACKDIR="$(sed 's@/.*@@' unpacked | uniq )"
|
---|
| 187 | if test $(wc -w <<< $JH_UNPACKDIR) -eq 1; then
|
---|
[39dc04a] | 188 | unzip $SRC_DIR/$PACKAGE
|
---|
[67992a0] | 189 | else
|
---|
[1fa0dee] | 190 | JH_UNPACKDIR=${PACKAGE%.zip}
|
---|
| 191 | unzip -d $JH_UNPACKDIR $SRC_DIR/$PACKAGE
|
---|
[67992a0] | 192 | fi
|
---|
| 193 | ;;
|
---|
| 194 | *)
|
---|
[1fa0dee] | 195 | JH_UNPACKDIR=$JH_PKG_DIR-build
|
---|
| 196 | mkdir $JH_UNPACKDIR
|
---|
| 197 | cp $SRC_DIR/$PACKAGE $JH_UNPACKDIR
|
---|
| 198 | cp $(find . -mindepth 1 -maxdepth 1 -type l) $JH_UNPACKDIR
|
---|
[67992a0] | 199 | ;;
|
---|
| 200 | esac
|
---|
[1fa0dee] | 201 | export JH_UNPACKDIR
|
---|
| 202 | cd $JH_UNPACKDIR

|
---|
[67992a0] | 203 | </xsl:text>
|
---|
[67c3df4] | 204 | <!-- If stats are requested, insert the start time -->
|
---|
| 205 | <xsl:if test="contains($list-stat-norm,concat(' ',../@id,' '))">
|
---|
| 206 | <xsl:text>echo Start Time: ${SECONDS} >> $INFOLOG
|
---|
| 207 |
|
---|
| 208 | </xsl:text>
|
---|
| 209 | </xsl:if>
|
---|
| 210 |
|
---|
[e576789] | 211 | <xsl:apply-templates select=".//screen | .//para/command"/>
|
---|
| 212 | <xsl:if test="$sudo = 'y'">
|
---|
| 213 | <xsl:text>sudo /sbin/</xsl:text>
|
---|
| 214 | </xsl:if>
|
---|
| 215 | <xsl:text>ldconfig

</xsl:text>
|
---|
| 216 | </xsl:when>
|
---|
| 217 | <xsl:when test="@role = 'configuration'">
|
---|
| 218 | <xsl:apply-templates select=".//screen" mode="config"/>
|
---|
| 219 | </xsl:when>
|
---|
| 220 | </xsl:choose>
|
---|
| 221 | </xsl:template>
|
---|
| 222 |
|
---|
| 223 | <!--==================== Download code =======================-->
|
---|
| 224 |
|
---|
[642722f] | 225 | <!-- template for extracting the filename from an url in the form:
|
---|
| 226 | proto://internet.name/dir1/.../dirn/filename?condition.
|
---|
| 227 | Needed, because substring-after(...,'/') returns only the
|
---|
| 228 | substring after the first '/'. -->
|
---|
[e576789] | 229 | <xsl:template name="package_name">
|
---|
| 230 | <xsl:param name="url" select="foo"/>
|
---|
| 231 | <xsl:param name="sub-url" select="substring-after($url,'/')"/>
|
---|
| 232 | <xsl:choose>
|
---|
| 233 | <xsl:when test="contains($sub-url,'/')">
|
---|
| 234 | <xsl:call-template name="package_name">
|
---|
| 235 | <xsl:with-param name="url" select="$sub-url"/>
|
---|
| 236 | </xsl:call-template>
|
---|
| 237 | </xsl:when>
|
---|
| 238 | <xsl:otherwise>
|
---|
| 239 | <xsl:choose>
|
---|
| 240 | <xsl:when test="contains($sub-url,'?')">
|
---|
| 241 | <xsl:value-of select="substring-before($sub-url,'?')"/>
|
---|
| 242 | </xsl:when>
|
---|
| 243 | <xsl:otherwise>
|
---|
| 244 | <xsl:value-of select="$sub-url"/>
|
---|
| 245 | </xsl:otherwise>
|
---|
| 246 | </xsl:choose>
|
---|
| 247 | </xsl:otherwise>
|
---|
| 248 | </xsl:choose>
|
---|
| 249 | </xsl:template>
|
---|
| 250 |
|
---|
[642722f] | 251 | <!-- Generates the code to download a package, an additional package or
|
---|
| 252 | a patch. -->
|
---|
| 253 | <xsl:template name="download-file">
|
---|
| 254 | <xsl:param name="httpurl" select="''"/>
|
---|
| 255 | <xsl:param name="ftpurl" select="''"/>
|
---|
| 256 | <xsl:param name="md5" select="''"/>
|
---|
| 257 | <xsl:param name="varname" select="''"/>
|
---|
| 258 | <xsl:variable name="package">
|
---|
| 259 | <xsl:call-template name="package_name">
|
---|
| 260 | <xsl:with-param name="url">
|
---|
[e576789] | 261 | <xsl:choose>
|
---|
[642722f] | 262 | <xsl:when test="string-length($httpurl) > 10">
|
---|
| 263 | <xsl:value-of select="$httpurl"/>
|
---|
[e576789] | 264 | </xsl:when>
|
---|
| 265 | <xsl:otherwise>
|
---|
[642722f] | 266 | <xsl:value-of select="$ftpurl"/>
|
---|
[e576789] | 267 | </xsl:otherwise>
|
---|
| 268 | </xsl:choose>
|
---|
[642722f] | 269 | </xsl:with-param>
|
---|
| 270 | </xsl:call-template>
|
---|
| 271 | </xsl:variable>
|
---|
| 272 | <xsl:variable name="first_letter"
|
---|
| 273 | select="translate(substring($package,1,1),
|
---|
| 274 | 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
---|
| 275 | 'abcdefghijklmnopqrstuvwxyz')"/>
|
---|
| 276 | <xsl:text>
</xsl:text>
|
---|
| 277 | <xsl:value-of select="$varname"/>
|
---|
| 278 | <xsl:text>=</xsl:text>
|
---|
| 279 | <xsl:value-of select="$package"/>
|
---|
| 280 | <xsl:text>
if [[ ! -f $</xsl:text>
|
---|
| 281 | <xsl:value-of select="$varname"/>
|
---|
[8dc4646] | 282 | <xsl:text> ]] ; then
|
---|
[1fa0dee] | 283 | if [[ -f $JH_SRC_ARCHIVE/$</xsl:text>
|
---|
[642722f] | 284 | <xsl:value-of select="$varname"/>
|
---|
| 285 | <xsl:text> ]] ; then
</xsl:text>
|
---|
[1fa0dee] | 286 | <xsl:text> cp $JH_SRC_ARCHIVE/$</xsl:text>
|
---|
[642722f] | 287 | <xsl:value-of select="$varname"/>
|
---|
| 288 | <xsl:text> $</xsl:text>
|
---|
| 289 | <xsl:value-of select="$varname"/>
|
---|
[8dc4646] | 290 | <xsl:text>
|
---|
| 291 | else
</xsl:text>
|
---|
[342c862] | 292 | <!-- Download from upstream http -->
|
---|
[642722f] | 293 | <xsl:if test="string-length($httpurl) > 10">
|
---|
[8dc4646] | 294 | <xsl:text> wget -T 30 -t 5 </xsl:text>
|
---|
[642722f] | 295 | <xsl:value-of select="$httpurl"/>
|
---|
[342c862] | 296 | <xsl:text> ||
</xsl:text>
|
---|
[642722f] | 297 | </xsl:if>
|
---|
[342c862] | 298 | <!-- Download from upstream ftp -->
|
---|
[642722f] | 299 | <xsl:if test="string-length($ftpurl) > 10">
|
---|
[8dc4646] | 300 | <xsl:text> wget -T 30 -t 5 </xsl:text>
|
---|
[642722f] | 301 | <xsl:value-of select="$ftpurl"/>
|
---|
[342c862] | 302 | <xsl:text> ||
</xsl:text>
|
---|
[642722f] | 303 | </xsl:if>
|
---|
[342c862] | 304 | <!-- The FTP_SERVER mirror as a last resort -->
|
---|
[1fa0dee] | 305 | <xsl:text> wget -T 30 -t 5 ${JH_FTP_SERVER}svn/</xsl:text>
|
---|
[342c862] | 306 | <xsl:value-of select="$first_letter"/>
|
---|
| 307 | <xsl:text>/$</xsl:text>
|
---|
| 308 | <xsl:value-of select="$varname"/>
|
---|
[1fa0dee] | 309 | <xsl:text>
|
---|
[8dc4646] | 310 | fi
|
---|
[e576789] | 311 | fi
|
---|
| 312 | </xsl:text>
|
---|
[642722f] | 313 | <xsl:if test="string-length($md5) > 10">
|
---|
| 314 | <xsl:text>echo "</xsl:text>
|
---|
| 315 | <xsl:value-of select="$md5"/>
|
---|
| 316 | <xsl:text>  $</xsl:text>
|
---|
| 317 | <xsl:value-of select="$varname"/>
|
---|
| 318 | <xsl:text>" | md5sum -c -
|
---|
[39dc04a] | 319 | </xsl:text>
|
---|
| 320 | </xsl:if>
|
---|
| 321 | <!-- link additional packages into $BUILD_DIR, because they are supposed to
|
---|
| 322 | be there-->
|
---|
| 323 | <xsl:if test="string($varname) != 'PACKAGE'">
|
---|
[8dc4646] | 324 | <xsl:text>[[ "$SRC_DIR" != "$BUILD_DIR" ]] && ln -sf $SRC_DIR/$</xsl:text>
|
---|
[39dc04a] | 325 | <xsl:value-of select="$varname"/>
|
---|
| 326 | <xsl:text> $BUILD_DIR
|
---|
[e576789] | 327 | </xsl:text>
|
---|
[642722f] | 328 | </xsl:if>
|
---|
| 329 | </xsl:template>
|
---|
| 330 |
|
---|
| 331 | <!-- Extract the MD5 sum information -->
|
---|
| 332 | <xsl:template match="para" mode="md5">
|
---|
| 333 | <xsl:choose>
|
---|
| 334 | <xsl:when test="contains(substring-after(string(),'sum: '),'
')">
|
---|
| 335 | <xsl:value-of select="substring-before(substring-after(string(),'sum: '),'
')"/>
|
---|
[e576789] | 336 | </xsl:when>
|
---|
[642722f] | 337 | <xsl:otherwise>
|
---|
| 338 | <xsl:value-of select="substring-after(string(),'sum: ')"/>
|
---|
| 339 | </xsl:otherwise>
|
---|
[e576789] | 340 | </xsl:choose>
|
---|
| 341 | </xsl:template>
|
---|
| 342 |
|
---|
[642722f] | 343 | <!-- We have several templates itemizedlist, depending on whether we
|
---|
| 344 | expect the package information, or additional package(s) or patch(es)
|
---|
| 345 | information. Select the appropriate mode here. -->
|
---|
| 346 | <xsl:template match="bridgehead">
|
---|
[e576789] | 347 | <xsl:choose>
|
---|
[642722f] | 348 | <!-- Special case for Openjdk -->
|
---|
| 349 | <xsl:when test="contains(string(),'Source Package Information')">
|
---|
| 350 | <xsl:apply-templates
|
---|
| 351 | select="following-sibling::itemizedlist[1]//simplelist">
|
---|
| 352 | <xsl:with-param name="varname" select="'PACKAGE'"/>
|
---|
| 353 | </xsl:apply-templates>
|
---|
| 354 | <xsl:apply-templates select="following-sibling::itemizedlist
|
---|
| 355 | [preceding-sibling::bridgehead[1]=current()
|
---|
| 356 | and position() >1]//simplelist">
|
---|
| 357 | <xsl:with-param name="varname" select="'PACKAGE1'"/>
|
---|
| 358 | </xsl:apply-templates>
|
---|
[e576789] | 359 | </xsl:when>
|
---|
[642722f] | 360 | <!-- Package information -->
|
---|
| 361 | <xsl:when test="contains(string(),'Package Information')">
|
---|
| 362 | <xsl:apply-templates select="following-sibling::itemizedlist
|
---|
| 363 | [preceding-sibling::bridgehead[1]=current()]"
|
---|
| 364 | mode="package"/>
|
---|
[e576789] | 365 | </xsl:when>
|
---|
[642722f] | 366 | <!-- Additional package information -->
|
---|
[ba57e61] | 367 | <!-- special case for llvm -->
|
---|
| 368 | <xsl:when test="contains(string(),'Optional Download')">
|
---|
| 369 | <xsl:apply-templates select="following-sibling::itemizedlist"
|
---|
| 370 | mode="additional"/>
|
---|
| 371 | </xsl:when>
|
---|
| 372 | <!-- All other additional packages have "Additional" -->
|
---|
[642722f] | 373 | <xsl:when test="contains(string(),'Additional')">
|
---|
| 374 | <xsl:apply-templates select="following-sibling::itemizedlist"
|
---|
| 375 | mode="additional"/>
|
---|
[e576789] | 376 | </xsl:when>
|
---|
[642722f] | 377 | <!-- Do not do anything if the dev has created another type of
|
---|
| 378 | bridgehead. -->
|
---|
| 379 | <xsl:otherwise/>
|
---|
[e576789] | 380 | </xsl:choose>
|
---|
| 381 | </xsl:template>
|
---|
| 382 |
|
---|
[642722f] | 383 | <!-- Call the download code template with appropriate parameters -->
|
---|
| 384 | <xsl:template match="itemizedlist" mode="package">
|
---|
| 385 | <xsl:call-template name="download-file">
|
---|
| 386 | <xsl:with-param name="httpurl">
|
---|
| 387 | <xsl:value-of select="./listitem[1]/para/ulink/@url"/>
|
---|
| 388 | </xsl:with-param>
|
---|
| 389 | <xsl:with-param name="ftpurl">
|
---|
| 390 | <xsl:value-of select="./listitem/para[contains(string(),'FTP')]/ulink/@url"/>
|
---|
| 391 | </xsl:with-param>
|
---|
| 392 | <xsl:with-param name="md5">
|
---|
| 393 | <xsl:apply-templates select="./listitem/para[contains(string(),'MD5')]"
|
---|
| 394 | mode="md5"/>
|
---|
| 395 | </xsl:with-param>
|
---|
| 396 | <xsl:with-param name="varname" select="'PACKAGE'"/>
|
---|
| 397 | </xsl:call-template>
|
---|
[e576789] | 398 | </xsl:template>
|
---|
| 399 |
|
---|
[642722f] | 400 | <xsl:template match="itemizedlist" mode="additional">
|
---|
| 401 | <!-- The normal layout is "one listitem"<->"one url", but some devs
|
---|
| 402 | find amusing to have FTP and/or MD5sum listitems, or to
|
---|
| 403 | enclose the download information inside a simplelist tag... -->
|
---|
| 404 | <xsl:for-each select="listitem[.//ulink]">
|
---|
| 405 | <xsl:choose>
|
---|
| 406 | <!-- hopefully, there was a HTTP line before -->
|
---|
| 407 | <xsl:when test="contains(string(./para),'FTP')"/>
|
---|
| 408 | <xsl:when test=".//simplelist">
|
---|
| 409 | <xsl:apply-templates select=".//simplelist">
|
---|
| 410 | <xsl:with-param name="varname" select="'PACKAGE1'"/>
|
---|
| 411 | </xsl:apply-templates>
|
---|
| 412 | </xsl:when>
|
---|
| 413 | <xsl:otherwise>
|
---|
| 414 | <xsl:call-template name="download-file">
|
---|
| 415 | <xsl:with-param name="httpurl">
|
---|
| 416 | <xsl:value-of select="./para/ulink/@url"/>
|
---|
| 417 | </xsl:with-param>
|
---|
| 418 | <xsl:with-param name="ftpurl">
|
---|
| 419 | <xsl:value-of
|
---|
| 420 | select="following-sibling::listitem[1]/
|
---|
| 421 | para[contains(string(),'FTP')]/ulink/@url"/>
|
---|
| 422 | </xsl:with-param>
|
---|
| 423 | <xsl:with-param name="md5">
|
---|
| 424 | <xsl:apply-templates
|
---|
| 425 | select="following-sibling::listitem[position()<3]/
|
---|
| 426 | para[contains(string(),'MD5')]"
|
---|
| 427 | mode="md5"/>
|
---|
| 428 | </xsl:with-param>
|
---|
| 429 | <xsl:with-param name="varname">
|
---|
| 430 | <xsl:choose>
|
---|
| 431 | <xsl:when test="contains(./para/ulink/@url,'.patch')">
|
---|
| 432 | <xsl:text>PATCH</xsl:text>
|
---|
| 433 | </xsl:when>
|
---|
| 434 | <xsl:otherwise>
|
---|
| 435 | <xsl:text>PACKAGE1</xsl:text>
|
---|
| 436 | </xsl:otherwise>
|
---|
| 437 | </xsl:choose>
|
---|
| 438 | </xsl:with-param>
|
---|
| 439 | </xsl:call-template>
|
---|
| 440 | </xsl:otherwise>
|
---|
| 441 | </xsl:choose>
|
---|
| 442 | </xsl:for-each>
|
---|
[e576789] | 443 | </xsl:template>
|
---|
| 444 |
|
---|
[642722f] | 445 | <!-- the simplelist case. Hopefully, the layout is one member for
|
---|
| 446 | url, one for md5 and others for various information, that we do not
|
---|
| 447 | use -->
|
---|
| 448 | <xsl:template match="simplelist">
|
---|
| 449 | <xsl:param name="varname" select="'PACKAGE1'"/>
|
---|
| 450 | <xsl:call-template name="download-file">
|
---|
| 451 | <xsl:with-param name="httpurl" select=".//ulink/@url"/>
|
---|
| 452 | <xsl:with-param name="md5">
|
---|
| 453 | <xsl:value-of select="substring-after(member[contains(string(),'MD5')],'sum: ')"/>
|
---|
| 454 | </xsl:with-param>
|
---|
| 455 | <xsl:with-param name="varname" select="$varname"/>
|
---|
| 456 | </xsl:call-template>
|
---|
| 457 | </xsl:template>
|
---|
[e576789] | 458 | <!--======================== Commands code ==========================-->
|
---|
| 459 |
|
---|
| 460 | <xsl:template match="screen">
|
---|
| 461 | <xsl:if test="child::* = userinput and not(@role = 'nodump')">
|
---|
| 462 | <xsl:choose>
|
---|
[67c3df4] | 463 | <!-- First the case of installation instructions -->
|
---|
| 464 | <xsl:when test="@role = 'root' and
|
---|
| 465 | ancestor::sect2[@role='installation'] and
|
---|
| 466 | not(contains(string(),'useradd')) and
|
---|
| 467 | not(contains(string(),'groupadd'))">
|
---|
[945ccaa] | 468 | <xsl:if test="not(preceding-sibling::screen[1][@role='root'])">
|
---|
[67c3df4] | 469 | <xsl:if test="contains($list-stat-norm,
|
---|
| 470 | concat(' ',
|
---|
| 471 | ancestor::sect1/@id,
|
---|
| 472 | ' '))">
|
---|
| 473 | <xsl:call-template name="output-destdir"/>
|
---|
| 474 | </xsl:if>
|
---|
[945ccaa] | 475 | <xsl:if test="$sudo = 'y'">
|
---|
| 476 | <xsl:text>sudo -E sh << ROOT_EOF
</xsl:text>
|
---|
| 477 | </xsl:if>
|
---|
[67c3df4] | 478 | <xsl:if test="$wrap-install = 'y'">
|
---|
[1fa0dee] | 479 | <xsl:text>if [ -r "$JH_PACK_INSTALL" ]; then
|
---|
| 480 | source $JH_PACK_INSTALL
|
---|
[945ccaa] | 481 | export -f wrapInstall
|
---|
| 482 | export -f packInstall
|
---|
| 483 | fi
|
---|
| 484 | wrapInstall '
|
---|
| 485 | </xsl:text>
|
---|
| 486 | </xsl:if>
|
---|
[e576789] | 487 | </xsl:if>
|
---|
| 488 | <xsl:apply-templates mode="root"/>
|
---|
[945ccaa] | 489 | <xsl:if test="not(following-sibling::screen[1][@role='root'])">
|
---|
[67c3df4] | 490 | <xsl:if test="$del-la-files = 'y'">
|
---|
[dc7fd7b] | 491 | <xsl:call-template name="output-root">
|
---|
| 492 | <xsl:with-param name="out-string" select="$la-files-instr"/>
|
---|
| 493 | </xsl:call-template>
|
---|
| 494 | </xsl:if>
|
---|
[67c3df4] | 495 | <xsl:if test="$wrap-install = 'y'">
|
---|
[945ccaa] | 496 | <xsl:text>'
packInstall</xsl:text>
|
---|
| 497 | </xsl:if>
|
---|
| 498 | <xsl:if test="$sudo = 'y'">
|
---|
| 499 | <xsl:text>
ROOT_EOF</xsl:text>
|
---|
| 500 | </xsl:if>
|
---|
[e576789] | 501 | </xsl:if>
|
---|
| 502 | </xsl:when>
|
---|
[67c3df4] | 503 | <!-- then the case of other instructions run as root (configuration mainly) -->
|
---|
| 504 | <xsl:when test="@role = 'root'">
|
---|
| 505 | <xsl:if test="not(preceding-sibling::screen[1][@role='root'])">
|
---|
| 506 | <xsl:if test="$sudo = 'y'">
|
---|
| 507 | <xsl:text>sudo -E sh << ROOT_EOF
</xsl:text>
|
---|
| 508 | </xsl:if>
|
---|
| 509 | </xsl:if>
|
---|
| 510 | <xsl:apply-templates mode="root"/>
|
---|
| 511 | <xsl:if test="not(following-sibling::screen[1][@role='root'])">
|
---|
| 512 | <xsl:if test="$sudo = 'y'">
|
---|
| 513 | <xsl:text>
ROOT_EOF</xsl:text>
|
---|
| 514 | </xsl:if>
|
---|
| 515 | </xsl:if>
|
---|
| 516 | </xsl:when>
|
---|
| 517 | <!-- then all the instructions run as user -->
|
---|
[e576789] | 518 | <xsl:otherwise>
|
---|
| 519 | <xsl:apply-templates select="userinput"/>
|
---|
| 520 | </xsl:otherwise>
|
---|
| 521 | </xsl:choose>
|
---|
| 522 | <xsl:text>
</xsl:text>
|
---|
| 523 | </xsl:if>
|
---|
| 524 | </xsl:template>
|
---|
| 525 |
|
---|
[70d73d1] | 526 | <xsl:template name="set-bootpkg-dir">
|
---|
| 527 | <xsl:param name="bootpkg" select="'bootscripts'"/>
|
---|
| 528 | <xsl:param name="url" select="''"/>
|
---|
[973c767] | 529 | <xsl:text>BOOTPKG_DIR=blfs-</xsl:text>
|
---|
[70d73d1] | 530 | <xsl:copy-of select="$bootpkg"/>
|
---|
| 531 | <xsl:text>
|
---|
[1fa0dee] | 532 | BOOTSRC_DIR=${JH_SRC_ARCHIVE}${JH_SRC_SUBDIRS:+/${BOOTPKG_DIR}}
|
---|
| 533 | BOOTBUILD_DIR=${JH_BUILD_ROOT}${JH_BUILD_SUBDIRS:+/${BOOTPKG_DIR}}
|
---|
[973c767] | 534 | mkdir -p $BOOTSRC_DIR
|
---|
| 535 | mkdir -p $BOOTBUILD_DIR
|
---|
| 536 |
|
---|
| 537 | pushd $BOOTSRC_DIR
|
---|
[e576789] | 538 | URL=</xsl:text>
|
---|
[70d73d1] | 539 | <xsl:value-of select="$url"/>
|
---|
| 540 | <xsl:text>
|
---|
[e576789] | 541 | BOOTPACKG=$(basename $URL)
|
---|
[bbcdeab] | 542 | if [[ ! -f $BOOTPACKG ]] ; then
|
---|
[1fa0dee] | 543 | if [[ -f $JH_SRC_ARCHIVE/$BOOTPACKG ]] ; then
|
---|
| 544 | cp $JH_SRC_ARCHIVE/$BOOTPACKG $BOOTPACKG
|
---|
[bbcdeab] | 545 | else
|
---|
| 546 | wget -T 30 -t 5 $URL
|
---|
| 547 | fi
|
---|
[973c767] | 548 | rm -f $BOOTBUILD_DIR/unpacked
|
---|
[bbcdeab] | 549 | fi
|
---|
| 550 |
|
---|
[973c767] | 551 | cd $BOOTBUILD_DIR
|
---|
[e576789] | 552 | if [[ -e unpacked ]] ; then
|
---|
[f079f8f] | 553 | BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
|
---|
| 554 | if ! [[ -d $BOOTUNPACKDIR ]]; then
|
---|
[973c767] | 555 | tar -xvf $BOOTSRC_DIR/$BOOTPACKG > unpacked
|
---|
[f079f8f] | 556 | BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
|
---|
[e576789] | 557 | fi
|
---|
| 558 | else
|
---|
[973c767] | 559 | tar -xvf $BOOTSRC_DIR/$BOOTPACKG > unpacked
|
---|
[f079f8f] | 560 | BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
|
---|
[e576789] | 561 | fi
|
---|
[f079f8f] | 562 | cd $BOOTUNPACKDIR
|
---|
[e576789] | 563 | </xsl:text>
|
---|
[70d73d1] | 564 | </xsl:template>
|
---|
| 565 |
|
---|
| 566 | <xsl:template match="screen" mode="config">
|
---|
| 567 | <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts']">
|
---|
| 568 | <xsl:call-template name="set-bootpkg-dir">
|
---|
| 569 | <xsl:with-param name="bootpkg" select="'bootscripts'"/>
|
---|
| 570 | <xsl:with-param name="url"
|
---|
| 571 | select="id('bootscripts')//itemizedlist//ulink/@url"/>
|
---|
| 572 | </xsl:call-template>
|
---|
| 573 | </xsl:if>
|
---|
| 574 | <xsl:if test="preceding-sibling::para[1]/xref[@linkend='systemd-units']">
|
---|
| 575 | <xsl:call-template name="set-bootpkg-dir">
|
---|
| 576 | <xsl:with-param name="bootpkg" select="'systemd-units'"/>
|
---|
| 577 | <xsl:with-param name="url"
|
---|
| 578 | select="id('systemd-units')//itemizedlist//ulink/@url"/>
|
---|
| 579 | </xsl:call-template>
|
---|
[e576789] | 580 | </xsl:if>
|
---|
| 581 | <xsl:apply-templates select='.'/>
|
---|
[70d73d1] | 582 | <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts' or
|
---|
| 583 | @linkend='systemd-units']">
|
---|
[e576789] | 584 | <xsl:text>
|
---|
| 585 | popd</xsl:text>
|
---|
| 586 | </xsl:if>
|
---|
| 587 | <xsl:text>
</xsl:text>
|
---|
| 588 | </xsl:template>
|
---|
| 589 |
|
---|
| 590 | <xsl:template match="para/command">
|
---|
[a743e57] | 591 | <xsl:variable name="ns" select="normalize-space(string())"/>
|
---|
[67c3df4] | 592 | <xsl:if test="contains($ns,'test') or
|
---|
| 593 | contains($ns,'check')">
|
---|
| 594 | <xsl:choose>
|
---|
| 595 | <xsl:when test="contains($list-stat-norm,
|
---|
| 596 | concat(' ',ancestor::sect1/@id,' '))">
|
---|
| 597 | <xsl:text>
|
---|
| 598 | echo Time after make: ${SECONDS} >> $INFOLOG
|
---|
| 599 | echo Size after make: $(sudo du -skx --exclude home /) >> $INFOLOG
|
---|
| 600 | echo Time before test: ${SECONDS} >> $INFOLOG
|
---|
| 601 | </xsl:text>
|
---|
| 602 | </xsl:when>
|
---|
| 603 | <xsl:otherwise>
|
---|
| 604 | <xsl:text>#</xsl:text>
|
---|
| 605 | </xsl:otherwise>
|
---|
| 606 | </xsl:choose>
|
---|
| 607 | <xsl:choose>
|
---|
| 608 | <xsl:when test="contains($ns,'make')">
|
---|
| 609 | <xsl:value-of select="substring-before($ns,'make ')"/>
|
---|
| 610 | <xsl:text>make </xsl:text>
|
---|
| 611 | <xsl:if test="not(contains($ns,'-k'))">
|
---|
| 612 | <xsl:text>-k </xsl:text>
|
---|
| 613 | </xsl:if>
|
---|
| 614 | <xsl:value-of select="substring-after($ns,'make ')"/>
|
---|
| 615 | </xsl:when>
|
---|
| 616 | <xsl:otherwise>
|
---|
| 617 | <xsl:copy-of select="$ns"/>
|
---|
| 618 | </xsl:otherwise>
|
---|
| 619 | </xsl:choose>
|
---|
| 620 | <xsl:if test="contains($list-stat-norm,
|
---|
| 621 | concat(' ',ancestor::sect1/@id,' '))">
|
---|
| 622 | <xsl:text> >> $TESTLOG 2>&1</xsl:text>
|
---|
[9c5ea2f] | 623 | </xsl:if>
|
---|
[e576789] | 624 | <xsl:text> || true
</xsl:text>
|
---|
| 625 | </xsl:if>
|
---|
| 626 | </xsl:template>
|
---|
| 627 |
|
---|
| 628 | <xsl:template match="userinput">
|
---|
| 629 | <xsl:apply-templates/>
|
---|
| 630 | </xsl:template>
|
---|
| 631 |
|
---|
| 632 | <xsl:template match="text()" mode="root">
|
---|
| 633 | <xsl:call-template name="output-root">
|
---|
| 634 | <xsl:with-param name="out-string" select="string()"/>
|
---|
| 635 | </xsl:call-template>
|
---|
| 636 | </xsl:template>
|
---|
| 637 |
|
---|
[945ccaa] | 638 | <xsl:variable name="APOS">'</xsl:variable>
|
---|
| 639 |
|
---|
[e576789] | 640 | <xsl:template name="output-root">
|
---|
| 641 | <xsl:param name="out-string" select="''"/>
|
---|
| 642 | <xsl:choose>
|
---|
[9c5ea2f] | 643 | <xsl:when test="contains($out-string,'make ')">
|
---|
[e576789] | 644 | <xsl:call-template name="output-root">
|
---|
| 645 | <xsl:with-param name="out-string"
|
---|
[9c5ea2f] | 646 | select="substring-before($out-string,'make ')"/>
|
---|
[e576789] | 647 | </xsl:call-template>
|
---|
[9c5ea2f] | 648 | <xsl:text>make -j1 </xsl:text>
|
---|
[e576789] | 649 | <xsl:call-template name="output-root">
|
---|
| 650 | <xsl:with-param name="out-string"
|
---|
[9c5ea2f] | 651 | select="substring-after($out-string,'make ')"/>
|
---|
[e576789] | 652 | </xsl:call-template>
|
---|
| 653 | </xsl:when>
|
---|
| 654 | <xsl:when test="contains($out-string,'$') and $sudo = 'y'">
|
---|
| 655 | <xsl:call-template name="output-root">
|
---|
| 656 | <xsl:with-param name="out-string"
|
---|
| 657 | select="substring-before($out-string,'$')"/>
|
---|
| 658 | </xsl:call-template>
|
---|
| 659 | <xsl:text>\$</xsl:text>
|
---|
| 660 | <xsl:call-template name="output-root">
|
---|
| 661 | <xsl:with-param name="out-string"
|
---|
| 662 | select="substring-after($out-string,'$')"/>
|
---|
| 663 | </xsl:call-template>
|
---|
| 664 | </xsl:when>
|
---|
| 665 | <xsl:when test="contains($out-string,'`') and $sudo = 'y'">
|
---|
| 666 | <xsl:call-template name="output-root">
|
---|
| 667 | <xsl:with-param name="out-string"
|
---|
| 668 | select="substring-before($out-string,'`')"/>
|
---|
| 669 | </xsl:call-template>
|
---|
| 670 | <xsl:text>\`</xsl:text>
|
---|
| 671 | <xsl:call-template name="output-root">
|
---|
| 672 | <xsl:with-param name="out-string"
|
---|
| 673 | select="substring-after($out-string,'`')"/>
|
---|
| 674 | </xsl:call-template>
|
---|
| 675 | </xsl:when>
|
---|
| 676 | <xsl:when test="contains($out-string,'\') and $sudo = 'y'">
|
---|
| 677 | <xsl:call-template name="output-root">
|
---|
| 678 | <xsl:with-param name="out-string"
|
---|
| 679 | select="substring-before($out-string,'\')"/>
|
---|
| 680 | </xsl:call-template>
|
---|
| 681 | <xsl:text>\\</xsl:text>
|
---|
| 682 | <xsl:call-template name="output-root">
|
---|
| 683 | <xsl:with-param name="out-string"
|
---|
| 684 | select="substring-after($out-string,'\')"/>
|
---|
| 685 | </xsl:call-template>
|
---|
| 686 | </xsl:when>
|
---|
[945ccaa] | 687 | <xsl:when test="contains($out-string,string($APOS))
|
---|
| 688 | and $wrap-install = 'y'
|
---|
| 689 | and ancestor::sect2[@role='installation']">
|
---|
| 690 | <xsl:call-template name="output-root">
|
---|
| 691 | <xsl:with-param name="out-string"
|
---|
| 692 | select="substring-before($out-string,string($APOS))"/>
|
---|
| 693 | </xsl:call-template>
|
---|
| 694 | <xsl:text>'\''</xsl:text>
|
---|
| 695 | <xsl:call-template name="output-root">
|
---|
| 696 | <xsl:with-param name="out-string"
|
---|
| 697 | select="substring-after($out-string,string($APOS))"/>
|
---|
| 698 | </xsl:call-template>
|
---|
| 699 | </xsl:when>
|
---|
[e576789] | 700 | <xsl:otherwise>
|
---|
| 701 | <xsl:value-of select="$out-string"/>
|
---|
| 702 | </xsl:otherwise>
|
---|
| 703 | </xsl:choose>
|
---|
| 704 | </xsl:template>
|
---|
| 705 |
|
---|
| 706 | <xsl:template match="replaceable">
|
---|
| 707 | <xsl:text>**EDITME</xsl:text>
|
---|
| 708 | <xsl:apply-templates/>
|
---|
| 709 | <xsl:text>EDITME**</xsl:text>
|
---|
| 710 | </xsl:template>
|
---|
| 711 |
|
---|
| 712 | <xsl:template match="replaceable" mode="root">
|
---|
| 713 | <xsl:text>**EDITME</xsl:text>
|
---|
| 714 | <xsl:apply-templates/>
|
---|
| 715 | <xsl:text>EDITME**</xsl:text>
|
---|
| 716 | </xsl:template>
|
---|
| 717 |
|
---|
[67c3df4] | 718 | <xsl:template name="output-destdir">
|
---|
| 719 | <!-- Hopefully, the current node is the first screen with role equal to root.
|
---|
| 720 | We first output stats, since we are only called if stats are needed.
|
---|
| 721 | then we output DESTDIR instructions,etc -->
|
---|
| 722 | <xsl:text>
|
---|
| 723 | echo Time after tests: ${SECONDS} >> $INFOLOG
|
---|
| 724 | echo Size after tests: $(sudo du -skx --exclude home /) >> $INFOLOG
|
---|
| 725 | echo Time before install: ${SECONDS} >> $INFOLOG
|
---|
| 726 | </xsl:text>
|
---|
| 727 | <xsl:apply-templates
|
---|
| 728 | select="userinput|following-sibling::screen[@role='root']/userinput"
|
---|
| 729 | mode="destdir"/>
|
---|
| 730 | <xsl:text>
|
---|
| 731 | echo Time after install: ${SECONDS} >> $INFOLOG
|
---|
| 732 | echo Size after install: $(sudo du -skx --exclude home /) >> $INFOLOG
|
---|
| 733 | </xsl:text>
|
---|
| 734 | </xsl:template>
|
---|
| 735 |
|
---|
| 736 | <xsl:template match="userinput" mode="destdir">
|
---|
| 737 | <xsl:choose>
|
---|
| 738 | <xsl:when test="./literal">
|
---|
| 739 | <xsl:call-template name="outputpkgdest">
|
---|
| 740 | <xsl:with-param name="outputstring" select="text()[1]"/>
|
---|
| 741 | </xsl:call-template>
|
---|
| 742 | <xsl:apply-templates select="literal"/>
|
---|
| 743 | <xsl:call-template name="outputpkgdest">
|
---|
| 744 | <xsl:with-param name="outputstring" select="text()[2]"/>
|
---|
| 745 | </xsl:call-template>
|
---|
| 746 | </xsl:when>
|
---|
| 747 | <xsl:otherwise>
|
---|
| 748 | <xsl:call-template name="outputpkgdest">
|
---|
| 749 | <xsl:with-param name="outputstring" select="string()"/>
|
---|
| 750 | </xsl:call-template>
|
---|
| 751 | </xsl:otherwise>
|
---|
| 752 | </xsl:choose>
|
---|
| 753 | <xsl:text>
</xsl:text>
|
---|
| 754 | </xsl:template>
|
---|
| 755 |
|
---|
| 756 | <xsl:template name="outputpkgdest">
|
---|
| 757 | <xsl:param name="outputstring" select="'foo'"/>
|
---|
| 758 | <xsl:choose>
|
---|
| 759 | <xsl:when test="contains($outputstring,'make ')">
|
---|
| 760 | <xsl:choose>
|
---|
| 761 | <xsl:when test="not(starts-with($outputstring,'make'))">
|
---|
| 762 | <xsl:call-template name="outputpkgdest">
|
---|
| 763 | <xsl:with-param name="outputstring"
|
---|
| 764 | select="substring-before($outputstring,'make')"/>
|
---|
| 765 | </xsl:call-template>
|
---|
| 766 | <xsl:call-template name="outputpkgdest">
|
---|
| 767 | <xsl:with-param
|
---|
| 768 | name="outputstring"
|
---|
| 769 | select="substring-after($outputstring,
|
---|
| 770 | substring-before($outputstring,'make'))"/>
|
---|
| 771 | </xsl:call-template>
|
---|
| 772 | </xsl:when>
|
---|
| 773 | <xsl:otherwise>
|
---|
| 774 | <xsl:text>make DESTDIR=$PKG_DEST</xsl:text>
|
---|
| 775 | <xsl:call-template name="outputpkgdest">
|
---|
| 776 | <xsl:with-param
|
---|
| 777 | name="outputstring"
|
---|
| 778 | select="substring-after($outputstring,'make')"/>
|
---|
| 779 | </xsl:call-template>
|
---|
| 780 | </xsl:otherwise>
|
---|
| 781 | </xsl:choose>
|
---|
| 782 | </xsl:when>
|
---|
| 783 | <xsl:when test="contains($outputstring,'ninja install')">
|
---|
| 784 | <xsl:choose>
|
---|
| 785 | <xsl:when test="not(starts-with($outputstring,'ninja install'))">
|
---|
| 786 | <xsl:call-template name="outputpkgdest">
|
---|
| 787 | <xsl:with-param name="outputstring"
|
---|
| 788 | select="substring-before($outputstring,'ninja install')"/>
|
---|
| 789 | </xsl:call-template>
|
---|
| 790 | <xsl:call-template name="outputpkgdest">
|
---|
| 791 | <xsl:with-param
|
---|
| 792 | name="outputstring"
|
---|
| 793 | select="substring-after($outputstring,
|
---|
| 794 | substring-before($outputstring,'ninja install'))"/>
|
---|
| 795 | </xsl:call-template>
|
---|
| 796 | </xsl:when>
|
---|
| 797 | <xsl:otherwise>
|
---|
| 798 | <xsl:text>DESTDIR=$PKG_DEST ninja</xsl:text>
|
---|
| 799 | <xsl:call-template name="outputpkgdest">
|
---|
| 800 | <xsl:with-param
|
---|
| 801 | name="outputstring"
|
---|
| 802 | select="substring-after($outputstring,'ninja')"/>
|
---|
| 803 | </xsl:call-template>
|
---|
| 804 | </xsl:otherwise>
|
---|
| 805 | </xsl:choose>
|
---|
| 806 | </xsl:when>
|
---|
| 807 | <xsl:otherwise> <!-- no make nor ninja in this string -->
|
---|
| 808 | <xsl:choose>
|
---|
| 809 | <xsl:when test="contains($outputstring,'>/') and
|
---|
| 810 | not(contains(substring-before($outputstring,'>/'),' /'))">
|
---|
| 811 | <xsl:value-of select="substring-before($outputstring,'>/')"/>
|
---|
| 812 | <xsl:text>>$PKG_DEST/</xsl:text>
|
---|
| 813 | <xsl:call-template name="outputpkgdest">
|
---|
| 814 | <xsl:with-param name="outputstring" select="substring-after($outputstring,'>/')"/>
|
---|
| 815 | </xsl:call-template>
|
---|
| 816 | </xsl:when>
|
---|
| 817 | <xsl:when test="contains($outputstring,' /')">
|
---|
| 818 | <xsl:value-of select="substring-before($outputstring,' /')"/>
|
---|
| 819 | <xsl:text> $PKG_DEST/</xsl:text>
|
---|
| 820 | <xsl:call-template name="outputpkgdest">
|
---|
| 821 | <xsl:with-param name="outputstring" select="substring-after($outputstring,' /')"/>
|
---|
| 822 | </xsl:call-template>
|
---|
| 823 | </xsl:when>
|
---|
| 824 | <xsl:otherwise>
|
---|
| 825 | <xsl:value-of select="$outputstring"/>
|
---|
| 826 | </xsl:otherwise>
|
---|
| 827 | </xsl:choose>
|
---|
| 828 | </xsl:otherwise>
|
---|
| 829 | </xsl:choose>
|
---|
| 830 | </xsl:template>
|
---|
| 831 |
|
---|
[e576789] | 832 | </xsl:stylesheet>
|
---|