aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobin Haberkorn <rhaberkorn@fmsbw.de>2026-07-05 02:26:53 +0200
committerRobin Haberkorn <rhaberkorn@fmsbw.de>2026-07-05 11:45:11 +0200
commit45d8de38393c2b34eaafd49901a48fced685b1e8 (patch)
treedc89853e1c49129bc748423d653715e751414032
parentecd1b0d916bbbe002af9624f152c062a891e4633 (diff)
added gtk-broadway-run.sh as an alternative to xfvb-run
The latter sometimes fails and causes a lot of fallout on OBS servers. gtk-broadway-run.sh uses the GTK Broadway backend instead and will only work with GTK applications. It is currently tested for the Debian and RPM packages and might later be integrated into the FreeBSD package as well.
-rw-r--r--Makefile.am3
-rwxr-xr-xgtk-broadway-run.sh28
2 files changed, 31 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index e956878..2393eb1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -12,6 +12,9 @@ dist_scitecodata_DATA = fallback.teco_ini
EXTRA_DIST = README TODO
+# Used in many packaging recipes
+dist_noinst_SCRIPTS = gtk-broadway-run.sh
+
if INTERFACE_GTK
# Only the lower resolution PNG icons are installed as they are
# required by the GTK UI.
diff --git a/gtk-broadway-run.sh b/gtk-broadway-run.sh
new file mode 100755
index 0000000..9b20f7b
--- /dev/null
+++ b/gtk-broadway-run.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+# ./gtk-broadway-run.sh PROGRAM ARGS...
+# Starts PROGRAM under Gtk with the Broadway backend.
+#
+# This is meant as a more reliable replacement to xvfb-run
+# when building SciTECO on headless systems.
+# WARNING: This will block indefinitely when letting
+# SciTECO (or any Gtk app) start up to its UI.
+set -e
+
+export GDK_BACKEND=broadway
+
+# mktemp would create the file already
+BROADWAY_SOCKET=/tmp/gtk-broadway.sock.$$
+
+broadwayd --unixsocket $BROADWAY_SOCKET >/dev/null &
+BROADWAY_PID=$!
+trap "kill $BROADWAY_PID; rm -f $BROADWAY_SOCKET" EXIT
+
+# Wait for broadway to start up.
+# broadwayd might also die in the meantime.
+while kill -0 $BROADWAY_PID >/dev/null && [ ! -S $BROADWAY_SOCKET ]; do
+ # `sleep 0.1` might be unportable.
+ sleep 0.1 || sleep 1
+done
+
+# We don't exec, so we can still clean up with the trap afterwards.
+"$@"