api.sh 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #!/bin/sh
  2. #
  3. # Script to generate API documentation and send it to sf.net
  4. #
  5. # Copyright 2009-2010 Konstantin Dmitriev
  6. # Copyright 2010, 2013 Carlos López
  7. #
  8. # This program is free software; you can redistribute it and/or
  9. # modify it under the terms of the GNU General Public License as
  10. # published by the Free Software Foundation; either version 2 of
  11. # the License, or (at your option) any later version.
  12. #
  13. # This script has been redesigned to be used in a cron work.
  14. # Adapt the following macros to the proper directories values.
  15. export HTMLDIR=$HOME/synfig/synfig-repository/api
  16. #export SOURCEDIR=$HOME/synfig/synfig-repository/code/synfig
  17. export SOURCEDIR=$HOME/synfig/synfig-repository/api/tmp/synfig
  18. set -e
  19. #check for git and doxygen
  20. if ! which git > /dev/null 2>&1; then
  21. echo "Please install git."
  22. exit
  23. fi
  24. if ! which doxygen > /dev/null 2>&1; then
  25. echo "Please install doxygen."
  26. exit
  27. fi
  28. #fetching sources
  29. if [ ! -d $SOURCEDIR ]; then
  30. mkdir -p `dirname $SOURCEDIR`
  31. cd `dirname $SOURCEDIR`
  32. git clone --depth 1 git://github.com/synfig/synfig.git `basename $SOURCEDIR`
  33. fi
  34. mkdir -p $HTMLDIR
  35. cd $SOURCEDIR
  36. git fetch
  37. git reset --hard
  38. git checkout remotes/origin/master
  39. #generating api to htmldir
  40. for module in ETL synfig-core synfig-studio; do
  41. cd $module
  42. echo "Generating API for $module..."
  43. case $module in
  44. ETL)
  45. MODULETITLE='Extended Template Library'
  46. ;;
  47. synfig-core)
  48. MODULETITLE='Synfig Core'
  49. ;;
  50. synfig-studio)
  51. MODULETITLE='Synfig Studio'
  52. ;;
  53. esac
  54. VERSION=`cat configure.ac |egrep "AC_INIT\(\[$MODULETITLE\],"| sed "s|.*$MODULETITLE\],\[||" | sed "s|\],\[.*||"`
  55. VERSION=${VERSION#*\'}
  56. VERSION=${VERSION%\'}
  57. cp -f doxygen.cfg.in doxygen.cfg
  58. sed -i "s/@VERSION@/$VERSION/" doxygen.cfg
  59. sed -i "s/@PACKAGE@/$module/" doxygen.cfg
  60. doxygen doxygen.cfg
  61. rm -rf $HTMLDIR/$module
  62. mv doc/html $HTMLDIR/$module
  63. cp $SOURCEDIR/$module/doxygen.cfg $HTMLDIR/$module
  64. cd ..
  65. done
  66. #index.html
  67. DATE=`date -R`
  68. cat > $HTMLDIR/index.html <<EOF
  69. <html><head><title>ETL, synfig, synfigstudio API docs</title></head>
  70. <body>
  71. <h1>ETL, synfig, synfigstudio API docs</h1>
  72. <ul>
  73. <li><a href="ETL/annotated.html">ETL</a></li>
  74. <li><a href="synfig-core/annotated.html">synfig-core</a></li>
  75. <li><a href="synfig-studio/annotated.html">synfig-studio</a></li>
  76. </ul>
  77. <p>Generated on: $DATE.</p>
  78. </body></html>
  79. EOF