-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcompilearch
executable file
·300 lines (290 loc) · 7.01 KB
/
compilearch
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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
#!/bin/sh
#___INFO__MARK_BEGIN__
##########################################################################
#
# The Contents of this file are made available subject to the terms of
# the Sun Industry Standards Source License Version 1.2
#
# Sun Microsystems Inc., March, 2001
#
#
# Sun Industry Standards Source License Version 1.2
# =================================================
# The contents of this file are subject to the Sun Industry Standards
# Source License Version 1.2 (the "License"); You may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
#
# Software provided under this License is provided on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
# See the License for the specific provisions governing your rights and
# obligations concerning the Software.
#
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
#
# Copyright: 2001 by Sun Microsystems, Inc.
#
# All Rights Reserved.
#
##########################################################################
#___INFO__MARK_END__
#
# Credit should be given to Robert Manchek manchek@CS.UTK.EDU for creating
# a similar aimk procedure for the PVM 3.x distribution, Jul 22 1991,
# which inspired the Cluster Scheduler aimk build scheme.
# Make sure to avoid confusion between shell variables and environment
# variables
#
dir=`dirname $0`
basedir=`cd $dir/..; pwd`
usage() {
echo ""
echo "usage: compilearch (-b|-t|-c) [<arch>]"
echo ""
echo " -b print the build arch (SOLARIS64)"
echo " -t print the target bits (TARGET_32BIT or TARGET_64BIT)"
echo " -c print the compile arch (e.g LINUXIA64_24) or an empty"
echo " string if the build arch is equal to the compile arch"
echo ""
echo " <arch> print the information for a specific architecture."
echo " If <arch> is missing the architecture is determined"
echo " by calling the dist/util/arch script"
echo ""
}
buildarch=""
option=""
case $# in
0) usage; exit 1;;
1)
case $1 in
-b) option="-b";;
-t) option="-t";;
-c) option="-c";;
*) usage; exit 1;;
esac;;
2)
option=$1; buildarch=$2;;
*)
usage
exit 1;;
esac
if [ "$buildarch" = "" ]; then
archscript=$basedir/dist/util/arch
if [ -f $archscript ]; then
buildarch=`$archscript`
if [ $? -ne 0 ]; then
echo "error in $archscript: $buildarch"
exit 1
fi
else
echo script $archscript not available
exit 1
fi
fi
COMPILE_ARCH=
BUILDARCH=
TARGET_BITS=
# Map buildarch into uppercase BUILDARCH
#
case $buildarch in
darwin)
BUILDARCH=DARWIN
TARGET_BITS=TARGET_32BIT
;;
darwin-x64)
BUILDARCH=DARWIN_X64
TARGET_BITS=TARGET_64BIT
;;
darwin-arm64)
BUILDARCH=DARWIN_ARM64
TARGET_BITS=TARGET_64BIT
;;
fbsd-alpha)
BUILDARCH=FREEBSD_ALPHA
TARGET_BITS=TARGET_64BIT
;;
fbsd-amd64)
BUILDARCH=FREEBSD_AMD64
TARGET_BITS=TARGET_64BIT
;;
fbsd-i386)
BUILDARCH=FREEBSD_I386
TARGET_BITS=TARGET_32BIT
;;
fbsd-ia64)
BUILDARCH=FREEBSD_IA64
TARGET_BITS=TARGET_64BIT
;;
fbsd-ppc)
BUILDARCH=FREEBSD_PPC
TARGET_BITS=TARGET_32BIT
;;
fbsd-sparc64)
BUILDARCH=FREEBSD_SPARC64
;;
lx-amd64)
BUILDARCH=LINUXAMD64
COMPILE_ARCH=LINUXAMD64
TARGET_BITS=TARGET_64BIT
;;
lx-arm6)
BUILDARCH=LINUXARM6
COMPILE_ARCH=LINUXARM6
TARGET_BITS=TARGET_32BIT
;;
lx-arm7)
BUILDARCH=LINUXARM7
COMPILE_ARCH=LINUXARM7
TARGET_BITS=TARGET_32BIT
;;
lx-arm64)
BUILDARCH=LINUXARM64
COMPILE_ARCH=LINUXARM64
TARGET_BITS=TARGET_64BIT
;;
lx-armhf)
BUILDARCH=LINUXARMHF
COMPILE_ARCH=LINUXARMHF
TARGET_BITS=TARGET_32BIT
;;
lx-ia64)
BUILDARCH=LINUXIA64
COMPILE_ARCH=LINUXIA64
TARGET_BITS=TARGET_64BIT
;;
lx-mips)
BUILDARCH=LINUXMIPS
COMPILE_ARCH=LINUXMIPS
TARGET_BITS=TARGET_32BIT
;;
lx-mips64)
BUILDARCH=LINUXMIPS64
COMPILE_ARCH=LINUXMIPS64
TARGET_BITS=TARGET_64BIT
;;
lx-ppc64le)
BUILDARCH=LINUXPPC64LE
COMPILE_ARCH=LINUXPPC64LE
TARGET_BITS=TARGET_64BIT
;;
lx-s390)
BUILDARCH=LINUXS390
COMPILE_ARCH=LINUXS390
TARGET_BITS=TARGET_32BIT
;;
lx-s390x)
BUILDARCH=LINUXS390X
COMPILE_ARCH=LINUXS390X
TARGET_BITS=TARGET_64BIT
;;
lx-sparc)
BUILDARCH=LINUXSPARC
COMPILE_ARCH=LINUXSPARC
TARGET_BITS=TARGET_32BIT
;;
lx-sparc64)
BUILDARCH=LINUXSPARC64
COMPILE_ARCH=LINUXSPARC64
TARGET_BITS=TARGET_64BIT
;;
lx-x86)
BUILDARCH=LINUX86
COMPILE_ARCH=LINUX86
TARGET_BITS=TARGET_32BIT
;;
ulx-amd64)
BUILDARCH=LINUXAMD64
COMPILE_ARCH=ULINUXAMD64
TARGET_BITS=TARGET_64BIT
;;
ulx-sparc64)
BUILDARCH=LINUXSPARC64
COMPILE_ARCH=ULINUXSPARC64
TARGET_BITS=TARGET_64BIT
;;
ulx-x86)
BUILDARCH=LINUX86
COMPILE_ARCH=ULINUX86
TARGET_BITS=TARGET_32BIT
;;
xlx-amd64)
BUILDARCH=LINUXAMD64
COMPILE_ARCH=ULINUXAMD64
TARGET_BITS=TARGET_64BIT
;;
nbsd-alpha)
BUILDARCH=NETBSD_ALPHA
TARGET_BITS=TARGET_64BIT
;;
nbsd-i386)
BUILDARCH=NETBSD_I386
TARGET_BITS=TARGET_32BIT
;;
nbsd-powerpc)
BUILDARCH=NETBSD_POWERPC
TARGET_BITS=TARGET_32BIT
;;
nbsd-sparc64)
BUILDARCH=NETBSD_SPARC64
TARGET_BITS=TARGET_64BIT
;;
nbsd-x86_64)
BUILDARCH=NETBSD_X86_64
TARGET_BITS=TARGET_64BIT
;;
sol-sparc)
BUILDARCH=SOLARIS
TARGET_BITS=TARGET_32BIT
;;
sol-sparc64)
BUILDARCH=SOLARIS64
TARGET_BITS=TARGET_64BIT
;;
sol-x86)
BUILDARCH=SOLARIS86
TARGET_BITS=TARGET_32BIT
;;
sol-amd64|osol-amd64)
BUILDARCH=SOLARISAMD64
TARGET_BITS=TARGET_64BIT
;;
usol-sparc)
BUILDARCH=SOLARIS
COMPILE_ARCH=USOLARIS
TARGET_BITS=TARGET_32BIT
;;
usol-sparc64)
BUILDARCH=SOLARIS64
COMPILE_ARCH=USOLARIS64
TARGET_BITS=TARGET_64BIT
;;
usol-x86)
BUILDARCH=SOLARIS86
COMPILE_ARCH=USOLARIS86
TARGET_BITS=TARGET_32BIT
;;
usol-amd64)
BUILDARCH=SOLARISAMD64
COMPILE_ARCH=USOLARISAMD64
TARGET_BITS=TARGET_64BIT
;;
lx-riscv64)
BUILDARCH=LINUXRISCV64
COMPILE_ARCH=LINUXRISCV64
TARGET_BITS=TARGET_64BIT
;;
*)
echo cannot compile - no mapping for architecture \"$buildarch\" defined yet
exit 1
;;
esac
case "$option" in
-b) echo $BUILDARCH;;
-t) echo $TARGET_BITS;;
-c) echo $COMPILE_ARCH;;
*)
echo "invalid option $option"
exit 1;;
esac