]>
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 | |
ff39e2f2 VZ |
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 | |
c0e5edf5 | 32 | if [ "$OSTYPE" = "cygwin" ]; then |
ff39e2f2 | 33 | WXWIDGETS=`cygpath -w $WXWIDGETS` |
c0e5edf5 | 34 | fi |
ff39e2f2 | 35 | export WXWIDGETS |
c0e5edf5 | 36 | fi |
aa6ec1d7 | 37 | |
df30f953 RD |
38 | if [ "$DOXYGEN" = "" ]; then |
39 | DOXYGEN=doxygen | |
40 | fi | |
41 | ||
a7c93f3f | 42 | # prepare folders for the cp commands below |
85e43f4e | 43 | mkdir -p out/html # we need to copy files in this folder below |
ce154616 | 44 | mkdir -p out/html/generic |
4411a6b6 | 45 | |
20a886a3 BP |
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 | |
a7c93f3f | 48 | # custom aliases |
686631c6 | 49 | cp images/generic/*png out/html/generic |
d513b59d | 50 | |
b15e29d6 BP |
51 | # Defaults for settings controlled by this script |
52 | export GENERATE_DOCSET="NO"; | |
53 | export GENERATE_HTML="NO"; | |
54 | export GENERATE_HTMLHELP="NO"; | |
55 | export GENERATE_LATEX="NO"; | |
56 | export GENERATE_QHP="NO"; | |
57 | export GENERATE_XML="NO"; | |
58 | export SEARCHENGINE="NO"; | |
59 | export SERVER_BASED_SEARCH="NO"; | |
60 | ||
61 | # Which format should we generate during this run? | |
62 | case "$1" in | |
63 | all) # All *main* formats, not all formats, here for backwards compat. | |
64 | export GENERATE_HTML="YES"; | |
65 | export GENERATE_HTMLHELP="YES"; | |
66 | export GENERATE_XML="YES"; | |
67 | ;; | |
68 | chm) | |
69 | export GENERATE_HTML="YES"; | |
70 | export GENERATE_HTMLHELP="YES"; | |
71 | ;; | |
72 | docset) | |
73 | export GENERATE_DOCSET="YES"; | |
74 | export GENERATE_HTML="YES"; | |
75 | ;; | |
76 | latex) | |
77 | export GENERATE_LATEX="YES"; | |
78 | ;; | |
79 | php) # HTML, but with PHP Search Engine | |
80 | export GENERATE_HTML="YES"; | |
81 | export SEARCHENGINE="YES"; | |
82 | export SERVER_BASED_SEARCH="YES"; | |
83 | ;; | |
84 | qch) | |
85 | export GENERATE_HTML="YES"; | |
86 | export GENERATE_QHP="YES"; | |
87 | ;; | |
88 | xml) | |
89 | export GENERATE_XML="YES"; | |
90 | ;; | |
91 | *) # Default to HTML only | |
92 | export GENERATE_HTML="YES"; | |
93 | export SEARCHENGINE="YES"; | |
94 | ;; | |
95 | esac | |
a7c93f3f | 96 | |
85e43f4e FM |
97 | # |
98 | # NOW RUN DOXYGEN | |
99 | # | |
100 | # NB: we do this _after_ copying the required files to the output folders | |
101 | # otherwise when generating the CHM file with Doxygen, those files are | |
102 | # not included! | |
103 | # | |
b15e29d6 | 104 | $DOXYGEN Doxyfile |
85e43f4e | 105 | |
5590a552 FM |
106 | if [[ "$1" = "qch" ]]; then |
107 | # we need to add missing files to the .qhp | |
108 | cd out/html | |
109 | qhelpfile="index.qhp" | |
110 | ||
74dda7b2 FM |
111 | # remove all <file> and <files> tags |
112 | cat $qhelpfile | grep -v "<file" >temp | |
5590a552 | 113 | |
74dda7b2 | 114 | # remove last 4 lines (so we have nothing after the last <keyword> tag) |
5590a552 | 115 | lines=$(wc -l < temp) |
74dda7b2 | 116 | wanted=`expr $lines - 4` |
5590a552 FM |
117 | head -n $wanted temp >$qhelpfile |
118 | ||
74dda7b2 FM |
119 | # generate a list of new <keyword> tags to add to the index file; without |
120 | # this step in the 'index' tab of Qt assistant the "wxWindow" class is not | |
121 | # present; just "wxWindow::wxWindow" ctor is listed. | |
122 | # NOTE: this operation is not indispensable but produces a QCH easier to use IMO. | |
123 | 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 | |
124 | cat temp >>$qhelpfile | |
125 | echo " </keywords>" >>$qhelpfile | |
126 | echo " <files>" >>$qhelpfile | |
127 | ||
128 | # remove useless files to make the qch slim | |
129 | rm temp *map *md5 | |
5590a552 FM |
130 | |
131 | # add a <file> tag for _any_ file in out/html folder except the .qhp itself | |
74dda7b2 | 132 | for f in * */*png; do |
5590a552 FM |
133 | if [[ $f != $qhelpfile ]]; then |
134 | echo " <file>$f</file>" >>$qhelpfile | |
135 | fi | |
136 | done | |
137 | ||
138 | # add ending tags to the qhp file | |
139 | echo " </files> | |
140 | </filterSection> | |
141 | </QtHelpProject>" >>$qhelpfile | |
142 | ||
74dda7b2 FM |
143 | # replace keyword names so that they appear fully-qualified in the |
144 | # "index" tab of the Qt Assistant; e.g. Fit => wxWindow::Fit | |
145 | # NOTE: this operation is not indispendable but produces a QCH easier to use IMO. | |
146 | sed -e 's/<keyword name="[a-zA-Z:~]*" id="\([a-zA-Z]*::[a-zA-Z~]*\)"/<keyword name="\1" id="\1"/g' <$qhelpfile >temp | |
147 | mv temp $qhelpfile | |
148 | ||
5590a552 FM |
149 | # last, run qhelpgenerator: |
150 | cd ../.. | |
151 | qhelpgenerator out/html/index.qhp -o out/wx.qch | |
152 | fi | |
153 | ||
eaa9e06d SC |
154 | if [[ "$1" = "docset" ]]; then |
155 | DOCSETNAME="org.wxwidgets.doxygen.wx29.docset" | |
156 | ATOM="org.wxwidgets.doxygen.docset.wx29.atom" | |
157 | ATOMDIR="http://docs.wxwidgets.org/docsets" | |
158 | XAR="org.wxwidgets.doxygen.docset.wx29.xar" | |
159 | XARDIR="http://docs.wxwidgets.org/docsets" | |
160 | XCODE_INSTALL=`sh xcode-select -print-path` | |
161 | ||
eaa9e06d SC |
162 | cd out/html |
163 | DESTINATIONDIR=`pwd` | |
164 | ||
165 | rm -rf $DESTINATIONDIR/$DOCSETNAME | |
166 | rm -f $DESTINATIONDIR/$XAR | |
167 | ||
168 | make | |
169 | ||
170 | defaults write $DESTINATIONDIR/$DOCSETNAME/Contents/Info CFBundleVersion 1.3 | |
171 | defaults write $DESTINATIONDIR/$DOCSETNAME/Contents/Info CFBundleShortVersionString 1.3 | |
172 | defaults write $DESTINATIONDIR/$DOCSETNAME/Contents/Info CFBundleName "wxWidgets 2.9 Library" | |
173 | defaults write $DESTINATIONDIR/$DOCSETNAME/Contents/Info DocSetFeedURL $ATOMDIR/$ATOM | |
174 | defaults write $DESTINATIONDIR/$DOCSETNAME/Contents/Info DocSetFallbackURL http://docs.wxwidgets.org | |
175 | defaults write $DESTINATIONDIR/$DOCSETNAME/Contents/Info DocSetDescription "API reference and conceptual documentation for wxWidgets 2.9" | |
c5a79f08 | 176 | defaults write $DESTINATIONDIR/$DOCSETNAME/Contents/Info NSHumanReadableCopyright "Copyright 1992-2012 wxWidgets team, Portions 1996 Artificial Intelligence Applications Institute" |
eaa9e06d SC |
177 | |
178 | $XCODE_INSTALL/usr/bin/docsetutil package -atom $DESTINATIONDIR/$ATOM -download-url $XARDIR/$XAR -output $DESTINATIONDIR/$XAR $DESTINATIONDIR/$DOCSETNAME | |
179 | ||
180 | cd ../.. | |
181 | fi | |
182 | ||
d513b59d FM |
183 | # Doxygen has the annoying habit to put the full path of the |
184 | # affected files in the log file; remove it to make the log | |
185 | # more readable | |
186 | currpath=`pwd`/ | |
2c58a7e7 | 187 | interfacepath=`cd ../../interface && pwd`/ |
20004800 BP |
188 | cat doxygen.log | sed -e "s|$currpath||g" -e "s|$interfacepath||g" > temp |
189 | cat temp > doxygen.log | |
edbbd747 | 190 | rm temp |
4514447c | 191 | |
edbbd747 | 192 | # return to the original folder from which this script was launched |
aa6ec1d7 | 193 | cd $current |