-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathpackage_linux.sh
More file actions
executable file
·187 lines (160 loc) · 8.57 KB
/
Copy pathpackage_linux.sh
File metadata and controls
executable file
·187 lines (160 loc) · 8.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#!/bin/bash
# Package the Linux runtime build as a relocatable tarball + install.sh (#705).
#
# ./scripts/package_linux.sh # package an existing build/ (runs
# # build_linux.sh --hybrid --no-test
# # first if artifacts are missing)
# ./scripts/package_linux.sh --no-build # fail instead of building
#
# Output: dist/displayxr-runtime-linux-<arch>-<version>.tar.gz containing
# bin/displayxr-cli bin/displayxr-service
# bin/displayxr-gnome-extension-enable
# lib/openxr_displayxr.so
# lib/displayxr/plugins/DisplayXR-SimDisplay.so
# share/gnome-shell/extensions/window-geometry@displayxr.org/ (GNOME Shell
# extension: windowed Wayland weaving + capture exclusion; install.sh
# installs and enables it for the installing user)
# share/systemd/user/displayxr.socket + displayxr.service.in (#1744:
# install.sh substitutes the service path and enables the socket, so the
# service is socket-activated on first use)
# install.sh / uninstall.sh / README.md / VERSION
#
# v1 scope (#705): runtime + sim_display, user-level default. Config files
# (ActiveRuntime json, DP manifest, the service unit's ExecStart) are
# GENERATED by install.sh at install time with absolute paths.
#
# The runtime is the HYBRID build (#1744) — the same configuration as the .deb:
# ordinary apps in-process, XR_DXR_weave present-owners and workspace
# controllers over IPC to displayxr-service. (Before #1744 the tarball shipped
# an IPC-ONLY runtime from a plain --service build, so every app needed the
# service, and install.sh's unit could not start it.)
# The vendor (Leia SR) plug-in ships via its own installer into the same
# DisplayProcessors root; this tarball stays vendor-free.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
BUILD_DIR="$ROOT/build"
DIST_DIR="$ROOT/dist"
NO_BUILD=0
for arg in "$@"; do
case "$arg" in
--no-build) NO_BUILD=1 ;;
*) echo "Unknown option: $arg (supported: --no-build)" >&2; exit 2 ;;
esac
done
find_runtime() { find "$BUILD_DIR/src/xrt/targets/openxr" -maxdepth 1 -name "openxr_displayxr.so" -type f 2>/dev/null | head -1; }
if [ -z "$(find_runtime)" ]; then
if [ "$NO_BUILD" = 1 ]; then
echo "error: no build found under $BUILD_DIR (run scripts/build_linux.sh --hybrid first)" >&2
exit 1
fi
echo "==> No existing build — running build_linux.sh --hybrid --no-test"
"$ROOT/scripts/build_linux.sh" --hybrid --no-test
fi
RUNTIME_SO="$(find_runtime)"
CLI_BIN="$(find "$BUILD_DIR/src/xrt/targets/cli" -maxdepth 1 -name displayxr-cli -type f | head -1)"
# `|| true`: a build without --service has no targets/service dir, so find exits
# non-zero and, under pipefail + set -e, used to abort the script silently here
# instead of reaching the "packaging without it" note below.
SERVICE_BIN="$(find "$BUILD_DIR/src/xrt/targets/service" -maxdepth 1 -name displayxr-service -type f 2>/dev/null | head -1 || true)"
PLUGIN_SO="$(find "$BUILD_DIR/src/xrt/drivers" -name "DisplayXR-SimDisplay.so" -type f | head -1)"
for f in "$RUNTIME_SO" "$CLI_BIN" "$PLUGIN_SO"; do
[ -n "$f" ] || { echo "error: missing build artifact (runtime/cli/plugin)" >&2; exit 1; }
done
[ -n "$SERVICE_BIN" ] || {
echo "error: displayxr-service not built — the tarball ships it (#1744); build with --hybrid" >&2
exit 1
}
# Same hybrid-runtime guard as package_deb_linux.sh (here-string: see there).
RUNTIME_STRINGS="$(strings -a "$RUNTIME_SO" 2>/dev/null || true)"
if ! grep -q 'Hybrid mode: XR_DXR_weave present-owner' <<<"$RUNTIME_STRINGS"; then
echo "error: $RUNTIME_SO is not the hybrid runtime — build with scripts/build_linux.sh --hybrid" >&2
exit 1
fi
# Refuse a runtime without the native-Wayland present path (see the script for
# why this is a strings check rather than a NEEDED one).
"$ROOT/scripts/check_linux_runtime_wayland.sh" "$RUNTIME_SO" || exit 1
EXT_UUID="window-geometry@displayxr.org"
EXT_SRC="$ROOT/contrib/gnome-shell/$EXT_UUID"
# Both entry-point forms ship: extension.js is the GNOME 45+ ES module (the
# slot GNOME reads), extension-gnome42.js the GNOME 40-44 legacy one, lib.js
# the logic they share. install.sh's enable script puts the right one in the
# slot for the running shell (Ubuntu 22.04 is GNOME 42).
EXT_FILES="extension.js extension-gnome42.js lib.js metadata.json"
for f in $EXT_FILES; do
[ -f "$EXT_SRC/$f" ] || { echo "error: missing $EXT_SRC/$f (GNOME Shell extension payload)" >&2; exit 1; }
done
[ -f "$ROOT/scripts/linux/displayxr-gnome-extension-enable" ] || {
echo "error: missing scripts/linux/displayxr-gnome-extension-enable" >&2; exit 1
}
VERSION="$(git -C "$ROOT" describe --tags --always --dirty 2>/dev/null || echo unknown)"
ARCH="$(uname -m)"
NAME="displayxr-runtime-linux-$ARCH-$VERSION"
STAGE="$DIST_DIR/$NAME"
echo "==> Staging $NAME"
rm -rf "$STAGE"
mkdir -p "$STAGE/bin" "$STAGE/lib/displayxr/plugins" "$STAGE/share/gnome-shell/extensions/$EXT_UUID" \
"$STAGE/share/systemd/user"
cp "$CLI_BIN" "$STAGE/bin/"
cp "$SERVICE_BIN" "$STAGE/bin/"
cp "$ROOT/scripts/linux/systemd/displayxr.socket" "$ROOT/scripts/linux/systemd/displayxr.service.in" \
"$STAGE/share/systemd/user/"
cp "$RUNTIME_SO" "$STAGE/lib/"
cp "$PLUGIN_SO" "$STAGE/lib/displayxr/plugins/"
for f in $EXT_FILES; do cp "$EXT_SRC/$f" "$STAGE/share/gnome-shell/extensions/$EXT_UUID/"; done
install -m 0755 "$ROOT/scripts/linux/displayxr-gnome-extension-enable" "$STAGE/bin/"
cp "$ROOT/scripts/linux/install.sh" "$ROOT/scripts/linux/uninstall.sh" "$STAGE/"
chmod +x "$STAGE/install.sh" "$STAGE/uninstall.sh"
echo "$VERSION" > "$STAGE/VERSION"
# --- glibc floor (#1656) ---------------------------------------------------
# A tarball built on a newer distribution than the user's unpacks fine and then
# fails at every dlopen(). Record the highest glibc symbol version the shipped
# binaries reference so install.sh can refuse such a host with a clear message.
# (The release tarball is built in the oldest supported container — the Package
# job in .github/workflows/build-linux.yml — so the recorded floor is that
# release's; a locally built tarball honestly records the local one.)
# (`|| true`: objdump exits non-zero on the shell script in bin/, and under
# pipefail that would abort the script.)
GLIBC_SYMS="$(objdump -T "$STAGE/bin"/* "$STAGE/lib/openxr_displayxr.so" \
"$STAGE/lib/displayxr/plugins/DisplayXR-SimDisplay.so" 2>/dev/null || true)"
GLIBC_FLOOR="$(echo "$GLIBC_SYMS" | grep -o 'GLIBC_[0-9.]*' | sed 's/GLIBC_//' | sort -uV | tail -1 || true)"
if [ -n "$GLIBC_FLOOR" ]; then
echo "$GLIBC_FLOOR" > "$STAGE/GLIBC_FLOOR"
echo "==> glibc floor: $GLIBC_FLOOR (recorded in GLIBC_FLOOR; install.sh refuses older hosts)"
else
echo "note: objdump unavailable — no GLIBC_FLOOR recorded in the tarball" >&2
fi
cat > "$STAGE/README.md" <<EOF
# DisplayXR runtime for Linux ($VERSION)
Lightweight OpenXR runtime for 3D displays — Linux x86_64 build with the
vendor-neutral sim-display display processor.
## Install (user-level, no root)
./install.sh
Registers this runtime as the OpenXR ActiveRuntime for your user, installs the
sim-display display processor into the shared DisplayProcessors discovery
root, and enables a systemd user socket (\`displayxr.socket\`) for
displayxr-service: apps that need the out-of-process path (XR_DXR_weave
present-owners such as the DisplayXR browser, workspace controllers) start it
on first use; it exits when idle. Ordinary apps run in-process.
System-wide instead: \`sudo ./install.sh --system\` (units under
/usr/local/lib/systemd/user, the socket enabled for every user).
Remove with \`./uninstall.sh\` (same flag).
## GNOME: the window-geometry extension
On GNOME, \`install.sh\` also installs the GNOME Shell extension
\`window-geometry@displayxr.org\` (needed for windowed weaving under Wayland
and for transparent apps on a 3D panel) and enables it for you, unless you
disabled it before. **Log out and back in** afterwards: a Wayland session
cannot reload GNOME Shell, so the extension (or a new version of it) only
starts at your next login. \`--system\` installs it for every user instead,
each enabled at their next GNOME login.
Check it is running:
gnome-extensions info window-geometry@displayxr.org
## Verify
~/.local/share/displayxr/bin/displayxr-cli selftest
## Vendor display plug-ins
Vendor display processors (e.g. Leia SR) install separately into the same
DisplayProcessors root with a lower probe order and take precedence over
sim-display automatically. See the DisplayXR docs: plugin-discovery.md.
EOF
mkdir -p "$DIST_DIR"
tar -C "$DIST_DIR" -czf "$DIST_DIR/$NAME.tar.gz" "$NAME"
echo "==> $DIST_DIR/$NAME.tar.gz"