Skip to content

Commit a1a1929

Browse files
committed
* makes '$build_root/{install,debug}/' the default prefix. This makes it not '$pwd/zig-cache/'.
1 parent 93bb1d9 commit a1a1929

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

lib/std/build.zig

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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);

0 commit comments

Comments
 (0)