forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon-platform
executable file
·63 lines (57 loc) · 1.62 KB
/
common-platform
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
#!/usr/bin/env bash
unset cygwin mingw msys darwin
# COLUMNS is used together with command line option '-pageWidth'.
if command -v tput >/dev/null 2>&1; then
export COLUMNS="$(tput -Tdumb cols)"
fi
case "`uname`" in
CYGWIN*) cygwin=true
;;
MINGW*) mingw=true
;;
MSYS*) msys=true
;;
Darwin*) darwin=true
;;
esac
unset DIST_PROJECT DIST_DIR
if [[ ${cygwin-} || ${mingw-} || ${msys-} ]]; then
DIST_PROJECT="dist-win-x86_64"
DIST_DIR="dist/win-x86_64"
else
# OS and arch logic taken from https://github.com/VirtusLab/scala-cli/blob/main/scala-cli.sh
unset arch ARCH_NORM
arch=$(uname -m)
if [[ "$arch" == "aarch64" ]] || [[ "$arch" == "x86_64" ]]; then
ARCH_NORM="$arch"
elif [[ "$arch" == "amd64" ]]; then
ARCH_NORM="x86_64"
elif [[ "$arch" == "arm64" ]]; then
ARCH_NORM="aarch64"
else
ARCH_NORM="unknown"
fi
if [ "$(expr substr $(uname -s) 1 5 2>/dev/null)" == "Linux" ]; then
if [[ "$ARCH_NORM" == "unknown" ]]; then
echo >&2 "unknown Linux CPU architecture, defaulting to JVM launcher"
DIST_PROJECT="dist"
DIST_DIR="dist"
else
DIST_PROJECT="dist-linux-$ARCH_NORM"
DIST_DIR="dist/linux-$ARCH_NORM"
fi
elif [ "$(uname)" == "Darwin" ]; then
if [[ "$ARCH_NORM" == "unknown" ]]; then
echo >&2 "unknown Darwin CPU architecture, defaulting to JVM launcher"
DIST_PROJECT="dist"
DIST_DIR="dist"
else
DIST_PROJECT="dist-mac-$ARCH_NORM"
DIST_DIR="dist/mac-$ARCH_NORM"
fi
else
echo >&2 "unknown OS, defaulting to JVM launcher"
DIST_PROJECT="dist"
DIST_DIR="dist"
fi
fi