1#! /bin/sh 2 3# GDB script to create web ARI page directly from within gdb/ari directory. 4# 5# Copyright (C) 2012-2023 Free Software Foundation, Inc. 6# 7# This file is part of GDB. 8# 9# This program is free software; you can redistribute it and/or modify 10# it under the terms of the GNU General Public License as published by 11# the Free Software Foundation; either version 3 of the License, or 12# (at your option) any later version. 13# 14# This program is distributed in the hope that it will be useful, 15# but WITHOUT ANY WARRANTY; without even the implied warranty of 16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17# GNU General Public License for more details. 18# 19# You should have received a copy of the GNU General Public License 20# along with this program. If not, see <http://www.gnu.org/licenses/>. 21 22# Determine directory of current script. 23scriptpath=`dirname $0` 24# If "scriptpath" is a relative path, then convert it to absolute. 25if [ "`echo ${scriptpath} | cut -b1`" != '/' ] ; then 26 scriptpath="`pwd`/${scriptpath}" 27fi 28 29# update-web-ari.sh script wants four parameters 30# 1: directory of checkout src or gdb-RELEASE for release sources. 31# 2: a temp directory. 32# 3: a directory for generated web page. 33# 4: The name of the current package, must be gdb here. 34# Here we provide default values for these 4 parameters 35 36# srcdir parameter 37if [ -z "${srcdir}" ] ; then 38 srcdir=${scriptpath}/../../.. 39fi 40 41# Determine location of a temporary directory to be used by 42# update-web-ari.sh script. 43if [ -z "${tempdir}" ] ; then 44 if [ ! -z "$TMP" ] ; then 45 tempdir=$TMP/create-ari 46 elif [ ! -z "$TEMP" ] ; then 47 tempdir=$TEMP/create-ari 48 else 49 tempdir=/tmp/create-ari 50 fi 51fi 52 53# Default location of generate index.hmtl web page. 54if [ -z "${webdir}" ] ; then 55# Use 'branch' subdir name if Tag contains branch 56 if [ -f "${srcdir}/gdb/CVS/Tag" ] ; then 57 tagname=`cat "${srcdir}/gdb/CVS/Tag"` 58 elif [ -d "${srcdir}/.git" ] ; then 59 tagname=`cd ${srcdir} && git rev-parse --abbrev-ref HEAD` 60 if test "$tagname" = "master"; then 61 tagname=trunk 62 fi 63 else 64 tagname=trunk 65 fi 66 if [ "${tagname#branch}" != "${tagname}" ] ; then 67 subdir=branch 68 else 69 subdir=trunk 70 fi 71 webdir=`pwd`/${subdir}/ari 72fi 73 74# Launch update-web-ari.sh in same directory as current script. 75${SHELL} ${scriptpath}/update-web-ari.sh ${srcdir} ${tempdir} ${webdir} gdb 76 77if [ -f "${webdir}/index.html" ] ; then 78 echo "ARI output can be viewed in file \"${webdir}/index.html\"" 79else 80 echo "ARI script failed to generate file \"${webdir}/index.html\"" 81fi 82 83