5 # This bash script regenerates the HTML doxygen version of the
6 # wxWidgets manual and adjusts the doxygen log to make it more
10 # ./regen.sh [html|chm|xml|latex|all]
12 # Pass "x" to regen only the X output format and "all" to regen them all.
13 # If no arguments are passed all formats are regenerated
14 # (just like passing "all").
18 # remember current folder and then cd to the docs/doxygen one
20 path
=${0%%/$me} # path from which the script has been launched
23 if [[ -z "$WXWIDGETS" ]]; then
24 # Notice the use of -P to ensure we get the canonical path even if there
25 # are symlinks in the current path. This is important because Doxygen
26 # strips this string from the paths in the generated files textually and it
27 # wouldn't work if it contained symlinks.
28 WXWIDGETS
=`cd ../.. && pwd -P`
29 if [ "$OSTYPE" = "cygwin" ]; then
30 WXWIDGETS
=`cygpath -w $WXWIDGETS`
35 if [ "$DOXYGEN" = "" ]; then
39 # prepare folders for the cp commands below
40 mkdir -p out
/html
# we need to copy files in this folder below
41 mkdir -p out
/html
/generic
43 # These are not automatically copied by Doxygen because they're not
44 # used in doxygen documentation, only in our html footer and by our
46 cp images
/generic
/*png out
/html
/generic
48 # Defaults for settings controlled by this script
49 export GENERATE_DOCSET
="NO";
50 export GENERATE_HTML
="NO";
51 export GENERATE_HTMLHELP
="NO";
52 export GENERATE_LATEX
="NO";
53 export GENERATE_QHP
="NO";
54 export GENERATE_XML
="NO";
55 export SEARCHENGINE
="NO";
56 export SERVER_BASED_SEARCH
="NO";
58 # Which format should we generate during this run?
60 all
) # All *main* formats, not all formats, here for backwards compat.
61 export GENERATE_HTML
="YES";
62 export GENERATE_HTMLHELP
="YES";
63 export GENERATE_XML
="YES";
66 export GENERATE_HTML
="YES";
67 export GENERATE_HTMLHELP
="YES";
70 export GENERATE_DOCSET
="YES";
71 export GENERATE_HTML
="YES";
74 export GENERATE_LATEX
="YES";
76 php
) # HTML, but with PHP Search Engine
77 export GENERATE_HTML
="YES";
78 export SEARCHENGINE
="YES";
79 export SERVER_BASED_SEARCH
="YES";
82 export GENERATE_HTML
="YES";
83 export GENERATE_QHP
="YES";
86 export GENERATE_XML
="YES";
88 *) # Default to HTML only
89 export GENERATE_HTML
="YES";
90 export SEARCHENGINE
="YES";
97 # NB: we do this _after_ copying the required files to the output folders
98 # otherwise when generating the CHM file with Doxygen, those files are
103 if [[ "$1" = "qch" ]]; then
104 # we need to add missing files to the .qhp
106 qhelpfile
="index.qhp"
108 # remove all <file> and <files> tags
109 cat $qhelpfile | grep -v "<file" >temp
111 # remove last 4 lines (so we have nothing after the last <keyword> tag)
112 lines
=$(wc -l < temp)
113 wanted
=`expr $lines - 4`
114 head -n $wanted temp
>$qhelpfile
116 # generate a list of new <keyword> tags to add to the index file; without
117 # this step in the 'index' tab of Qt assistant the "wxWindow" class is not
118 # present; just "wxWindow::wxWindow" ctor is listed.
119 # NOTE: this operation is not indispensable but produces a QCH easier to use IMO.
120 sed -e 's/<keyword name="wx[a-zA-Z~]*" id="wx\([a-zA-Z]*\)::[a-zA-Z~]*" ref="\([a-z_]*.html\)#.*"/<keyword name="wx\1" id="wx\1" ref="\2"/g' < $qhelpfile | grep "<keyword name=\"wx" | uniq >temp
121 cat temp
>>$qhelpfile
122 echo " </keywords>" >>$qhelpfile
123 echo " <files>" >>$qhelpfile
125 # remove useless files to make the qch slim
128 # add a <file> tag for _any_ file in out/html folder except the .qhp itself
129 for f
in * */*png
; do
130 if [[ $f != $qhelpfile ]]; then
131 echo " <file>$f</file>" >>$qhelpfile
135 # add ending tags to the qhp file
138 </QtHelpProject>" >>$qhelpfile
140 # replace keyword names so that they appear fully-qualified in the
141 # "index" tab of the Qt Assistant; e.g. Fit => wxWindow::Fit
142 # NOTE: this operation is not indispendable but produces a QCH easier to use IMO.
143 sed -e 's/<keyword name="[a-zA-Z:~]*" id="\([a-zA-Z]*::[a-zA-Z~]*\)"/<keyword name="\1" id="\1"/g' <$qhelpfile >temp
146 # last, run qhelpgenerator:
148 qhelpgenerator out
/html
/index.qhp
-o out
/wx.qch
151 if [[ "$1" = "docset" ]]; then
152 DOCSETNAME
="org.wxwidgets.doxygen.wx29.docset"
153 ATOM
="org.wxwidgets.doxygen.docset.wx29.atom"
154 ATOMDIR
="http://docs.wxwidgets.org/docsets"
155 XAR
="org.wxwidgets.doxygen.docset.wx29.xar"
156 XARDIR
="http://docs.wxwidgets.org/docsets"
157 XCODE_INSTALL
=`sh xcode-select -print-path`
162 rm -rf $DESTINATIONDIR/$DOCSETNAME
163 rm -f $DESTINATIONDIR/$XAR
167 defaults
write $DESTINATIONDIR/$DOCSETNAME/Contents
/Info CFBundleVersion
1.3
168 defaults
write $DESTINATIONDIR/$DOCSETNAME/Contents
/Info CFBundleShortVersionString
1.3
169 defaults
write $DESTINATIONDIR/$DOCSETNAME/Contents
/Info CFBundleName
"wxWidgets 2.9 Library"
170 defaults
write $DESTINATIONDIR/$DOCSETNAME/Contents
/Info DocSetFeedURL
$ATOMDIR/$ATOM
171 defaults
write $DESTINATIONDIR/$DOCSETNAME/Contents
/Info DocSetFallbackURL http
://docs.wxwidgets.org
172 defaults
write $DESTINATIONDIR/$DOCSETNAME/Contents
/Info DocSetDescription
"API reference and conceptual documentation for wxWidgets 2.9"
173 defaults
write $DESTINATIONDIR/$DOCSETNAME/Contents
/Info NSHumanReadableCopyright
"Copyright 1992-2012 wxWidgets team, Portions 1996 Artificial Intelligence Applications Institute"
175 $XCODE_INSTALL/usr
/bin
/docsetutil package
-atom $DESTINATIONDIR/$ATOM -download-url $XARDIR/$XAR -output $DESTINATIONDIR/$XAR $DESTINATIONDIR/$DOCSETNAME
180 # Doxygen has the annoying habit to put the full path of the
181 # affected files in the log file; remove it to make the log
184 interfacepath
=`cd ../../interface && pwd`/
185 cat doxygen.log
| sed -e "s|$currpath||g" -e "s|$interfacepath||g" > temp
186 cat temp
> doxygen.log
189 # return to the original folder from which this script was launched