API generation script update.
[synfig.git] / autobuild / api.sh
1 #!/bin/sh
2 #
3 # Script to generate API documentation and send it to sf.net
4 #
5 # Copyright 2009 Konstantin Dmitriev
6 #
7 # This program is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License as
9 # published by the Free Software Foundation; either version 2 of
10 # the License, or (at your option) any later version.
11
12 export HTMLDIR=$HOME/synfig/api/html
13 export SOURCEDIR=$HOME/synfig/api/source
14
15 set -e
16
17 #check for git and doxygen
18 if ! which git > /dev/null 2>&1; then
19         echo "Please install git."
20         exit
21 fi
22 if ! which doxygen > /dev/null 2>&1; then
23         echo "Please install doxygen."
24         exit
25 fi
26
27 #fetching sources
28 if [ ! -d $SOURCEDIR ]; then
29         mkdir -p `dirname $SOURCEDIR`
30         cd `dirname $SOURCEDIR`
31         git clone git://synfig.git.sourceforge.net/gitroot/synfig `basename $SOURCEDIR`
32 fi
33
34 getversion(){
35         VERSION=`cat configure| egrep PACKAGE_VERSION=\'`
36         VERSION=${VERSION#*\'}
37         VERSION=${VERSION%\'}
38 }
39
40 mkdir -p $HTMLDIR
41
42 cd $SOURCEDIR
43 git fetch
44 git checkout remotes/origin/master
45
46 #generating api to htmldir
47 for module in ETL synfig-core synfig-studio; do
48 cd $module/trunk
49 echo "Generating API for $module..."
50 autoreconf --install --force || ( sed -i 's/^AC_CONFIG_SUBDIRS/# AC_CONFIG_SUBDIRS/' configure.ac && autoreconf --install --force )
51 getversion
52 cp -f doxygen.cfg.in doxygen.cfg
53 sed -i "s/@VERSION@/$VERSION/" doxygen.cfg
54 sed -i "s/@PACKAGE@/$module/" doxygen.cfg
55 doxygen doxygen.cfg
56 rm -rf $HTMLDIR/$module
57 mv doc/html $HTMLDIR/$module
58 cp $SOURCEDIR/$module/trunk/doxygen.cfg $HTMLDIR/$module
59 cd ../..
60 done
61
62 #index.html
63 DATE=`date -R`
64 cat > $HTMLDIR/index.html <<EOF
65 <html><head><title>ETL, synfig, synfigstudio API docs</title></head>
66 <body>
67 <h1>ETL, synfig, synfigstudio API docs</h1>
68 <ul>
69 <li><a href="ETL/">ETL</a></li>
70 <li><a href="synfig/">synfig</a></li>
71 <li><a href="synfigstudio/">synfigstudio</a></li>
72 </ul>
73 <p>Generated on: $DATE.</p>
74 </body></html>
75 EOF
76
77 #beep (because we asking password)
78 echo -e "\a"; sleep 0.2; echo -e "\a"; sleep 0.2; echo -e "\a"
79
80 echo -n "Enter your sf.net username: "
81 read USERNAME
82
83 #push to sf.net
84 rsync -avP -e ssh $HTMLDIR/ $USERNAME,synfig@web.sourceforge.net:htdocs/api/
85