/[d-i]/trunk/manual/build/buildone.sh
ViewVC logotype

Contents of /trunk/manual/build/buildone.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 26980 - (hide annotations) (download) (as text)
Thu Apr 21 22:27:44 2005 UTC (8 years, 1 month ago) by fjpop-guest
Original Path: trunk/installer/doc/manual/build/buildone.sh
File MIME type: application/x-sh
File size: 9084 byte(s)
Exclude zh_CN from PDF/PS building
1 pronik-guest 21971 #!/bin/sh
2    
3 pronik-guest 22212 if [ "$1" = "--help" ]; then
4 fjpop-guest 23368 echo "$0: Generate the Debian Installer Manual in several different formats"
5 pronik-guest 22212 echo "Usage: $0 [arch] [lang] [format]"
6 fjpop-guest 23368 echo "[format] may consist of multiple formats provided they are quoted (e.g. \"html pdf\")"
7 fjpop-guest 24223 echo "Supported formats: html, ps, pdf, txt"
8     exit 0
9 pronik-guest 22212 fi
10    
11     arch=${1:-i386}
12     language=${2:-en}
13 fjpop-guest 23368 formats=${3:-html}
14 pronik-guest 22212
15 fjpop-guest 23368 ## Configuration
16 fjpop-guest 23462 basedir="$(cd "$(dirname $0)"; pwd)"
17 fjpop-guest 24102 manual_path="$(echo $basedir | sed "s:/build$::")"
18     build_path="$manual_path/build"
19 fjpop-guest 23368 cd $build_path
20 pronik-guest 22121
21 fjpop-guest 23368 stylesheet_dir="$build_path/stylesheets"
22 pronik-guest 22121 stylesheet_profile="$stylesheet_dir/style-profile.xsl"
23 fjpop-guest 25033 if [ ! "$web_build" ]; then
24     stylesheet_html="$stylesheet_dir/style-html.xsl"
25     else
26     stylesheet_html="$stylesheet_dir/style-html-web.xsl"
27     fi
28 fjpop-guest 24214 stylesheet_html_single="$stylesheet_dir/style-html-single.xsl"
29 pronik-guest 22121 stylesheet_fo="$stylesheet_dir/style-fo.xsl"
30     stylesheet_dsssl="$stylesheet_dir/style-print.dsl"
31    
32 fjpop-guest 23368 entities_path="$build_path/entities"
33     source_path="$manual_path/$language"
34 pronik-guest 22121
35 fjpop-guest 24560 if [ -z "$destdir" ]; then
36     destdir="build.out"
37 pronik-guest 22121 fi
38    
39 fjpop-guest 23368 tempdir="build.tmp"
40 pronik-guest 22121 dynamic="${tempdir}/dynamic.ent"
41    
42 pronik-guest 21971 create_profiled () {
43    
44 fjpop-guest 24223 [ -x /usr/bin/xsltproc ] || return 9
45 fjpop-guest 23368
46 fjpop-guest 24223 echo "Info: creating temporary profiled .xml file..."
47 fjpop-guest 23368
48 pronik-guest 21971 if [ ! "$official_build" ]; then
49 fjpop-guest 21976 unofficial_build="FIXME;unofficial-build"
50 pronik-guest 21971 else
51 fjpop-guest 21976 unofficial_build=""
52 pronik-guest 21971 fi
53    
54 fjpop-guest 23368 # Now we source the profiling information for the selected architecture
55 fjpop-guest 24560 [ -f "arch-options/${arch}" ] || {
56     echo "Error: unknown architecture '$arch'"
57 fjpop-guest 24223 return 1
58 fjpop-guest 23368 }
59     . arch-options/$arch
60 pronik-guest 21971
61 fjpop-guest 23368 # Join all architecture options into one big variable
62 fjpop-guest 22882 condition="$fdisk;$network;$boot;$smp;$other;$goodies;$unofficial_build;$status"
63 pronik-guest 21971
64 fjpop-guest 23368 # Write dynamic non-profilable entities into the file
65 pronik-guest 21971 echo "<!-- arch- and lang-specific non-profilable entities -->" > $dynamic
66     echo "<!ENTITY langext \".${language}\">" >> $dynamic
67     echo "<!ENTITY architecture \"${arch}\">" >> $dynamic
68     echo "<!ENTITY kernelversion \"${kernelversion}\">" >> $dynamic
69     echo "<!ENTITY altkernelversion \"${altkernelversion}\">" >> $dynamic
70 fjpop-guest 24560 sed "s:##SRCPATH##:$source_path:" templates/docstruct.ent >> $dynamic
71 pronik-guest 21971
72 fjpop-guest 23368 sed "s:##LANG##:$language:g" templates/install.xml.template | \
73 fjpop-guest 24560 sed "s:##TEMPDIR##:$tempdir:g" | \
74     sed "s:##ENTPATH##:$entities_path:g" | \
75     sed "s:##SRCPATH##:$source_path:" > $tempdir/install.${language}.xml
76 pronik-guest 21971
77 fjpop-guest 23368 # Create the profiled xml file
78     /usr/bin/xsltproc \
79     --xinclude \
80     --stringparam profile.arch "$archspec" \
81     --stringparam profile.condition "$condition" \
82     --output $tempdir/install.${language}.profiled.xml \
83     $stylesheet_profile \
84     $tempdir/install.${language}.xml
85 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
86    
87     return 0
88 pronik-guest 21971 }
89    
90     create_html () {
91    
92 fjpop-guest 24223 echo "Info: creating .html files..."
93 fjpop-guest 23368
94     /usr/bin/xsltproc \
95 fjpop-guest 21976 --xinclude \
96 fjpop-guest 24560 --stringparam base.dir $destdir/html/ \
97 fjpop-guest 21976 $stylesheet_html \
98 fjpop-guest 21995 $tempdir/install.${language}.profiled.xml
99 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
100    
101     return 0
102 pronik-guest 21971 }
103    
104 fjpop-guest 24214 create_text () {
105    
106 fjpop-guest 24223 [ -x /usr/bin/w3m ] || return 9
107 fjpop-guest 24214
108 fjpop-guest 24223 echo "Info: creating temporary .html file..."
109 fjpop-guest 24214
110     /usr/bin/xsltproc \
111     --xinclude \
112     --output $tempdir/install.${language}.html \
113     $stylesheet_html_single \
114     $tempdir/install.${language}.profiled.xml
115 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
116 fjpop-guest 24214
117     # Replace some unprintable characters
118 fjpop-guest 24330 sed "s:–:-:g # n-dash
119     s:—:--:g # m-dash
120     s:“:\&quot;:g # different types of quotes
121     s:”:\&quot;:g
122     s:„:\&quot;:g
123     s:…:...:g # ellipsis
124     s:™: (tm):g # trademark" \
125 fjpop-guest 24223 $tempdir/install.${language}.html >$tempdir/install.${language}.corr.html
126     RET=$?; [ $RET -ne 0 ] && return $RET
127 fjpop-guest 24214
128 fjpop-guest 24223 echo "Info: creating .txt file..."
129 fjpop-guest 24214
130     # Set encoding for output file
131 fjpop-guest 24560 case "$language" in
132 fjpop-guest 24214 cs)
133 fjpop-guest 26533 CHARSET=ISO-8859-2 ;;
134 fjpop-guest 24214 ja)
135 fjpop-guest 26533 CHARSET=EUC-JP ;;
136     ko)
137     CHARSET=EUC-KR ;;
138 fjpop-guest 24214 ru)
139 fjpop-guest 26533 CHARSET=KOI8-R ;;
140 fjpop-guest 26971 el|zh_CN)
141     CHARSET=UTF-8 ;;
142 fjpop-guest 24214 *)
143 fjpop-guest 26533 CHARSET=ISO-8859-1 ;;
144 fjpop-guest 24214 esac
145    
146 fjpop-guest 24223 /usr/bin/w3m -dump $tempdir/install.${language}.corr.html \
147 fjpop-guest 24214 -o display_charset=$CHARSET \
148 fjpop-guest 24560 >$destdir/install.${language}.txt
149 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
150    
151 fjpop-guest 26533 # Ugly hack because w3m does not compute width for table borders correctly
152     # for oriental character sets.
153     # Output is not perfect, but a lot better than when uncorrected
154     case "$language" in
155     ja)
156     mv $destdir/install.${language}.txt $tempdir
157 fjpop-guest 26569 sed "s:¨£:¨£¨¡:g
158     s:¨¨:¨¨¨¡:g
159     s:¨¤:¨¡¨¤:g
160     s:¨§:¨§¨¡:g
161     s:¨«:¨«¨¡:g
162     s:¨©:¨¡¨©:g
163     s:¨¦:¨¦¨¡:g
164     s:¨ª:¨ª¨¡:g
165     s:¨¥:¨¡¨¥:g
166     s:¨¢$: ¨¢:g
167     s:¨¡:¨¡¨¡:g
168     s:¨¢:¨¢ :g" \
169 fjpop-guest 26533 $tempdir/install.${language}.txt >$destdir/install.${language}.txt
170     ;;
171     ko)
172     mv $destdir/install.${language}.txt $tempdir
173 fjpop-guest 26569 sed "s:¦£:¦£¦¡:g
174     s:¦¨:¦¨¦¡:g
175     s:¦¤:¦¡¦¤:g
176     s:¦§:¦§¦¡:g
177     s:¦«:¦«¦¡:g
178     s:¦©:¦¡¦©:g
179     s:¦¦:¦¦¦¡:g
180     s:¦ª:¦ª¦¡:g
181     s:¦¥:¦¡¦¥:g
182     s:¦¢$: ¦¢:g
183     s:¦¡:¦¡¦¡:g
184     s:¦¢:¦¢ :g" \
185 fjpop-guest 26533 $tempdir/install.${language}.txt >$destdir/install.${language}.txt
186     ;;
187     esac
188    
189 fjpop-guest 24223 return 0
190 fjpop-guest 24214 }
191    
192 fjpop-guest 23385 create_dvi () {
193 pronik-guest 22108
194 fjpop-guest 24223 [ -x /usr/bin/openjade ] || return 9
195     [ -x /usr/bin/jadetex ] || return 9
196    
197 fjpop-guest 23368 # Skip this step if the .dvi file already exists
198 fjpop-guest 24560 [ -f "$tempdir/install.${language}.dvi" ] && return
199 fjpop-guest 23368
200 fjpop-guest 24223 echo "Info: creating temporary .tex file..."
201 fjpop-guest 21976
202 fjpop-guest 23381 # And use openjade to generate a .tex file
203 fjpop-guest 23368 export SP_ENCODING="utf-8"
204     /usr/bin/openjade -t tex \
205     -b utf-8 \
206     -o $tempdir/install.${language}.tex \
207     -d $stylesheet_dsssl \
208     -V tex-backend \
209     $tempdir/install.${language}.profiled.xml
210 fjpop-guest 25031 RET=$?; [ $RET -ne 0 ] && return $RET
211 fjpop-guest 23368
212 fjpop-guest 24223 echo "Info: creating temporary .dvi file..."
213 fjpop-guest 23368
214     # Next we use jadetext to generate a .dvi file
215 fjpop-guest 24223 # This needs three passes to properly generate the index (page numbering)
216 fjpop-guest 23368 cd $tempdir
217     for PASS in 1 2 3 ; do
218     /usr/bin/jadetex install.${language}.tex >/dev/null
219 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && break
220 fjpop-guest 23368 done
221     cd ..
222 fjpop-guest 24223 [ $RET -ne 0 ] && return $RET
223    
224     return 0
225 pronik-guest 22108 }
226 pronik-guest 21971
227 pronik-guest 22108 create_pdf() {
228    
229 fjpop-guest 24223 [ -x /usr/bin/dvipdf ] || return 9
230    
231 pronik-guest 22108 create_dvi
232 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
233 fjpop-guest 23368
234 fjpop-guest 24223 echo "Info: creating .pdf file..."
235 fjpop-guest 23368
236     /usr/bin/dvipdf $tempdir/install.${language}.dvi
237 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
238 fjpop-guest 24560 mv install.${language}.pdf $destdir/
239 fjpop-guest 24223
240     return 0
241 pronik-guest 22108 }
242    
243     create_ps() {
244    
245 fjpop-guest 24223 [ -x /usr/bin/dvips ] || return 9
246    
247 pronik-guest 22108 create_dvi
248 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
249 fjpop-guest 23368
250 fjpop-guest 24223 echo "Info: creating .ps file..."
251 fjpop-guest 23368
252     /usr/bin/dvips -q $tempdir/install.${language}.dvi
253 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
254 fjpop-guest 24560 mv install.${language}.ps $destdir/
255 fjpop-guest 24223
256     return 0
257 pronik-guest 22108 }
258    
259 fjpop-guest 23368 ## MAINLINE
260    
261     # Clean old builds
262     rm -rf $tempdir
263 fjpop-guest 24560 rm -rf $destdir
264 fjpop-guest 23368
265 fjpop-guest 24560 [ -d "$manual_path/$language" ] || {
266     echo "Error: unknown language '$language'"
267 fjpop-guest 23368 exit 1
268     }
269    
270 pronik-guest 21971 mkdir -p $tempdir
271 fjpop-guest 24560 mkdir -p $destdir
272 pronik-guest 21971
273 fjpop-guest 24223 # Create profiled XML. This is needed for all output formats.
274     create_profiled
275     RET=$?; [ $RET -ne 0 ] && exit 1
276    
277     BUILD_OK=""
278     BUILD_FAIL=""
279 fjpop-guest 23368 for format in $formats ; do
280 fjpop-guest 26980 if [ "$language" = "el" -o "$language" = "ja" -o "$language" = "ko" -o "$language" = "zh_CN" ] && \
281 fjpop-guest 26533 [ "$format" = "pdf" -o "$format" = "ps" ] ; then
282 fjpop-guest 26980 echo "Warning: pdf and ps formats are currently not supported for Chinese, Greek, Japanese and Korean"
283 fjpop-guest 24223 BUILD_SKIP="$BUILD_SKIP $format"
284     continue
285     fi
286    
287 fjpop-guest 23368 case $format in
288 fjpop-guest 23385 html) create_html;;
289     ps) create_ps;;
290     pdf) create_pdf;;
291 fjpop-guest 24214 txt) create_text;;
292 fjpop-guest 24223 *)
293     echo "Error: format $format unknown or not yet supported!"
294     exit 1
295     ;;
296     esac
297 pronik-guest 21971
298 fjpop-guest 24223 RET=$?
299     case $RET in
300     0)
301     BUILD_OK="$BUILD_OK $format"
302     ;;
303     9)
304     BUILD_FAIL="$BUILD_FAIL $format"
305     echo "Error: build of $format failed because of missing build dependencies"
306     ;;
307     *)
308     BUILD_FAIL="$BUILD_FAIL $format"
309     echo "Error: build of $format failed with error code $RET"
310     ;;
311 fjpop-guest 23368 esac
312     done
313 pronik-guest 21971
314 fjpop-guest 23368 # Clean up
315 fjpop-guest 24364 rm -r $tempdir
316 fjpop-guest 23368
317 fjpop-guest 24223 # Evaluate the overall results
318     [ -n "$BUILD_SKIP" ] && echo "Info: The following formats were skipped:$BUILD_SKIP"
319     [ -z "$BUILD_FAIL" ] && exit 0 # Build successful for all formats
320     echo "Warning: The following formats failed to build:$BUILD_FAIL"
321     [ -n "$BUILD_OK" ] && exit 2 # Build failed for some formats
322     exit 1 # Build failed for all formats

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5