From a378414137ab42776cfe35ff354629b41863726b Mon Sep 17 00:00:00 2001 From: 4gray Date: Fri, 10 Jul 2026 22:13:21 +0200 Subject: [PATCH] spike(embedded-mpv): auto-detect Homebrew prefix and Node headers for Intel Macs BREW_PREFIX was hardcoded to /opt/homebrew (Apple Silicon) and NODE_INC to one nvm version; both now resolve via brew --prefix and the PATH node's execPath, so the pending Intel Mac run needs no Makefile edits. README gets a fresh-machine checklist. Co-Authored-By: Claude Fable 5 --- spikes/mpv-frame-copy/Makefile | 11 ++++++----- spikes/mpv-frame-copy/README.md | 16 ++++++++++++++-- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/spikes/mpv-frame-copy/Makefile b/spikes/mpv-frame-copy/Makefile index f90c66cfb..3d96406a9 100644 --- a/spikes/mpv-frame-copy/Makefile +++ b/spikes/mpv-frame-copy/Makefile @@ -1,11 +1,12 @@ # mpv frame-copy spike (macOS only for now). # -# Requires: Homebrew libmpv (brew install mpv) and Node headers for the -# N-API addon. Override NODE_INC if your Node lives elsewhere: -# make NODE_INC=$(node -e 'console.log(process.execPath)')/../../include/node +# Requires: Homebrew libmpv (brew install mpv) and Node >= 18 on PATH (for +# its N-API headers). Both are auto-detected; override BREW_PREFIX/NODE_INC +# if detection picks the wrong one. Works on Apple Silicon (/opt/homebrew) +# and Intel (/usr/local) Homebrew layouts. -BREW_PREFIX ?= /opt/homebrew -NODE_INC ?= $(HOME)/.nvm/versions/node/v22.14.0/include/node +BREW_PREFIX ?= $(shell brew --prefix 2>/dev/null || echo /opt/homebrew) +NODE_INC ?= $(shell node -p "require('path').join(process.execPath, '..', '..', 'include', 'node')" 2>/dev/null) BUILD := build diff --git a/spikes/mpv-frame-copy/README.md b/spikes/mpv-frame-copy/README.md index c0c325e1a..a5f96c0a3 100644 --- a/spikes/mpv-frame-copy/README.md +++ b/spikes/mpv-frame-copy/README.md @@ -20,8 +20,20 @@ to measure whether the copy pipeline meets the go/no-go gates. ## Build and run -Requires Homebrew `mpv` (libmpv + headers) and Node headers for the addon -build (`NODE_INC` in the Makefile, defaults to nvm's v22.14.0). +Requires Homebrew `mpv` (libmpv + headers) and Node ≥ 18 on `PATH`; the +Makefile auto-detects the Homebrew prefix (Apple Silicon and Intel) and the +Node include dir. + +Quick checklist for a fresh machine (e.g. the pending Intel Mac run): + +```bash +brew install mpv # libmpv + headers +git clone && cd +pnpm install --frozen-lockfile # provides the Electron binary for the viewer +cd spikes/mpv-frame-copy +./run.sh 'av://lavfi:testsrc2=size=1920x1080:rate=60' # sanity +# then the RESULTS.md scenarios (4K synthetic, 4K HEVC hwdec, 50 fps, HDR) +``` ```bash ./run.sh /path/to/video.mkv 3840x2160