gdb/contrib/ari/create-web-ari-in-src.sh - gdb

  1. #! /bin/sh

  2. # GDB script to create web ARI page directly from within gdb/ari directory.
  3. #
  4. # Copyright (C) 2012-2015 Free Software Foundation, Inc.
  5. #
  6. # This file is part of GDB.
  7. #
  8. # This program is free software; you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation; either version 3 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. # GNU General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with this program.  If not, see <http://www.gnu.org/licenses/>.

  20. # Determine directory of current script.
  21. scriptpath=`dirname $0`
  22. # If "scriptpath" is a relative path, then convert it to absolute.
  23. if [ "`echo ${scriptpath} | cut -b1`" != '/' ] ; then
  24.     scriptpath="`pwd`/${scriptpath}"
  25. fi

  26. # update-web-ari.sh script wants four parameters
  27. # 1: directory of checkout src or gdb-RELEASE for release sources.
  28. # 2: a temp directory.
  29. # 3: a directory for generated web page.
  30. # 4: The name of the current package, must be gdb here.
  31. # Here we provide default values for these 4 parameters

  32. # srcdir parameter
  33. if [ -z "${srcdir}" ] ; then
  34.   srcdir=${scriptpath}/../../..
  35. fi

  36. # Determine location of a temporary directory to be used by
  37. # update-web-ari.sh script.
  38. if [ -z "${tempdir}" ] ; then
  39.   if [ ! -z "$TMP" ] ; then
  40.     tempdir=$TMP/create-ari
  41.   elif [ ! -z "$TEMP" ] ; then
  42.     tempdir=$TEMP/create-ari
  43.   else
  44.     tempdir=/tmp/create-ari
  45.   fi
  46. fi

  47. # Default location of generate index.hmtl web page.
  48. if [ -z "${webdir}" ] ; then
  49. # Use 'branch' subdir name if Tag contains branch
  50.   if [ -f "${srcdir}/gdb/CVS/Tag" ] ; then
  51.     tagname=`cat "${srcdir}/gdb/CVS/Tag"`
  52.   elif [ -d "${srcdir}/.git" ] ; then
  53.     tagname=`cd ${srcdir} && git rev-parse --abbrev-ref HEAD`
  54.     if test "$tagname" = "master"; then
  55.       tagname=trunk
  56.     fi
  57.   else
  58.     tagname=trunk
  59.   fi
  60.   if [ "${tagname#branch}" != "${tagname}" ] ; then
  61.     subdir=branch
  62.   else
  63.     subdir=trunk
  64.   fi
  65.   webdir=`pwd`/${subdir}/ari
  66. fi

  67. # Launch update-web-ari.sh in same directory as current script.
  68. ${SHELL} ${scriptpath}/update-web-ari.sh ${srcdir} ${tempdir} ${webdir} gdb

  69. if [ -f "${webdir}/index.html" ] ; then
  70.   echo "ARI output can be viewed in file \"${webdir}/index.html\""
  71. else
  72.   echo "ARI script failed to generate file \"${webdir}/index.html\""
  73. fi