AtlatestRepositorysigil-ui

sigil-ui / tree / scriptsgenerate-wayland-protocols

1#!/bin/sh
2# Regenerate the Wayland protocol code from the XML files kept beside it:
3# native/wayland for the library, test/wayland for the test input driver.
4# The output is checked in, so building sigil-ui needs neither
5# wayland-scanner nor the Wayland development headers. The other headers in
6# native/wayland/include are copied from libwayland's wayland-client.
7#
8# Usage: scripts/generate-wayland-protocols (needs wayland-scanner >= 1.20)
9set -eu
10root=$(cd "$(dirname "$0")/.." && pwd)
11command -v wayland-scanner >/dev/null || { echo "wayland-scanner is not on PATH" >&2; exit 1; }
13generate() {
14 cd "$1"
15 for xml in protocols/*.xml; do
16 name=$(basename "$xml" .xml)
17 if [ "$name" = wayland ]; then
18 wayland-scanner client-header "$xml" include/wayland-client-protocol.h
19 elif [ "$name" != tablet-v2 ]; then
20 # tablet-v2 is here only for the interface cursor-shape refers to.
21 wayland-scanner client-header "$xml" "$name-client-protocol.h"
22 fi
23 wayland-scanner private-code "$xml" "$name-protocol.c"
24 done
25 echo "generated in $1: $(ls *.h *.c | tr '\n' ' ')"
28generate "$root/native/wayland"
29generate "$root/test/wayland"