~ubuntu-branches/ubuntu/vivid/qgo/vivid-proposed

« back to all changes in this revision

Viewing changes to admin/ylwrap

  • Committer: Package Import Robot
  • Author(s): Yann Dirson
  • Date: 2012-05-19 19:05:05 UTC
  • mfrom: (1.1.12)
  • Revision ID: package-import@ubuntu.com-20120519190505-b23f5tzx7y8cu946
Tags: 2~svn764-1
* The "Raise dead" release (Closes: #673520), new maintainer.
* New upstream snapshot with Qt4 support (Closes: #604589), adjusted
  build-deps.
* Switched to source format "3.0 (quilt)", adjusted build-deps.
* Switched to dh and debhelper compat level 9, adjusted build-deps.
* Build with -fpermissive.
* New build-dep libasound2-dev, remove obsolete build-dep on libxinerama-dev.
* Refreshed patches 01_gnugo and 04_desktop, leaving 20_kfreebsd away
  for this release, and removing the remaining ones, now obsolete.
* Added patch 02_usrgames for FHS-correct install location.
* Adjusted icon names in menu file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh
2
 
# ylwrap - wrapper for lex/yacc invocations.
3
 
# Copyright 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
4
 
# Written by Tom Tromey <tromey@cygnus.com>.
5
 
#
6
 
# This program is free software; you can redistribute it and/or modify
7
 
# it under the terms of the GNU General Public License as published by
8
 
# the Free Software Foundation; either version 2, or (at your option)
9
 
# any later version.
10
 
#
11
 
# This program is distributed in the hope that it will be useful,
12
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
# GNU General Public License for more details.
15
 
#
16
 
# You should have received a copy of the GNU General Public License
17
 
# along with this program; if not, write to the Free Software
18
 
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
 
 
20
 
# As a special exception to the GNU General Public License, if you
21
 
# distribute this file as part of a program that contains a
22
 
# configuration script generated by Autoconf, you may include it under
23
 
# the same distribution terms that you use for the rest of that program.
24
 
 
25
 
# Usage:
26
 
#     ylwrap INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]...
27
 
# * INPUT is the input file
28
 
# * OUTPUT is file PROG generates
29
 
# * DESIRED is file we actually want
30
 
# * PROGRAM is program to run
31
 
# * ARGS are passed to PROG
32
 
# Any number of OUTPUT,DESIRED pairs may be used.
33
 
 
34
 
# The input.
35
 
input="$1"
36
 
shift
37
 
case "$input" in
38
 
 [\\/]* | ?:[\\/]*)
39
 
    # Absolute path; do nothing.
40
 
    ;;
41
 
 *)
42
 
    # Relative path.  Make it absolute.
43
 
    input="`pwd`/$input"
44
 
    ;;
45
 
esac
46
 
 
47
 
# The directory holding the input.
48
 
input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'`
49
 
# Quote $INPUT_DIR so we can use it in a regexp.
50
 
# FIXME: really we should care about more than `.' and `\'.
51
 
input_rx=`echo "$input_dir" | sed -e 's,\\\\,\\\\\\\\,g' -e 's,\\.,\\\\.,g'`
52
 
 
53
 
echo "got $input_rx"
54
 
 
55
 
pairlist=
56
 
while test "$#" -ne 0; do
57
 
   if test "$1" = "--"; then
58
 
      shift
59
 
      break
60
 
   fi
61
 
   pairlist="$pairlist $1"
62
 
   shift
63
 
done
64
 
 
65
 
# The program to run.
66
 
prog="$1"
67
 
shift
68
 
# Make any relative path in $prog absolute.
69
 
case "$prog" in
70
 
 [\\/]* | ?:[\\/]*) ;;
71
 
 *[\\/]*) prog="`pwd`/$prog" ;;
72
 
esac
73
 
 
74
 
# FIXME: add hostname here for parallel makes that run commands on
75
 
# other machines.  But that might take us over the 14-char limit.
76
 
dirname=ylwrap$$
77
 
trap "cd `pwd`; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15
78
 
mkdir $dirname || exit 1
79
 
 
80
 
cd $dirname
81
 
 
82
 
$prog ${1+"$@"} "$input"
83
 
status=$?
84
 
 
85
 
if test $status -eq 0; then
86
 
   set X $pairlist
87
 
   shift
88
 
   first=yes
89
 
   # Since DOS filename conventions don't allow two dots,
90
 
   # the DOS version of Bison writes out y_tab.c instead of y.tab.c
91
 
   # and y_tab.h instead of y.tab.h. Test to see if this is the case.
92
 
   y_tab_nodot="no"
93
 
   if test -f y_tab.c || test -f y_tab.h; then
94
 
      y_tab_nodot="yes"
95
 
   fi
96
 
 
97
 
   while test "$#" -ne 0; do
98
 
      from="$1"
99
 
      # Handle y_tab.c and y_tab.h output by DOS
100
 
      if test $y_tab_nodot = "yes"; then
101
 
         if test $from = "y.tab.c"; then
102
 
            from="y_tab.c"
103
 
         else
104
 
            if test $from = "y.tab.h"; then
105
 
               from="y_tab.h"
106
 
            fi
107
 
         fi
108
 
      fi
109
 
      if test -f "$from"; then
110
 
         # If $2 is an absolute path name, then just use that,
111
 
         # otherwise prepend `../'.
112
 
         case "$2" in
113
 
           [\\/]* | ?:[\\/]*) target="$2";;
114
 
           *) target="../$2";;
115
 
         esac
116
 
 
117
 
         # Edit out `#line' or `#' directives.  We don't want the
118
 
         # resulting debug information to point at an absolute srcdir;
119
 
         # it is better for it to just mention the .y file with no
120
 
         # path.
121
 
         sed -e "/^#/ s,$input_rx,," "$from" > "$target" || status=$?
122
 
      else
123
 
         # A missing file is only an error for the first file.  This
124
 
         # is a blatant hack to let us support using "yacc -d".  If -d
125
 
         # is not specified, we don't want an error when the header
126
 
         # file is "missing".
127
 
         if test $first = yes; then
128
 
            status=1
129
 
         fi
130
 
      fi
131
 
      shift
132
 
      shift
133
 
      first=no
134
 
   done
135
 
else
136
 
   status=$?
137
 
fi
138
 
 
139
 
# Remove the directory.
140
 
cd ..
141
 
rm -rf $dirname
142
 
 
143
 
exit $status