build: add --shared-perfetto flag

Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/65614
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Antoine du Hamel committed 2026-09-15 10:49:41 +02:00
1 parent 05cdf1db62
commit 02f8eb3b2d
8 files changed
+78 -16

No files matched your search

+2
View File
@@ -29,6 +29,7 @@ on:
- deps/nghttp2/**
- deps/ngtcp2/**
- deps/openssl/*/**
- deps/perfetto/**
- deps/simdjson/**
- deps/sqlite/**
- deps/uv/**
@@ -84,6 +85,7 @@ on:
- deps/nghttp2/**
- deps/ngtcp2/**
- deps/openssl/*/**
- deps/perfetto/**
- deps/simdjson/**
- deps/sqlite/**
- deps/uv/**
+1
View File
@@ -1319,6 +1319,7 @@ ifeq ($(SKIP_SHARED_DEPS), 1)
$(RM) -r $(TARNAME)/deps/ngtcp2
find $(TARNAME)/deps/openssl -maxdepth 1 -type f ! -name 'nodejs-openssl.cnf' -exec $(RM) {} +
find $(TARNAME)/deps/openssl -mindepth 1 -maxdepth 1 -type d -exec $(RM) -r {} +
$(RM) -r $(TARNAME)/deps/perfetto
$(RM) -r $(TARNAME)/deps/simdjson
$(RM) -r $(TARNAME)/deps/sqlite
$(RM) -r $(TARNAME)/deps/uv
+33
View File
@@ -546,6 +546,29 @@ shared_optgroup.add_argument('--shared-openssl-libpath',
dest='shared_openssl_libpath',
help='a directory to search for the shared OpenSSL DLLs')
shared_optgroup.add_argument('--shared-perfetto',
action='store_true',
dest='shared_perfetto',
default=None,
help='link to a shared perfetto SDK instead of the one in deps/perfetto '
'(requires --with-perfetto)')
shared_optgroup.add_argument('--shared-perfetto-includes',
action='store',
dest='shared_perfetto_includes',
help='directory containing perfetto header files')
shared_optgroup.add_argument('--shared-perfetto-libname',
action='store',
dest='shared_perfetto_libname',
default='perfetto',
help='alternative lib name to link to [default: %(default)s]')
shared_optgroup.add_argument('--shared-perfetto-libpath',
action='store',
dest='shared_perfetto_libpath',
help='a directory to search for the shared perfetto DLL')
shared_optgroup.add_argument('--shared-uvwasi',
action='store_true',
dest='shared_uvwasi',
@@ -2366,6 +2389,15 @@ def configure_lief(o):
configure_library('lief', o, pkgname='LIEF')
def configure_perfetto(o):
if not options.with_perfetto:
if options.shared_perfetto:
error('--shared-perfetto requires --with-perfetto')
o['variables']['node_shared_perfetto'] = b(False)
return
configure_library('perfetto', o)
def configure_sqlite(o):
o['variables']['node_use_sqlite'] = b(not options.without_sqlite)
if options.without_sqlite:
@@ -2941,6 +2973,7 @@ configure_library('nghttp2', output, pkgname='libnghttp2')
configure_library('nghttp3', output, pkgname='libnghttp3')
configure_library('ngtcp2', output, pkgname='libngtcp2')
configure_lief(output);
configure_perfetto(output);
configure_sqlite(output);
configure_ffi(output);
configure_library('temporal_capi', output)
+9 -4
View File
@@ -28,6 +28,7 @@
'node_shared_nbytes%': 'false',
'node_shared_nghttp2%': 'false',
'node_shared_openssl%': 'false',
'node_shared_perfetto%': 'false',
'node_shared_sqlite%': 'false',
'node_shared_ffi%': 'false',
'node_shared_temporal_capi%': 'false',
@@ -942,8 +943,12 @@
'sources': [
'<@(node_tracing_perfetto_sources)',
],
'dependencies': [
'deps/perfetto/perfetto.gyp:perfetto_sdk',
'conditions': [
['node_shared_perfetto=="false"', {
'dependencies': [
'deps/perfetto/perfetto.gyp:perfetto_sdk',
],
}],
],
}, {
'sources': [
@@ -1401,7 +1406,7 @@
}, {
'sources!': [ '<@(node_cctest_quic_sources)' ],
}],
[ 'v8_use_perfetto==1', {
[ 'v8_use_perfetto==1 and node_shared_perfetto=="false"', {
'dependencies': [
'deps/perfetto/perfetto.gyp:perfetto_sdk',
],
@@ -1731,7 +1736,7 @@
'NODE_USE_NODE_CODE_CACHE=1',
],
}],
[ 'v8_use_perfetto==1', {
[ 'v8_use_perfetto==1 and node_shared_perfetto=="false"', {
'dependencies': [
'deps/perfetto/perfetto.gyp:perfetto_sdk',
],
+4
View File
@@ -29,6 +29,7 @@
withSQLite
withFFI
withSSL
withPerfetto
withTemporal
;
}
@@ -52,6 +53,7 @@ let
useSharedAda = builtins.hasAttr "ada" sharedLibDeps;
useSharedOpenSSL = builtins.hasAttr "openssl" sharedLibDeps;
useSharedPerfetto = builtins.hasAttr "perfetto" sharedLibDeps;
useSharedTemporal = builtins.hasAttr "temporal_capi" sharedLibDeps;
needsRustCompiler = withTemporal && !useSharedTemporal;
@@ -65,6 +67,7 @@ let
pkgs.lib.optional useSharedICU icu
++ pkgs.lib.optional (builtins.hasAttr "abseil" sharedLibDeps) sharedLibDeps.abseil
++ pkgs.lib.optional (builtins.hasAttr "highway" sharedLibDeps) sharedLibDeps.highway
++ pkgs.lib.optional (withPerfetto && useSharedPerfetto) sharedLibDeps.perfetto
++ pkgs.lib.optional (withTemporal && useSharedTemporal) sharedLibDeps.temporal_capi;
# Put here only the configure flags that affect the V8 build
@@ -79,6 +82,7 @@ let
]
++ pkgs.lib.optional (builtins.hasAttr "abseil" sharedLibDeps) "--shared-abseil"
++ pkgs.lib.optional (builtins.hasAttr "highway" sharedLibDeps) "--shared-highway"
++ pkgs.lib.optional (withPerfetto && useSharedPerfetto) "--shared-perfetto"
++ pkgs.lib.optional (withTemporal && useSharedTemporal) "--shared-temporal_capi"
++ pkgs.lib.optional withPerfetto "--with-perfetto";
in
+8
View File
@@ -5,6 +5,7 @@
withSQLite ? true,
withSSL ? true,
withFFI ? true,
withPerfetto ? false,
withTemporal ? false,
}:
{
@@ -52,6 +53,13 @@
// (pkgs.lib.optionalAttrs withSSL ({
inherit (import ./openssl-matrix.nix { inherit pkgs; }) openssl;
}))
// (pkgs.lib.optionalAttrs withPerfetto {
perfetto =
(pkgs.callPackage (builtins.fetchurl {
url = "https://github.com/NixOS/nixpkgs/raw/c19db427a1fdfc7591c0b0baeb4665dcef2c61da/pkgs/by-name/pe/perfetto/package.nix";
sha256 = "0wc4p96kwxpqr8g2a6lmlfjsffrm3dc824m7hiy0q21r2papc0ik";
}) { }).sdk;
})
// (pkgs.lib.optionalAttrs withTemporal {
inherit (pkgs) temporal_capi;
})
+4 -3
View File
@@ -47,9 +47,10 @@ let
]
++ lib.optional (!useSharedAbseil) ../../tools/v8_gypfiles/abseil.gyp
++ lib.optional (!useSharedHighway) ../../tools/v8_gypfiles/highway.gyp
++ lib.optionals (builtins.elem "--with-perfetto" configureFlags) [
../../deps/perfetto
]
++ lib.optional (
builtins.elem "--with-perfetto" configureFlags
&& !(builtins.elem "--shared-perfetto" configureFlags)
) ../../deps/perfetto
++ lib.optionals (icu != null) [
../../tools/icu/icu_versions.json
../../tools/icu/icu-system.gyp
+17 -9
View File
@@ -295,7 +295,7 @@
'<(V8_ROOT)/src/init/setup-isolate-full.cc',
],
'conditions': [
['v8_use_perfetto==1', {
['v8_use_perfetto==1 and node_shared_perfetto=="false"', {
'dependencies': [
'<(perfetto_gyp_file):perfetto_sdk',
],
@@ -323,7 +323,7 @@
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_initializers.*?sources = ")',
],
'conditions': [
['v8_use_perfetto==1', {
['v8_use_perfetto==1 and node_shared_perfetto=="false"', {
'dependencies': [
'<(perfetto_gyp_file):perfetto_sdk',
],
@@ -498,7 +498,7 @@
},
],
'conditions': [
['v8_use_perfetto==1', {
['v8_use_perfetto==1 and node_shared_perfetto=="false"', {
'dependencies': [
'<(perfetto_gyp_file):perfetto_sdk',
],
@@ -998,7 +998,7 @@
'v8_pch',
],
'conditions': [
['v8_use_perfetto==1', {
['v8_use_perfetto==1 and node_shared_perfetto=="false"', {
'dependencies': [
'<(perfetto_gyp_file):perfetto_sdk',
],
@@ -1139,8 +1139,12 @@
'sources': [
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_base_without_compiler.*?v8_use_perfetto.*?sources \\+= ")',
],
'dependencies': [
'<(perfetto_gyp_file):perfetto_sdk',
'conditions': [
['node_shared_perfetto=="false"', {
'dependencies': [
'<(perfetto_gyp_file):perfetto_sdk',
],
}],
],
}],
['v8_enable_snapshot_compression==1', {
@@ -1765,8 +1769,12 @@
'sources': [
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_libplatform.*?v8_use_perfetto.*?sources \\+= ")',
],
'dependencies': [
'<(perfetto_gyp_file):perfetto_sdk',
'conditions': [
['node_shared_perfetto=="false"', {
'dependencies': [
'<(perfetto_gyp_file):perfetto_sdk',
],
}],
],
}],
['v8_enable_system_instrumentation==1 and is_win', {
@@ -1880,7 +1888,7 @@
},
},
'conditions': [
['v8_use_perfetto==1', {
['v8_use_perfetto==1 and node_shared_perfetto=="false"', {
'dependencies': [
'<(perfetto_gyp_file):perfetto_sdk',
],