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