-
Notifications
You must be signed in to change notification settings - Fork 3
/
release.sh
executable file
·71 lines (55 loc) · 1.49 KB
/
release.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
#!/bin/bash
set -euxo pipefail
if [ "$OSTYPE" = "win32" ] || [ "$OSTYPE" = "msys" ] || [ "$OSTYPE" = "cygwin" ]; then
is_windows=true
else
is_windows=false
fi
fail_usage() {
if [ "$is_windows" = true ]; then
echo "Usage: release.sh <path to DDPLS> <optional path to MinGW zip>"
else
echo "Usage: release.sh <path to DDPLS>"
fi
exit 1
}
# ======= Safe Guards =======
if [ "$(basename $(pwd))" != "Kompilierer" ]; then
echo "This script must be run from the root of the Kompilierer repo"
fail_usage
fi
if [ -z "$1" ] || [ ! -f "$1" ]; then
echo "Path to DDPLS is not a file"
fail_usage
fi
if [ $# -ge 2 ] && [ ! -f "$2" ]; then
echo "Path to MinGW is not a file"
fail_usage
fi
# ===========================
make -j$(nproc)
ship_mingw=true
if [ "$is_windows" = false ] || [ $# -eq 1 ]; then
ship_mingw=false
fi
release_folder_path="DDP-"
release_folder_path+=$(eval ./build/DDP/bin/kddp version | head -n 1 | tr " " "-")
if [ "$is_windows" = true ] && [ "$ship_mingw" != true ]; then
release_folder_path+="-no-mingw"
fi
echo "Output folder: $release_folder_path"
rm -rf $release_folder_path
cp -rf ./build/DDP/ "$release_folder_path"
ls_dest="$release_folder_path/bin/DDPLS"
if [ "$is_windows" = true ]; then
ls_dest+=".exe"
fi
cp -rf "$1" "$ls_dest"
if [ "$ship_mingw" = true ]; then
cp -f "$2" "$release_folder_path/mingw64.zip"
fi
if [ "$is_windows" = true ]; then
zip -r "$release_folder_path.zip" "$release_folder_path"
else
tar -czf "$release_folder_path.tar.gz" "$release_folder_path"
fi