refactor: migrate the UI to GTK4 with Relm4 and libadwaita
This commit is contained in:
parent
517d938c46
commit
7fdcd0d811
11 changed files with 2782 additions and 4765 deletions
|
|
@ -1,10 +1,11 @@
|
|||
#!/usr/bin/env sh
|
||||
# Devbox installs library packages as their -dev outputs, which carry no
|
||||
# shared objects; the outs they reference do. Put the GUI stack's real lib
|
||||
# dirs on LD_LIBRARY_PATH — wayland, xkbcommon, EGL and vulkan are dlopened
|
||||
# at runtime, so neither rpath nor a DT_NEEDED scan can cover them. Only
|
||||
# matching package names are picked up: a blanket list would drag glibc and
|
||||
# friends onto the path for every process in the shell.
|
||||
# dirs on LD_LIBRARY_PATH — wayland, xkbcommon, EGL, vulkan, gtk — all of
|
||||
# which are dlopened or linked at runtime, so neither rpath nor a
|
||||
# DT_NEEDED scan can cover them. Package names match exactly up to the
|
||||
# version suffix: a substring match would drag glibc onto the path for
|
||||
# every process in the shell ("glib" matches "glibc") and crash them.
|
||||
set -e
|
||||
|
||||
if [ -z "$DEVBOX_PACKAGES_DIR" ]; then
|
||||
|
|
@ -15,17 +16,24 @@ MANIFEST="$DEVBOX_PACKAGES_DIR/manifest.json"
|
|||
[ -f "$MANIFEST" ] || return 0 2>/dev/null || exit 0
|
||||
|
||||
libs=$(python3 - "$MANIFEST" <<'EOF'
|
||||
import json, os, subprocess, sys
|
||||
import json, os, re, subprocess, sys
|
||||
|
||||
WANTED = {
|
||||
"wayland", "libxkbcommon", "libglvnd", "vulkan-loader", "mesa",
|
||||
"gtk4", "libadwaita", "glib", "pango", "cairo", "gdk-pixbuf", "graphene",
|
||||
"harfbuzz", "libepoxy", "freetype", "fribidi", "fontconfig",
|
||||
"libpng", "pixman", "libxml2", "libtiff", "libjpeg_turbo",
|
||||
}
|
||||
|
||||
def pkg_name(path):
|
||||
base = os.path.basename(path.rstrip("/"))
|
||||
# "pango-1.56.0-dev" -> "pango"
|
||||
m = re.match(r"([A-Za-z0-9_.-]+?)(-[0-9].*)?$", base)
|
||||
return m.group(1).rstrip("-") if m else base
|
||||
|
||||
wanted = ("wayland", "libxkbcommon", "libglvnd", "vulkan-loader", "mesa")
|
||||
manifest = json.load(open(sys.argv[1]))
|
||||
seen, dirs = set(), []
|
||||
paths = [
|
||||
path
|
||||
for name, el in manifest["elements"].items()
|
||||
if any(w in name for w in wanted)
|
||||
for path in el.get("storePaths", [])
|
||||
]
|
||||
paths = [p for el in manifest["elements"].values() for p in el.get("storePaths", [])]
|
||||
for path in paths:
|
||||
candidates = [path]
|
||||
try:
|
||||
|
|
@ -37,10 +45,9 @@ for path in paths:
|
|||
pass
|
||||
for cand in candidates:
|
||||
lib = os.path.join(cand, "lib")
|
||||
base = os.path.basename(cand)
|
||||
if lib in seen or not os.path.isdir(lib):
|
||||
continue
|
||||
if not any(w in base for w in wanted):
|
||||
if pkg_name(cand) not in WANTED:
|
||||
continue
|
||||
if any(name.endswith(".so") or ".so." in name for name in os.listdir(lib)):
|
||||
seen.add(lib)
|
||||
|
|
@ -50,3 +57,5 @@ EOF
|
|||
)
|
||||
|
||||
export LD_LIBRARY_PATH="${libs}:${DEVBOX_PACKAGES_DIR}/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
|
||||
# GTK finds schemas, icons and themes through XDG_DATA_DIRS.
|
||||
export XDG_DATA_DIRS="${DEVBOX_PACKAGES_DIR}/share:${XDG_DATA_DIRS:-/usr/share:/usr/local/share}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue