|
48 | 48 | benchmarkTools ? import ./tools/nix/benchmarkTools.nix { inherit pkgs; }, |
49 | 49 | }: |
50 | 50 |
|
| 51 | +assert pkgs.lib.assertMsg (withTemporal || !(builtins.hasAttr "temporal_capi" sharedLibDeps)) |
| 52 | + "`sharedLibDeps` must not contain `temporal_capi` when `withTemporal` is false"; |
| 53 | +assert pkgs.lib.assertMsg (withPerfetto || !(builtins.hasAttr "perfetto" sharedLibDeps)) |
| 54 | + "`sharedLibDeps` must not contain `perfetto` when `withPerfetto` is false"; |
| 55 | + |
51 | 56 | let |
52 | 57 | useSharedICU = if builtins.isString icu then icu == "system" else icu != null; |
53 | | - useSharedAda = builtins.hasAttr "ada" sharedLibDeps; |
54 | | - useSharedOpenSSL = builtins.hasAttr "openssl" sharedLibDeps; |
| 58 | + needsRustCompiler = withTemporal && !(builtins.hasAttr "temporal_capi" sharedLibDeps); |
55 | 59 |
|
56 | | - useSharedPerfetto = builtins.hasAttr "perfetto" sharedLibDeps; |
57 | | - useSharedTemporal = builtins.hasAttr "temporal_capi" sharedLibDeps; |
58 | | - needsRustCompiler = withTemporal && !useSharedTemporal; |
| 60 | + sharedV8Deps = builtins.filter (depName: builtins.hasAttr depName sharedLibDeps) ( |
| 61 | + [ |
| 62 | + "abseil" |
| 63 | + "highway" |
| 64 | + "perfetto" |
| 65 | + "simdutf" |
| 66 | + "temporal_capi" |
| 67 | + ] |
| 68 | + ); |
59 | 69 |
|
60 | 70 | nativeBuildInputs = |
61 | 71 | pkgs.nodejs-slim_latest.nativeBuildInputs |
|
64 | 74 | pkgs.rustc |
65 | 75 | ]; |
66 | 76 | buildInputs = |
67 | | - pkgs.lib.optional useSharedICU icu |
68 | | - ++ pkgs.lib.optional (builtins.hasAttr "abseil" sharedLibDeps) sharedLibDeps.abseil |
69 | | - ++ pkgs.lib.optional (builtins.hasAttr "highway" sharedLibDeps) sharedLibDeps.highway |
70 | | - ++ pkgs.lib.optional (withPerfetto && useSharedPerfetto) sharedLibDeps.perfetto |
71 | | - ++ pkgs.lib.optional (builtins.hasAttr "simdutf" sharedLibDeps) sharedLibDeps.simdutf |
72 | | - ++ pkgs.lib.optional (withTemporal && useSharedTemporal) sharedLibDeps.temporal_capi; |
| 77 | + pkgs.lib.optional useSharedICU icu ++ builtins.map (depName: sharedLibDeps.${depName}) sharedV8Deps; |
73 | 78 |
|
74 | 79 | # Put here only the configure flags that affect the V8 build |
75 | 80 | configureFlags = [ |
|
81 | 86 | ) |
82 | 87 | "--v8-${if withTemporal then "enable" else "disable"}-temporal-support" |
83 | 88 | ] |
84 | | - ++ pkgs.lib.optional (builtins.hasAttr "abseil" sharedLibDeps) "--shared-abseil" |
85 | | - ++ pkgs.lib.optional (builtins.hasAttr "highway" sharedLibDeps) "--shared-highway" |
86 | | - ++ pkgs.lib.optional (withPerfetto && useSharedPerfetto) "--shared-perfetto" |
87 | | - ++ pkgs.lib.optional (builtins.hasAttr "simdutf" sharedLibDeps) "--shared-simdutf" |
88 | | - ++ pkgs.lib.optional (withTemporal && useSharedTemporal) "--shared-temporal_capi" |
| 89 | + ++ builtins.map (depName: "--shared-${depName}") sharedV8Deps |
89 | 90 | ++ pkgs.lib.optional withPerfetto "--with-perfetto"; |
90 | 91 | in |
91 | 92 | pkgs.mkShell { |
@@ -131,26 +132,14 @@ pkgs.mkShell { |
131 | 132 | ++ pkgs.lib.optional (!withSSL) "--without-ssl" |
132 | 133 | ++ pkgs.lib.optional loadJSBuiltinsDynamically "--node-builtin-modules-path=${builtins.toString ./.}" |
133 | 134 | ++ pkgs.lib.optional (useSeparateDerivationForV8 != false) "--without-bundled-v8" |
134 | | - ++ |
135 | | - pkgs.lib.concatMap |
136 | | - (name: [ |
137 | | - "--shared-${name}" |
138 | | - "--shared-${name}-libpath=${pkgs.lib.getLib sharedLibDeps.${name}}/lib" |
139 | | - "--shared-${name}-include=${pkgs.lib.getInclude sharedLibDeps.${name}}/include" |
140 | | - ]) |
141 | | - ( |
142 | | - builtins.attrNames ( |
143 | | - if (useSeparateDerivationForV8 != false) then |
144 | | - builtins.removeAttrs sharedLibDeps [ |
145 | | - "abseil" |
146 | | - "highway" |
147 | | - "simdutf" |
148 | | - "temporal_capi" |
149 | | - ] |
150 | | - else |
151 | | - sharedLibDeps |
152 | | - ) |
153 | | - ) |
| 135 | + ++ builtins.map (name: "--shared-${name}") ( |
| 136 | + builtins.attrNames ( |
| 137 | + if (useSeparateDerivationForV8 != false) then |
| 138 | + builtins.removeAttrs sharedLibDeps sharedV8Deps |
| 139 | + else |
| 140 | + sharedLibDeps |
| 141 | + ) |
| 142 | + ) |
154 | 143 | ); |
155 | 144 | } |
156 | 145 | // ( |
|
0 commit comments