| ... | ... | @@ -41,9 +41,10 @@ pub const Builder = struct { |
| 41 | 41 | env_map: *BufMap, |
| 42 | 42 | top_level_steps: ArrayList(*TopLevelStep), |
| 43 | 43 | install_prefix: ?[]const u8, |
| 44 | | search_prefixes: ArrayList([]const u8), |
| 44 | dest_dir: ?[]const u8, |
| 45 | 45 | lib_dir: ?[]const u8, |
| 46 | 46 | exe_dir: ?[]const u8, |
| 47 | search_prefixes: ArrayList([]const u8), |
| 47 | 48 | installed_files: ArrayList(InstalledFile), |
| 48 | 49 | build_root: []const u8, |
| 49 | 50 | cache_root: []const u8, |
| ... | ... | @@ -125,10 +126,11 @@ pub const Builder = struct { |
| 125 | 126 | .top_level_steps = ArrayList(*TopLevelStep).init(allocator), |
| 126 | 127 | .default_step = undefined, |
| 127 | 128 | .env_map = env_map, |
| 128 | | .install_prefix = null, |
| 129 | 129 | .search_prefixes = ArrayList([]const u8).init(allocator), |
| 130 | .install_prefix = null, |
| 130 | 131 | .lib_dir = null, |
| 131 | 132 | .exe_dir = null, |
| 133 | .dest_dir = env_map.get("DESTDIR"), |
| 132 | 134 | .installed_files = ArrayList(InstalledFile).init(allocator), |
| 133 | 135 | .install_tls = TopLevelStep{ |
| 134 | 136 | .step = Step.initNoOp("install", allocator), |
| ... | ... | @@ -164,14 +166,14 @@ pub const Builder = struct { |
| 164 | 166 | } |
| 165 | 167 | |
| 166 | 168 | fn resolveInstallPrefix(self: *Builder) void { |
| 167 | | const prefix = if (self.install_prefix) |prefix| prefix else blk: { |
| 168 | | const prefix = self.cache_root; |
| 169 | | self.install_prefix = prefix; |
| 170 | | break :blk prefix; |
| 169 | const dest_dir = self.dest_dir orelse blk: { |
| 170 | const dest_dir = self.install_prefix orelse self.cache_root; |
| 171 | self.dest_dir = dest_dir; |
| 172 | break :blk dest_dir; |
| 171 | 173 | }; |
| 172 | | |
| 173 | | self.lib_dir = fs.path.join(self.allocator, [_][]const u8{ prefix, "lib" }) catch unreachable; |
| 174 | | self.exe_dir = fs.path.join(self.allocator, [_][]const u8{ prefix, "bin" }) catch unreachable; |
| 174 | self.dest_dir = dest_dir; |
| 175 | self.lib_dir = fs.path.join(self.allocator, [_][]const u8{ dest_dir, "lib" }) catch unreachable; |
| 176 | self.exe_dir = fs.path.join(self.allocator, [_][]const u8{ dest_dir, "bin" }) catch unreachable; |
| 175 | 177 | } |
| 176 | 178 | |
| 177 | 179 | pub fn addExecutable(self: *Builder, name: []const u8, root_src: ?[]const u8) *LibExeObjStep { |
| ... | ... | @@ -884,7 +886,7 @@ pub const Builder = struct { |
| 884 | 886 | |
| 885 | 887 | fn getInstallPath(self: *Builder, dir: InstallDir, dest_rel_path: []const u8) []const u8 { |
| 886 | 888 | const base_dir = switch (dir) { |
| 887 | | .Prefix => self.install_prefix.?, |
| 889 | .Prefix => self.dest_dir.?, |
| 888 | 890 | .Bin => self.exe_dir.?, |
| 889 | 891 | .Lib => self.lib_dir.?, |
| 890 | 892 | }; |