Commit | Line | Data |
---|---|---|
b786c521 PM |
1 | #! /bin/sh |
2 | ||
3 | # GDB script to create web ARI page directly from within gdb/ari directory. | |
4 | # | |
e2882c85 | 5 | # Copyright (C) 2012-2018 Free Software Foundation, Inc. |
b786c521 PM |
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. | |
23 | scriptpath=`dirname $0` | |
24 | # If "scriptpath" is a relative path, then convert it to absolute. | |
25 | if [ "`echo ${scriptpath} | cut -b1`" != '/' ] ; then | |
26 | scriptpath="`pwd`/${scriptpath}" | |
27 | fi | |
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 | |
37 | if [ -z "${srcdir}" ] ; then | |
38 | srcdir=${scriptpath}/../../.. | |
39 | fi | |
40 | ||
41 | # Determine location of a temporary directory to be used by | |
42 | # update-web-ari.sh script. | |
43 | if [ -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 | |
51 | fi | |
52 | ||
53 | # Default location of generate index.hmtl web page. | |
54 | if [ -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"` | |
c8f8fedd TT |
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 | |
b786c521 PM |
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 | |
72 | fi | |
73 | ||
74 | # Launch update-web-ari.sh in same directory as current script. | |
01f2564a | 75 | ${SHELL} ${scriptpath}/update-web-ari.sh ${srcdir} ${tempdir} ${webdir} gdb |
b786c521 PM |
76 | |
77 | if [ -f "${webdir}/index.html" ] ; then | |
78 | echo "ARI output can be viewed in file \"${webdir}/index.html\"" | |
79 | else | |
80 | echo "ARI script failed to generate file \"${webdir}/index.html\"" | |
81 | fi | |
82 |