/[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 42357 - (hide annotations) (download) (as text)
Mon Oct 30 17:18:55 2006 UTC (6 years, 6 months ago) by fjp
File MIME type: application/x-sh
File size: 9280 byte(s)
Add misplaced entry
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 fjpop-guest 27855 stylesheet_css="$stylesheet_dir/install.css"
32 pronik-guest 22121
33 fjpop-guest 23368 entities_path="$build_path/entities"
34     source_path="$manual_path/$language"
35 pronik-guest 22121
36 fjpop-guest 24560 if [ -z "$destdir" ]; then
37     destdir="build.out"
38 pronik-guest 22121 fi
39    
40 fjpop-guest 23368 tempdir="build.tmp"
41 pronik-guest 22121 dynamic="${tempdir}/dynamic.ent"
42    
43 pronik-guest 21971 create_profiled () {
44    
45 joeyh 41850 [ -x "`which xsltproc 2>/dev/null`" ] || return 9
46 fjpop-guest 23368
47 fjpop-guest 24223 echo "Info: creating temporary profiled .xml file..."
48 fjpop-guest 23368
49 pronik-guest 21971 if [ ! "$official_build" ]; then
50 fjpop-guest 21976 unofficial_build="FIXME;unofficial-build"
51 pronik-guest 21971 else
52 fjpop-guest 21976 unofficial_build=""
53 pronik-guest 21971 fi
54    
55 fjpop-guest 27074 if [ -z "$manual_release" ]; then
56 fjp 33725 manual_release="etch"
57 fjpop-guest 27074 fi
58 fjp 30374 if [ -z "$manual_target" ]; then
59     manual_target="for_cd"
60     fi
61 fjpop-guest 27074
62 fjpop-guest 23368 # Now we source the profiling information for the selected architecture
63 fjpop-guest 24560 [ -f "arch-options/${arch}" ] || {
64     echo "Error: unknown architecture '$arch'"
65 fjpop-guest 24223 return 1
66 fjpop-guest 23368 }
67     . arch-options/$arch
68 pronik-guest 21971
69 fjp 36879 # Now we source the profiling information for the current language
70     if [ -f "lang-options/${language}" ]; then
71     . lang-options/$language
72     fi
73    
74 fjpop-guest 23368 # Join all architecture options into one big variable
75 fjp 40980 condition="$fdisk;$network;$boot;$smp;$other;$goodies;$unofficial_build;$status;$manual_release"
76 fjp 36879 # Add language options
77     condition="$condition;$optional_paras"
78 fjp 29683 # Add build options for the manual
79 fjp 30374 condition="$condition;$unofficial_build;$status;$manual_release;$manual_target"
80 fjp 40980 # TODO: Obsoleted, but keep until translations have been updated
81     condition="$condition;common-kpkg"
82 pronik-guest 21971
83 fjpop-guest 23368 # Write dynamic non-profilable entities into the file
84 pronik-guest 21971 echo "<!-- arch- and lang-specific non-profilable entities -->" > $dynamic
85     echo "<!ENTITY langext \".${language}\">" >> $dynamic
86     echo "<!ENTITY architecture \"${arch}\">" >> $dynamic
87     echo "<!ENTITY kernelversion \"${kernelversion}\">" >> $dynamic
88 fjp 35329 echo "<!ENTITY arch-listname \"${arch_listname}\">" >> $dynamic
89 pronik-guest 21971 echo "<!ENTITY altkernelversion \"${altkernelversion}\">" >> $dynamic
90 fjp 28997 echo "<!ENTITY smp-config-section \"${smp_config_section}\">" >> $dynamic
91     echo "<!ENTITY smp-config-option \"${smp_config_option}\">" >> $dynamic
92 fjpop-guest 24560 sed "s:##SRCPATH##:$source_path:" templates/docstruct.ent >> $dynamic
93 pronik-guest 21971
94 fjpop-guest 23368 sed "s:##LANG##:$language:g" templates/install.xml.template | \
95 fjpop-guest 24560 sed "s:##TEMPDIR##:$tempdir:g" | \
96     sed "s:##ENTPATH##:$entities_path:g" | \
97     sed "s:##SRCPATH##:$source_path:" > $tempdir/install.${language}.xml
98 pronik-guest 21971
99 fjpop-guest 23368 # Create the profiled xml file
100 joeyh 41850 xsltproc \
101 fjpop-guest 23368 --xinclude \
102     --stringparam profile.arch "$archspec" \
103     --stringparam profile.condition "$condition" \
104     --output $tempdir/install.${language}.profiled.xml \
105     $stylesheet_profile \
106     $tempdir/install.${language}.xml
107 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
108    
109     return 0
110 pronik-guest 21971 }
111    
112     create_html () {
113    
114 fjpop-guest 24223 echo "Info: creating .html files..."
115 fjpop-guest 23368
116 joeyh 41850 xsltproc \
117 fjpop-guest 21976 --xinclude \
118 fjpop-guest 24560 --stringparam base.dir $destdir/html/ \
119 fjpop-guest 21976 $stylesheet_html \
120 fjpop-guest 21995 $tempdir/install.${language}.profiled.xml
121 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
122    
123 fjpop-guest 27855 # Copy the custom css stylesheet to the destination directory
124     cp $stylesheet_css $destdir/html/
125    
126 fjpop-guest 24223 return 0
127 pronik-guest 21971 }
128    
129 fjpop-guest 24214 create_text () {
130    
131 joeyh 41850 [ -x "`which w3m 2>/dev/null`" ] || return 9
132 fjpop-guest 24214
133 fjpop-guest 24223 echo "Info: creating temporary .html file..."
134 fjpop-guest 24214
135 joeyh 41850 xsltproc \
136 fjpop-guest 24214 --xinclude \
137     --output $tempdir/install.${language}.html \
138     $stylesheet_html_single \
139     $tempdir/install.${language}.profiled.xml
140 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
141 fjpop-guest 24214
142     # Replace some unprintable characters
143 fjpop-guest 24330 sed "s:–:-:g # n-dash
144     s:—:--:g # m-dash
145     s:“:\&quot;:g # different types of quotes
146     s:”:\&quot;:g
147     s:„:\&quot;:g
148     s:…:...:g # ellipsis
149     s:™: (tm):g # trademark" \
150 fjpop-guest 24223 $tempdir/install.${language}.html >$tempdir/install.${language}.corr.html
151     RET=$?; [ $RET -ne 0 ] && return $RET
152 fjpop-guest 24214
153 fjpop-guest 24223 echo "Info: creating .txt file..."
154 fjpop-guest 24214
155     # Set encoding for output file
156 fjpop-guest 24560 case "$language" in
157 fjpop-guest 24214 ja)
158 fjpop-guest 26533 CHARSET=EUC-JP ;;
159     ko)
160     CHARSET=EUC-KR ;;
161 fjpop-guest 24214 ru)
162 fjpop-guest 26533 CHARSET=KOI8-R ;;
163 fjp 39480 cs|el|hu|ro|zh_CN|zh_TW)
164 fjpop-guest 26971 CHARSET=UTF-8 ;;
165 fjpop-guest 24214 *)
166 fjpop-guest 26533 CHARSET=ISO-8859-1 ;;
167 fjpop-guest 24214 esac
168    
169 joeyh 41850 HOME=$tempdir w3m -dump $tempdir/install.${language}.corr.html \
170 fjpop-guest 24214 -o display_charset=$CHARSET \
171 fjpop-guest 24560 >$destdir/install.${language}.txt
172 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
173 fjpop-guest 26533
174 fjpop-guest 24223 return 0
175 fjpop-guest 24214 }
176    
177 fjpop-guest 23385 create_dvi () {
178 pronik-guest 22108
179 joeyh 41850 [ -x "`which openjade 2>/dev/null`" ] || return 9
180     [ -x "`which jadetex 2>/dev/null`" ] || return 9
181 fjpop-guest 24223
182 fjpop-guest 23368 # Skip this step if the .dvi file already exists
183 fjpop-guest 24560 [ -f "$tempdir/install.${language}.dvi" ] && return
184 fjpop-guest 23368
185 fjpop-guest 24223 echo "Info: creating temporary .tex file..."
186 fjpop-guest 21976
187 fjpop-guest 23381 # And use openjade to generate a .tex file
188 fjpop-guest 23368 export SP_ENCODING="utf-8"
189 joeyh 41850 openjade -t tex \
190 fjpop-guest 23368 -b utf-8 \
191     -o $tempdir/install.${language}.tex \
192     -d $stylesheet_dsssl \
193 fjp 34676 -V tex-backend declaration/xml.dcl \
194 fjpop-guest 23368 $tempdir/install.${language}.profiled.xml
195 fjpop-guest 25031 RET=$?; [ $RET -ne 0 ] && return $RET
196 fjpop-guest 23368
197 fjp 40073 # some languages need additional macro
198     case "$language" in
199     ko)
200     mv $tempdir/install.${language}.tex \
201     $tempdir/install.${language}.orig.tex
202     cat templates/header.${language}.tex \
203     $tempdir/install.${language}.orig.tex \
204     > $tempdir/install.${language}.tex
205     rm $tempdir/install.${language}.orig.tex
206     ;;
207     esac
208    
209 fjpop-guest 24223 echo "Info: creating temporary .dvi file..."
210 fjpop-guest 23368
211 fjp 38466 # Next we use jadetex to generate a .dvi file
212 fjpop-guest 24223 # This needs three passes to properly generate the index (page numbering)
213 fjpop-guest 23368 cd $tempdir
214     for PASS in 1 2 3 ; do
215 joeyh 41850 jadetex install.${language}.tex >/dev/null
216 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && break
217 fjpop-guest 23368 done
218     cd ..
219 fjpop-guest 24223 [ $RET -ne 0 ] && return $RET
220    
221     return 0
222 pronik-guest 22108 }
223 pronik-guest 21971
224 pronik-guest 22108 create_pdf() {
225    
226 joeyh 41850 [ -x "`which dvipdf 2>/dev/null`" ] || return 9
227 fjpop-guest 24223
228 pronik-guest 22108 create_dvi
229 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
230 fjpop-guest 23368
231 fjpop-guest 24223 echo "Info: creating .pdf file..."
232 fjpop-guest 23368
233 joeyh 41850 dvipdf $tempdir/install.${language}.dvi
234 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
235 fjpop-guest 24560 mv install.${language}.pdf $destdir/
236 fjpop-guest 24223
237     return 0
238 pronik-guest 22108 }
239    
240     create_ps() {
241    
242 joeyh 41850 [ -x "`which dvips 2>/dev/null`" ] || return 9
243 fjpop-guest 24223
244 pronik-guest 22108 create_dvi
245 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
246 fjpop-guest 23368
247 fjpop-guest 24223 echo "Info: creating .ps file..."
248 fjpop-guest 23368
249 joeyh 41850 dvips -q $tempdir/install.${language}.dvi
250 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
251 fjpop-guest 24560 mv install.${language}.ps $destdir/
252 fjpop-guest 24223
253     return 0
254 pronik-guest 22108 }
255    
256 fjpop-guest 23368 ## MAINLINE
257    
258     # Clean old builds
259     rm -rf $tempdir
260 fjpop-guest 24560 rm -rf $destdir
261 fjpop-guest 23368
262 fjpop-guest 24560 [ -d "$manual_path/$language" ] || {
263     echo "Error: unknown language '$language'"
264 fjpop-guest 23368 exit 1
265     }
266    
267 pronik-guest 21971 mkdir -p $tempdir
268 fjpop-guest 24560 mkdir -p $destdir
269 pronik-guest 21971
270 fjpop-guest 24223 # Create profiled XML. This is needed for all output formats.
271     create_profiled
272     RET=$?; [ $RET -ne 0 ] && exit 1
273    
274     BUILD_OK=""
275     BUILD_FAIL=""
276 fjpop-guest 23368 for format in $formats ; do
277 fjpop-guest 27015 case "$language" in
278 fjp 40073 el|ja|vi|zh_CN|zh_TW)
279 fjpop-guest 27015 if [ "$format" = "pdf" -o "$format" = "ps" ] ; then
280 fjp 40073 echo "Warning: pdf and ps formats are currently not supported for Chinese, Greek, Japanese and Vietnamese"
281 fjpop-guest 27015 BUILD_SKIP="$BUILD_SKIP $format"
282     continue
283     fi
284     ;;
285     esac
286 fjpop-guest 24223
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 fjp 42357 #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