#!/usr/bin/env bash # Makes GPUI's X11 backend linkable on distributions that ship # libxkbcommon-x11.so.0 without the unversioned development symlink. # # The real fix is installing libxkbcommon-x11-dev. When that package is absent # this creates the one symlink the linker needs in a cache directory and exports # LIBRARY_PATH, so a UI build works without root. Source it, do not run it. # # source scripts/native-libs.sh lumbridge_native_libs() { local runtime=/usr/lib/x86_64-linux-gnu/libxkbcommon-x11.so.0 local devlink=/usr/lib/x86_64-linux-gnu/libxkbcommon-x11.so if [ -e "$devlink" ]; then return 0 fi if [ ! -e "$runtime" ]; then echo "libxkbcommon-x11 is not installed; a UI build will fail to link" >&2 echo " install it with: sudo apt install libxkbcommon-x11-dev" >&2 return 0 fi local cache="${XDG_CACHE_HOME:-$HOME/.cache}/lumbridge-native-libs" mkdir -p "$cache" ln -sfn "$runtime" "$cache/libxkbcommon-x11.so" export LIBRARY_PATH="$cache${LIBRARY_PATH:+:$LIBRARY_PATH}" echo "using $cache for libxkbcommon-x11.so (install libxkbcommon-x11-dev to avoid this)" >&2 } lumbridge_native_libs