| ... | @@ -45,6 +45,7 @@ pub const Builder = struct { | ... | @@ -45,6 +45,7 @@ pub const Builder = struct { |
| 45 | dest_dir: ?[]const u8, | 45 | dest_dir: ?[]const u8, |
| 46 | lib_dir: []const u8, | 46 | lib_dir: []const u8, |
| 47 | exe_dir: []const u8, | 47 | exe_dir: []const u8, |
| | 48 | h_dir: []const u8, |
| 48 | install_path: []const u8, | 49 | install_path: []const u8, |
| 49 | search_prefixes: ArrayList([]const u8), | 50 | search_prefixes: ArrayList([]const u8), |
| 50 | installed_files: ArrayList(InstalledFile), | 51 | installed_files: ArrayList(InstalledFile), |
| ... | @@ -145,6 +146,7 @@ pub const Builder = struct { | ... | @@ -145,6 +146,7 @@ pub const Builder = struct { |
| 145 | .install_prefix = null, | 146 | .install_prefix = null, |
| 146 | .lib_dir = undefined, | 147 | .lib_dir = undefined, |
| 147 | .exe_dir = undefined, | 148 | .exe_dir = undefined, |
| | 149 | .h_dir = undefined, |
| 148 | .dest_dir = env_map.get("DESTDIR"), | 150 | .dest_dir = env_map.get("DESTDIR"), |
| 149 | .installed_files = ArrayList(InstalledFile).init(allocator), | 151 | .installed_files = ArrayList(InstalledFile).init(allocator), |
| 150 | .install_tls = TopLevelStep{ | 152 | .install_tls = TopLevelStep{ |
| ... | @@ -197,6 +199,7 @@ pub const Builder = struct { | ... | @@ -197,6 +199,7 @@ pub const Builder = struct { |
| 197 | } | 199 | } |
| 198 | self.lib_dir = fs.path.join(self.allocator, &[_][]const u8{ self.install_path, "lib" }) catch unreachable; | 200 | self.lib_dir = fs.path.join(self.allocator, &[_][]const u8{ self.install_path, "lib" }) catch unreachable; |
| 199 | self.exe_dir = fs.path.join(self.allocator, &[_][]const u8{ self.install_path, "bin" }) catch unreachable; | 201 | self.exe_dir = fs.path.join(self.allocator, &[_][]const u8{ self.install_path, "bin" }) catch unreachable; |
| | 202 | self.h_dir = fs.path.join(self.allocator, &[_][]const u8{ self.install_path, "include" }) catch unreachable; |
| 200 | } | 203 | } |
| 201 | | 204 | |
| 202 | pub fn addExecutable(self: *Builder, name: []const u8, root_src: ?[]const u8) *LibExeObjStep { | 205 | pub fn addExecutable(self: *Builder, name: []const u8, root_src: ?[]const u8) *LibExeObjStep { |
| ... | @@ -933,6 +936,7 @@ pub const Builder = struct { | ... | @@ -933,6 +936,7 @@ pub const Builder = struct { |
| 933 | .Prefix => self.install_path, | 936 | .Prefix => self.install_path, |
| 934 | .Bin => self.exe_dir, | 937 | .Bin => self.exe_dir, |
| 935 | .Lib => self.lib_dir, | 938 | .Lib => self.lib_dir, |
| | 939 | .Header => self.h_dir, |
| 936 | }; | 940 | }; |
| 937 | return fs.path.resolve( | 941 | return fs.path.resolve( |
| 938 | self.allocator, | 942 | self.allocator, |
| ... | @@ -2171,6 +2175,7 @@ const InstallArtifactStep = struct { | ... | @@ -2171,6 +2175,7 @@ const InstallArtifactStep = struct { |
| 2171 | artifact: *LibExeObjStep, | 2175 | artifact: *LibExeObjStep, |
| 2172 | dest_dir: InstallDir, | 2176 | dest_dir: InstallDir, |
| 2173 | pdb_dir: ?InstallDir, | 2177 | pdb_dir: ?InstallDir, |
| | 2178 | h_dir: ?InstallDir, |
| 2174 | | 2179 | |
| 2175 | const Self = @This(); | 2180 | const Self = @This(); |
| 2176 | | 2181 | |
| ... | @@ -2185,8 +2190,8 @@ const InstallArtifactStep = struct { | ... | @@ -2185,8 +2190,8 @@ const InstallArtifactStep = struct { |
| 2185 | .dest_dir = switch (artifact.kind) { | 2190 | .dest_dir = switch (artifact.kind) { |
| 2186 | .Obj => unreachable, | 2191 | .Obj => unreachable, |
| 2187 | .Test => unreachable, | 2192 | .Test => unreachable, |
| 2188 | .Exe => InstallDir.Bin, | 2193 | .Exe => .Bin, |
| 2189 | .Lib => InstallDir.Lib, | 2194 | .Lib => .Lib, |
| 2190 | }, | 2195 | }, |
| 2191 | .pdb_dir = if (artifact.producesPdbFile()) blk: { | 2196 | .pdb_dir = if (artifact.producesPdbFile()) blk: { |
| 2192 | if (artifact.kind == .Exe) { | 2197 | if (artifact.kind == .Exe) { |
| ... | @@ -2195,6 +2200,7 @@ const InstallArtifactStep = struct { | ... | @@ -2195,6 +2200,7 @@ const InstallArtifactStep = struct { |
| 2195 | break :blk InstallDir.Lib; | 2200 | break :blk InstallDir.Lib; |
| 2196 | } | 2201 | } |
| 2197 | } else null, | 2202 | } else null, |
| | 2203 | .h_dir = if (artifact.kind == .Lib and !artifact.disable_gen_h) .Header else null, |
| 2198 | }; | 2204 | }; |
| 2199 | self.step.dependOn(&artifact.step); | 2205 | self.step.dependOn(&artifact.step); |
| 2200 | artifact.install_step = self; | 2206 | artifact.install_step = self; |
| ... | @@ -2210,6 +2216,9 @@ const InstallArtifactStep = struct { | ... | @@ -2210,6 +2216,9 @@ const InstallArtifactStep = struct { |
| 2210 | if (self.pdb_dir) |pdb_dir| { | 2216 | if (self.pdb_dir) |pdb_dir| { |
| 2211 | builder.pushInstalledFile(pdb_dir, artifact.out_pdb_filename); | 2217 | builder.pushInstalledFile(pdb_dir, artifact.out_pdb_filename); |
| 2212 | } | 2218 | } |
| | 2219 | if (self.h_dir) |h_dir| { |
| | 2220 | builder.pushInstalledFile(h_dir, artifact.out_h_filename); |
| | 2221 | } |
| 2213 | return self; | 2222 | return self; |
| 2214 | } | 2223 | } |
| 2215 | | 2224 | |
| ... | @@ -2226,6 +2235,10 @@ const InstallArtifactStep = struct { | ... | @@ -2226,6 +2235,10 @@ const InstallArtifactStep = struct { |
| 2226 | const full_pdb_path = builder.getInstallPath(pdb_dir, self.artifact.out_pdb_filename); | 2235 | const full_pdb_path = builder.getInstallPath(pdb_dir, self.artifact.out_pdb_filename); |
| 2227 | try builder.updateFile(self.artifact.getOutputPdbPath(), full_pdb_path); | 2236 | try builder.updateFile(self.artifact.getOutputPdbPath(), full_pdb_path); |
| 2228 | } | 2237 | } |
| | 2238 | if (self.h_dir) |h_dir| { |
| | 2239 | const full_pdb_path = builder.getInstallPath(h_dir, self.artifact.out_h_filename); |
| | 2240 | try builder.updateFile(self.artifact.getOutputHPath(), full_pdb_path); |
| | 2241 | } |
| 2229 | self.artifact.installed_path = full_dest_path; | 2242 | self.artifact.installed_path = full_dest_path; |
| 2230 | } | 2243 | } |
| 2231 | }; | 2244 | }; |
| ... | @@ -2478,6 +2491,7 @@ pub const InstallDir = enum { | ... | @@ -2478,6 +2491,7 @@ pub const InstallDir = enum { |
| 2478 | Prefix, | 2491 | Prefix, |
| 2479 | Lib, | 2492 | Lib, |
| 2480 | Bin, | 2493 | Bin, |
| | 2494 | Header, |
| 2481 | }; | 2495 | }; |
| 2482 | | 2496 | |
| 2483 | pub const InstalledFile = struct { | 2497 | pub const InstalledFile = struct { |