* makes '$build_root/{install,debug}/' the default prefix. This makes it not '$pwd/zig-cache/'.
This commit is contained in:
g-w1 2020-12-30 21:04:27 -05:00
parent 93bb1d93cd
commit a1a1929cf4
2 changed files with 9 additions and 5 deletions

View file

@ -200,12 +200,16 @@ pub const Builder = struct {
const install_prefix = self.install_prefix orelse "/usr"; const install_prefix = self.install_prefix orelse "/usr";
self.install_path = fs.path.join(self.allocator, &[_][]const u8{ dest_dir, install_prefix }) catch unreachable; self.install_path = fs.path.join(self.allocator, &[_][]const u8{ dest_dir, install_prefix }) catch unreachable;
} else { } else {
const install_prefix = self.install_prefix orelse blk: { self.install_path = self.install_prefix orelse blk: {
const p = self.cache_root; const p = if (self.release_mode) |mode| switch (mode) {
.Debug => "debug",
.ReleaseSafe => "release",
.ReleaseFast => "release",
.ReleaseSmall => "release",
} else "debug";
self.install_prefix = p; 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.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; self.exe_dir = fs.path.join(self.allocator, &[_][]const u8{ self.install_path, "bin" }) catch unreachable;

View file

@ -134,8 +134,8 @@ pub fn main() !void {
} }
} }
builder.resolveInstallPrefix();
try runBuild(builder); try runBuild(builder);
builder.resolveInstallPrefix();
if (builder.validateUserInputDidItFail()) if (builder.validateUserInputDidItFail())
return usageAndErr(builder, true, stderr_stream); return usageAndErr(builder, true, stderr_stream);