/[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 64775 - (hide annotations) (download) (as text)
Sat Sep 18 13:25:25 2010 UTC (2 years, 8 months ago) by sthibault
File MIME type: application/x-sh
File size: 9376 byte(s)
Factorize os-specific parameters in build/arch-options.
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_dsssl="$stylesheet_dir/style-print.dsl"
30 fjpop-guest 27855 stylesheet_css="$stylesheet_dir/install.css"
31 pronik-guest 22121
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 joeyh 41850 [ -x "`which xsltproc 2>/dev/null`" ] || 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 27074 if [ -z "$manual_release" ]; then
55 fjp 58386 manual_release="squeeze"
56 fjpop-guest 27074 fi
57 fjp 30374 if [ -z "$manual_target" ]; then
58     manual_target="for_cd"
59     fi
60 fjpop-guest 27074
61 fjpop-guest 23368 # Now we source the profiling information for the selected architecture
62 fjpop-guest 24560 [ -f "arch-options/${arch}" ] || {
63     echo "Error: unknown architecture '$arch'"
64 fjpop-guest 24223 return 1
65 fjpop-guest 23368 }
66     . arch-options/$arch
67 sthibault 64775 os=`dpkg-architecture -a$arch -qDEB_HOST_ARCH_OS 2> /dev/null`
68     . arch-options/$os
69 pronik-guest 21971
70 fjp 36879 # Now we source the profiling information for the current language
71     if [ -f "lang-options/${language}" ]; then
72     . lang-options/$language
73     fi
74    
75 fjpop-guest 23368 # Join all architecture options into one big variable
76 fjp 43642 condition="$fdisk;$network;$boot;$smp;$frontend;$other;$goodies;$unofficial_build;$status;$manual_release"
77 fjp 36879 # Add language options
78     condition="$condition;$optional_paras"
79 fjp 29683 # Add build options for the manual
80 fjp 30374 condition="$condition;$unofficial_build;$status;$manual_release;$manual_target"
81 pronik-guest 21971
82 fjpop-guest 23368 # Write dynamic non-profilable entities into the file
83 pronik-guest 21971 echo "<!-- arch- and lang-specific non-profilable entities -->" > $dynamic
84     echo "<!ENTITY langext \".${language}\">" >> $dynamic
85     echo "<!ENTITY architecture \"${arch}\">" >> $dynamic
86 sthibault 64655 echo "<!ENTITY arch-kernel \"${arch_kernel}\">" >> $dynamic
87 fjp 35329 echo "<!ENTITY arch-listname \"${arch_listname}\">" >> $dynamic
88 sthibault 64716 echo "<!ENTITY arch-porturl \"${arch_porturl}\">" >> $dynamic
89 sthibault 64739 echo "<!ENTITY arch-parttype \"${arch_parttype}\">" >> $dynamic
90 pronik-guest 21971 echo "<!ENTITY altkernelversion \"${altkernelversion}\">" >> $dynamic
91 fjp 28997 echo "<!ENTITY smp-config-section \"${smp_config_section}\">" >> $dynamic
92     echo "<!ENTITY smp-config-option \"${smp_config_option}\">" >> $dynamic
93 fjp 43735 echo "<!ENTITY minimum-memory \"${minimum_memory}&notation-megabytes;\">" >> $dynamic
94 fjp 43782 echo "<!ENTITY minimum-memory-gtk \"${minimum_memory_gtk}&notation-megabytes;\">" >> $dynamic
95 fjp 43735
96 fjpop-guest 24560 sed "s:##SRCPATH##:$source_path:" templates/docstruct.ent >> $dynamic
97 pronik-guest 21971
98 fjpop-guest 23368 sed "s:##LANG##:$language:g" templates/install.xml.template | \
99 fjpop-guest 24560 sed "s:##TEMPDIR##:$tempdir:g" | \
100     sed "s:##ENTPATH##:$entities_path:g" | \
101     sed "s:##SRCPATH##:$source_path:" > $tempdir/install.${language}.xml
102 pronik-guest 21971
103 fjpop-guest 23368 # Create the profiled xml file
104 joeyh 41850 xsltproc \
105 fjpop-guest 23368 --xinclude \
106     --stringparam profile.arch "$archspec" \
107     --stringparam profile.condition "$condition" \
108     --output $tempdir/install.${language}.profiled.xml \
109     $stylesheet_profile \
110     $tempdir/install.${language}.xml
111 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
112    
113     return 0
114 pronik-guest 21971 }
115    
116     create_html () {
117    
118 fjpop-guest 24223 echo "Info: creating .html files..."
119 fjpop-guest 23368
120 joeyh 41850 xsltproc \
121 fjpop-guest 21976 --xinclude \
122 fjpop-guest 24560 --stringparam base.dir $destdir/html/ \
123 fjpop-guest 21976 $stylesheet_html \
124 fjpop-guest 21995 $tempdir/install.${language}.profiled.xml
125 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
126    
127 fjpop-guest 27855 # Copy the custom css stylesheet to the destination directory
128     cp $stylesheet_css $destdir/html/
129    
130 fjpop-guest 24223 return 0
131 pronik-guest 21971 }
132    
133 fjpop-guest 24214 create_text () {
134    
135 joeyh 41850 [ -x "`which w3m 2>/dev/null`" ] || return 9
136 fjpop-guest 24214
137 fjpop-guest 24223 echo "Info: creating temporary .html file..."
138 fjpop-guest 24214
139 joeyh 41850 xsltproc \
140 fjpop-guest 24214 --xinclude \
141     --output $tempdir/install.${language}.html \
142     $stylesheet_html_single \
143     $tempdir/install.${language}.profiled.xml
144 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
145 fjpop-guest 24214
146     # Replace some unprintable characters
147 fjpop-guest 24330 sed "s:–:-:g # n-dash
148     s:—:--:g # m-dash
149     s:“:\&quot;:g # different types of quotes
150     s:”:\&quot;:g
151     s:„:\&quot;:g
152     s:…:...:g # ellipsis
153     s:™: (tm):g # trademark" \
154 fjpop-guest 24223 $tempdir/install.${language}.html >$tempdir/install.${language}.corr.html
155     RET=$?; [ $RET -ne 0 ] && return $RET
156 fjpop-guest 24214
157 fjpop-guest 24223 echo "Info: creating .txt file..."
158 fjpop-guest 24214
159     # Set encoding for output file
160 fjpop-guest 24560 case "$language" in
161 fjp 51253 ru) CHARSET=KOI8-R ;;
162     *) CHARSET=UTF-8 ;;
163 fjpop-guest 24214 esac
164    
165 joeyh 41850 HOME=$tempdir w3m -dump $tempdir/install.${language}.corr.html \
166 fjpop-guest 24214 -o display_charset=$CHARSET \
167 fjpop-guest 24560 >$destdir/install.${language}.txt
168 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
169 fjpop-guest 26533
170 fjpop-guest 24223 return 0
171 fjpop-guest 24214 }
172    
173 fjpop-guest 23385 create_dvi () {
174 pronik-guest 22108
175 joeyh 41850 [ -x "`which openjade 2>/dev/null`" ] || return 9
176     [ -x "`which jadetex 2>/dev/null`" ] || return 9
177 fjpop-guest 24223
178 fjpop-guest 23368 # Skip this step if the .dvi file already exists
179 fjpop-guest 24560 [ -f "$tempdir/install.${language}.dvi" ] && return
180 fjpop-guest 23368
181 fjpop-guest 24223 echo "Info: creating temporary .tex file..."
182 fjpop-guest 21976
183 fjpop-guest 23381 # And use openjade to generate a .tex file
184 fjpop-guest 23368 export SP_ENCODING="utf-8"
185 joeyh 41850 openjade -t tex \
186 fjpop-guest 23368 -b utf-8 \
187     -o $tempdir/install.${language}.tex \
188     -d $stylesheet_dsssl \
189 fjp 34676 -V tex-backend declaration/xml.dcl \
190 fjpop-guest 23368 $tempdir/install.${language}.profiled.xml
191 fjpop-guest 25031 RET=$?; [ $RET -ne 0 ] && return $RET
192 fjpop-guest 23368
193 fjp 40073 # some languages need additional macro
194     case "$language" in
195     ko)
196     mv $tempdir/install.${language}.tex \
197     $tempdir/install.${language}.orig.tex
198     cat templates/header.${language}.tex \
199     $tempdir/install.${language}.orig.tex \
200     > $tempdir/install.${language}.tex
201     rm $tempdir/install.${language}.orig.tex
202     ;;
203     esac
204    
205 fjpop-guest 24223 echo "Info: creating temporary .dvi file..."
206 fjpop-guest 23368
207 fjp 38466 # Next we use jadetex to generate a .dvi file
208 fjpop-guest 24223 # This needs three passes to properly generate the index (page numbering)
209 fjpop-guest 23368 cd $tempdir
210     for PASS in 1 2 3 ; do
211 joeyh 41850 jadetex install.${language}.tex >/dev/null
212 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && break
213 fjpop-guest 23368 done
214     cd ..
215 fjpop-guest 24223 [ $RET -ne 0 ] && return $RET
216    
217     return 0
218 pronik-guest 22108 }
219 pronik-guest 21971
220 pronik-guest 22108 create_pdf() {
221    
222 joeyh 41850 [ -x "`which dvipdf 2>/dev/null`" ] || return 9
223 fjpop-guest 24223
224 pronik-guest 22108 create_dvi
225 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
226 fjpop-guest 23368
227 fjpop-guest 24223 echo "Info: creating .pdf file..."
228 fjpop-guest 23368
229 joeyh 41850 dvipdf $tempdir/install.${language}.dvi
230 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
231 fjpop-guest 24560 mv install.${language}.pdf $destdir/
232 fjpop-guest 24223
233     return 0
234 pronik-guest 22108 }
235    
236     create_ps() {
237    
238 joeyh 41850 [ -x "`which dvips 2>/dev/null`" ] || return 9
239 fjpop-guest 24223
240 pronik-guest 22108 create_dvi
241 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
242 fjpop-guest 23368
243 fjpop-guest 24223 echo "Info: creating .ps file..."
244 fjpop-guest 23368
245 joeyh 41850 dvips -q $tempdir/install.${language}.dvi
246 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
247 fjpop-guest 24560 mv install.${language}.ps $destdir/
248 fjpop-guest 24223
249     return 0
250 pronik-guest 22108 }
251    
252 fjpop-guest 23368 ## MAINLINE
253    
254     # Clean old builds
255     rm -rf $tempdir
256 fjpop-guest 24560 rm -rf $destdir
257 fjpop-guest 23368
258 fjpop-guest 24560 [ -d "$manual_path/$language" ] || {
259     echo "Error: unknown language '$language'"
260 fjpop-guest 23368 exit 1
261     }
262    
263 pronik-guest 21971 mkdir -p $tempdir
264 fjpop-guest 24560 mkdir -p $destdir
265 pronik-guest 21971
266 fjpop-guest 24223 # Create profiled XML. This is needed for all output formats.
267     create_profiled
268     RET=$?; [ $RET -ne 0 ] && exit 1
269    
270     BUILD_OK=""
271     BUILD_FAIL=""
272 fjpop-guest 23368 for format in $formats ; do
273 fjpop-guest 27015 case "$language" in
274 fjp 58686 el|ja|vi|zh_CN|zh_TW)
275 fjpop-guest 27015 if [ "$format" = "pdf" -o "$format" = "ps" ] ; then
276 fjp 40073 echo "Warning: pdf and ps formats are currently not supported for Chinese, Greek, Japanese and Vietnamese"
277 fjpop-guest 27015 BUILD_SKIP="$BUILD_SKIP $format"
278     continue
279     fi
280     ;;
281     esac
282 fjpop-guest 24223
283 fjpop-guest 23368 case $format in
284 fjpop-guest 23385 html) create_html;;
285     ps) create_ps;;
286     pdf) create_pdf;;
287 fjpop-guest 24214 txt) create_text;;
288 fjpop-guest 24223 *)
289     echo "Error: format $format unknown or not yet supported!"
290     exit 1
291     ;;
292     esac
293 pronik-guest 21971
294 fjpop-guest 24223 RET=$?
295     case $RET in
296     0)
297     BUILD_OK="$BUILD_OK $format"
298     ;;
299     9)
300     BUILD_FAIL="$BUILD_FAIL $format"
301     echo "Error: build of $format failed because of missing build dependencies"
302     ;;
303     *)
304     BUILD_FAIL="$BUILD_FAIL $format"
305     echo "Error: build of $format failed with error code $RET"
306     ;;
307 fjpop-guest 23368 esac
308     done
309 pronik-guest 21971
310 fjpop-guest 23368 # Clean up
311 fjp 58686 rm -r $tempdir
312 fjpop-guest 23368
313 fjpop-guest 24223 # Evaluate the overall results
314     [ -n "$BUILD_SKIP" ] && echo "Info: The following formats were skipped:$BUILD_SKIP"
315     [ -z "$BUILD_FAIL" ] && exit 0 # Build successful for all formats
316     echo "Warning: The following formats failed to build:$BUILD_FAIL"
317     [ -n "$BUILD_OK" ] && exit 2 # Build failed for some formats
318     exit 1 # Build failed for all formats

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5