|
8 | 8 | extraConfigFlags ? [ |
9 | 9 | "--debug-node" |
10 | 10 | ], |
| 11 | + useSeparateDerivationForV8 ? false, # to help CI better managed its binary cache, not recommended outside of CI usage. |
11 | 12 |
|
12 | 13 | # Build options |
13 | 14 | icu ? pkgs.icu, |
|
17 | 18 | withSQLite ? true, |
18 | 19 | withSSL ? true, |
19 | 20 | withTemporal ? false, |
20 | | - sharedLibDeps ? import ./tools/nix/sharedLibDeps.nix { |
21 | | - inherit |
22 | | - pkgs |
23 | | - withLief |
24 | | - withQuic |
25 | | - withSQLite |
26 | | - withSSL |
27 | | - withTemporal |
28 | | - ; |
29 | | - }, |
| 21 | + sharedLibDeps ? |
| 22 | + let |
| 23 | + d = import ./tools/nix/sharedLibDeps.nix { |
| 24 | + inherit |
| 25 | + pkgs |
| 26 | + withLief |
| 27 | + withQuic |
| 28 | + withSQLite |
| 29 | + withSSL |
| 30 | + withTemporal |
| 31 | + ; |
| 32 | + }; |
| 33 | + in |
| 34 | + # To avoid conflicts with V8's bundled simdutf lib, it's easier to remove it when using a precompiled V8. |
| 35 | + if (useSeparateDerivationForV8 != false) then builtins.removeAttrs d [ "simdutf" ] else d, |
30 | 36 |
|
31 | 37 | # dev tools (not needed to build Node.js, useful to maintain it) |
32 | 38 | ncu-path ? null, # Provide this if you want to use a local version of NCU |
|
40 | 46 | useSharedOpenSSL = builtins.hasAttr "openssl" sharedLibDeps; |
41 | 47 |
|
42 | 48 | needsRustCompiler = withTemporal && !builtins.hasAttr "temporal_capi" sharedLibDeps; |
| 49 | + |
| 50 | + buildInputs = builtins.attrValues sharedLibDeps ++ pkgs.lib.optional useSharedICU icu; |
| 51 | + configureFlags = [ |
| 52 | + ( |
| 53 | + if icu == null then |
| 54 | + "--without-intl" |
| 55 | + else |
| 56 | + "--with-intl=${if useSharedICU then "system" else icu}-icu" |
| 57 | + ) |
| 58 | + ] |
| 59 | + ++ extraConfigFlags |
| 60 | + ++ pkgs.lib.optional (!withAmaro) "--without-amaro" |
| 61 | + ++ pkgs.lib.optional (!withLief) "--without-lief" |
| 62 | + ++ pkgs.lib.optional withQuic "--experimental-quic" |
| 63 | + ++ pkgs.lib.optional (!withSQLite) "--without-sqlite" |
| 64 | + ++ pkgs.lib.optional (!withSSL) "--without-ssl" |
| 65 | + ++ pkgs.lib.optional withTemporal "--v8-enable-temporal-support" |
| 66 | + ++ pkgs.lib.optional (ninja != null) "--ninja" |
| 67 | + ++ pkgs.lib.optional loadJSBuiltinsDynamically "--node-builtin-modules-path=${builtins.toString ../..}" |
| 68 | + ++ pkgs.lib.concatMap (name: [ |
| 69 | + "--shared-${name}" |
| 70 | + "--shared-${name}-libpath=${pkgs.lib.getLib sharedLibDeps.${name}}/lib" |
| 71 | + "--shared-${name}-include=${pkgs.lib.getInclude sharedLibDeps.${name}}/include" |
| 72 | + ]) (builtins.attrNames sharedLibDeps); |
43 | 73 | in |
44 | 74 | pkgs.mkShell { |
45 | 75 | inherit (pkgs.nodejs_latest) nativeBuildInputs; |
46 | 76 |
|
47 | | - buildInputs = builtins.attrValues sharedLibDeps ++ pkgs.lib.optional useSharedICU icu; |
| 77 | + buildInputs = |
| 78 | + buildInputs |
| 79 | + ++ pkgs.lib.optional (useSeparateDerivationForV8 != false) ( |
| 80 | + if useSeparateDerivationForV8 == true then |
| 81 | + import ./tools/nix/v8.nix { |
| 82 | + inherit |
| 83 | + pkgs |
| 84 | + configureFlags |
| 85 | + buildInputs |
| 86 | + needsRustCompiler |
| 87 | + ; |
| 88 | + } |
| 89 | + else |
| 90 | + useSeparateDerivationForV8 |
| 91 | + ); |
48 | 92 |
|
49 | 93 | packages = |
50 | 94 | pkgs.lib.optional (ccache != null) ccache |
@@ -74,28 +118,7 @@ pkgs.mkShell { |
74 | 118 | ] |
75 | 119 | ); |
76 | 120 | CONFIG_FLAGS = builtins.toString ( |
77 | | - [ |
78 | | - ( |
79 | | - if icu == null then |
80 | | - "--without-intl" |
81 | | - else |
82 | | - "--with-intl=${if useSharedICU then "system" else icu}-icu" |
83 | | - ) |
84 | | - ] |
85 | | - ++ extraConfigFlags |
86 | | - ++ pkgs.lib.optional (!withAmaro) "--without-amaro" |
87 | | - ++ pkgs.lib.optional (!withLief) "--without-lief" |
88 | | - ++ pkgs.lib.optional withQuic "--experimental-quic" |
89 | | - ++ pkgs.lib.optional (!withSQLite) "--without-sqlite" |
90 | | - ++ pkgs.lib.optional (!withSSL) "--without-ssl" |
91 | | - ++ pkgs.lib.optional withTemporal "--v8-enable-temporal-support" |
92 | | - ++ pkgs.lib.optional (ninja != null) "--ninja" |
93 | | - ++ pkgs.lib.optional loadJSBuiltinsDynamically "--node-builtin-modules-path=${builtins.toString ./.}" |
94 | | - ++ pkgs.lib.concatMap (name: [ |
95 | | - "--shared-${name}" |
96 | | - "--shared-${name}-libpath=${pkgs.lib.getLib sharedLibDeps.${name}}/lib" |
97 | | - "--shared-${name}-include=${pkgs.lib.getInclude sharedLibDeps.${name}}/include" |
98 | | - ]) (builtins.attrNames sharedLibDeps) |
| 121 | + configureFlags ++ pkgs.lib.optional (useSeparateDerivationForV8 != false) "--without-bundled-v8" |
99 | 122 | ); |
100 | 123 | NOSQLITE = pkgs.lib.optionalString (!withSQLite) "1"; |
101 | 124 | } |
0 commit comments