This repository has been archived by the owner on Mar 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure
205 lines (153 loc) · 3.72 KB
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
#!/bin/bash
################################################################################
#
# Configure scipt for Pascal-p2
#
# Sets up the complete Pascal-p2 project.
#
################################################################################
#
# Check command exists
#
# Uses the bash "command" built in.
#
function checkexists {
command -v $1 >/dev/null
rc=$?
if [[ $rc != 0 ]] ; then
echo "*** No $1 was found"
fi
}
#
# Set default variables
#
compiler="gpc"
bits="32"
host="linux"
#
# Determine if needed programs exist. The only fatal one is grep, because we
# need that to run this script. The rest will impact the running of various
# test and build scripts.
#
checkexists grep
if [[ $rc != 0 ]] ; then
exit 1
fi
checkexists gpc
if [[ $rc != 0 ]] ; then
compiler=""
# fatal this for now
exit 1
else
gpc -v 2> temp
grep "gpc version 20070904" temp > /dev/null
rc=$?
if [[ $rc != 0 ]] ; then
echo "*** Warning, Pascal-p2 is only validated to work with gpc version 20070904"
fi
grep "build=x86_64" temp > /dev/null
rc=$?
if [[ $rc == 0 ]] ; then
echo "*** Pascal-p2 will only work with 32 bits"
exit 1
bits="64"
fi
fi
checkexists diff
checkexists sed
checkexists rm
checkexists cp
checkexists mv
checkexists flip
if [[ $rc != 0 ]] ; then
echo "flip does not exist, attempting to make it"
make_flip
checkexists flip
flip=$rc
if [[ $rc != 0 ]] ; then
echo "*** Unable to make flip"
fi
fi
checkexists ls
checkexists gzip
checkexists tar
#
# Check user arguments
#
for var in "$@"
do
if [ $var = "--help" ]
then
echo "Configure program for Pascal-p2"
echo
echo "--gpc: Select GPC as target compiler"
echo "--ip_pascal: Select IP Pascal as target compiler"
echo "--32: Select 32 bit target"
echo "--64: Select 64 bit target"
echo
exit 0
elif [ $var = "--gpc" ]
then
compiler="gpc"
elif [ $var = "--ip_pascal" ]
then
compiler="ip_pascal"
elif [ $var = "--32" ]
then
bits="32"
elif [ $var = "--64" ]
then
bits="64"
fi
done
if [ $compiler = "ip_pascal" ] || [ $compiler = "IP_Pascal" ]
then
#
# Set up for IP Pascal
#
echo "Set up for IP Pascal"
cp ip_pascal/p2.bat bin/p2.bat
cp ip_pascal/compile.bat bin/compile.bat
cp ip_pascal/run.bat bin/run.bat
cp ip_pascal/p2 bin/p2
cp ip_pascal/compile bin/compile
cp ip_pascal/run bin/run
cp ip_pascal/Makefile .
cp ip_pascal/standard_tests/iso7185pat.cmp standard_tests
cp ip_pascal/standard_tests/iso7185pats.cmp standard_tests
#
# IP Pascal does not care about line endings, but returning to DOS mode
# line endings normalizes the files for SVN checkin.
#
#unixeol
elif [ $compiler = "gpc" ]
then
#
# Set up for GPC Pascal
#
echo "Set up for gpc"
cp gpc/p2.bat bin/p2.bat
cp gpc/compile.bat bin/compile.bat
cp gpc/run.bat bin/run.bat
cp gpc/p2 bin/p2
cp gpc/compile bin/compile
cp gpc/run bin/run
cp gpc/standard_tests/iso7185pat.cmp standard_tests
cp gpc/standard_tests/iso7185pats.cmp standard_tests
#
# GPC has been problematic for line endings. This changes them
# all to Unix mode for GPC compiles, which at this moment is
# all there is. GPC for Windows has serious problems.
#
#unixeol
else
#
# No compiler name found!
#
echo "*** Compiler name does not match currently implemented"
echo "*** compilers"
echo
echo "IP Pascal - use \"ip_pascal\""
echo "GPC Pascal - use \"GPC\""
fi
echo "Configure completed!"