aboutsummaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
authorg-w1 <jacoblevgw@gmail.com>2020-12-30 21:04:27 -0500
committerg-w1 <jacoblevgw@gmail.com>2020-12-31 20:02:07 -0500
commita1a1929cf4ff979bdaba17f858d4ce8647e87a65 (patch)
tree12e40f9bb6f0a0728980db8fd64473245e6a2574 /lib/std
parent93bb1d93cd18e739410009e7c77048d151a93b10 (diff)
downloadzig-a1a1929cf4ff979bdaba17f858d4ce8647e87a65.tar.gz
zig-a1a1929cf4ff979bdaba17f858d4ce8647e87a65.zip
Fix #7296:
* makes '$build_root/{install,debug}/' the default prefix. This makes it not '$pwd/zig-cache/'.
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/build.zig12
-rw-r--r--lib/std/special/build_runner.zig2
2 files changed, 9 insertions, 5 deletions
diff --git a/lib/std/build.zig b/lib/std/build.zig
index 8fed629f32..d8d0cb23eb 100644
--- a/lib/std/build.zig
+++ b/lib/std/build.zig
@@ -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;
diff --git a/lib/std/special/build_runner.zig b/lib/std/special/build_runner.zig
index e3e90e7574..be6d59ccb3 100644
--- a/lib/std/special/build_runner.zig
+++ b/lib/std/special/build_runner.zig
@@ -134,8 +134,8 @@ pub fn main() !void {
}
}
- builder.resolveInstallPrefix();
try runBuild(builder);
+ builder.resolveInstallPrefix();
if (builder.validateUserInputDidItFail())
return usageAndErr(builder, true, stderr_stream);