Skip to content

Commit

Permalink
Merge pull request ziglang#7612 from g-w1/do-7296
Browse files Browse the repository at this point in the history
Implement ziglang#7296
  • Loading branch information
andrewrk authored Jan 3, 2021
2 parents d8f3f14 + 33e53d7 commit 6838141
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
# -andrewrk

zig-cache/
/release/
/debug/
/build/
/build-*/
/docgen_tmp/
12 changes: 8 additions & 4 deletions lib/std/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,16 @@ pub const Builder = struct {
const install_prefix = self.install_prefix orelse "/usr";
self.install_path = fs.path.join(self.allocator, &[_][]const u8{ dest_dir, install_prefix }) catch unreachable;
} else {
const install_prefix = self.install_prefix orelse blk: {
const p = self.cache_root;
self.install_path = self.install_prefix orelse blk: {
const p = if (self.release_mode) |mode| switch (mode) {
.Debug => "debug",
.ReleaseSafe => "release",
.ReleaseFast => "release",
.ReleaseSmall => "release",
} else "debug";
self.install_prefix = p;
break :blk p;
break :blk self.pathFromRoot(p);
};
self.install_path = install_prefix;
}
self.lib_dir = fs.path.join(self.allocator, &[_][]const u8{ self.install_path, "lib" }) catch unreachable;
self.exe_dir = fs.path.join(self.allocator, &[_][]const u8{ self.install_path, "bin" }) catch unreachable;
Expand Down
2 changes: 1 addition & 1 deletion lib/std/special/build_runner.zig
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ pub fn main() !void {
}
}

builder.resolveInstallPrefix();
try runBuild(builder);
builder.resolveInstallPrefix();

if (builder.validateUserInputDidItFail())
return usageAndErr(builder, true, stderr_stream);
Expand Down

0 comments on commit 6838141

Please sign in to comment.