authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-01-02 22:05:31-08:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2021-01-02 22:05:31-08:00
log683814190bde2340dbecf8e48ae1629900f51306
tree95235ea1016445971aa65c86b694c1d0b572bc40
parentd8f3f14532c4b5d65377efaef015c3855137dccf
parent33e53d729493bdfc76726dd2d247e1998e321930
signature Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #7612 from g-w1/do-7296

Implement #7296

3 files changed, 11 insertions(+), 5 deletions(-)

.gitignore+2
...@@ -10,6 +10,8 @@...@@ -10,6 +10,8 @@
10# -andrewrk10# -andrewrk
1111
12zig-cache/12zig-cache/
13/release/
14/debug/
13/build/15/build/
14/build-*/16/build-*/
15/docgen_tmp/17/docgen_tmp/
lib/std/build.zig+8-4
...@@ -200,12 +200,16 @@ pub const Builder = struct {...@@ -200,12 +200,16 @@ pub const Builder = struct {
200 const install_prefix = self.install_prefix orelse "/usr";200 const install_prefix = self.install_prefix orelse "/usr";
201 self.install_path = fs.path.join(self.allocator, &[_][]const u8{ dest_dir, install_prefix }) catch unreachable;201 self.install_path = fs.path.join(self.allocator, &[_][]const u8{ dest_dir, install_prefix }) catch unreachable;
202 } else {202 } else {
203 const install_prefix = self.install_prefix orelse blk: {203 self.install_path = self.install_prefix orelse blk: {
204 const p = self.cache_root;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";
205 self.install_prefix = p;210 self.install_prefix = p;
206 break :blk p;211 break :blk self.pathFromRoot(p);
207 };212 };
208 self.install_path = install_prefix;
209 }213 }
210 self.lib_dir = fs.path.join(self.allocator, &[_][]const u8{ self.install_path, "lib" }) catch unreachable;214 self.lib_dir = fs.path.join(self.allocator, &[_][]const u8{ self.install_path, "lib" }) catch unreachable;
211 self.exe_dir = fs.path.join(self.allocator, &[_][]const u8{ self.install_path, "bin" }) catch unreachable;215 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 {...@@ -134,8 +134,8 @@ pub fn main() !void {
134 }134 }
135 }135 }
136136
137 builder.resolveInstallPrefix();
138 try runBuild(builder);137 try runBuild(builder);
138 builder.resolveInstallPrefix();
139139
140 if (builder.validateUserInputDidItFail())140 if (builder.validateUserInputDidItFail())
141 return usageAndErr(builder, true, stderr_stream);141 return usageAndErr(builder, true, stderr_stream);