forked from dmitryvk/sbcl-win32-threads
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathguess-environment.sh
150 lines (141 loc) · 4.32 KB
/
guess-environment.sh
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
# For some build environments, file system hierarchy, style and
# filename constraints are different for host CL and target SBCL. In
# that case, targetpath and hostpath should be set to file name
# conversion commands or shell functions.
#
targetpath=${SBCL_ENV_TARGETPATH:-"echo -n"}
hostpath=${SBCL_ENV_HOSTPATH:-"echo -n"}
devnull=/dev/null
# Cygwin and MSYS set OSTYPE by themselves (hence a strange name that
# I wouldn't choose but have to accept). For "combined cross-native"
# builds with e.g. Linux host and wine environment, OSTYPE has to be
# set manually.
if [ "$OSTYPE" = "cygwin" -o "$OSTYPE" = "msys" -o "$OSTYPE" = "wine" \
-o -n "$windir" ] ;
then
definstallroot="${PROGRAMFILES:-C:/Program Files}/Steel Bank Common Lisp/"
installroot=${SBCL_ENV_INSTALL_ROOT:-$definstallroot}
runtime=sbcl.exe
sbcl_os=win32
sbcl_arch=${SBCL_ARCH:-x86}
case "$OSTYPE" in
cygwin)
targetpath=${SBCL_ENV_TARGETPATH:-"env TERM=dumb cygpath -w"}
hostpath=${SBCL_ENV_HOSTPATH:-"cygpath -u"}
lncp="ln -s"
;;
wine)
targetpath=${SBCL_ENV_TARGETPATH:-"env TERM=dumb winepath -w"}
hostpath=${SBCL_ENV_HOSTPATH:-"env TERM=dumb winepath -u"}
lncp="ln -s"
# Temporary workaround for some "smart" change in
# wine-1.3.12: "console subsystem" programs started to
# output some terminal escape garbage before other output,
# even if redirected to a pipe, file or socket. It breaks
# "hello, world" -- surely there is an award for such
# things!
#
# What's fortunate and even convenient, though: wine
# doesn't show its new talents when
TERM=dumb
# so we
export TERM
;;
*)
lncp="cp -r"
;;
esac
else
installroot=${SBCL_ENV_INSTALL_ROOT:-"/usr/local"}
runtime=sbcl
lncp="ln -s"
fi
if [ -z "$sbcl_os" ] ; then
case `uname` in
Linux)
sbcl_os="linux"
;;
OSF1)
# it's changed name twice since it was called OSF/1: clearly
# the marketers forgot to tell the engineers about Digital Unix
# _or_ OSF/1 ...
sbcl_os="osf1"
;;
*BSD)
case `uname` in
FreeBSD)
sbcl_os="freebsd"
;;
OpenBSD)
sbcl_os="openbsd"
;;
NetBSD)
sbcl_os="netbsd"
;;
*)
echo unsupported BSD variant: `uname`
exit 1
;;
esac
;;
Darwin)
sbcl_os="darwin"
;;
SunOS)
sbcl_os="sunos"
;;
CYGWIN* | WindowsNT | MINGW*)
sbcl_os="win32"
;;
HP-UX)
sbcl_os="hpux"
;;
*)
echo unsupported OS type: `uname`
exit 1
;;
esac
case `uname -m` in
*86) guessed_sbcl_arch=x86 ;;
i86pc) guessed_sbcl_arch=x86 ;;
*x86_64) guessed_sbcl_arch=x86-64 ;;
amd64) guessed_sbcl_arch=x86-64 ;;
[Aa]lpha) guessed_sbcl_arch=alpha ;;
sparc*) guessed_sbcl_arch=sparc ;;
sun*) guessed_sbcl_arch=sparc ;;
*ppc) guessed_sbcl_arch=ppc ;;
ppc64) guessed_sbcl_arch=ppc ;;
Power*Macintosh) guessed_sbcl_arch=ppc ;;
parisc) guessed_sbcl_arch=hppa ;;
9000/800) guessed_sbcl_arch=hppa ;;
mips*) guessed_sbcl_arch=mips ;;
*)
# If we're not building on a supported target architecture, we
# we have no guess, but it's not an error yet, since maybe
# target architecture will be specified explicitly below.
guessed_sbcl_arch=''
;;
esac
# Under Solaris, uname -m returns "i86pc" even if CPU is amd64.
if [ "$sbcl_os" = "sunos" ] && [ `isainfo -k` = "amd64" ]; then
guessed_sbcl_arch=x86-64
fi
# Under Darwin, uname -m returns "i386" even if CPU is x86_64.
if [ "$sbcl_os" = "darwin" ] &&
[ "`/usr/sbin/sysctl -n hw.optional.x86_64`" = "1" ] ; then
guessed_sbcl_arch=x86-64
fi
sbcl_arch=${SBCL_ARCH:-$guessed_sbcl_arch}
if [ "$sbcl_arch" = "" ] ; then
echo "can't guess target SBCL architecture, need SBCL_ARCH environment var"
exit 1
fi
fi
# Under Darwin x86-64, guess whether Darwin 9+ or below.
if [ "$sbcl_os" = "darwin" ] && [ "$sbcl_arch" = "x86-64" ]; then
darwin_version=`uname -r`
darwin_version_major=${DARWIN_VERSION_MAJOR:-${darwin_version%%.*}}
fi
link_or_copy() {
$lncp "$1" "$2"
}