]> git.saurik.com Git - wxWidgets.git/blame - docs/doxygen/regen.sh
Compilation fix for wxMSW build without PCH.
[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
e5156137 23export WXWIDGETS=`cd ../.. && pwd`
aa6ec1d7 24
a7c93f3f 25# prepare folders for the cp commands below
85e43f4e 26mkdir -p out/html # we need to copy files in this folder below
7a118965 27mkdir -p 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 32cp images/powered-by-wxwidgets.png out/html
cb2996e2 33cp images/logo_*.png out/html
ef7f03ad 34cp images/tab_*.gif out/html
7a118965
FM
35cp images/wxmsw/*png out/html/wxmsw
36cp images/wxmac/*png out/html/wxmac
37cp images/wxgtk/*png out/html/wxgtk
20a886a3 38cp wxwidgets.js out/html
d513b59d 39
ef7f03ad 40# these CSS are not automatically copied by Doxygen because they're
d513b59d
FM
41# included by our custom html header...
42cp wxwidgets.css out/html
ef7f03ad 43cp wxtabs.css out/html
d513b59d 44
a7c93f3f
FM
45# which configuration should we use?
46if [[ -z "$1" ]]; then
66e09890 47 cfgfile="Doxyfile_all"
a7c93f3f 48else
66e09890 49 cfgfile="Doxyfile_$1"
a7c93f3f
FM
50fi
51
85e43f4e
FM
52#
53# NOW RUN DOXYGEN
54#
55# NB: we do this _after_ copying the required files to the output folders
56# otherwise when generating the CHM file with Doxygen, those files are
57# not included!
58#
85e43f4e
FM
59doxygen $cfgfile
60
5590a552
FM
61if [[ "$1" = "qch" ]]; then
62 # we need to add missing files to the .qhp
63 cd out/html
64 qhelpfile="index.qhp"
65
74dda7b2
FM
66 # remove all <file> and <files> tags
67 cat $qhelpfile | grep -v "<file" >temp
5590a552 68
74dda7b2 69 # remove last 4 lines (so we have nothing after the last <keyword> tag)
5590a552 70 lines=$(wc -l < temp)
74dda7b2 71 wanted=`expr $lines - 4`
5590a552
FM
72 head -n $wanted temp >$qhelpfile
73
74dda7b2
FM
74 # generate a list of new <keyword> tags to add to the index file; without
75 # this step in the 'index' tab of Qt assistant the "wxWindow" class is not
76 # present; just "wxWindow::wxWindow" ctor is listed.
77 # NOTE: this operation is not indispensable but produces a QCH easier to use IMO.
78 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
79 cat temp >>$qhelpfile
80 echo " </keywords>" >>$qhelpfile
81 echo " <files>" >>$qhelpfile
82
83 # remove useless files to make the qch slim
84 rm temp *map *md5
5590a552
FM
85
86 # add a <file> tag for _any_ file in out/html folder except the .qhp itself
74dda7b2 87 for f in * */*png; do
5590a552
FM
88 if [[ $f != $qhelpfile ]]; then
89 echo " <file>$f</file>" >>$qhelpfile
90 fi
91 done
92
93 # add ending tags to the qhp file
94 echo " </files>
95 </filterSection>
96</QtHelpProject>" >>$qhelpfile
97
74dda7b2
FM
98 # replace keyword names so that they appear fully-qualified in the
99 # "index" tab of the Qt Assistant; e.g. Fit => wxWindow::Fit
100 # NOTE: this operation is not indispendable but produces a QCH easier to use IMO.
101 sed -e 's/<keyword name="[a-zA-Z:~]*" id="\([a-zA-Z]*::[a-zA-Z~]*\)"/<keyword name="\1" id="\1"/g' <$qhelpfile >temp
102 mv temp $qhelpfile
103
5590a552
FM
104 # last, run qhelpgenerator:
105 cd ../..
106 qhelpgenerator out/html/index.qhp -o out/wx.qch
107fi
108
d513b59d
FM
109# Doxygen has the annoying habit to put the full path of the
110# affected files in the log file; remove it to make the log
111# more readable
112currpath=`pwd`/
2c58a7e7
FM
113interfacepath=`cd ../../interface && pwd`/
114cat doxygen.log | sed -e "s|$currpath||g" -e "s|$interfacepath||g" >temp
4514447c 115
edbbd747
FM
116# Doxygen warnings are not completely sorted for filename; enforce correct sorting:
117cat temp | sort >doxygen.log
118rm temp
4514447c 119
edbbd747 120# return to the original folder from which this script was launched
aa6ec1d7 121cd $current