diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-05-06 19:22:40 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-05-06 22:41:00 -0700 |
| commit | ec95e00e28cb23f37dc097f71afd7090e947a1cd (patch) | |
| tree | a7393f13c3d2c7895eb3687d0ebd7f3205699289 /src/main.zig | |
| parent | 3b60ab4872355f0b9a9c7d0794ca8b548ab99412 (diff) | |
| download | zig-ec95e00e28cb23f37dc097f71afd7090e947a1cd.tar.gz zig-ec95e00e28cb23f37dc097f71afd7090e947a1cd.zip | |
flatten lib/std/special and improve "pkg inside another" logic
stage2: change logic for detecting whether the main package is inside
the std package. Previously it relied on realpath() which is not portable.
This uses resolve() which is how imports already work.
* stage2: fix cleanup bug when creating Module
* flatten lib/std/special/* to lib/*
- this was motivated by making main_pkg_is_inside_std false for
compiler_rt & friends.
* rename "mini libc" to "universal libc"
Diffstat (limited to 'src/main.zig')
| -rw-r--r-- | src/main.zig | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/main.zig b/src/main.zig index 9487f2e962..58c614c76e 100644 --- a/src/main.zig +++ b/src/main.zig @@ -3421,8 +3421,8 @@ pub fn cmdInit( const s = fs.path.sep_str; const template_sub_path = switch (output_mode) { .Obj => unreachable, - .Lib => "std" ++ s ++ "special" ++ s ++ "init-lib", - .Exe => "std" ++ s ++ "special" ++ s ++ "init-exe", + .Lib => "init-lib", + .Exe => "init-exe", }; var template_dir = zig_lib_directory.handle.openDir(template_sub_path, .{}) catch |err| { fatal("unable to open zig project template directory '{s}{s}{s}': {s}", .{ zig_lib_directory.path, s, template_sub_path, @errorName(err) }); @@ -3571,19 +3571,10 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi }; defer zig_lib_directory.handle.close(); - const std_special = "std" ++ fs.path.sep_str ++ "special"; - const special_dir_path = try zig_lib_directory.join(arena, &[_][]const u8{std_special}); - var main_pkg: Package = .{ - .root_src_directory = .{ - .path = special_dir_path, - .handle = zig_lib_directory.handle.openDir(std_special, .{}) catch |err| { - fatal("unable to open directory '{s}{s}{s}': {s}", .{ override_lib_dir, fs.path.sep_str, std_special, @errorName(err) }); - }, - }, + .root_src_directory = zig_lib_directory, .root_src_path = "build_runner.zig", }; - defer main_pkg.root_src_directory.handle.close(); var cleanup_build_dir: ?fs.Dir = null; defer if (cleanup_build_dir) |*dir| dir.close(); |
