forked from ewmailing/IupCocoa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tec_uname
199 lines (175 loc) · 4 KB
/
tec_uname
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
#!/bin/bash
Pause()
{
echo -n Press Enter to continue or Ctrl+C to abort...
read contscr
echo ' '
}
ComputeTecUname()
{
# Base Definitions
TEC_SYSNAME=`uname -s`
TEC_SYSVERSION=`uname -r|cut -f1 -d.`
TEC_SYSMINOR=`uname -r|cut -f2 -d.`
TEC_SYSARCH=`uname -m`
# Fixes
if [ $TEC_SYSNAME == SunOS ]; then
TEC_SYSARCH=`uname -p`
fi
if [ $TEC_SYSNAME == IRIX ]; then
TEC_SYSARCH=`uname -p`
fi
if [ $TEC_SYSNAME == FreeBSD ]; then
TEC_SYSMINOR=`uname -r|cut -f2 -d.|cut -f1 -d-`
fi
if [ $TEC_SYSNAME == GNU/kFreeBSD ]; then
TEC_SYSNAME=kFreeBSD
TEC_SYSMINOR=`uname -r|cut -f2 -d.|cut -f1 -d-`
fi
if [ $TEC_SYSNAME == AIX ]; then
TEC_SYSVERSION=`uname -v`
TEC_SYSMINOR=`uname -r`
TEC_SYSARCH=ppc
fi
if [ $TEC_SYSNAME == Darwin ]; then
TEC_SYSNAME=MacOS
TEC_SYSVERSION=`sw_vers -productVersion|cut -f1 -d.`
TEC_SYSMINOR=`sw_vers -productVersion|cut -f2 -d.`
TEC_SYSARCH=`uname -p`
fi
if [ $TEC_SYSARCH == i686 ]; then
TEC_SYSARCH=x86
fi
if [ $TEC_SYSARCH == i386 ]; then
TEC_SYSARCH=x86
fi
if [ $TEC_SYSARCH == powerpc ]; then
TEC_SYSARCH=ppc
fi
if [ $TEC_SYSARCH == x86_64 ]; then
TEC_SYSARCH=x64
fi
if [ $TEC_SYSARCH == amd64 ]; then
TEC_SYSARCH=x64
fi
# Compose
TEC_UNAME=$TEC_SYSNAME$TEC_SYSVERSION$TEC_SYSMINOR
# Cygwin
CYGW=`uname -s|cut -f1 -d-`
if [ $CYGW == CYGWIN_NT ]; then
TEC_SYSNAME=CYGWIN
TEC_UNAME='cygw'$TEC_SYSVERSION$TEC_SYSMINOR
fi
# Linux 2.4 and GCC 3.x
if [ $TEC_UNAME == Linux24 ]; then
GCCVER=`gcc -dumpversion|cut -f1 -d.`
if [ $GCCVER == 3 ]; then
TEC_UNAME=$TEC_UNAME'g3'
fi
fi
# Linux 2.6 and GCC 4.x
if [ $TEC_UNAME == Linux26 ]; then
GCCVER=`gcc -dumpversion|cut -f1 -d.`
if [ $GCCVER == 4 ]; then
TEC_UNAME=$TEC_UNAME'g4'
fi
fi
if [ $TEC_SYSNAME == Linux ]; then
# Linux and PowerPC
if [ $TEC_SYSARCH == ppc ]; then
TEC_UNAME=$TEC_UNAME'ppc'
fi
# 64-bits Linux
if [ $TEC_SYSARCH == x64 ]; then
BUILD_64=Yes
TEC_UNAME=$TEC_UNAME'_64'
fi
# Itanium Linux
if [ $TEC_SYSARCH == ia64 ]; then
BUILD_64=Yes
TEC_UNAME=$TEC_UNAME'_ia64'
fi
# Linux Distribution
TEC_DISTNAME=`lsb_release -is`
TEC_DISTVERSION=`lsb_release -rs|cut -f1 -d.`
TEC_DIST=$TEC_DISTNAME$TEC_DISTVERSION
fi
# 64-bits FreeBSD
if [ $TEC_SYSNAME == FreeBSD ]; then
if [ $TEC_SYSARCH == x64 ]; then
BUILD_64=Yes
TEC_UNAME=$TEC_UNAME'_64'
fi
fi
# Solaris and Intel
if [ $TEC_SYSNAME == SunOS ]; then
if [ $TEC_SYSARCH == x86 ]; then
TEC_UNAME=$TEC_UNAME'x86'
fi
fi
# MacOS and Intel
if [ $TEC_SYSNAME == MacOS ]; then
if [ $TEC_SYSMINOR == 5 ]; then
if [ $TEC_SYSARCH == x86 ]; then
TEC_UNAME=$TEC_UNAME'x86'
fi
else
if [ $TEC_SYSMINOR == 4 ]; then
if [ $TEC_SYSARCH == x86 ]; then
TEC_UNAME=$TEC_UNAME'x86'
fi
else
TEC_SYSARCH=x64
fi
fi
fi
}
ComputeSystemPaths()
{
if [ $TEC_SYSARCH == x64 ]; then
if [ -d /usr/lib64 ]; then
TEC_SYSTEM_LIB=/usr/lib64
else
TEC_SYSTEM_LIB=/usr/lib
fi
else
TEC_SYSTEM_LIB=/usr/lib
fi
TEC_SYSTEM_INC=/usr/include
if [ $TEC_SYSNAME == Haiku ]; then
TEC_SYSTEM_LIB=`finddir B_SYSTEM_LIB_DIRECTORY`
TEC_SYSTEM_INC=`finddir B_SYSTEM_HEADERS_DIRECTORY`
fi
TEC_LUA_LIB=$TEC_SYSTEM_LIB/lua/$LUA_VER
}
ComputeLuaVersion()
{
if [ -n "$USE_LUA51" ]; then
LUA_VER=5.1
LUA_SFX=51
fi
if [ -n "$USE_LUA52" ]; then
LUA_VER=5.2
LUA_SFX=52
fi
if [ -n "$USE_LUA53" ]; then
LUA_VER=5.3
LUA_SFX=53
fi
# Default Lua version
if [ -z "$LUA_VER" ]; then
LUA_VER=5.1
LUA_SFX=51
fi
}
PrintInfo()
{
echo ' '
echo ' Info:'
echo 'TEC_SYSNAME='$TEC_SYSNAME
echo 'TEC_SYSVERSION='$TEC_SYSVERSION
echo 'TEC_SYSMINOR='$TEC_SYSMINOR
echo 'TEC_SYSARCH='$TEC_SYSARCH
echo 'TEC_SYSTEM_LIB='$TEC_SYSTEM_LIB
echo 'TEC_SYSTEM_INC='$TEC_SYSTEM_INC
}