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