-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpackage.sh
executable file
·81 lines (67 loc) · 2.23 KB
/
package.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
#!/bin/bash
#
# package.sh {src | data | datasrc | bondle}
#
# One of the following commands must be given:
#
# - `src`: Create source archive `openzone-src-<version>.tar.xz`.
# - `data`: Create compiled data archive `openzone-data-<version>.tar.xz`. All data packages found
# in `share/openzone` directory are included.
# - `datasrc`: Create source data archive `openzone-datasrc-<version>.tar.xz`. All source data
# packages found in `data` directory are included.
# - `bundle`: Create a 7zip archive that contains Linux-x86_64 and Windows-x86_64 standalone builds
# and compiled game data packages found in `share/openzone`.
#
set -e
platforms=(
Linux-x86_64
Windows-x86_64
)
eval "$(grep -E '^version=' ./autogen.sh)"
files=$(git ls-files | grep -Ev '^data$')
files="$files share/applications share/pixmaps"
. etc/common.sh
case $1 in
src)
echo "Packing openzone-src-$version.tar.xz"
tar Jcvf "openzone-src-$version.tar.xz" --owner=0 --group=0 --xform "s|^|openzone-$version/|" \
"${files[@]}"
;;
data)
echo "Packing openzone-data-$version.tar.xz"
tar Jcvf "openzone-data-$version.tar.xz" --owner=0 --group=0 --xform "s|^|openzone-$version/|" \
share/openzone/*.zip
;;
datasrc)
echo "Packing openzone-datasrc-$version.tar.xz"
tar Jcvf "openzone-data-src-$version.tar.xz" --owner=0 --group=0 --exclude=DISABLED \
--xform "s|^|openzone-$version/|" data
;;
bundle)
echo "Packing multi-platform OpenZone-$version.zip bundle"
mkdir -p build/bundle && cd build/bundle
rm -rf "OpenZone-$version" "../../OpenZone-$version-bundle.zip"
for platform in "${platforms[@]}"; do
mkdir -p "$platform" && cd "$platform"
header_msg "$platform"
cmake \
-G Ninja \
-D CMAKE_TOOLCHAIN_FILE="../../../cmake/$platform.Toolchain.cmake" \
-D CMAKE_BUILD_TYPE=Release \
-D OZ_BUNDLE=ON \
../../..
ninja
cmake -DCMAKE_INSTALL_PREFIX="../OpenZone-$version" -P cmake_install.cmake
cd ..
done
header_msg "Packaging ..."
rm -rf "OpenZone-$version"/{include,lib}
zip -9r "../../OpenZone-$version-bundle.zip" "OpenZone-$version"
cd ../..
rm -rf build/bundle
ls -hl --color=always "OpenZone-$version-bundle.zip"
;;
*)
echo "Usage: $0 {src | data | datasrc | bundle}"
;;
esac