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