~ubuntu-branches/ubuntu/intrepid/libgtkada2/intrepid

« back to all changes in this revision

Viewing changes to src/tools/gate.in

  • Committer: Bazaar Package Importer
  • Author(s): Ludovic Brenta
  • Date: 2008-07-31 18:10:47 UTC
  • mfrom: (1.1.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 7.
  • Revision ID: james.westby@ubuntu.com-20080731181047-6m1y25zjad0p2yjr
Tags: 2.12.0-2

Correct the project files to add a Library_ALI_Dir and correct the
Library_Name.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
if [ $# -eq 0 ]; then
 
4
  echo "Usage: gate project-file"
 
5
  exit 1
 
6
fi
 
7
 
 
8
echo Generating Ada files...
 
9
 
 
10
dir=`dirname $1`
 
11
file=`cd $dir; pwd`/`basename $1`
 
12
info=`gate-in.exe -p -s -x $file`
 
13
stat=$?
 
14
 
 
15
if [ $stat != 0 ]; then
 
16
  if [ $stat = 2 ]; then
 
17
     echo $info
 
18
  fi
 
19
 
 
20
  echo "Couldn't parse $file Exiting."
 
21
  exit 1
 
22
fi
 
23
 
 
24
set $info
 
25
 
 
26
if [ "$1" = "<no_name>" ]; then
 
27
   prj=default
 
28
else
 
29
   prj=$1
 
30
fi
 
31
 
 
32
if [ "$2" = "<no_name>" ]; then
 
33
   srcdir=.
 
34
   psrcdir="the current directory"
 
35
else
 
36
   srcdir=$2
 
37
   psrcdir=$srcdir
 
38
fi
 
39
 
 
40
pixdir="$3"
 
41
# Copy any pixmap files from pixdir to srcdir
 
42
 
 
43
mkdir -p $dir/$srcdir
 
44
 
 
45
if [ "$pixdir" != "<no_name>" -a -d $dir/$pixdir ]; then
 
46
   cp $dir/$pixdir/*xpm $dir/$srcdir > /dev/null 2>&1
 
47
fi
 
48
 
 
49
owd=`pwd`
 
50
cd $dir/$srcdir
 
51
 
 
52
if [ $? != 0 ]; then
 
53
  echo "Couldn't change to $dir/$srcdir, aborting."
 
54
  exit 1
 
55
fi
 
56
 
 
57
gt=".gate/$prj"
 
58
mkdir -p $gt > /dev/null 2>&1
 
59
tmp=$gt/tmp
 
60
/bin/rm -rf $tmp
 
61
mkdir $tmp
 
62
wd=`pwd`
 
63
gate-in.exe $file > $tmp/gate.ada
 
64
 
 
65
if [ $? != 0 ]; then
 
66
  echo "Couldn't generate Ada code. Exiting."
 
67
  exit 1
 
68
fi
 
69
 
 
70
cd $tmp
 
71
if gnatchop gate.ada > /dev/null 2>&1; then
 
72
  true
 
73
else
 
74
  echo "Warning: gnatchop returned non zero status."
 
75
fi 
 
76
 
 
77
/bin/rm -f gate.ada
 
78
files=`echo *`
 
79
cd $wd
 
80
 
 
81
if [ "@MERGE_AVAIL@" = "True" ]; then
 
82
  conflicts=0
 
83
  echo "Merge of some changes failed. It usually means that some modified code
 
84
is obsolete in the current project file.
 
85
Conflicts have been kept in the following files to help merging manually:
 
86
" > $gt/conflicts.txt
 
87
 
 
88
  for j in $files; do
 
89
    if [ -f $j ]; then
 
90
      @MERGE@ $j $gt/$j $tmp/$j 2>/dev/null
 
91
    else
 
92
      cp $tmp/$j $j
 
93
    fi
 
94
 
 
95
    if [ $? = 1 ]; then
 
96
      conflicts=1
 
97
      echo "$j" >> $gt/conflicts.txt
 
98
    fi
 
99
  done
 
100
 
 
101
  echo "The following files have been created/updated in $psrcdir:"
 
102
 
 
103
  for j in $files; do
 
104
    echo "  "$j
 
105
  done
 
106
 
 
107
  if [ $conflicts = 1 ]; then
 
108
    cat $gt/conflicts.txt | gdialog error justify_left
 
109
  fi
 
110
  
 
111
  echo done.
 
112
 
 
113
else
 
114
 
 
115
  /bin/rm -f $gt/gate.difs
 
116
 
 
117
  for j in $files; do
 
118
    @DIFF@ $gt/$j $j >> $gt/gate.difs 2>/dev/null
 
119
  done
 
120
 
 
121
  /bin/cp -f $tmp/* .
 
122
  /bin/rm -f *.rej *.orig
 
123
 
 
124
  if cat $gt/gate.difs | @PATCH@ > $gt/patch.out 2>&1; then
 
125
    echo "The following files have been created/updated in $psrcdir:"
 
126
 
 
127
    for j in $files; do
 
128
      echo "  "$j
 
129
    done
 
130
 
 
131
    /bin/rm -f *.orig
 
132
  else
 
133
    echo "The following files have been updated in $psrcdir:"
 
134
 
 
135
    for j in $files; do
 
136
      echo "  "$j
 
137
    done
 
138
 
 
139
    cat << EOF | gdialog error justify_left
 
140
Merge of some changes failed. It usually means that some modified code
 
141
is obsolete in the current project file.
 
142
.rej files have been generated to help merging manually if needed.
 
143
EOF
 
144
  fi
 
145
 
 
146
  echo done.
 
147
fi
 
148
 
 
149
/bin/mv -f $tmp/* $gt/