]> git.saurik.com Git - wxWidgets.git/blob - docs/doxygen/regen.sh
4abb91d4af14c8dd1d2f6aa6195f06b4ba4c51be
[wxWidgets.git] / docs / doxygen / regen.sh
1 #!/bin/bash
2 #
3 # $Id$
4 #
5 # This bash script regenerates the HTML doxygen version of the
6 # wxWidgets manual and adjusts the doxygen log to make it more
7 # readable.
8 #
9 # Usage:
10 # ./regen.sh [html|chm|xml|latex|all]
11 #
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").
15 #
16
17
18 # remember current folder and then cd to the docs/doxygen one
19 me=$(basename $0)
20 path=${0%%/$me} # path from which the script has been launched
21 current=$(pwd)
22 cd $path
23 if [[ -z "$WXWIDGETS" ]]; then
24 WXWIDGETS=`cd ../.. && pwd`
25 # Use the real path in case it's a symlink
26 if command -v readlink; then
27 normalized=`readlink -e $WXWIDGETS`
28 if [[ -n $normalized ]]; then
29 WXWIDGETS=$normalized
30 fi
31 fi
32 if [ "$OSTYPE" = "cygwin" ]; then
33 WXWIDGETS=`cygpath -w $WXWIDGETS`
34 fi
35 export WXWIDGETS
36 fi
37
38 if [ "$DOXYGEN" = "" ]; then
39 DOXYGEN=doxygen
40 fi
41
42 # prepare folders for the cp commands below
43 mkdir -p out/html # we need to copy files in this folder below
44 mkdir -p out/html/generic out/html/wxmsw out/html/wxgtk out/html/wxmac
45
46 # These are not automatically copied by Doxygen because they're not
47 # used in doxygen documentation, only in our html footer and by our
48 # custom aliases
49 cp images/powered-by-wxwidgets.png out/html
50 cp images/wxmsw/*png out/html/wxmsw
51 cp images/wxmac/*png out/html/wxmac
52 cp images/wxgtk/*png out/html/wxgtk
53 cp images/generic/*png out/html/generic
54 cp wxwidgets.js out/html
55
56 # which configuration should we use?
57 if [[ -z "$1" ]]; then
58 cfgfile="Doxyfile_all"
59 else
60 cfgfile="Doxyfile_$1"
61 fi
62
63 #
64 # NOW RUN DOXYGEN
65 #
66 # NB: we do this _after_ copying the required files to the output folders
67 # otherwise when generating the CHM file with Doxygen, those files are
68 # not included!
69 #
70 $DOXYGEN $cfgfile
71
72 if [[ "$1" = "qch" ]]; then
73 # we need to add missing files to the .qhp
74 cd out/html
75 qhelpfile="index.qhp"
76
77 # remove all <file> and <files> tags
78 cat $qhelpfile | grep -v "<file" >temp
79
80 # remove last 4 lines (so we have nothing after the last <keyword> tag)
81 lines=$(wc -l < temp)
82 wanted=`expr $lines - 4`
83 head -n $wanted temp >$qhelpfile
84
85 # generate a list of new <keyword> tags to add to the index file; without
86 # this step in the 'index' tab of Qt assistant the "wxWindow" class is not
87 # present; just "wxWindow::wxWindow" ctor is listed.
88 # NOTE: this operation is not indispensable but produces a QCH easier to use IMO.
89 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
90 cat temp >>$qhelpfile
91 echo " </keywords>" >>$qhelpfile
92 echo " <files>" >>$qhelpfile
93
94 # remove useless files to make the qch slim
95 rm temp *map *md5
96
97 # add a <file> tag for _any_ file in out/html folder except the .qhp itself
98 for f in * */*png; do
99 if [[ $f != $qhelpfile ]]; then
100 echo " <file>$f</file>" >>$qhelpfile
101 fi
102 done
103
104 # add ending tags to the qhp file
105 echo " </files>
106 </filterSection>
107 </QtHelpProject>" >>$qhelpfile
108
109 # replace keyword names so that they appear fully-qualified in the
110 # "index" tab of the Qt Assistant; e.g. Fit => wxWindow::Fit
111 # NOTE: this operation is not indispendable but produces a QCH easier to use IMO.
112 sed -e 's/<keyword name="[a-zA-Z:~]*" id="\([a-zA-Z]*::[a-zA-Z~]*\)"/<keyword name="\1" id="\1"/g' <$qhelpfile >temp
113 mv temp $qhelpfile
114
115 # last, run qhelpgenerator:
116 cd ../..
117 qhelpgenerator out/html/index.qhp -o out/wx.qch
118 fi
119
120 if [[ "$1" = "docset" ]]; then
121 DOCSETNAME="org.wxwidgets.doxygen.wx29.docset"
122 ATOM="org.wxwidgets.doxygen.docset.wx29.atom"
123 ATOMDIR="http://docs.wxwidgets.org/docsets"
124 XAR="org.wxwidgets.doxygen.docset.wx29.xar"
125 XARDIR="http://docs.wxwidgets.org/docsets"
126 XCODE_INSTALL=`sh xcode-select -print-path`
127
128 cp wxdocsettabs.css out/html/wxtabs.css
129 cp wxdocsetwidgets.css out/html/wxwidgets.css
130 cp img_downArrow.png out/html
131 cp background_navigation.png out/html
132
133 cd out/html
134 DESTINATIONDIR=`pwd`
135
136 rm -rf $DESTINATIONDIR/$DOCSETNAME
137 rm -f $DESTINATIONDIR/$XAR
138
139 make
140
141 defaults write $DESTINATIONDIR/$DOCSETNAME/Contents/Info CFBundleVersion 1.3
142 defaults write $DESTINATIONDIR/$DOCSETNAME/Contents/Info CFBundleShortVersionString 1.3
143 defaults write $DESTINATIONDIR/$DOCSETNAME/Contents/Info CFBundleName "wxWidgets 2.9 Library"
144 defaults write $DESTINATIONDIR/$DOCSETNAME/Contents/Info DocSetFeedURL $ATOMDIR/$ATOM
145 defaults write $DESTINATIONDIR/$DOCSETNAME/Contents/Info DocSetFallbackURL http://docs.wxwidgets.org
146 defaults write $DESTINATIONDIR/$DOCSETNAME/Contents/Info DocSetDescription "API reference and conceptual documentation for wxWidgets 2.9"
147 defaults write $DESTINATIONDIR/$DOCSETNAME/Contents/Info NSHumanReadableCopyright "Copyright 1992-2011 wxWidgets team, Portions 1996 Artificial Intelligence Applications Institute"
148
149 $XCODE_INSTALL/usr/bin/docsetutil package -atom $DESTINATIONDIR/$ATOM -download-url $XARDIR/$XAR -output $DESTINATIONDIR/$XAR $DESTINATIONDIR/$DOCSETNAME
150
151 cd ../..
152 fi
153
154 # Doxygen has the annoying habit to put the full path of the
155 # affected files in the log file; remove it to make the log
156 # more readable
157 currpath=`pwd`/
158 interfacepath=`cd ../../interface && pwd`/
159 cat doxygen.log | sed -e "s|$currpath||g" -e "s|$interfacepath||g" > temp
160 cat temp > doxygen.log
161 rm temp
162
163 # return to the original folder from which this script was launched
164 cd $current