-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfluid
executable file
·78 lines (66 loc) · 1.57 KB
/
fluid
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
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. "$SCRIPT_DIR/config.fluid"
function need() {
if [[ ! $(which $1) ]]; then
printf "$1 is needed to build this project!\n"
exit 1
fi
}
function NOTE() {
printf "[NOTE] $1\n"
}
if [[ ! -z "${1+x}" ]]; then
case "$1" in
"clean")
NOTE "Cleaning..."
rm -rf ./$BUILD_DIR love-* *.zip
exit 1
;;
"help")
printf "Fluid - build system for games made with Lua and LOVE2D.\n"
printf "Usage: $0 <command>\n"
printf "Available commands:\n"
printf "\thelp - dispay this help message.\n"
printf "\tclean - clean build files(in initialized project).\n"
exit 1
;;
esac
fi
need wget
need zip
need unzip
if [[ ! -d ./$BUILD_DIR ]]; then
mkdir -p ./$BUILD_DIR
fi
# UNIX
NOTE "Building for UNIX-like systems..."
zip -9 -r ./$NAME.love $(echo $FILES)
chmod +x ./$NAME.love
mv ./$NAME.love ./$BUILD_DIR
NOTE "Done!"
# Windows
printf "[NOTE] Building for Windows...\n"
if [[ ! -d ./love-11.5-win64 ]]; then
printf "\t"
NOTE "Downloading and unpacking love2d-11.5-win64"
wget https://github.com/love2d/love/releases/download/11.5/love-11.5-win64.zip
unzip ./love-11.5-win64.zip
rm love-11.5-win64.zip*
printf "\t"
NOTE "Done!"
fi
cat ./love-11.5-win64/love.exe ./$BUILD_DIR/$NAME.love > ./$NAME.exe
cp ./love-11.5-win64/*.dll ./$BUILD_DIR/
chmod +x ./$NAME.exe # idk why
mv ./$NAME.exe ./$BUILD_DIR
NOTE "Done!"
# Zip-it
NOTE "Making archive..."
cd ./$BUILD_DIR
zip -9 -r ../$NAME.zip .
cd ..
NOTE "Done!"
printf "Build successful!\n"
# vim:set noet sw=4 ts=4 ft=zsh: