forked from HansKristian-Work/vkd3d-proton
-
Notifications
You must be signed in to change notification settings - Fork 1
/
package-release.sh
executable file
·101 lines (84 loc) · 2.15 KB
/
package-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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/usr/bin/env bash
set -e
shopt -s extglob
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Usage: $0 version destdir [--native] [--no-package] [--dev-build] [--debug]"
exit 1
fi
VKD3D_VERSION="$1"
VKD3D_SRC_DIR=$(dirname "$(readlink -f "$0")")
VKD3D_BUILD_DIR=$(realpath "$2")"/vkd3d-proton-$VKD3D_VERSION"
VKD3D_ARCHIVE_PATH=$(realpath "$2")"/vkd3d-proton-$VKD3D_VERSION.tar.zst"
if [ -e "$VKD3D_BUILD_DIR" ]; then
echo "Build directory $VKD3D_BUILD_DIR already exists"
exit 1
fi
shift 2
opt_nopackage=0
opt_devbuild=0
opt_native=0
opt_buildtype="release"
opt_strip=--strip
while [ $# -gt 0 ]; do
case "$1" in
"--native")
opt_native=1
;;
"--no-package")
opt_nopackage=1
;;
"--dev-build")
opt_strip=
opt_nopackage=1
opt_devbuild=1
;;
"--debug")
opt_buildtype="debug"
;;
*)
echo "Unrecognized option: $1" >&2
exit 1
esac
shift
done
function build_arch {
local arch="$1"
shift
cd "$VKD3D_SRC_DIR"
meson setup "$@" \
--buildtype "${opt_buildtype}" \
--prefix "$VKD3D_BUILD_DIR" \
$opt_strip \
--bindir "x${arch}" \
--libdir "x${arch}" \
"$VKD3D_BUILD_DIR/build.${arch}"
cd "$VKD3D_BUILD_DIR/build.${arch}"
ninja install
if [ $opt_devbuild -eq 0 ]; then
if [ $opt_native -eq 0 ]; then
# get rid of some useless .a files
rm "$VKD3D_BUILD_DIR/x${arch}/"*.!(dll)
fi
rm -R "$VKD3D_BUILD_DIR/build.${arch}"
fi
}
function build_script {
cp "$VKD3D_SRC_DIR/setup_vkd3d_proton.sh" "$VKD3D_BUILD_DIR/setup_vkd3d_proton.sh"
chmod +x "$VKD3D_BUILD_DIR/setup_vkd3d_proton.sh"
}
function package {
cd "$VKD3D_BUILD_DIR/.."
tar -caf "$VKD3D_ARCHIVE_PATH" "vkd3d-proton-$VKD3D_VERSION"
rm -R "vkd3d-proton-$VKD3D_VERSION"
}
if [ $opt_native -eq 0 ]; then
build_arch 64 --cross-file build-win64.txt
build_arch 86 --cross-file build-win32.txt
build_script
else
build_arch 64
CC="gcc -m32" CXX="g++ -m32" PKG_CONFIG_PATH="/usr/lib32/pkgconfig:/usr/lib/i386-linux-gnu/pkgconfig:/usr/lib/pkgconfig" build_arch 86
fi
if [ $opt_nopackage -eq 0 ]; then
package
fi