-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinit.sh
61 lines (50 loc) · 2.08 KB
/
init.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
#!/bin/bash
PREMAKE_VERSION="5.0.0-alpha14"
PREMAKE_LOCATION="."
os=$(uname -s)
arch=$(uname -m)
# Linux system
if [ "$os" == "Linux" ]; then
os="linux"
# Max OS X system
elif [ "$os" == "Darwin" ]; then
os="osx"
# Assume Windows
else
os="windows"
fi
# Initialize submodules
git submodule update --init
git submodule foreach --recursive "git submodule update --init"
# Windows setup
if [ "$os" == "windows" ]; then
# Download premake executable
curl -Lo "$PREMAKE_LOCATION/premake5.zip" "https://github.com/premake/premake-core/releases/download/v$PREMAKE_VERSION/premake-$PREMAKE_VERSION-windows.zip"
unzip -oqu "$PREMAKE_LOCATION/premake5.zip" -d "$PREMAKE_LOCATION/"
rm -f "$PREMAKE_LOCATION/premake5.zip"
# Linux setup
elif [ "$os" == "linux" ]; then
# Determine whether we need to build from source or not
if [ "$arch" == "x86_64" ]; then
# Download premake executable
curl -Lo "$PREMAKE_LOCATION/premake5.tar.gz" "https://github.com/premake/premake-core/releases/download/v$PREMAKE_VERSION/premake-$PREMAKE_VERSION-linux.tar.gz"
tar -xvzf "$PREMAKE_LOCATION/premake5.tar.gz" -C "$PREMAKE_LOCATION/"
rm -f "$PREMAKE_LOCATION/premake5.tar.gz"
else
# Download premake source package
curl -Lo "$PREMAKE_LOCATION/premake5-src.zip" "https://github.com/premake/premake-core/releases/download/v$PREMAKE_VERSION/premake-$PREMAKE_VERSION-src.zip"
unzip -o "$PREMAKE_LOCATION/premake5-src.zip" -d "$PREMAKE_LOCATION/"
# Build premake
echo "Building premake from source.."
make -C "$PREMAKE_LOCATION/premake-$PREMAKE_VERSION/build/gmake.unix/"
cp "$PREMAKE_LOCATION/premake-$PREMAKE_VERSION/bin/release/premake5" "$PREMAKE_LOCATION/"
rm -rf "$PREMAKE_LOCATION/premake-$PREMAKE_VERSION/"
rm -f "$PREMAKE_LOCATION/premake5-src.zip"
fi
# Mac OS X setup
elif [ "$os" == "osx" ]; then
# Download premake executable
curl -Lo "$PREMAKE_LOCATION/premake5.tar.gz" "https://github.com/premake/premake-core/releases/download/v$PREMAKE_VERSION/premake-$PREMAKE_VERSION-macosx.tar.gz"
tar -xvzf "$PREMAKE_LOCATION/premake5.tar.gz" -C "$PREMAKE_LOCATION/"
rm -f "$PREMAKE_LOCATION/premake5.tar.gz"
fi