source: CLFS3/clfs3.xsl@ 4d15d7f

2.3 2.3.x 2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since 4d15d7f was 2512414, checked in by Manuel Canales Esparcia <manuel@…>, 18 years ago

Fixed temporaly envars needed by uClibc in CLFS-embedded.

  • Property mode set to 100644
File size: 5.9 KB
RevLine 
[837797e]1<?xml version="1.0"?>
2<!DOCTYPE xsl:stylesheet [
3 <!ENTITY % general-entities SYSTEM "FAKEDIR/general.ent">
4 %general-entities;
5]>
6
7<!-- $Id$ -->
8
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 CLFS2 books. -->
15
16 <!-- Install vim-lang package? -->
17 <xsl:param name="vim-lang" select="y"/>
18
19 <!-- Time zone -->
20 <xsl:param name="timezone" select="GMT"/>
21
22 <!-- Page size -->
23 <xsl:param name="page" select="letter"/>
24
25 <!-- Locale settings -->
26 <xsl:param name="lang" select="C"/>
27
28 <xsl:template match="/">
29 <xsl:apply-templates select="//sect1"/>
30 </xsl:template>
31
32 <xsl:template match="sect1">
33 <xsl:choose>
34 <xsl:when test="../@id='chapter-partitioning' or
35 ../@id='chapter-getting-materials' or
36 ../@id='chapter-final-preps'"/>
37 <xsl:otherwise>
38 <xsl:if test="count(descendant::screen/userinput) &gt; 0 and
39 count(descendant::screen/userinput) &gt;
40 count(descendant::screen[@role='nodump'])">
41 <!-- The dirs names -->
42 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
43 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
44 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
45 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
46 <!-- The file names -->
47 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
48 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
49 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
50 <!-- The build order -->
51 <xsl:variable name="position" select="position()"/>
52 <xsl:variable name="order">
53 <xsl:choose>
54 <xsl:when test="string-length($position) = 1">
55 <xsl:text>00</xsl:text>
56 <xsl:value-of select="$position"/>
57 </xsl:when>
58 <xsl:when test="string-length($position) = 2">
59 <xsl:text>0</xsl:text>
60 <xsl:value-of select="$position"/>
61 </xsl:when>
62 <xsl:otherwise>
63 <xsl:value-of select="$position"/>
64 </xsl:otherwise>
65 </xsl:choose>
66 </xsl:variable>
67 <!-- Creating dirs and files -->
68 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
[ee89023]69 <xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
[837797e]70 <xsl:if test="not(@id='ch-system-stripping')">
[5f4982d]71 <xsl:text>set -e&#xA;</xsl:text>
[837797e]72 </xsl:if>
[5f4982d]73 <xsl:text>&#xA;</xsl:text>
[2512414]74 <!-- Set envars needed by uClibc -->
75 <xsl:if test="@id='ch-cross-tools-uclibc'">
76 <xsl:copy-of select="//sect1[@id='ch-cross-tools-toolchain']/screen"/>
77 <xsl:text>&#xA;&#xA;</xsl:text>
78 </xsl:if>
[837797e]79 <xsl:if test="sect2[@role='installation']">
80 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
81 </xsl:if>
82 <xsl:apply-templates select=".//para/userinput | .//screen"/>
83 <xsl:text>exit</xsl:text>
84 </exsl:document>
85 </xsl:if>
86 </xsl:otherwise>
87 </xsl:choose>
88 </xsl:template>
89
90 <xsl:template match="screen">
91 <xsl:if test="child::* = userinput and not(@role = 'nodump')">
92 <xsl:apply-templates select="userinput" mode="screen"/>
93 </xsl:if>
94 </xsl:template>
95
96 <xsl:template match="para/userinput"/>
97
98 <xsl:template match="userinput" mode="screen">
99 <xsl:choose>
100 <!-- Estandarized package formats -->
101 <xsl:when test="contains(string(),'tar.gz')">
102 <xsl:value-of select="substring-before(string(),'tar.gz')"/>
103 <xsl:text>tar.*</xsl:text>
104 <xsl:value-of select="substring-after(string(),'tar.gz')"/>
105 <xsl:text>&#xA;</xsl:text>
106 </xsl:when>
107 <!-- Setting $LANG for /etc/profile -->
108 <xsl:when test="ancestor::sect1[@id='ch-scripts-profile'] and
109 contains(string(),'export LANG=')">
110 <xsl:value-of select="substring-before(string(),'export LANG=')"/>
111 <xsl:text>export LANG=</xsl:text>
112 <xsl:value-of select="$lang"/>
113 <xsl:value-of select="substring-after(string(),'charmap]')"/>
114 <xsl:text>&#xA;</xsl:text>
115 </xsl:when>
116 <!-- Compile the keymap into the kernel has been disabled -->
117 <xsl:when test="contains(string(),'defkeymap')"/>
118 <!-- Copying the kernel config file -->
119 <xsl:when test="string() = 'make mrproper'">
120 <xsl:text>make mrproper&#xA;</xsl:text>
121 <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
122 </xsl:when>
123 <!-- No interactive commands are needed if the .config file is the proper one -->
124 <xsl:when test="contains(string(),'menuconfig')"/>
125 <!-- Don't stop on strip run -->
126 <xsl:when test="contains(string(),'strip ')">
127 <xsl:apply-templates/>
128 <xsl:text> || true&#xA;</xsl:text>
129 </xsl:when>
130 <!-- The rest of commands -->
131 <xsl:otherwise>
132 <xsl:apply-templates/>
133 <xsl:text>&#xA;</xsl:text>
134 </xsl:otherwise>
135 </xsl:choose>
136 </xsl:template>
137
138 <xsl:template match="replaceable">
139 <xsl:choose>
140 <xsl:when test="ancestor::sect1[@id='ch-cross-tools-glibc']">
141 <xsl:value-of select="$timezone"/>
142 </xsl:when>
143 <xsl:when test="ancestor::sect1[@id='ch-cross-tools-groff'] or
144 ancestor::sect1[@id='ch-system-groff']">
145 <xsl:value-of select="$page"/>
146 </xsl:when>
147 <xsl:otherwise>
148 <xsl:text>**EDITME</xsl:text>
149 <xsl:apply-templates/>
150 <xsl:text>EDITME**</xsl:text>
151 </xsl:otherwise>
152 </xsl:choose>
153 </xsl:template>
154
155</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.