~brian-sidebotham/wxwidgets-cmake/wxpython-2.9.4

« back to all changes in this revision

Viewing changes to docs/doxygen/regen.sh

  • Committer: Brian Sidebotham
  • Date: 2013-08-03 14:30:08 UTC
  • Revision ID: brian.sidebotham@gmail.com-20130803143008-c7806tkych1tp6fc
Initial import into Bazaar

Show diffs side-by-side

added added

removed removed

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