-
Notifications
You must be signed in to change notification settings - Fork 182
/
generate-wayland-protocols.sh
executable file
·51 lines (39 loc) · 1.34 KB
/
generate-wayland-protocols.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
#!/bin/sh
set -e
TMP_CLONE_DIR="$(mktemp -d)"
GLGLFW_PATH="$1"
if [ "$GLGLFW_PATH" = "" ]; then
echo "no glfw destination path set."
echo "sample: generate-wayland-protocols.sh ../v3.2/glfw/glfw/src"
exit 1
fi
git clone https://gitlab.freedesktop.org/wayland/wayland-protocols.git $TMP_CLONE_DIR
generate() {
HEADER=$1
VER=$2
if [ "$VER" = "stable" ]; then
NAME="$HEADER"
GROUP="stable"
else
NAME="$HEADER"-unstable-$VER
GROUP="unstable"
fi
WAYLAND_CLIENT_C="$GLGLFW_PATH/wayland-$NAME-client-protocol.c"
WAYLAND_CLIENT_H="$GLGLFW_PATH/wayland-$NAME-client-protocol.h"
rm -f "$WAYLAND_CLIENT_C" "$WAYLAND_CLIENT_H"
wayland-scanner private-code $TMP_CLONE_DIR/"$GROUP"/"$HEADER"/"$NAME".xml "$WAYLAND_CLIENT_C"
wayland-scanner client-header $TMP_CLONE_DIR/"$GROUP"/"$HEADER"/"$NAME".xml "$WAYLAND_CLIENT_H"
# Go modules don't support symbolic links.
# This removes the "wayland-xdg-decoration-client-protocol.h"
# link and moves the original file in place.
if [ "$HEADER" = "xdg-decoration" ]; then
mv "$WAYLAND_CLIENT_H" "$GLGLFW_PATH/wayland-xdg-decoration-client-protocol.h"
fi
}
generate "pointer-constraints" "v1"
generate "relative-pointer" "v1"
generate "idle-inhibit" "v1"
generate "xdg-shell" "stable"
generate "xdg-decoration" "v1"
generate "viewporter" "stable"
rm -rf "${TMP_CLONE_DIR}"