authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-30 00:10:44-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2021-04-30 00:10:44-04:00
log4e07755ce705066cdb4e20feebc5010c7e3e6d12
treec1676ae89de0a886055c730a17c1336cd55f372b
parent585479500e1941da25bcc4c55a4c3abc69fec031
parent5079d11b213a02e9d9465f3371d0833021cfc636
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #8638 from ifreund/build-default-prefix

std/build: change default install prefix to zig-out

3 files changed, 6 insertions(+), 4 deletions(-)

.gitignore+1
...@@ -10,6 +10,7 @@...@@ -10,6 +10,7 @@
10# -andrewrk10# -andrewrk
1111
12zig-cache/12zig-cache/
13zig-out/
13/release/14/release/
14/debug/15/debug/
15/build/16/build/
lib/std/build.zig+2-1
...@@ -195,7 +195,8 @@ pub const Builder = struct {...@@ -195,7 +195,8 @@ pub const Builder = struct {
195 self.install_prefix = install_prefix orelse "/usr";195 self.install_prefix = install_prefix orelse "/usr";
196 self.install_path = fs.path.join(self.allocator, &[_][]const u8{ dest_dir, self.install_prefix }) catch unreachable;196 self.install_path = fs.path.join(self.allocator, &[_][]const u8{ dest_dir, self.install_prefix }) catch unreachable;
197 } else {197 } else {
198 self.install_prefix = install_prefix orelse self.cache_root;198 self.install_prefix = install_prefix orelse
199 (fs.path.join(self.allocator, &[_][]const u8{ self.build_root, "zig-out" }) catch unreachable);
199 self.install_path = self.install_prefix;200 self.install_path = self.install_prefix;
200 }201 }
201 self.lib_dir = fs.path.join(self.allocator, &[_][]const u8{ self.install_path, "lib" }) catch unreachable;202 self.lib_dir = fs.path.join(self.allocator, &[_][]const u8{ self.install_path, "lib" }) catch unreachable;
lib/std/special/build_runner.zig+3-3
...@@ -82,9 +82,9 @@ pub fn main() !void {...@@ -82,9 +82,9 @@ pub fn main() !void {
82 builder.verbose = true;82 builder.verbose = true;
83 } else if (mem.eql(u8, arg, "-h") or mem.eql(u8, arg, "--help")) {83 } else if (mem.eql(u8, arg, "-h") or mem.eql(u8, arg, "--help")) {
84 return usage(builder, false, stdout_stream);84 return usage(builder, false, stdout_stream);
85 } else if (mem.eql(u8, arg, "--prefix")) {85 } else if (mem.eql(u8, arg, "-p") or mem.eql(u8, arg, "--prefix")) {
86 install_prefix = nextArg(args, &arg_idx) orelse {86 install_prefix = nextArg(args, &arg_idx) orelse {
87 warn("Expected argument after --prefix\n\n", .{});87 warn("Expected argument after {s}\n\n", .{arg});
88 return usageAndErr(builder, false, stderr_stream);88 return usageAndErr(builder, false, stderr_stream);
89 };89 };
90 } else if (mem.eql(u8, arg, "--search-prefix")) {90 } else if (mem.eql(u8, arg, "--search-prefix")) {
...@@ -188,7 +188,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void...@@ -188,7 +188,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
188 \\General Options:188 \\General Options:
189 \\ -h, --help Print this help and exit189 \\ -h, --help Print this help and exit
190 \\ --verbose Print commands before executing them190 \\ --verbose Print commands before executing them
191 \\ --prefix [path] Override default install prefix191 \\ -p, --prefix [path] Override default install prefix
192 \\ --search-prefix [path] Add a path to look for binaries, libraries, headers192 \\ --search-prefix [path] Add a path to look for binaries, libraries, headers
193 \\ --color [auto|off|on] Enable or disable colored error messages193 \\ --color [auto|off|on] Enable or disable colored error messages
194 \\194 \\