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