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