authorgravatar for jacoblevgw@gmail.comJacob G-W <jacoblevgw@gmail.com> 2020-12-30 21:04:27-05:00
committergravatar for jacoblevgw@gmail.comJacob G-W <jacoblevgw@gmail.com> 2020-12-31 20:02:07-05:00
loga1a1929cf4ff979bdaba17f858d4ce8647e87a65
tree12e40f9bb6f0a0728980db8fd64473245e6a2574
parent93bb1d93cd18e739410009e7c77048d151a93b10

Fix #7296:

* makes '$build_root/{install,debug}/' the default prefix. This makes it not '$pwd/zig-cache/'.

2 files changed, 9 insertions(+), 5 deletions(-)

lib/std/build.zig+8-4
......@@ -200,12 +200,16 @@ pub const Builder = struct {
200200 const install_prefix = self.install_prefix orelse "/usr";
201201 self.install_path = fs.path.join(self.allocator, &[_][]const u8{ dest_dir, install_prefix }) catch unreachable;
202202 } else {
203 const install_prefix = self.install_prefix orelse blk: {
204 const p = self.cache_root;
203 self.install_path = self.install_prefix orelse blk: {
204 const p = if (self.release_mode) |mode| switch (mode) {
205 .Debug => "debug",
206 .ReleaseSafe => "release",
207 .ReleaseFast => "release",
208 .ReleaseSmall => "release",
209 } else "debug";
205210 self.install_prefix = p;
206 break :blk p;
211 break :blk self.pathFromRoot(p);
207212 };
208 self.install_path = install_prefix;
209213 }
210214 self.lib_dir = fs.path.join(self.allocator, &[_][]const u8{ self.install_path, "lib" }) catch unreachable;
211215 self.exe_dir = fs.path.join(self.allocator, &[_][]const u8{ self.install_path, "bin" }) catch unreachable;
lib/std/special/build_runner.zig+1-1
......@@ -134,8 +134,8 @@ pub fn main() !void {
134134 }
135135 }
136136
137 builder.resolveInstallPrefix();
138137 try runBuild(builder);
138 builder.resolveInstallPrefix();
139139
140140 if (builder.validateUserInputDidItFail())
141141 return usageAndErr(builder, true, stderr_stream);