From 2f5ab12d358be4ab3e8e8ba42dcd0a7a6a84de64 Mon Sep 17 00:00:00 2001 From: William Wold Date: Thu, 1 Aug 2019 04:54:28 +0000 Subject: Add foreign toplevel management protocol and generated code --- applets/wncklet/wayland-protocol/generate-code.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 applets/wncklet/wayland-protocol/generate-code.sh (limited to 'applets/wncklet/wayland-protocol/generate-code.sh') diff --git a/applets/wncklet/wayland-protocol/generate-code.sh b/applets/wncklet/wayland-protocol/generate-code.sh new file mode 100755 index 00000000..90b248b2 --- /dev/null +++ b/applets/wncklet/wayland-protocol/generate-code.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# This script uses wayland-scanner to generate C bindings from Wayland protocol XML definitions +# It only needs to be called with the XML files change, and is not called as part of the build system + +# Fail the script if anything goes wrong +set -euo pipefail + +# Get the directory this script is in +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +echo "Looking for Wayland protocols in $SCRIPT_DIR" + +# Loop through all XML files in the same directory as this script +for PROTO_FILE_PATH in $(ls "$SCRIPT_DIR"/*.xml); do + # Strip the path and the .xml extension + PROTO_NAME=$(basename "$PROTO_FILE_PATH" .xml) + echo "Generating C bindings for $PROTO_NAME" + wayland-scanner -c client-header "$PROTO_FILE_PATH" "$SCRIPT_DIR/$PROTO_NAME-client.h" + wayland-scanner -c private-code "$PROTO_FILE_PATH" "$SCRIPT_DIR/$PROTO_NAME-code.c" +done -- cgit v1.2.1