@@ -34,15 +34,15 @@ pub fn needsCrt0(output_mode: std.builtin.OutputMode) ?CrtFile {
34
34
35
35
fn includePath (comp : * Compilation , arena : Allocator , sub_path : []const u8 ) ! []const u8 {
36
36
return path .join (arena , &.{
37
- comp .zig_lib_directory .path .? ,
37
+ comp .dirs . zig_lib .path .? ,
38
38
"libc" ++ path .sep_str ++ "include" ,
39
39
sub_path ,
40
40
});
41
41
}
42
42
43
43
fn csuPath (comp : * Compilation , arena : Allocator , sub_path : []const u8 ) ! []const u8 {
44
44
return path .join (arena , &.{
45
- comp .zig_lib_directory .path .? ,
45
+ comp .dirs . zig_lib .path .? ,
46
46
"libc" ++ path .sep_str ++ "netbsd" ++ path .sep_str ++ "lib" ++ path .sep_str ++ "csu" ,
47
47
sub_path ,
48
48
});
@@ -383,11 +383,11 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
383
383
// Use the global cache directory.
384
384
var cache : Cache = .{
385
385
.gpa = gpa ,
386
- .manifest_dir = try comp .global_cache_directory .handle .makeOpenPath ("h" , .{}),
386
+ .manifest_dir = try comp .dirs . global_cache .handle .makeOpenPath ("h" , .{}),
387
387
};
388
388
cache .addPrefix (.{ .path = null , .handle = fs .cwd () });
389
- cache .addPrefix (comp .zig_lib_directory );
390
- cache .addPrefix (comp .global_cache_directory );
389
+ cache .addPrefix (comp .dirs . zig_lib );
390
+ cache .addPrefix (comp .dirs . global_cache );
391
391
defer cache .manifest_dir .close ();
392
392
393
393
var man = cache .obtain ();
@@ -397,7 +397,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
397
397
man .hash .add (target .abi );
398
398
man .hash .add (target_version );
399
399
400
- const full_abilists_path = try comp .zig_lib_directory .join (arena , &.{abilists_path });
400
+ const full_abilists_path = try comp .dirs . zig_lib .join (arena , &.{abilists_path });
401
401
const abilists_index = try man .addFile (full_abilists_path , abilists_max_size );
402
402
403
403
if (try man .hit ()) {
@@ -406,7 +406,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
406
406
return queueSharedObjects (comp , .{
407
407
.lock = man .toOwnedLock (),
408
408
.dir_path = .{
409
- .root_dir = comp .global_cache_directory ,
409
+ .root_dir = comp .dirs . global_cache ,
410
410
.sub_path = try gpa .dupe (u8 , "o" ++ fs .path .sep_str ++ digest ),
411
411
},
412
412
});
@@ -415,9 +415,9 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
415
415
const digest = man .final ();
416
416
const o_sub_path = try path .join (arena , &[_ ][]const u8 { "o" , & digest });
417
417
418
- var o_directory : Compilation .Directory = .{
419
- .handle = try comp .global_cache_directory .handle .makeOpenPath (o_sub_path , .{}),
420
- .path = try comp .global_cache_directory .join (arena , &.{o_sub_path }),
418
+ var o_directory : Cache .Directory = .{
419
+ .handle = try comp .dirs . global_cache .handle .makeOpenPath (o_sub_path , .{}),
420
+ .path = try comp .dirs . global_cache .join (arena , &.{o_sub_path }),
421
421
};
422
422
defer o_directory .handle .close ();
423
423
@@ -626,7 +626,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
626
626
var lib_name_buf : [32 ]u8 = undefined ; // Larger than each of the names "c", "pthread", etc.
627
627
const asm_file_basename = std .fmt .bufPrint (& lib_name_buf , "{s}.s" , .{lib .name }) catch unreachable ;
628
628
try o_directory .handle .writeFile (.{ .sub_path = asm_file_basename , .data = stubs_asm .items });
629
- try buildSharedLib (comp , arena , comp . global_cache_directory , o_directory , asm_file_basename , lib , prog_node );
629
+ try buildSharedLib (comp , arena , o_directory , asm_file_basename , lib , prog_node );
630
630
}
631
631
632
632
man .writeManifest () catch | err | {
@@ -636,7 +636,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
636
636
return queueSharedObjects (comp , .{
637
637
.lock = man .toOwnedLock (),
638
638
.dir_path = .{
639
- .root_dir = comp .global_cache_directory ,
639
+ .root_dir = comp .dirs . global_cache ,
640
640
.sub_path = try gpa .dupe (u8 , "o" ++ fs .path .sep_str ++ digest ),
641
641
},
642
642
});
@@ -675,8 +675,7 @@ fn queueSharedObjects(comp: *Compilation, so_files: BuiltSharedObjects) void {
675
675
fn buildSharedLib (
676
676
comp : * Compilation ,
677
677
arena : Allocator ,
678
- zig_cache_directory : Compilation.Directory ,
679
- bin_directory : Compilation.Directory ,
678
+ bin_directory : Cache.Directory ,
680
679
asm_file_basename : []const u8 ,
681
680
lib : Lib ,
682
681
prog_node : std.Progress.Node ,
@@ -708,9 +707,8 @@ fn buildSharedLib(
708
707
});
709
708
710
709
const root_mod = try Module .create (arena , .{
711
- .global_cache_directory = comp .global_cache_directory ,
712
710
.paths = .{
713
- .root = .{ . root_dir = comp . zig_lib_directory } ,
711
+ .root = .zig_lib_root ,
714
712
.root_src_path = "" ,
715
713
},
716
714
.fully_qualified_name = "root" ,
@@ -730,8 +728,6 @@ fn buildSharedLib(
730
728
.global = config ,
731
729
.cc_argv = &.{},
732
730
.parent = null ,
733
- .builtin_mod = null ,
734
- .builtin_modules = null , // there is only one module in this compilation
735
731
});
736
732
737
733
const c_source_files = [1 ]Compilation.CSourceFile {
@@ -742,9 +738,7 @@ fn buildSharedLib(
742
738
};
743
739
744
740
const sub_compilation = try Compilation .create (comp .gpa , arena , .{
745
- .local_cache_directory = zig_cache_directory ,
746
- .global_cache_directory = comp .global_cache_directory ,
747
- .zig_lib_directory = comp .zig_lib_directory ,
741
+ .dirs = comp .dirs .withoutLocalCache (),
748
742
.thread_pool = comp .thread_pool ,
749
743
.self_exe_path = comp .self_exe_path ,
750
744
.cache_mode = .incremental ,
0 commit comments