[eric] macos: native mouse-clamp addon to dodge the off-window mouse-release RootView::UpdateCursor crash

This commit is contained in:
ciregenz
2026-06-13 21:29:03 -07:00
parent ba30822b5a
commit d9481eb4b6
8 changed files with 170 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
#!/bin/bash
# Compile the macOS mouse-clamp native addon for one arch and stage it where
# electron-builder's extraResources picks it up (build-staging/mouseclamp/<arch>).
# See electron/native/mouseclamp/mouseclamp.mm for what it fixes.
set -euo pipefail
ARCH="${1:?usage: build-mouseclamp.sh <arm64|x64>}"
ELECTRON_TARGET="42.0.0"
HERE="$(cd "$(dirname "$0")/.." && pwd)" # electron/
SRC="$HERE/native/mouseclamp"
OUT="$HERE/build-staging/mouseclamp/$ARCH"
NODE_GYP="$HERE/node_modules/.bin/node-gyp"
[[ -x "$NODE_GYP" ]] || NODE_GYP="npx --yes node-gyp" # transitive dep usually, npx if not
echo "[mouseclamp] building for arch=$ARCH (electron $ELECTRON_TARGET)"
cd "$SRC"
rm -rf build
$NODE_GYP rebuild \
--target="$ELECTRON_TARGET" \
--arch="$ARCH" \
--dist-url=https://electronjs.org/headers
mkdir -p "$OUT"
cp "build/Release/mouseclamp.node" "$OUT/mouseclamp.node"
echo "[mouseclamp] staged -> $OUT/mouseclamp.node"
file "$OUT/mouseclamp.node"