4 echo "build_html.sh [-lDFh?]"
5 echo " -l Specify language"
6 echo " -D Enable simple debugging of this script"
7 echo " -F Force makeinfo to build the docs"
10 echo "Build the html version of the manual, including both the single"
11 echo "page version and the multi-page version. This also builds all the"
12 echo "category information."
16 while getopts "h?DFl:" arg
19 l
) language
=$OPTARG ;;
28 if [ "x$language" = "x" ]
31 languagedir
=@abs_srcdir@
33 texiinitfile
=$pwd/@TEXI2HTML@
35 languagedir
=@abs_srcdir@
/$language
37 if [ "$language" = "pt_BR" ]
40 texiinitfile
=$pwd/..
/@TEXI2HTML@
43 echo "$0: abs_srcdir=@abs_srcdir@, pwd=$pwd, language=$language, languagedir=$languagedir, texiinitfile=$texiinitfile"
45 includerfile
=include-maxima.texi
47 # Extract all filenames that are included using @include commands in the order
49 includedfiles
=`@EGREP@ '^[[:space:]]*@include' $includerfile | @AWK@ '{ print $NF; }'`
51 # If output dir exists, remove it so we start clean
52 if [ -d tmp_html
]; then
56 cp -r @abs_srcdir@
/figures tmp_html
57 # "make distcheck" write-protects the source tree. We don't want our
58 # figures to inherit that attribute as we want to delete the temp folder
62 cat include-maxima.texi
> tmp_html
/include-maxima.texi
66 for f
in $includedfiles
68 # Find the absolute path of the current element of $includedfiles
69 if [ -e $languagedir/$f ]
70 then includedfile_absolute
=$languagedir/$f
71 else if [ -e @abs_srcdir@
/$f ]
72 then includedfile_absolute
=@abs_srcdir@
/$f
73 else if [ -e ..
/..
/$f ]
74 then includedfile_absolute
=..
/..
/$f
76 then includedfile_absolute
=..
/$f
78 includedfile_absolute
=`pwd`/..
/$f
84 if [ -e $includedfile_absolute ]
86 if [ "X$DEBUG" = "Xyes" ]; then
87 echo "Taking the file $f from the path $includedfile_absolute"
90 echo Error
: File
$f cannot be found.
94 filenamebase
=`echo $includedfile_absolute | @SED@ -e 's/^.*\///;s/\.texi//'`
95 @SED@
-e 's/^@deffnx* *{[^}]*} *\([^[:blank:]]*\).*/@anchor{Item: '$filenamebase'\/deffn\/\1}\
97 -e 's/^@defvrx* *{[^}]*} *\([^[:blank:]]*\).*/@anchor{Item: '$filenamebase'\/defvr\/\1}\
99 -e 's/^@node *\([^,]*\).*/@anchor{Item: '$filenamebase'\/node\/\1}\
100 &/' $includedfile_absolute \
101 | @AWK@
'BEGIN { iftex = 0; } /^@iftex/ {iftex = 1;} {if (!iftex) {print;}} /^@end iftex/ {iftex = 0;}' \
102 | @AWK@
'/@anchor/ {if (!(foo[$0])) {foo[$0] = 1; print;}} !/@anchor/' > $
(basename $includedfile_absolute)
105 catprogname
=make-categories.lisp
108 filenamebase
=`echo $f | @SED@ -e 's/^.*\///;s/\.texi//'`
109 echo "(setq *filenamebase* \"$filenamebase\")"
110 echo "(setq items nil)"
112 done | @AWK@
'!/^@c / && !/^@c$/ && (/^@deffn/ || /^@defvr/ || /^@end deffn/ || /^@end defvr/ || /@category/ || /@node/ || /^.setq .filenamebase/ || /^.setq items nil/)' | @SED@
-f @abs_srcdir@
/extract_categories1.
sed | @AWK@
-f @abs_srcdir@
/extract_categories1.
awk > $catprogname
114 if [ "@DEFAULTLISP@" = "gcl" ]
115 then lispprog
="@GCL_NAME@"
116 lispargs
="-batch -load $catprogname"
117 elif [ "@DEFAULTLISP@" = "clisp" ]
118 then lispprog
="@CLISP_NAME@"
119 lispargs
="$catprogname"
120 elif [ "@DEFAULTLISP@" = "cmucl" ]
121 then lispprog
="@CMUCL_NAME@"
122 lispargs
="-load $catprogname -eval (quit)"
123 elif [ "@DEFAULTLISP@" = "scl" ]
124 then lispprog
="@SCL_NAME@"
125 lispargs
="-load $catprogname -eval (quit)"
126 elif [ "@DEFAULTLISP@" = "ecl" ]
127 then lispprog
="@ECL_NAME@"
128 lispargs
="--shell $catprogname"
129 elif [ "@DEFAULTLISP@" = "ccl64" ]
130 then lispprog
="@CCL64_NAME@"
131 lispargs
="--load $catprogname --eval (quit)"
132 # NOT SURE ABOUT OPENMCL; SAME ARGS AS CCL/CCL64 OR DIFFERENT ??
133 elif [ "@DEFAULTLISP@" = "ccl" -o "@DEFAULTLISP@" = "openmcl" ]
134 then lispprog
="@OPENMCL_NAME@"
135 lispargs
="--load $catprogname --eval (quit)"
136 elif [ "@DEFAULTLISP@" = "sbcl" ]
137 then lispprog
="@SBCL_NAME@"
138 lispargs
="--script $catprogname"
139 elif [ "@DEFAULTLISP@" = "abcl" ]
140 then lispprog
="@JRE@"
141 lispargs
="-jar @ABCL_JAR@ --load $catprogname --eval (quit)"
142 elif [ "@DEFAULTLISP@" = "acl" ]
143 then lispprog
="@ACL_NAME@"
144 lispargs
="-L $catprogname --kill"
146 echo "$0: DEFAULTLISP = @DEFAULTLISP@ not recognized, assume '@DEFAULTLISP@ $catprogname' is acceptable."
147 lispprog
="@DEFAULTLISP@"
148 lispargs
="$catprogname"
151 echo "$0: execute category program: \"$lispprog\" $lispargs"
152 "$lispprog" $lispargs
154 # Some languages don't have documentation categories so we don't want
155 # to add the extra section if it's going to be empty. So for any
156 # language that has categories, maxima.texi MUST have the line "@c
157 # Include documentation categories" to indicate that we will add the
158 # section to the manual.
159 if @GREP@
-q '^@c Include documentation categories' $languagedir/maxima.texi
; then
160 # Add documentation categories. First, replace @bye with @ifhtml
161 @SED@
-e 's/^@bye/@ifhtml/' $languagedir/maxima.texi
> maxima.texi
163 # Add all Category-*.texi files to maxima.texi.
164 # If there aren't any the file named "Category-*.texi" cannot be found
165 # and therefore will be excluded by the 'if'.
166 ( for f
in Category-
*.texi
; do
171 # Done with categories files, so close the @ifhtml and mark the end
172 # of the file with @bye that was removed above.
177 cat $languagedir/maxima.texi
> maxima.texi
180 if [ "X$DEBUG" = "Xyes" ]; then
184 # If NEED_MATHJAX is set by configure, then the version of makeinfo is
185 # too old to support the customization variable HTML_MATH. If so,
186 # don't try to set the variable on the command line. If NEED_MATHJAX
187 # is not set, set the HTML_MATH variable so that makeinfo will include
189 if [ -z "@NEED_MATHJAX@" ]; then
190 SET_HTML_MATH
="--set-customization-variable HTML_MATH=mathjax"
193 # Currently the Russian documentation has errors in it, so we're just
194 # going to force makeinfo to build anyway.
196 # DO NOT do this for the English documentation! Fix the English
197 # documentation so that makeinfo runs without errors!
198 if [ "x$language" = "xru" ]; then
202 # --no-node-files so we don't have thousands of little html files
203 # There should be no errors in the texi files so don't use "--force -e
204 # 10000" to force building the docs. We want to fail building if
205 # there are errors now.
206 TEXIOPT
="$FORCE --html -c OUTPUT_ENCODING_NAME=UTF-8 -e 10000 --document-lang=$language -I . -I $languagedir -I ../.. --css-include=@abs_srcdir@/manual.css -I @abs_srcdir@/figures --init-file $texiinitfile ${SET_HTML_MATH}"
209 @MAKEINFO@
$FORCE --split=chapter
--no-node-files --output="$languagedestdir" $TEXIOPT maxima.texi
211 if [ $rc -ne 0 ]; then
212 echo Failed to build multi-page html docs
215 @MAKEINFO@
$FORCE --no-split --output="$languagedestdir/maxima_singlepage.html" $TEXIOPT maxima.texi
217 if [ $rc -ne 0 ]; then
218 echo Failed to build single page html doc
223 if [ "X$DEBUG" = "Xyes" ]; then
229 if [ "X$DEBUG" != "Xyes" ]; then