build: add --shared-v8 flags by jblac · Pull Request #62097 · nodejs/node

Add first-class --shared-v8 support using the same configure_library()
pattern used by every other shared dependency in Node.js. This provides
--shared-v8-includes, --shared-v8-libpath, and --shared-v8-libname
flags with pkg-config fallback.

When --shared-v8 is used, the bundled deps/v8/ is completely excluded
from compilation. No v8 GYP targets are built, no bundled headers
are referenced. The external v8 is linked via the standard shared
mechanism.

Configure-time validation checks the shared v8 against Node.js
requirements. Hard errors on: version mismatch, v8 sandbox enabled,
extensible RO snapshot enabled, pointer compression ABI mismatch
(auto detected). warning on: V8_PROMISE_INTERNAL_FIELD_COUNT < 1
(async_hooks uses a slower fallback). These are the "floating patch"
requirements decomposed into verifiable build flags, not source patches.

Snapshot generation (node_mksnapshot) works correctly with shared v8
because it links against the Node.js library, which transitively links
against whatever v8 is configured. No snapshot disabling needed.

The existing --without-bundled-v8 flag is deprecated and aliased
to --shared-v8 for backwards compatibility.

Fixes: nodejs#53509