From 45d8de38393c2b34eaafd49901a48fced685b1e8 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sun, 5 Jul 2026 02:26:53 +0200 Subject: 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. --- Makefile.am | 3 +++ gtk-broadway-run.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100755 gtk-broadway-run.sh 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. +"$@" -- cgit v1.2.3