@@ -4,6 +4,13 @@ const V8_VERSION: []const u8 = "14.0.365.4";
44
55const LazyPath = std .Build .LazyPath ;
66
7+ fn addDepotToolsToPath (b : * std.Build , step : * std.Build.Step.Run , depot_tools : * std.Build.Dependency ) void {
8+ const old_path = step .getEnvMap ().get ("PATH" ) orelse "" ;
9+ const depot_tools_abs_path = b .pathFromRoot (depot_tools .path ("" ).getPath (b ));
10+ const new_path = b .fmt ("{s}:{s}" , .{ depot_tools_abs_path , old_path });
11+ step .setEnvironmentVariable ("PATH" , new_path );
12+ }
13+
714pub fn build (b : * std.Build ) ! void {
815 const target = b .standardTargetOptions (.{});
916 const optimize = b .standardOptimizeOption (.{});
@@ -250,6 +257,7 @@ fn bootstrapV8(b: *std.Build, v8_dir: []const u8) !*std.Build.Step.Run {
250257 gclient_sync .addFileArg (depot_tools .path ("gclient" ));
251258 gclient_sync .addArgs (&.{"sync" });
252259 gclient_sync .setCwd (.{ .cwd_relative = v8_dir });
260+ addDepotToolsToPath (b , gclient_sync , depot_tools );
253261 gclient_sync .step .dependOn (& write_gclient_args .step );
254262
255263 // Run clang update
@@ -302,7 +310,7 @@ fn buildV8(
302310 },
303311 .linux = > {
304312 if (arch == .aarch64 ) {
305- try gn_args .appendSlice (allocator , "clang_base_path=\" usr/lib/llvm-21\" \n " );
313+ try gn_args .appendSlice (allocator , "clang_base_path=\" / usr/lib/llvm-21\" \n " );
306314 try gn_args .appendSlice (allocator , "clang_use_chrome_plugins=false\n " );
307315 try gn_args .appendSlice (allocator , "treat_warnings_as_errors=false\n " );
308316 }
@@ -323,12 +331,14 @@ fn buildV8(
323331 b .fmt ("--args={s}" , .{gn_args .items }),
324332 });
325333 gn_run .setCwd (v8_dir );
334+ addDepotToolsToPath (b , gn_run , depot_tools );
326335 gn_run .step .dependOn (& bootstrapped_v8 .step );
327336
328337 var ninja_run = std .Build .Step .Run .create (b , "run ninja" );
329338 ninja_run .addFileArg (depot_tools .path ("ninja" ));
330339 ninja_run .addArgs (&.{ "-C" , out_dir , "c_v8" });
331340 ninja_run .setCwd (v8_dir );
341+ addDepotToolsToPath (b , ninja_run , depot_tools );
332342 ninja_run .step .dependOn (& gn_run .step );
333343
334344 const wf = b .addWriteFiles ();
0 commit comments