From fc38b42521027b2ddcba688ba07bd2f6eb2737bc Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 4 Jan 2021 13:49:17 -0700 Subject: Revert "Fix #7296:" This broke build scripts that wanted to refer to `exe_dir` or `install_path`. There has also been some pushback and discussion on this breaking change. I think it should be re-evaluated. This reverts commit a1a1929cf4ff979bdaba17f858d4ce8647e87a65. --- lib/std/build.zig | 12 ++++-------- lib/std/special/build_runner.zig | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/std/build.zig b/lib/std/build.zig index c981c957cf..bd097c9414 100644 --- a/lib/std/build.zig +++ b/lib/std/build.zig @@ -200,16 +200,12 @@ 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 { - 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"; + const install_prefix = self.install_prefix orelse blk: { + const p = self.cache_root; self.install_prefix = p; - break :blk self.pathFromRoot(p); + break :blk 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 ab418d3804..f2fa2dc3b8 100644 --- a/lib/std/special/build_runner.zig +++ b/lib/std/special/build_runner.zig @@ -134,8 +134,8 @@ pub fn main() !void { } } - try runBuild(builder); builder.resolveInstallPrefix(); + try runBuild(builder); if (builder.validateUserInputDidItFail()) return usageAndErr(builder, true, stderr_stream); -- cgit v1.2.3