Skip to content

RediWM is a Wayland compositor written in Zig (OpenGL ES) that includes everything in one process

Add experimental SteamOS 3.8 portable bundle

oxydizer4d988f573dcf
diff --git a/README.md b/README.md
index 1a27e21..dee5ce0 100644
--- a/README.md
+++ b/README.md
@@ -48,6 +48,9 @@ To build just the Nix package, without configuring a login session:
nix build github:oxydizer/rediwm
```
+For the experimental SteamOS 3.8 portable bundle (user-only installation and
+nested KDE testing), see [the SteamOS instructions](packaging/steamos/README.txt).
+
## Building and running
Requirements: Zig 0.17, wlroots 0.20, and the development files for Wayland,
diff --git a/build.zig b/build.zig
index ead8c6d..69b3f7f 100644
--- a/build.zig
+++ b/build.zig
@@ -214,6 +214,7 @@ pub fn build(b: *std.Build) void {
.optimize = optimize,
.use_llvm = use_llvm,
.wlroots_prefix = wlroots_prefix,
+ .transfers = b.option(bool, "transfers", "Build and install the torrent transfers helper") orelse true,
.i18n_tool = i18n_tool,
.wayland = wayland,
.xkbcommon = xkbcommon,
@@ -242,7 +243,7 @@ pub fn build(b: *std.Build) void {
.install_dir = .lib,
.install_subdir = "rediwm",
});
- for ([_]*std.Build.Step.Compile{ compositor, files, images, share_picker, pdf, editor }) |exe|
+ for ([_]*std.Build.Step.Compile{ compositor, files, images, share_picker, pdf, editor, monitor, calculator, theme_helper }) |exe|
exe.root_module.addRPathSpecial("$ORIGIN/../lib/rediwm");
}
data.add(ctx);
diff --git a/build/apps.zig b/build/apps.zig
index ee32570..0fc0372 100644
--- a/build/apps.zig
+++ b/build/apps.zig
@@ -43,26 +43,6 @@ pub fn add(ctx: Context) Apps {
addFilesTerminal(b, files.root_module, false);
const terminal_license = b.addInstallFileWithDir(b.dependency("vterm", .{}).path("LICENSE"), .prefix, "share/licenses/rediwm/libvterm-LICENSE");
b.getInstallStep().dependOn(&terminal_license.step);
- // Use the system C++ ABI, matching the distro's libtorrent-rasterbar.
- const torrents = b.addSystemCommand(&.{ "sh", "-c", "exec c++ -std=c++17 -Wall -Wextra -Werror -Wno-deprecated-declarations -Wno-missing-field-initializers $(pkg-config --cflags libtorrent-rasterbar gio-unix-2.0 json-glib-1.0) \"$@\" $(pkg-config --libs libtorrent-rasterbar gio-unix-2.0 json-glib-1.0)", "build-transfers" });
- torrents.addArg(if (optimize == .debug) "-O0" else "-O2");
- torrents.addArg("-g");
- torrents.addArg("-D_GLIBCXX_ASSERTIONS");
- torrents.addArg("-fstack-protector-strong");
- if (optimize != .debug) {
- // Distro compilers may predefine fortification; replace it explicitly.
- torrents.addArg("-U_FORTIFY_SOURCE");
- torrents.addArg("-D_FORTIFY_SOURCE=3");
- }
- inline for (.{ "helper.cpp", "helper_transfers.cpp", "helper_peers.cpp", "helper_tray.cpp" }) |part| torrents.addFileArg(b.path("src/files/torrent/" ++ part));
- torrents.addFileInput(b.path("src/files/torrent/helper.hpp"));
- torrents.addFileInput(b.path("src/platform/self_exe.h"));
- torrents.addArg("-o");
- const torrent_binary = torrents.addOutputFileArg("rediwm-transfers");
- const install_torrents = b.addInstallFileWithDir(torrent_binary, .bin, "rediwm-transfers");
- b.getInstallStep().dependOn(&install_torrents.step);
- const torrent_license = b.addInstallFileWithDir(b.path("src/files/torrent/LICENSE.libtorrent"), .prefix, "share/licenses/rediwm/libtorrent-LICENSE");
- b.getInstallStep().dependOn(&torrent_license.step);
const install_files = b.addInstallArtifact(files, .{});
// Advertises rediwm-files to the start menu's applications scanner
// (src/start_menu/applications.zig) and to any other XDG-aware
@@ -85,17 +65,39 @@ pub fn add(ctx: Context) Apps {
// builds everything, this only adds a narrower entry point.
const files_step = b.step("files", "Build the standalone Files and image viewer clients");
files_step.dependOn(&install_files.step);
- files_step.dependOn(&install_torrents.step);
- files_step.dependOn(&torrent_license.step);
- const transfers_entry = b.addInstallFileWithDir(localizedData(b, i18n_tool, ctx.layout.prefix, "data/rediwm-transfers.desktop"), .prefix, "share/applications/rediwm-transfers.desktop");
- b.getInstallStep().dependOn(&transfers_entry.step);
- files_step.dependOn(&transfers_entry.step);
- const test_torrents = b.step("test-files-torrents", "Test real loopback transfers and the Files/tray interface");
- const torrent_engine_test = b.addSystemCommand(&.{ "python3", "tests/files_torrents.py" });
- torrent_engine_test.step.dependOn(b.getInstallStep());
- const torrent_ui_test = b.addSystemCommand(&.{ "python3", "tests/files_transfers_ui.py" });
- torrent_ui_test.step.dependOn(&torrent_engine_test.step);
- test_torrents.dependOn(&torrent_ui_test.step);
+ if (ctx.transfers) {
+ // Use the system C++ ABI, matching the distro's libtorrent-rasterbar.
+ const torrents = b.addSystemCommand(&.{ "sh", "-c", "exec c++ -std=c++17 -Wall -Wextra -Werror -Wno-deprecated-declarations -Wno-missing-field-initializers $(pkg-config --cflags libtorrent-rasterbar gio-unix-2.0 json-glib-1.0) \"$@\" $(pkg-config --libs libtorrent-rasterbar gio-unix-2.0 json-glib-1.0)", "build-transfers" });
+ torrents.addArg(if (optimize == .debug) "-O0" else "-O2");
+ torrents.addArg("-g");
+ torrents.addArg("-D_GLIBCXX_ASSERTIONS");
+ torrents.addArg("-fstack-protector-strong");
+ if (optimize != .debug) {
+ // Distro compilers may predefine fortification; replace it explicitly.
+ torrents.addArg("-U_FORTIFY_SOURCE");
+ torrents.addArg("-D_FORTIFY_SOURCE=3");
+ }
+ inline for (.{ "helper.cpp", "helper_transfers.cpp", "helper_peers.cpp", "helper_tray.cpp" }) |part| torrents.addFileArg(b.path("src/files/torrent/" ++ part));
+ torrents.addFileInput(b.path("src/files/torrent/helper.hpp"));
+ torrents.addFileInput(b.path("src/platform/self_exe.h"));
+ torrents.addArg("-o");
+ const torrent_binary = torrents.addOutputFileArg("rediwm-transfers");
+ const install_torrents = b.addInstallFileWithDir(torrent_binary, .bin, "rediwm-transfers");
+ b.getInstallStep().dependOn(&install_torrents.step);
+ const torrent_license = b.addInstallFileWithDir(b.path("src/files/torrent/LICENSE.libtorrent"), .prefix, "share/licenses/rediwm/libtorrent-LICENSE");
+ b.getInstallStep().dependOn(&torrent_license.step);
+ files_step.dependOn(&install_torrents.step);
+ files_step.dependOn(&torrent_license.step);
+ const transfers_entry = b.addInstallFileWithDir(localizedData(b, i18n_tool, ctx.layout.prefix, "data/rediwm-transfers.desktop"), .prefix, "share/applications/rediwm-transfers.desktop");
+ b.getInstallStep().dependOn(&transfers_entry.step);
+ files_step.dependOn(&transfers_entry.step);
+ const test_torrents = b.step("test-files-torrents", "Test real loopback transfers and the Files/tray interface");
+ const torrent_engine_test = b.addSystemCommand(&.{ "python3", "tests/files_torrents.py" });
+ torrent_engine_test.step.dependOn(b.getInstallStep());
+ const torrent_ui_test = b.addSystemCommand(&.{ "python3", "tests/files_transfers_ui.py" });
+ torrent_ui_test.step.dependOn(&torrent_engine_test.step);
+ test_torrents.dependOn(&torrent_ui_test.step);
+ }
files_step.dependOn(&install_files_desktop_entry.step);
files_step.dependOn(&terminal_license.step);
const terminal_child = b.addExecutable(.{
diff --git a/build/context.zig b/build/context.zig
index 83c7ab5..b585bd0 100644
--- a/build/context.zig
+++ b/build/context.zig
@@ -10,6 +10,7 @@ pub const Context = struct {
target: std.Build.ResolvedTarget,
optimize: std.lang.Optimize,
use_llvm: bool,
+ transfers: bool,
wlroots_prefix: ?[]const u8,
i18n_tool: *std.Build.Step.Compile,
wayland: *std.Build.Module,
diff --git a/build/install_paths.zig b/build/install_paths.zig
index a118e5c..a506d71 100644
--- a/build/install_paths.zig
+++ b/build/install_paths.zig
@@ -22,6 +22,7 @@ pub const Layout = struct {
const normalized = std.fs.path.resolve(b.allocator, &.{raw}) catch @panic("out of memory");
const prefix = std.mem.trimEnd(u8, normalized, "/");
const options = b.addOptions();
+ options.addOption(bool, "git_integration", b.option(bool, "git-integration", "Enable Files Git integration") orelse true);
options.addOption([]const u8, "prefix", prefix);
options.addOption([]const u8, "bin", b.fmt("{s}/bin", .{prefix}));
options.addOption([]const u8, "data", b.fmt("{s}/share", .{prefix}));
diff --git a/packaging/steamos/Containerfile b/packaging/steamos/Containerfile
new file mode 100644
index 0000000..c7fe4a1
--- /dev/null
+++ b/packaging/steamos/Containerfile
@@ -0,0 +1,20 @@
+# Build dependencies come exclusively from Valve's versioned 3.8 repositories.
+# The Arch image supplies the bootstrap package manager only.
+FROM docker.io/library/archlinux:latest AS bootstrap
+RUN printf '[options]\nArchitecture = auto\nSigLevel = Never\nDisableDownloadTimeout\nParallelDownloads = 5\n' > /etc/pacman.conf && \
+ for repo in jupiter holo core extra; do \
+ printf '\n[%s-3.8]\nServer = https://steamdeck-packages.steamos.cloud/archlinux-mirror/$repo/os/$arch\n' "$repo" >> /etc/pacman.conf; \
+ done && \
+ mkdir -p /baseline/var/lib/pacman /baseline/dev && \
+ pacman --root /baseline --dbpath /baseline/var/lib/pacman --config /etc/pacman.conf \
+ --noscriptlet -Sy --noconfirm base base-devel ca-certificates meson ninja patchelf curl python \
+ wayland wayland-protocols pixman libxkbcommon freetype2 harfbuzz fontconfig \
+ librsvg cairo pango libinput poppler-glib libarchive libwebp libpng \
+ libjpeg-turbo libpulse pipewire pam libcups mesa readline libdrm libglvnd \
+ seatd lcms2 hwdata libxcb xcb-util-wm xcb-util-renderutil xcb-util-errors \
+ dbus git
+RUN cp /etc/pacman.conf /baseline/etc/pacman.conf
+FROM scratch
+COPY --from=bootstrap /baseline /
+RUN update-ca-trust && pacman -S --noconfirm xorg-xwayland
+WORKDIR /work
diff --git a/packaging/steamos/README.txt b/packaging/steamos/README.txt
new file mode 100644
index 0000000..9ddd757
--- /dev/null
+++ b/packaging/steamos/README.txt
@@ -0,0 +1,29 @@
+RediWM experimental SteamOS 3.8 portable bundle (x86_64)
+
+Extract the tarball in Desktop Mode and run ./rediwm-steamos/install as your
+normal user. It copies the bundle to ~/.local/opt/rediwm-steamos. No sudo,
+read-only filesystem changes, system packages, or session registration.
+
+Run ~/.local/opt/rediwm-steamos/run --check to verify library resolution.
+Then run ~/.local/opt/rediwm-steamos/run from KDE's Wayland session. RediWM
+opens nested. Super+Shift+E quits. Test Files, Images, Editor and PDF using
+the launcher. Verify display, keyboard, pointer and app launch behavior before
+considering full desktop session integration. KDE testing on a real Deck is
+required; a successful library check alone does not qualify Deck support.
+
+Settings/state are under ~/.local/share/rediwm-steamos-test and cache under
+~/.cache/rediwm-steamos-test. Remove these and ~/.local/opt/rediwm-steamos to
+uninstall. No desktop entries or file associations are installed.
+
+Git integration and the torrent transfers helper are omitted. Login/session
+management and privileged account changes are not supported by this bundle.
+Host Mesa, audio and other runtime libraries remain required. A missing
+library reported by --check is a packaging issue: report it rather than
+unlocking SteamOS or upgrading its system packages.
+
+Maintainers: sh scripts/make-steamos-bundle.sh builds the current checkout in
+an isolated container using Valve's versioned 3.8 repositories. These are
+mutable: BUILD-PACKAGES.txt records exact package versions. Repository
+signature checks are disabled only inside this disposable build container
+(the bootstrap Arch keyring lacks Valve keys); downloads use Valve HTTPS.
+wlroots and fallback sources are pinned and SHA256 checked by the build.
diff --git a/packaging/steamos/check-libs b/packaging/steamos/check-libs
new file mode 100644
index 0000000..93a60a4
--- /dev/null
+++ b/packaging/steamos/check-libs
@@ -0,0 +1,19 @@
+#!/bin/sh
+set -eu
+root=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
+# Do not let a developer's environment hide missing runtime dependencies.
+unset LD_LIBRARY_PATH LD_PRELOAD
+for file in "$root"/bin/* "$root"/lib/rediwm/*.so*; do
+ report=$(ldd "$file" 2>&1) || { printf '%s\n' "$report" >&2; exit 1; }
+ printf '%s\n%s\n' "$file" "$report"
+ if printf '%s\n' "$report" | grep -F 'not found' >/dev/null; then
+ printf '%s\n%s\n' "Library check failed: $file" "$report" >&2
+ exit 1
+ fi
+ # Every bundled library referenced by this object must resolve privately.
+ for lib in "$root"/lib/rediwm/lib*.so*; do
+ name=$(basename "$lib")
+ resolved=$(printf '%s\n' "$report" | awk -v name="$name" '$1 == name {print $3}')
+ [ -z "$resolved" ] || [ "$(readlink -f "$resolved")" = "$(readlink -f "$lib")" ] || exit 1
+ done
+done
diff --git a/packaging/steamos/install b/packaging/steamos/install
new file mode 100644
index 0000000..884574f
--- /dev/null
+++ b/packaging/steamos/install
@@ -0,0 +1,9 @@
+#!/bin/sh
+set -eu
+root=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
+dest="$HOME/.local/opt/rediwm-steamos"
+[ "$(id -u)" != 0 ] || { echo 'Run as your normal desktop user.' >&2; exit 1; }
+[ ! -e "$dest" ] || { echo "$dest already exists; move it aside before installing." >&2; exit 1; }
+mkdir -p "$HOME/.local/opt"
+cp -R "$root" "$dest"
+printf 'Installed. From KDE Wayland Desktop Mode, run:\n "%s/run" --check\n "%s/run"\n' "$dest" "$dest"
diff --git a/packaging/steamos/run b/packaging/steamos/run
new file mode 100644
index 0000000..81e0671
--- /dev/null
+++ b/packaging/steamos/run
@@ -0,0 +1,16 @@
+#!/bin/sh
+set -eu
+root=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
+if [ "${1:-}" = --check ]; then exec "$root/check-libs"; fi
+[ -n "${WAYLAND_DISPLAY:-}" ] || { echo 'Start this from KDE Desktop Mode with a Wayland session.' >&2; exit 1; }
+"$root/check-libs" >/dev/null
+# Isolate test settings and state from both KDE and another RediWM install.
+export XDG_CONFIG_HOME="$HOME/.local/share/rediwm-steamos-test/config"
+export XDG_STATE_HOME="$HOME/.local/share/rediwm-steamos-test/state"
+export XDG_CACHE_HOME="$HOME/.cache/rediwm-steamos-test"
+export XDG_DATA_HOME="$HOME/.local/share/rediwm-steamos-test/data"
+export XDG_DATA_DIRS="$root/share:/usr/local/share:/usr/share"
+export PATH="$root/bin:$PATH"
+export WLR_BACKENDS=wayland WLR_RENDERER=gles2 REDIWM_SCALE=1
+unset LD_LIBRARY_PATH LD_PRELOAD REDIWM_CONFIG REDIWM_SESSION_FD REDIWM_LOGIN_SESSION
+exec dbus-run-session -- "$root/bin/rediwm" "$@"
diff --git a/scripts/build-steamos-bundle.sh b/scripts/build-steamos-bundle.sh
new file mode 100644
index 0000000..6ca2644
--- /dev/null
+++ b/scripts/build-steamos-bundle.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+# Container-only payload; never invoke on a Steam Deck host.
+set -eu
+[ -f /run/.containerenv ] || [ -f /.dockerenv ] || { echo 'Run make-steamos-bundle.sh instead' >&2; exit 1; }
+out=$1
+prefix=/work/zig-out/steamos-wlroots
+REDIWM_BUNDLE_WAYLAND=1 sh scripts/build-wlroots.sh "$prefix"
+ZIG=$(sh scripts/zig-bootstrap.sh)
+sh scripts/with-wlroots.sh "$prefix" "$ZIG" build -Doptimize=ReleaseSafe \
+ -Dcpu=x86_64_v2 -Dtransfers=false -Dgit-integration=false \
+ -Dwlroots-prefix="$prefix" --prefix zig-out/steamos
+bundle=/work/zig-out/rediwm-steamos
+mkdir -p "$bundle"
+cp -a zig-out/steamos/bin zig-out/steamos/lib zig-out/steamos/share "$bundle/"
+# Portable nested testing has no privileged helpers or system integration.
+rm -f "$bundle/bin/rediwm-dm" "$bundle/bin/rediwm-accounts-helper" \
+ "$bundle/bin/rediwm-session" "$bundle/bin/rediwm-restart"
+rm -rf "$bundle/share/wayland-sessions" "$bundle/share/polkit-1" "$bundle/share/xdg-desktop-portal"
+# These entries are visible only inside the nested session through XDG_DATA_DIRS.
+# Resolve their commands through the launcher's private PATH after relocation.
+for entry in "$bundle"/share/applications/*.desktop; do
+ sed -i 's|=/usr/local/bin/|=|g' "$entry"
+done
+for exe in "$bundle"/bin/*; do
+ patchelf --set-rpath '$ORIGIN/../lib/rediwm' "$exe"
+done
+cp packaging/steamos/run packaging/steamos/check-libs packaging/steamos/install "$bundle/"
+chmod 755 "$bundle/run" "$bundle/check-libs" "$bundle/install"
+cp packaging/steamos/README.txt "$bundle/README.txt"
+pacman -Q > "$bundle/BUILD-PACKAGES.txt"
+# Explicit bundle contract: the baseline alone cannot satisfy wlroots.
+for lib in libwlroots-0.20.so libwayland-client.so.0 libwayland-server.so.0 libwayland-cursor.so.0; do
+ test -f "$bundle/lib/rediwm/$lib"
+done
+"$bundle/check-libs" > "$bundle/LIBRARY-CHECK.txt"
+(cd /work/zig-out && tar -czf "$out/rediwm-steamos-3.8-x86_64.tar.gz" rediwm-steamos)
+(cd "$out" && sha256sum rediwm-steamos-3.8-x86_64.tar.gz > rediwm-steamos-3.8-x86_64.tar.gz.sha256)
diff --git a/scripts/build-wlroots.sh b/scripts/build-wlroots.sh
index aa13040..111441d 100755
--- a/scripts/build-wlroots.sh
+++ b/scripts/build-wlroots.sh
@@ -38,7 +38,7 @@ for tool in meson ninja pkg-config curl sha256sum readelf patchelf ldd patch; do
done
patch_dir=$(CDPATH= cd -- "$(dirname -- "$0")/../patches/wlroots" && pwd)
-recipe=$(cat "$0" "$patch_dir"/*.patch | sha256sum | cut -d' ' -f1)
+recipe=$({ cat "$0" "$patch_dir"/*.patch; printf '%s\n' "${REDIWM_BUNDLE_WAYLAND:-0}"; } | sha256sum | cut -d' ' -f1)
if [ -f "$prefix/.rediwm-recipe" ] && [ "$(cat "$prefix/.rediwm-recipe")" = "$recipe" ]; then
log "wlroots $WLROOTS_VERSION already built in $prefix"
exit 0
@@ -104,7 +104,10 @@ wrap libdisplay-info libdisplay-info-0.3.0 \
# lookup settles for 0.43, so an in-between system pixman must be bypassed.
force_fallback=""
pkg-config --atleast-version=0.46.0 pixman-1 2>/dev/null || force_fallback="--force-fallback-for=pixman"
-log "Configuring wlroots (bundling only the dependencies this system lacks)"
+if [ "${REDIWM_BUNDLE_WAYLAND:-0}" = 1 ]; then
+ force_fallback="--force-fallback-for=wayland${force_fallback:+,pixman}"
+fi
+log "Configuring wlroots (bundling required dependencies)"
meson setup "$work/build" "$src" $force_fallback \
--prefix "$prefix" --libdir lib --buildtype release --wrap-mode nopromote -Dwerror=false \
-Dexamples=false -Dbackends=drm,libinput,x11 -Drenderers=gles2 \
diff --git a/scripts/make-steamos-bundle.sh b/scripts/make-steamos-bundle.sh
new file mode 100644
index 0000000..87c47af
--- /dev/null
+++ b/scripts/make-steamos-bundle.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+# Build the working checkout in a disposable SteamOS 3.8 baseline container.
+set -eu
+src=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
+out=${1:-"$src/release"}
+mkdir -p "$out"
+out=$(CDPATH= cd -- "$out" && pwd)
+engine=${REDIWM_CONTAINER_ENGINE:-podman}
+image=localhost/rediwm-steamos-build:3.8
+"$engine" build -t "$image" -f "$src/packaging/steamos/Containerfile" "$src/packaging/steamos"
+work=$(mktemp -d)
+trap 'rm -rf "$work"' EXIT HUP INT TERM
+# Include local changes, but never host build outputs or caches.
+tar -C "$src" --exclude=.git --exclude=.zig-cache --exclude=zig-out --exclude=release -cf - . | tar -C "$work" -xf -
+"$engine" run --rm -v "$work:/work" -v "$out:/out" "$image" sh scripts/build-steamos-bundle.sh /out
diff --git a/src/files/git.zig b/src/files/git.zig
index ec766cc..fac408a 100644
--- a/src/files/git.zig
+++ b/src/files/git.zig
@@ -262,6 +262,7 @@ pub const Outcome = struct {
/// refuses a switch that would overwrite local changes; its first line of
/// complaint is returned for display.
pub fn switchBranch(mem: Allocator, io: std.Io, environ: std.process.Environ, dir: []const u8, name: []const u8, create: bool) Outcome {
+ if (!@import("install_paths").git_integration) return .{ .ok = false };
var out: Outcome = .{ .ok = false };
const fail = struct {
fn set(o: *Outcome, msg: []const u8) Outcome {
@@ -306,6 +307,7 @@ pub fn switchBranch(mem: Allocator, io: std.Io, environ: std.process.Environ, di
}
pub fn scan(mem: Allocator, io: std.Io, environ: std.process.Environ, dir: []const u8) !?Repository {
+ if (!@import("install_paths").git_integration) return null;
var canonical: [std.fs.max_path_bytes]u8 = undefined;
const zdir = try mem.dupeSentinel(u8, dir, 0);
defer mem.free(zdir);
diff --git a/tests/steamos_bundle.py b/tests/steamos_bundle.py
new file mode 100644
index 0000000..ab67967
--- /dev/null
+++ b/tests/steamos_bundle.py
@@ -0,0 +1,37 @@
+#!/usr/bin/env python3
+"""Check a built portable tree without changing the host desktop or system.
+Usage: python3 tests/steamos_bundle.py /path/to/rediwm-steamos
+"""
+import os
+from pathlib import Path
+import subprocess
+import sys
+import tempfile
+
+bundle = Path(sys.argv[1]).resolve()
+assert not (bundle / 'bin/rediwm-transfers').exists()
+assert not (bundle / 'share/wayland-sessions').exists()
+for entry in (bundle / 'share/applications').glob('*.desktop'):
+ assert '=/usr/local/bin/' not in entry.read_text()
+assert not (bundle / 'share/applications/rediwm-transfers.desktop').exists()
+for name in ('libwlroots-0.20.so', 'libwayland-client.so.0',
+ 'libwayland-server.so.0', 'libwayland-cursor.so.0'):
+ assert (bundle / 'lib/rediwm' / name).is_file(), name
+for binary in (bundle / 'bin').iterdir():
+ dynamic = subprocess.check_output(['readelf', '-d', binary], text=True)
+ assert 'libtorrent' not in dynamic
+ assert '/work/' not in dynamic
+ assert '$ORIGIN/../lib/rediwm' in dynamic
+with tempfile.TemporaryDirectory(prefix='rediwm-portable-') as tmp:
+ env = dict(os.environ, HOME=tmp)
+ subprocess.run(['sh', bundle / 'install'], env=env, check=True)
+ installed = Path(tmp) / '.local/opt/rediwm-steamos'
+ # The actual loader check must also pass after relocation.
+ subprocess.run(['sh', installed / 'run', '--check'], env=env,
+ stdout=subprocess.DEVNULL, check=True)
+ assert list(Path(tmp).iterdir()) == [Path(tmp) / '.local']
+ # An update must not silently overwrite an existing installation.
+ result = subprocess.run(['sh', bundle / 'install'], env=env,
+ stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
+ assert result.returncode != 0
+print('PASS: private libraries, omitted features, user install, relocation, overwrite refusal')