-
Notifications
You must be signed in to change notification settings - Fork 827
/
Copy pathbuild.sh
executable file
·87 lines (69 loc) · 1.67 KB
/
build.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
#!/usr/bin/env bash
set -euo pipefail
echo "Building for target: clockwork pi GameSH"
declare -r DIR="$(dirname "${BASH_SOURCE[0]}")"
cd "$DIR"
declare -r ABSDIR="$(pwd)"
usage() {
echo "${BASH_SOURCE[0]} [--target /path/to/devliution/in/gameshell/menu] [--usage]"
exit 1
}
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-t|--target)
TARGET="$2"
shift # past argument
shift # past value
;;
--help|-h|--usage|-u)
usage
shift # past argument
;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
install_deps() {
sudo apt install -y cmake libsdl2-dev libbz2-dev libsodium-dev
}
main() {
install_deps
build
install
}
build() {
cd ../..
rm -f CMakeCache.txt
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DTARGET_PLATFORM=cpigamesh -DDISABLE_LTO=ON
cmake --build build -j $(getconf _NPROCESSORS_ONLN)
cd -
}
install() {
git rev-parse HEAD > /home/cpi/games/devilutionX/build/devilutionx.rev
if [ -z ${TARGET+x} ]; then
local target_dir="25_devilutionX"
else
local target_dir=${TARGET#"/home/cpi/apps/Menu/"}
fi
local script_dir="/home/cpi/apps/Menu/$target_dir"
local target_dir_base=`basename "$target_dir"`
local target_dir_dir=`dirname "$target_dir"`
local icon_name="${target_dir_dir}/${target_dir_base#*_}"
local icon_dir="/home/cpi/launcher/skin/default/Menu/GameShell/${icon_name}.png"
echo $target_dir
echo $script_dir
echo $target_dir_base
echo $target_dir_dir
echo $icon_name
echo $icon_dir
mkdir -p $script_dir
cp __init__.py $script_dir
cp Devilution.png $icon_dir
}
main