@ng-native/desktop 0.26.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/bin/app-config.mjs +1 -0
- package/bin/archive.mjs +166 -0
- package/bin/autolink.mjs +61 -30
- package/bin/cli.mjs +127 -27
- package/bin/host.mjs +255 -58
- package/bin/package-linux.mjs +1394 -0
- package/bin/package.mjs +171 -35
- package/bin/plist.mjs +6 -2
- package/bin/png-icon.mjs +315 -0
- package/bin/prebuilt.mjs +147 -26
- package/bin/toolchain.mjs +258 -19
- package/native/CMakeLists.txt +64 -6
- package/native/appkit/CMakeLists.txt +2 -1
- package/native/appkit/appkit-backend.h +1 -0
- package/native/appkit/appkit-backend.mm +13 -0
- package/native/appkit/header-toolbar.mm +28 -25
- package/native/appkit/host-view.h +10 -0
- package/native/appkit/host-view.mm +146 -40
- package/native/appkit/input-replay.h +6 -0
- package/native/appkit/input-replay.mm +21 -12
- package/native/appkit/main.mm +11 -7
- package/native/appkit/native-controls.mm +13 -1
- package/native/appkit/split-view.mm +7 -13
- package/native/appkit/text-input-field.h +4 -0
- package/native/appkit/text-input-field.mm +20 -1
- package/native/cmake/curl.cmake +79 -0
- package/native/cmake/libraries/react-native-reanimated.cmake +5 -0
- package/native/cmake/libraries/react-native-worklets.cmake +5 -0
- package/native/cmake/linked-modules.cmake +20 -4
- package/native/cmake/react-native.cmake +18 -1
- package/native/core/include/ngn/accent-colors.h +38 -0
- package/native/core/include/ngn/accessibility-relations.h +65 -0
- package/native/core/include/ngn/accessibility.h +26 -0
- package/native/core/include/ngn/animated-frame-loop.h +56 -0
- package/native/core/include/ngn/app-info.h +24 -8
- package/native/core/include/ngn/app-menus.h +14 -1
- package/native/core/include/ngn/app-windows.h +15 -2
- package/native/core/include/ngn/aria-role.h +96 -0
- package/native/core/include/ngn/audio.h +2 -0
- package/native/core/include/ngn/camera.h +9 -0
- package/native/core/include/ngn/control-sizes.h +7 -2
- package/native/core/include/ngn/crash-report.h +31 -0
- package/native/core/include/ngn/curl-network.h +93 -0
- package/native/core/include/ngn/dbus-menu.h +39 -0
- package/native/core/include/ngn/default-menu.h +36 -0
- package/native/core/include/ngn/desktop-expo.h +7 -1
- package/native/core/include/ngn/desktop-modules.h +22 -0
- package/native/core/include/ngn/desktop-props.h +21 -1
- package/native/core/include/ngn/desktop-view-props.h +6 -0
- package/native/core/include/ngn/focus-order.h +10 -0
- package/native/core/include/ngn/header-bar.h +22 -0
- package/native/core/include/ngn/host-os.h +6 -0
- package/native/core/include/ngn/host-reload.h +21 -0
- package/native/core/include/ngn/host-state.h +23 -0
- package/native/core/include/ngn/image-source.h +26 -1
- package/native/core/include/ngn/input-script.h +3 -3
- package/native/core/include/ngn/input.h +4 -1
- package/native/core/include/ngn/launch-frame.h +21 -0
- package/native/core/include/ngn/launch-settings.h +23 -5
- package/native/core/include/ngn/mounting-backend.h +5 -0
- package/native/core/include/ngn/mounting-manager.h +1 -0
- package/native/core/include/ngn/native-controls.h +26 -5
- package/native/core/include/ngn/notification-schedule.h +74 -0
- package/native/core/include/ngn/notifications.h +2 -1
- package/native/core/include/ngn/openssl-update-crypto.h +15 -0
- package/native/core/include/ngn/photo-library.h +60 -20
- package/native/core/include/ngn/posix-locale.h +43 -0
- package/native/core/include/ngn/runtime.h +5 -0
- package/native/core/include/ngn/safe-areas.h +14 -2
- package/native/core/include/ngn/split-view.h +78 -0
- package/native/core/include/ngn/surface-metrics.h +7 -0
- package/native/core/include/ngn/system.h +14 -0
- package/native/core/include/ngn/text-input.h +13 -0
- package/native/core/include/ngn/text-units.h +38 -0
- package/native/core/include/ngn/updates.h +14 -2
- package/native/core/include/ngn/view-box.h +40 -0
- package/native/core/include/ngn/view-transform.h +15 -0
- package/native/core/include/ngn/web-browser.h +46 -0
- package/native/core/src/accent-colors.cpp +88 -0
- package/native/core/src/accessibility-relations.cpp +138 -0
- package/native/core/src/accessibility.cpp +50 -0
- package/native/core/src/animated-frame-loop.cpp +166 -0
- package/native/core/src/app-menus.cpp +26 -9
- package/native/core/src/app-windows.cpp +27 -6
- package/native/core/src/aria-role.cpp +127 -0
- package/native/core/src/control-sizes.cpp +9 -5
- package/native/core/src/crash-report.cpp +196 -0
- package/native/core/src/curl-network.cpp +1562 -0
- package/native/core/src/dbus-menu.cpp +71 -0
- package/native/core/src/default-menu.cpp +134 -0
- package/native/core/src/desktop-view-props.cpp +14 -0
- package/native/core/src/focus-order.cpp +19 -0
- package/native/core/src/header-bar.cpp +20 -0
- package/native/core/src/host-os.cpp +19 -0
- package/native/core/src/host-reload.cpp +45 -0
- package/native/core/src/host-state.cpp +8 -0
- package/native/core/src/image-source.cpp +90 -0
- package/native/core/src/input-dispatcher.cpp +27 -5
- package/native/core/src/input-script.cpp +3 -2
- package/native/core/src/launch-settings.cpp +76 -0
- package/native/core/src/libraries/react-native-reanimated.cpp +6 -1
- package/native/core/src/modules/app-info.cpp +55 -6
- package/native/core/src/modules/app-modules.cpp +1 -1
- package/native/core/src/modules/audio.cpp +4 -2
- package/native/core/src/modules/camera.cpp +8 -11
- package/native/core/src/modules/desktop-expo.cpp +10 -5
- package/native/core/src/modules/desktop-modules.cpp +106 -41
- package/native/core/src/modules/file-photo-picker.cpp +408 -0
- package/native/core/src/modules/notifications.cpp +13 -17
- package/native/core/src/modules/photo-library.cpp +42 -13
- package/native/core/src/modules/web-browser.cpp +89 -0
- package/native/core/src/mounting-manager.cpp +12 -0
- package/native/core/src/native-controls.cpp +42 -1
- package/native/core/src/notification-schedule.cpp +429 -0
- package/native/core/src/openssl-update-crypto.cpp +83 -0
- package/native/core/src/posix-locale.cpp +192 -0
- package/native/core/src/runtime.cpp +30 -1
- package/native/core/src/safe-areas.cpp +19 -4
- package/native/core/src/spawn-rules.cpp +4 -1
- package/native/core/src/split-view.cpp +93 -0
- package/native/core/src/system.cpp +19 -0
- package/native/core/src/text-input.cpp +18 -1
- package/native/core/src/text-units.cpp +99 -0
- package/native/core/src/updates.cpp +76 -17
- package/native/core/src/view-box.cpp +75 -40
- package/native/core/src/view-transform.cpp +28 -0
- package/native/docker/Dockerfile +38 -0
- package/native/docker/Dockerfile.fedora +36 -0
- package/native/docker/glibc-floor.sh +49 -0
- package/native/gtk/CMakeLists.txt +137 -0
- package/native/gtk/accent-colour.cpp +57 -0
- package/native/gtk/accent-colour.h +41 -0
- package/native/gtk/accessibility-settings.cpp +159 -0
- package/native/gtk/accessibility-settings.h +62 -0
- package/native/gtk/accessible-text.cpp +151 -0
- package/native/gtk/accessible-text.h +49 -0
- package/native/gtk/accessible.cpp +306 -0
- package/native/gtk/accessible.h +75 -0
- package/native/gtk/alerts.cpp +267 -0
- package/native/gtk/alerts.h +30 -0
- package/native/gtk/animation-frames.cpp +159 -0
- package/native/gtk/animation-frames.h +20 -0
- package/native/gtk/app-info.cpp +91 -0
- package/native/gtk/app-info.h +25 -0
- package/native/gtk/app-windows.cpp +439 -0
- package/native/gtk/app-windows.h +150 -0
- package/native/gtk/audio.cpp +370 -0
- package/native/gtk/audio.h +54 -0
- package/native/gtk/auth-session.cpp +73 -0
- package/native/gtk/auth-session.h +16 -0
- package/native/gtk/battery.cpp +110 -0
- package/native/gtk/battery.h +19 -0
- package/native/gtk/box-paint.cpp +262 -0
- package/native/gtk/box-paint.h +32 -0
- package/native/gtk/cairo-canvas.cpp +755 -0
- package/native/gtk/cairo-canvas.h +49 -0
- package/native/gtk/camera.cpp +909 -0
- package/native/gtk/camera.h +69 -0
- package/native/gtk/capture.cpp +46 -0
- package/native/gtk/capture.h +19 -0
- package/native/gtk/clock-format.cpp +151 -0
- package/native/gtk/clock-format.h +36 -0
- package/native/gtk/crypto.cpp +75 -0
- package/native/gtk/crypto.h +14 -0
- package/native/gtk/dbus-properties.cpp +131 -0
- package/native/gtk/dbus-properties.h +61 -0
- package/native/gtk/drag-and-drop.cpp +339 -0
- package/native/gtk/drag-and-drop.h +30 -0
- package/native/gtk/file-dialogs.cpp +239 -0
- package/native/gtk/file-dialogs.h +21 -0
- package/native/gtk/file-system.cpp +212 -0
- package/native/gtk/file-system.h +25 -0
- package/native/gtk/focus.cpp +282 -0
- package/native/gtk/focus.h +37 -0
- package/native/gtk/fonts.cpp +89 -0
- package/native/gtk/fonts.h +22 -0
- package/native/gtk/gst-frames.cpp +150 -0
- package/native/gtk/gst-frames.h +47 -0
- package/native/gtk/gst-playback.cpp +496 -0
- package/native/gtk/gst-playback.h +81 -0
- package/native/gtk/gtk-backend.cpp +690 -0
- package/native/gtk/gtk-backend.h +134 -0
- package/native/gtk/host-sources.cpp +354 -0
- package/native/gtk/host-sources.h +46 -0
- package/native/gtk/image-manipulator.cpp +254 -0
- package/native/gtk/image-manipulator.h +30 -0
- package/native/gtk/image-view.cpp +256 -0
- package/native/gtk/image-view.h +54 -0
- package/native/gtk/input-replay.cpp +299 -0
- package/native/gtk/input-replay.h +36 -0
- package/native/gtk/launcher-badge.cpp +29 -0
- package/native/gtk/launcher-badge.h +21 -0
- package/native/gtk/locales.cpp +131 -0
- package/native/gtk/locales.h +23 -0
- package/native/gtk/location.cpp +274 -0
- package/native/gtk/location.h +19 -0
- package/native/gtk/main.cpp +1092 -0
- package/native/gtk/menus.cpp +447 -0
- package/native/gtk/menus.h +100 -0
- package/native/gtk/native-controls.cpp +831 -0
- package/native/gtk/native-controls.h +58 -0
- package/native/gtk/network-state.cpp +72 -0
- package/native/gtk/network-state.h +24 -0
- package/native/gtk/notifications.cpp +235 -0
- package/native/gtk/notifications.h +30 -0
- package/native/gtk/pango-text.cpp +274 -0
- package/native/gtk/pango-text.h +73 -0
- package/native/gtk/portal.cpp +451 -0
- package/native/gtk/portal.h +71 -0
- package/native/gtk/printing.cpp +338 -0
- package/native/gtk/printing.h +34 -0
- package/native/gtk/proxy-resolver.cpp +74 -0
- package/native/gtk/proxy-resolver.h +20 -0
- package/native/gtk/screens.cpp +1461 -0
- package/native/gtk/screens.h +274 -0
- package/native/gtk/scroll-view.cpp +414 -0
- package/native/gtk/scroll-view.h +82 -0
- package/native/gtk/secret-store.cpp +120 -0
- package/native/gtk/secret-store.h +27 -0
- package/native/gtk/settings-portal.cpp +129 -0
- package/native/gtk/settings-portal.h +47 -0
- package/native/gtk/split-view.cpp +1105 -0
- package/native/gtk/split-view.h +195 -0
- package/native/gtk/status-notifier.cpp +487 -0
- package/native/gtk/status-notifier.h +43 -0
- package/native/gtk/surface-input.cpp +251 -0
- package/native/gtk/surface-input.h +57 -0
- package/native/gtk/system-access.cpp +295 -0
- package/native/gtk/system-access.h +37 -0
- package/native/gtk/text-field.cpp +827 -0
- package/native/gtk/text-field.h +78 -0
- package/native/gtk/video.cpp +527 -0
- package/native/gtk/video.h +47 -0
- package/native/gtk/view-widget.cpp +431 -0
- package/native/gtk/view-widget.h +105 -0
- package/native/gtk/window-scale.cpp +95 -0
- package/native/gtk/window-scale.h +35 -0
- package/native/scripts/atspi-check.py +310 -0
- package/native/scripts/atspi-check.test.py +48 -0
- package/native/scripts/build.sh +20 -3
- package/native/scripts/compilers.sh +17 -0
- package/native/scripts/deb-depends-check.sh +22 -0
- package/native/scripts/fetch.sh +23 -2
- package/native/scripts/launch-cell.sh +157 -0
- package/native/scripts/launch-probe.sh +14 -3
- package/native/scripts/make-prebuilt.mjs +133 -44
- package/native/scripts/prebuilt-host-cache.mjs +71 -40
- package/native/scripts/reset-for-compilers.sh +44 -0
- package/native/scripts/start-xvfb.sh +35 -0
- package/native/shim/paragraph-platform/react/renderer/components/text/HostPlatformParagraphProps.h +35 -0
- package/native/shim/view-platform/react/renderer/components/view/HostPlatformViewTraitsInitializer.h +5 -2
- package/native/shim/worklets/linux-reanimated-props.h +14 -0
- package/native/shim/worklets/linux-worklets.h +23 -0
- package/package.json +6 -3
- package/prebuilt.json +70 -6
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Installs what a built GTK host needs on this distribution, from its own packages, and launches the
|
|
3
|
+
# host on a bundle to its first frame on each display asked for, with launch-probe.sh. Run as root,
|
|
4
|
+
# in a container of the distribution or on a runner of it. The nightly desktop workflow runs it on
|
|
5
|
+
# each distribution the Linux host supports, with a host built in the AlmaLinux 9 image.
|
|
6
|
+
#
|
|
7
|
+
# launch-cell.sh <host> <bundle.js> <out dir> <cell>...
|
|
8
|
+
#
|
|
9
|
+
# Cells:
|
|
10
|
+
# x11 Xvfb, the renderer GTK picks (GL over Mesa's software rasteriser)
|
|
11
|
+
# wayland headless Weston, pixman
|
|
12
|
+
# vulkan Xvfb with GSK_RENDERER=vulkan over lavapipe, Mesa's software Vulkan; fails when GTK
|
|
13
|
+
# falls back to another renderer
|
|
14
|
+
# mutter mutter --headless on Wayland, GNOME's compositor
|
|
15
|
+
#
|
|
16
|
+
# Fails on a library the host needs and the distribution's packages do not give it, and on any
|
|
17
|
+
# probe that fails. Each probe saves the window it drew, in-process, as <out>/<cell>.png.
|
|
18
|
+
set -euo pipefail
|
|
19
|
+
host="${1:?usage: launch-cell.sh <host> <bundle.js> <out dir> <cell>...}"
|
|
20
|
+
bundle="${2:?usage: launch-cell.sh <host> <bundle.js> <out dir> <cell>...}"
|
|
21
|
+
out="${3:?usage: launch-cell.sh <host> <bundle.js> <out dir> <cell>...}"
|
|
22
|
+
shift 3
|
|
23
|
+
[ "$#" -gt 0 ] || { echo "launch-cell: name at least one cell" >&2; exit 2; }
|
|
24
|
+
here="$(cd "$(dirname "$0")" && pwd)"
|
|
25
|
+
|
|
26
|
+
has_cell() {
|
|
27
|
+
local cell
|
|
28
|
+
for cell in "${cells[@]}"; do [ "$cell" = "$1" ] && return 0; done
|
|
29
|
+
return 1
|
|
30
|
+
}
|
|
31
|
+
cells=("$@")
|
|
32
|
+
for cell in "${cells[@]}"; do
|
|
33
|
+
case "$cell" in x11 | wayland | vulkan | mutter) ;; *)
|
|
34
|
+
echo "launch-cell: no cell named $cell" >&2
|
|
35
|
+
exit 2
|
|
36
|
+
;;
|
|
37
|
+
esac
|
|
38
|
+
done
|
|
39
|
+
mkdir -p "$out"
|
|
40
|
+
|
|
41
|
+
# What the host links (DEB_DEPENDS in bin/package-linux.mjs, and the rpm's equivalents), and what
|
|
42
|
+
# the cells run.
|
|
43
|
+
. /etc/os-release
|
|
44
|
+
case "$ID" in
|
|
45
|
+
ubuntu | debian)
|
|
46
|
+
export DEBIAN_FRONTEND=noninteractive
|
|
47
|
+
packages=(libc6 libgtk-4-1 libadwaita-1-0 libsecret-1-0 glib-networking libgstreamer1.0-0
|
|
48
|
+
libgstreamer-plugins-base1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-pulseaudio
|
|
49
|
+
libssl3t64 libnghttp2-14 zlib1g libsqlite3-0 libatomic1 libstdc++6
|
|
50
|
+
xvfb weston libgl1-mesa-dri libegl-mesa0 dbus fonts-dejavu-core)
|
|
51
|
+
has_cell vulkan && packages+=(mesa-vulkan-drivers)
|
|
52
|
+
has_cell mutter && packages+=(mutter)
|
|
53
|
+
apt-get update -q
|
|
54
|
+
apt-get install -y -q --no-install-recommends "${packages[@]}"
|
|
55
|
+
;;
|
|
56
|
+
fedora | almalinux | rhel)
|
|
57
|
+
# OpenSSL by the soname the host links, as an rpm's own requirements name it: Fedora 45 moved
|
|
58
|
+
# openssl-libs to OpenSSL 4, and keeps libssl.so.3 in openssl3-libs.
|
|
59
|
+
packages=(gtk4 libadwaita libsecret glib-networking gstreamer1 gstreamer1-plugins-base gstreamer1-plugins-good
|
|
60
|
+
'libssl.so.3()(64bit)' 'libcrypto.so.3()(64bit)' libnghttp2 sqlite-libs libatomic libstdc++ xorg-x11-server-Xvfb weston mesa-dri-drivers dbus-daemon
|
|
61
|
+
dejavu-sans-fonts)
|
|
62
|
+
has_cell vulkan && packages+=(mesa-vulkan-drivers)
|
|
63
|
+
has_cell mutter && packages+=(mutter)
|
|
64
|
+
dnf -y -q install "${packages[@]}"
|
|
65
|
+
;;
|
|
66
|
+
*)
|
|
67
|
+
echo "launch-cell: no package list for $ID" >&2
|
|
68
|
+
exit 2
|
|
69
|
+
;;
|
|
70
|
+
esac
|
|
71
|
+
echo "launch-cell: $PRETTY_NAME, $(uname -m)"
|
|
72
|
+
|
|
73
|
+
missing="$(ldd "$host" | grep 'not found' || true)"
|
|
74
|
+
if [ -n "$missing" ]; then
|
|
75
|
+
echo "launch-cell: the host needs libraries this distribution's packages did not install:" >&2
|
|
76
|
+
echo "$missing" >&2
|
|
77
|
+
exit 1
|
|
78
|
+
fi
|
|
79
|
+
|
|
80
|
+
XDG_RUNTIME_DIR="$(mktemp -d)"
|
|
81
|
+
export GTK_A11Y=none XDG_RUNTIME_DIR
|
|
82
|
+
chmod 700 "$XDG_RUNTIME_DIR"
|
|
83
|
+
pids=()
|
|
84
|
+
cleanup() {
|
|
85
|
+
local pid
|
|
86
|
+
for pid in "${pids[@]}"; do kill "$pid" 2> /dev/null || true; done
|
|
87
|
+
}
|
|
88
|
+
trap cleanup EXIT
|
|
89
|
+
|
|
90
|
+
wait_for() {
|
|
91
|
+
local what="$1" path="$2" log="$3"
|
|
92
|
+
for _ in $(seq 100); do
|
|
93
|
+
[ -e "$path" ] && return 0
|
|
94
|
+
sleep 0.2
|
|
95
|
+
done
|
|
96
|
+
echo "launch-cell: $what did not start" >&2
|
|
97
|
+
cat "$log" >&2
|
|
98
|
+
exit 1
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
xvfb() {
|
|
102
|
+
Xvfb :99 -screen 0 1280x800x24 -nolisten tcp > "$out/xvfb.log" 2>&1 &
|
|
103
|
+
pids+=($!)
|
|
104
|
+
wait_for Xvfb /tmp/.X11-unix/X99 "$out/xvfb.log"
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
failed=()
|
|
108
|
+
probe() {
|
|
109
|
+
local cell="$1"
|
|
110
|
+
shift
|
|
111
|
+
echo "::group::$cell"
|
|
112
|
+
if env "$@" NGN_CAPTURE="$out/$cell.png" "$here/launch-probe.sh" "$host" "$bundle"; then
|
|
113
|
+
echo "launch-cell: $cell passed"
|
|
114
|
+
else
|
|
115
|
+
failed+=("$cell")
|
|
116
|
+
fi
|
|
117
|
+
echo "::endgroup::"
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if has_cell x11 || has_cell vulkan; then xvfb; fi
|
|
121
|
+
has_cell x11 && probe x11 DISPLAY=:99 GDK_BACKEND=x11
|
|
122
|
+
# GSK_RENDERER=vulkan is only the first renderer GTK tries, and GTK falls back to GL or Cairo when
|
|
123
|
+
# it cannot realize it, so the probe also fails unless GTK logs that it uses the Vulkan one.
|
|
124
|
+
has_cell vulkan && probe vulkan DISPLAY=:99 GDK_BACKEND=x11 GSK_RENDERER=vulkan GSK_DEBUG=renderer \
|
|
125
|
+
NGN_EXPECT_RENDERER=GskVulkanRenderer
|
|
126
|
+
|
|
127
|
+
if has_cell wayland; then
|
|
128
|
+
# Weston 10 and later name the backend and the renderer; Weston 8 takes the module.
|
|
129
|
+
if weston --help 2>&1 | grep -q -- --renderer; then
|
|
130
|
+
headless=(--backend=headless --renderer=pixman)
|
|
131
|
+
else
|
|
132
|
+
headless=(--backend=headless-backend.so --use-pixman)
|
|
133
|
+
fi
|
|
134
|
+
weston "${headless[@]}" --socket=ngn-weston --width=1280 --height=800 > "$out/weston.log" 2>&1 &
|
|
135
|
+
pids+=($!)
|
|
136
|
+
wait_for Weston "$XDG_RUNTIME_DIR/ngn-weston" "$out/weston.log"
|
|
137
|
+
probe wayland WAYLAND_DISPLAY=ngn-weston GDK_BACKEND=wayland
|
|
138
|
+
fi
|
|
139
|
+
|
|
140
|
+
if has_cell mutter; then
|
|
141
|
+
# mutter wants a session bus, and a system bus, where a private one stands in (no logind on it).
|
|
142
|
+
dbus-daemon --config-file=/usr/share/dbus-1/session.conf --address="unix:path=$XDG_RUNTIME_DIR/system_bus" \
|
|
143
|
+
--fork --nopidfile
|
|
144
|
+
export DBUS_SYSTEM_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/system_bus"
|
|
145
|
+
dbus-daemon --session --address="unix:path=$XDG_RUNTIME_DIR/session_bus" --fork --nopidfile
|
|
146
|
+
export DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/session_bus"
|
|
147
|
+
mutter --headless --wayland --no-x11 --virtual-monitor 1280x800 > "$out/mutter.log" 2>&1 &
|
|
148
|
+
pids+=($!)
|
|
149
|
+
wait_for mutter "$XDG_RUNTIME_DIR/wayland-0" "$out/mutter.log"
|
|
150
|
+
probe mutter WAYLAND_DISPLAY=wayland-0 GDK_BACKEND=wayland
|
|
151
|
+
fi
|
|
152
|
+
|
|
153
|
+
if [ "${#failed[@]}" -gt 0 ]; then
|
|
154
|
+
echo "launch-cell: failed on $PRETTY_NAME: ${failed[*]}" >&2
|
|
155
|
+
exit 1
|
|
156
|
+
fi
|
|
157
|
+
echo "launch-cell: every cell passed on $PRETTY_NAME: ${cells[*]}"
|
|
@@ -3,13 +3,19 @@
|
|
|
3
3
|
# draws its first frame, then it keeps running for a moment. Fails on a crash or an exit before
|
|
4
4
|
# then, an uncaught JavaScript error, or no first frame in time. Prints the host's log either way.
|
|
5
5
|
#
|
|
6
|
-
# launch-probe.sh <ngn-macos> <bundle.js> [seconds, default 60]
|
|
6
|
+
# launch-probe.sh <ngn-macos or ngn-linux> <bundle.js> [seconds, default 60]
|
|
7
|
+
#
|
|
8
|
+
# With NGN_EXPECT_RENDERER=<GSK renderer class> (and GSK_DEBUG=renderer, which makes GTK log it), the
|
|
9
|
+
# probe also fails unless GTK says it is using that renderer. GSK_RENDERER only picks the renderer GTK
|
|
10
|
+
# tries first, and a failed one falls back to GL or Cairo with the frame still drawn. GTK logs
|
|
11
|
+
# "Using renderer of type 'GskVulkanRenderer' ..." up to 4.14 and "Using renderer 'GskVulkanRenderer' ..."
|
|
12
|
+
# from 4.16 (gsk/gskrenderer.c).
|
|
7
13
|
#
|
|
8
14
|
# A test launch (NGN_TESTS=1): the host keeps its state in a new directory, takes no focus and
|
|
9
15
|
# shows no system prompt, so the probe leaves nothing behind on the machine it runs on.
|
|
10
16
|
set -euo pipefail
|
|
11
|
-
host="${1:?usage: launch-probe.sh <
|
|
12
|
-
bundle="${2:?usage: launch-probe.sh <
|
|
17
|
+
host="${1:?usage: launch-probe.sh <host> <bundle.js> [seconds]}"
|
|
18
|
+
bundle="${2:?usage: launch-probe.sh <host> <bundle.js> [seconds]}"
|
|
13
19
|
limit="${3:-60}"
|
|
14
20
|
|
|
15
21
|
work="$(mktemp -d)"
|
|
@@ -51,6 +57,11 @@ while ! grep -q '^\[ngn\] first frame' "$log"; do
|
|
|
51
57
|
done
|
|
52
58
|
grep -q '^\[ngn\] commit' "$log" || fail "the first frame came with no commit"
|
|
53
59
|
|
|
60
|
+
if [ -n "${NGN_EXPECT_RENDERER:-}" ]; then
|
|
61
|
+
grep -qE "Using renderer (of type )?'$NGN_EXPECT_RENDERER'" "$log" \
|
|
62
|
+
|| fail "GTK did not use the $NGN_EXPECT_RENDERER renderer it was asked for"
|
|
63
|
+
fi
|
|
64
|
+
|
|
54
65
|
# Still running a moment after the first frame: a crash in the commits that follow fails too.
|
|
55
66
|
sleep 3
|
|
56
67
|
kill -0 "$pid" 2> /dev/null || { wait "$pid" && status=0 || status=$?; fail "the host exited ($status) after its first frame"; }
|
|
@@ -3,15 +3,19 @@
|
|
|
3
3
|
* Builds the prebuilt desktop host for one React Native version and flavour and packs it for a
|
|
4
4
|
* release.
|
|
5
5
|
*
|
|
6
|
-
* make-prebuilt.mjs <app> <out> [--flavour debug|release] [--version <v>]
|
|
7
|
-
* [--manifest <prebuilt.json>] [--host-cache <dir>]
|
|
8
|
-
* [--reuse-only] [--build-dir <dir>]
|
|
9
|
-
* make-prebuilt.mjs <app> --print-key [--flavour debug|release]
|
|
6
|
+
* make-prebuilt.mjs <app> <out> [--os macos|linux] [--flavour debug|release] [--version <v>]
|
|
7
|
+
* [--base-url <url>] [--manifest <prebuilt.json>] [--host-cache <dir>]
|
|
8
|
+
* [--reuse <prebuilt.json>] [--reuse-only] [--build-dir <dir>]
|
|
9
|
+
* make-prebuilt.mjs <app> --print-key [--os macos|linux] [--flavour debug|release]
|
|
10
10
|
*
|
|
11
11
|
* - <app>: the app whose react-native and host libraries (react-native-screens,
|
|
12
12
|
* react-native-safe-area-context) the host is built against: the desktop template.
|
|
13
13
|
* - <out>: where the archive and `prebuilt-host-<flavour>.json`, its manifest entry, go. Runs into
|
|
14
14
|
* the same folder take turns there (publishPrebuilt), so the two always come from the same build.
|
|
15
|
+
* - --os: `macos` (the default), the universal AppKit host, built on a Mac; or `linux`, the GTK
|
|
16
|
+
* host for this machine's architecture (x64 or arm64), built on Linux (the AlmaLinux 9 image in
|
|
17
|
+
* CI, so it needs glibc 2.34 at most). A Linux archive holds `gtk/ngn-linux` and `gtk/hermesc`,
|
|
18
|
+
* stripped of debug info and local symbols and not signed, and its entry names `os` and `arch`.
|
|
15
19
|
* - --flavour: `release` (the default), the universal Release build a packaged app ships
|
|
16
20
|
* (`build.sh --universal --release`), or `debug`, the universal dev build `run` uses
|
|
17
21
|
* (`build.sh --universal --no-tests`), which carries React Native's debugger.
|
|
@@ -26,7 +30,10 @@
|
|
|
26
30
|
* holds a host built from the same inputs (the host's native sources and build scripts, React
|
|
27
31
|
* Native's and each compiled-in library's version, the flavour, the compiler and the SDK), that
|
|
28
32
|
* host is stripped, signed and packed with no build; otherwise the host is built and the folder
|
|
29
|
-
* replaced with it. An inputs key that cannot be computed builds without the cache.
|
|
33
|
+
* replaced with it. An inputs key that cannot be computed builds without the cache. For Linux the
|
|
34
|
+
* inputs are the same with the OS and architecture, and in place of the SDK glibc's version and
|
|
35
|
+
* those of the libraries the host builds against in the image; the sources already cover the
|
|
36
|
+
* image's Dockerfile and the ICU pin, both under native/.
|
|
30
37
|
* - --reuse: a `prebuilt.json` of an earlier release. When its entry for this React Native version
|
|
31
38
|
* and flavour records the same inputs key, its archive is downloaded, checked against the entry's
|
|
32
39
|
* SHA-256 and published again under this release's name, byte for byte. A different key, a failed
|
|
@@ -66,16 +73,17 @@ import { parseArgs } from 'node:util';
|
|
|
66
73
|
import { HOST_LIBRARIES, packageDir } from '../../bin/host.mjs';
|
|
67
74
|
import {
|
|
68
75
|
AD_HOC_HOST_ENTITLEMENTS,
|
|
76
|
+
findHost,
|
|
69
77
|
FLAVOURS,
|
|
70
|
-
flavourOf,
|
|
71
78
|
prebuiltName,
|
|
72
79
|
publishPrebuilt,
|
|
73
80
|
readManifest,
|
|
74
81
|
signPrebuiltFiles,
|
|
75
82
|
} from '../../bin/prebuilt.mjs';
|
|
76
83
|
import {
|
|
77
|
-
HOST_FILES,
|
|
78
84
|
hostInputsKey,
|
|
85
|
+
LINUX_HOST,
|
|
86
|
+
MACOS_HOST,
|
|
79
87
|
readHostCache,
|
|
80
88
|
treeDigests,
|
|
81
89
|
writeHostCache,
|
|
@@ -83,6 +91,20 @@ import {
|
|
|
83
91
|
|
|
84
92
|
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
85
93
|
|
|
94
|
+
/** What the GTK host builds against through pkg-config (gtk/CMakeLists.txt), and what it links. */
|
|
95
|
+
const LINUX_PKG_CONFIG = [
|
|
96
|
+
'gtk4',
|
|
97
|
+
'libadwaita-1',
|
|
98
|
+
'pangocairo',
|
|
99
|
+
'gio-unix-2.0',
|
|
100
|
+
'sqlite3',
|
|
101
|
+
'openssl',
|
|
102
|
+
'libnghttp2',
|
|
103
|
+
'zlib',
|
|
104
|
+
'gstreamer-1.0',
|
|
105
|
+
'gstreamer-plugins-base-1.0',
|
|
106
|
+
];
|
|
107
|
+
|
|
86
108
|
/** @param {string} command @param {string[]} args @param {import('node:child_process').SpawnSyncOptions} [options] */
|
|
87
109
|
function run(command, args, options = {}) {
|
|
88
110
|
const result = spawnSync(command, args, { stdio: 'inherit', encoding: 'utf8', ...options });
|
|
@@ -95,6 +117,7 @@ function run(command, args, options = {}) {
|
|
|
95
117
|
const { values, positionals } = parseArgs({
|
|
96
118
|
allowPositionals: true,
|
|
97
119
|
options: {
|
|
120
|
+
os: { type: 'string', default: 'macos' },
|
|
98
121
|
flavour: { type: 'string', default: 'release' },
|
|
99
122
|
version: { type: 'string' },
|
|
100
123
|
'base-url': { type: 'string' },
|
|
@@ -110,7 +133,7 @@ const [appArg, outArg] = positionals;
|
|
|
110
133
|
const printKey = values['print-key'];
|
|
111
134
|
if (!appArg || (!outArg && !printKey)) {
|
|
112
135
|
console.error(
|
|
113
|
-
'Usage: make-prebuilt.mjs <app> <out> [--flavour debug|release] [--version <v>] [--base-url <url>] [--manifest <prebuilt.json>] [--host-cache <dir>] [--reuse <prebuilt.json> [--reuse-only]] [--build-dir <dir>]\n make-prebuilt.mjs <app> --print-key [--flavour debug|release]',
|
|
136
|
+
'Usage: make-prebuilt.mjs <app> <out> [--os macos|linux] [--flavour debug|release] [--version <v>] [--base-url <url>] [--manifest <prebuilt.json>] [--host-cache <dir>] [--reuse <prebuilt.json> [--reuse-only]] [--build-dir <dir>]\n make-prebuilt.mjs <app> --print-key [--os macos|linux] [--flavour debug|release]',
|
|
114
137
|
);
|
|
115
138
|
process.exit(2);
|
|
116
139
|
}
|
|
@@ -123,6 +146,22 @@ if (!FLAVOURS.includes(flavour)) {
|
|
|
123
146
|
console.error(`--flavour takes debug or release, not "${values.flavour}".`);
|
|
124
147
|
process.exit(2);
|
|
125
148
|
}
|
|
149
|
+
const os = values.os;
|
|
150
|
+
if (os !== 'macos' && os !== 'linux') {
|
|
151
|
+
console.error(`--os takes macos or linux, not "${os}".`);
|
|
152
|
+
process.exit(2);
|
|
153
|
+
}
|
|
154
|
+
const linux = os === 'linux';
|
|
155
|
+
if (linux) {
|
|
156
|
+
if (process.platform !== 'linux') {
|
|
157
|
+
console.error(
|
|
158
|
+
'--os linux builds on Linux only: run it in the AlmaLinux 9 image (native/docker).',
|
|
159
|
+
);
|
|
160
|
+
process.exit(2);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/** @type {import('../../bin/prebuilt.mjs').HostPlatform} */
|
|
164
|
+
const platform = linux ? { os, arch: process.arch === 'arm64' ? 'arm64' : 'x64' } : {};
|
|
126
165
|
const baseUrl = values['base-url'];
|
|
127
166
|
if (values.manifest !== undefined || baseUrl !== undefined) {
|
|
128
167
|
/** @type {URL | null} */
|
|
@@ -179,6 +218,17 @@ const libraryVersions = Object.fromEntries(
|
|
|
179
218
|
const capture = (command, args) =>
|
|
180
219
|
run(command, args, { stdio: ['ignore', 'pipe', 'inherit'] }).stdout.trim();
|
|
181
220
|
|
|
221
|
+
/**
|
|
222
|
+
* The version of each library the GTK host builds against, as pkg-config has it in the image, or
|
|
223
|
+
* that it is missing, which a build then fails on.
|
|
224
|
+
*/
|
|
225
|
+
function linuxLibraries() {
|
|
226
|
+
return LINUX_PKG_CONFIG.map((name) => {
|
|
227
|
+
const found = spawnSync('pkg-config', ['--modversion', name], { encoding: 'utf8' });
|
|
228
|
+
return `${name} ${found.status === 0 ? found.stdout.trim() : 'missing'}`;
|
|
229
|
+
}).join('\n');
|
|
230
|
+
}
|
|
231
|
+
|
|
182
232
|
/** The key of everything the host is built from (prebuilt-host-cache.mjs hostInputsKey). */
|
|
183
233
|
function inputsKey() {
|
|
184
234
|
const desktop = path.resolve(here, '..', '..');
|
|
@@ -192,12 +242,17 @@ function inputsKey() {
|
|
|
192
242
|
path.join(desktop, 'bin', 'host.mjs'),
|
|
193
243
|
path.join(desktop, 'bin', 'prebuilt.mjs'),
|
|
194
244
|
].flatMap((root) => treeDigests(desktop, root)),
|
|
195
|
-
toolchain:
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
245
|
+
toolchain: (linux
|
|
246
|
+
? [
|
|
247
|
+
capture(process.env['CXX'] || 'clang++', ['--version']),
|
|
248
|
+
capture('ldd', ['--version']).split('\n')[0] ?? '',
|
|
249
|
+
linuxLibraries(),
|
|
250
|
+
]
|
|
251
|
+
: [capture('xcrun', ['clang', '--version']), capture('xcrun', ['--show-sdk-version'])]
|
|
252
|
+
).join('\n'),
|
|
253
|
+
// A reused archive is signed: another identity is another archive. A Linux one is not signed.
|
|
254
|
+
signing: linux ? 'unsigned' : process.env['NGN_SIGN_IDENTITY'] || '-',
|
|
255
|
+
...(linux ? { platform } : {}),
|
|
201
256
|
});
|
|
202
257
|
}
|
|
203
258
|
|
|
@@ -231,10 +286,16 @@ if (hostCache || reuse) {
|
|
|
231
286
|
*/
|
|
232
287
|
async function reuseArchive(manifestFile, inputs, packed) {
|
|
233
288
|
try {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
289
|
+
// The host for this OS (and a Linux one's architecture), never another's.
|
|
290
|
+
const entry = findHost(readManifest(readFileSync(manifestFile, 'utf8')), {
|
|
291
|
+
reactNative,
|
|
292
|
+
flavour,
|
|
293
|
+
...platform,
|
|
294
|
+
});
|
|
295
|
+
if (!entry) {
|
|
296
|
+
const which = linux ? `Linux ${platform.arch} ${flavour}` : flavour;
|
|
297
|
+
return `${manifestFile} has no ${which} host for React Native ${reactNative}`;
|
|
298
|
+
}
|
|
238
299
|
if (entry.inputs !== inputs)
|
|
239
300
|
return `the ${flavour} host in ${manifestFile} was built from other inputs`;
|
|
240
301
|
const response = await fetch(entry.url, { signal: AbortSignal.timeout(600_000) });
|
|
@@ -250,14 +311,36 @@ async function reuseArchive(manifestFile, inputs, packed) {
|
|
|
250
311
|
}
|
|
251
312
|
}
|
|
252
313
|
|
|
314
|
+
/**
|
|
315
|
+
* Throws unless the executable is built for what the archive says: arm64 and x86_64 for macOS,
|
|
316
|
+
* this machine's architecture for Linux.
|
|
317
|
+
*
|
|
318
|
+
* @param {string} executable
|
|
319
|
+
*/
|
|
320
|
+
function checkArchitecture(executable) {
|
|
321
|
+
if (linux) {
|
|
322
|
+
const kind = capture('file', ['-b', executable]);
|
|
323
|
+
const want = platform.arch === 'arm64' ? /ARM aarch64/ : /x86-64/;
|
|
324
|
+
if (!want.test(kind)) throw new Error(`${executable} is not a ${platform.arch} ELF: ${kind}`);
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
const archs = capture('lipo', ['-archs', executable]);
|
|
328
|
+
if (archs.split(' ').sort().join(' ') !== 'arm64 x86_64') {
|
|
329
|
+
throw new Error(`ngn-macos is built for ${archs}, not arm64 and x86_64.`);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
253
333
|
const desktopVersion = values.version ?? versionOf(packageDir);
|
|
254
|
-
const name = prebuiltName(desktopVersion, reactNative, flavour);
|
|
334
|
+
const name = prebuiltName(desktopVersion, reactNative, flavour, platform);
|
|
335
|
+
// The build folder's subfolder the host's files are in, and the files archived from it.
|
|
336
|
+
const layout = linux ? LINUX_HOST : MACOS_HOST;
|
|
337
|
+
const { folder, files } = layout;
|
|
255
338
|
mkdirSync(out, { recursive: true });
|
|
256
339
|
// Packed at a name of its own in <out>, and moved into place with its entry by publishPrebuilt.
|
|
257
340
|
const packed = path.join(out, `.${name}.${process.pid}.partial`);
|
|
258
341
|
const staging = mkdtempSync(path.join(tmpdir(), 'ngn-prebuilt-'));
|
|
259
342
|
try {
|
|
260
|
-
const appkit = path.join(staging,
|
|
343
|
+
const appkit = path.join(staging, folder);
|
|
261
344
|
let reused = false;
|
|
262
345
|
if (reuse && key) {
|
|
263
346
|
const why = await reuseArchive(reuse, key, packed);
|
|
@@ -284,9 +367,9 @@ try {
|
|
|
284
367
|
/** @type {string | null} */
|
|
285
368
|
let source = null;
|
|
286
369
|
if (hostCache && key) {
|
|
287
|
-
const cached = readHostCache(hostCache, key);
|
|
288
|
-
if (cached.
|
|
289
|
-
source = cached.
|
|
370
|
+
const cached = readHostCache(hostCache, key, layout);
|
|
371
|
+
if (cached.host) {
|
|
372
|
+
source = cached.host;
|
|
290
373
|
console.error(
|
|
291
374
|
`make-prebuilt: packing the host built from these inputs (${key}) in ${hostCache}.`,
|
|
292
375
|
);
|
|
@@ -300,7 +383,8 @@ try {
|
|
|
300
383
|
path.join(here, 'build.sh'),
|
|
301
384
|
[
|
|
302
385
|
reactNativeDir,
|
|
303
|
-
'
|
|
386
|
+
// A Linux host is built for this machine's architecture.
|
|
387
|
+
...(linux ? ['--backend', 'gtk'] : ['--universal']),
|
|
304
388
|
// The debug host is the dev build an app's `run` makes, with React Native's debugger.
|
|
305
389
|
flavour === 'release' ? '--release' : '--no-tests',
|
|
306
390
|
// Stripped before it is packed, so debug info would only slow the build.
|
|
@@ -311,42 +395,47 @@ try {
|
|
|
311
395
|
],
|
|
312
396
|
{ stdio: ['inherit', 'pipe', 'inherit'], env: { ...process.env, NGN_DESKTOP_LINK: '' } },
|
|
313
397
|
);
|
|
314
|
-
source = built = path.join(build.stdout.trim().split('\n').pop() ?? '',
|
|
398
|
+
source = built = path.join(build.stdout.trim().split('\n').pop() ?? '', folder);
|
|
315
399
|
}
|
|
316
400
|
mkdirSync(appkit, { recursive: true });
|
|
317
|
-
for (const file of
|
|
401
|
+
for (const file of files) {
|
|
318
402
|
cpSync(path.join(source, file), path.join(appkit, file), {
|
|
319
403
|
recursive: true,
|
|
320
404
|
verbatimSymlinks: true,
|
|
321
405
|
});
|
|
322
406
|
}
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
407
|
+
if (linux) {
|
|
408
|
+
for (const file of files)
|
|
409
|
+
run('strip', ['--strip-debug', '--discard-all', path.join(appkit, file)]);
|
|
410
|
+
} else {
|
|
411
|
+
// The framework first, which the binary's signature then covers with the same identity.
|
|
412
|
+
const framework = path.join(appkit, 'hermesvm.framework');
|
|
413
|
+
if (existsSync(framework)) signPrebuiltFiles(run, [framework], process.env);
|
|
414
|
+
const entitlements = path.join(staging, 'ad-hoc-host.entitlements');
|
|
415
|
+
writeFileSync(entitlements, AD_HOC_HOST_ENTITLEMENTS);
|
|
416
|
+
signPrebuiltFiles(run, [path.join(appkit, 'ngn-macos')], process.env, entitlements);
|
|
417
|
+
rmSync(entitlements);
|
|
418
|
+
signPrebuiltFiles(run, [path.join(appkit, 'hermesc')], process.env);
|
|
419
|
+
}
|
|
331
420
|
}
|
|
332
|
-
for (const file of
|
|
421
|
+
for (const file of files) {
|
|
333
422
|
if (!existsSync(path.join(appkit, file))) throw new Error(`The host has no ${file}.`);
|
|
334
423
|
}
|
|
335
|
-
|
|
336
|
-
stdio: ['inherit', 'pipe', 'inherit'],
|
|
337
|
-
}).stdout.trim();
|
|
338
|
-
if (archs.split(' ').sort().join(' ') !== 'arm64 x86_64') {
|
|
339
|
-
throw new Error(`ngn-macos is built for ${archs}, not arm64 and x86_64.`);
|
|
340
|
-
}
|
|
424
|
+
checkArchitecture(path.join(appkit, files[0] ?? ''));
|
|
341
425
|
// Kept as the build left it, unstripped and unsigned, for the next run with the same inputs.
|
|
342
|
-
if (built && hostCache && key) writeHostCache(hostCache, key, built);
|
|
426
|
+
if (built && hostCache && key) writeHostCache(hostCache, key, built, layout);
|
|
343
427
|
|
|
344
|
-
// Owner and group dropped, so the archive does not carry the build machine's
|
|
345
|
-
|
|
428
|
+
// Owner and group dropped, so the archive does not carry the build machine's: bsdtar on a Mac,
|
|
429
|
+
// GNU tar on Linux.
|
|
430
|
+
const owner = linux
|
|
431
|
+
? ['--owner=0', '--group=0', '--numeric-owner']
|
|
432
|
+
: ['--uid', '0', '--gid', '0'];
|
|
433
|
+
if (!reused) run('tar', ['-czf', packed, ...owner, '-C', staging, folder]);
|
|
346
434
|
const sha256 = createHash('sha256').update(readFileSync(packed)).digest('hex');
|
|
347
435
|
const host = {
|
|
348
436
|
reactNative,
|
|
349
437
|
flavour,
|
|
438
|
+
...platform,
|
|
350
439
|
url: `${(baseUrl ?? '').replace(/\/$/, '')}/${name}`,
|
|
351
440
|
sha256,
|
|
352
441
|
libraries: libraryVersions,
|