| ... | ... | @@ -108,6 +108,7 @@ object_src: []const u8, |
| 108 | 108 | link_objects: ArrayList(LinkObject), |
| 109 | 109 | include_dirs: ArrayList(IncludeDir), |
| 110 | 110 | c_macros: ArrayList([]const u8), |
| 111 | installed_headers: ArrayList(*std.build.InstallFileStep), |
| 111 | 112 | output_dir: ?[]const u8, |
| 112 | 113 | is_linking_libc: bool = false, |
| 113 | 114 | is_linking_libcpp: bool = false, |
| ... | ... | @@ -370,6 +371,7 @@ fn initExtraArgs( |
| 370 | 371 | .lib_paths = ArrayList([]const u8).init(builder.allocator), |
| 371 | 372 | .rpaths = ArrayList([]const u8).init(builder.allocator), |
| 372 | 373 | .framework_dirs = ArrayList([]const u8).init(builder.allocator), |
| 374 | .installed_headers = ArrayList(*std.build.InstallFileStep).init(builder.allocator), |
| 373 | 375 | .object_src = undefined, |
| 374 | 376 | .c_std = Builder.CStd.C99, |
| 375 | 377 | .override_lib_dir = null, |
| ... | ... | @@ -472,6 +474,13 @@ pub fn installRaw(self: *LibExeObjStep, dest_filename: []const u8, options: Inst |
| 472 | 474 | return self.builder.installRaw(self, dest_filename, options); |
| 473 | 475 | } |
| 474 | 476 | |
| 477 | pub fn installHeader(a: *LibExeObjStep, src_path: []const u8) void { |
| 478 | const basename = fs.path.basename(src_path); |
| 479 | const install_file = a.builder.addInstallHeaderFile(src_path, basename); |
| 480 | a.builder.getInstallStep().dependOn(&install_file.step); |
| 481 | a.installed_headers.append(install_file) catch unreachable; |
| 482 | } |
| 483 | |
| 475 | 484 | /// Creates a `RunStep` with an executable built with `addExecutable`. |
| 476 | 485 | /// Add command line arguments with `addArg`. |
| 477 | 486 | pub fn run(exe: *LibExeObjStep) *RunStep { |
| ... | ... | @@ -1362,7 +1371,7 @@ fn make(step: *Step) !void { |
| 1362 | 1371 | |
| 1363 | 1372 | if (self.libc_file) |libc_file| { |
| 1364 | 1373 | try zig_args.append("--libc"); |
| 1365 | | try zig_args.append(libc_file.getPath(self.builder)); |
| 1374 | try zig_args.append(libc_file.getPath(builder)); |
| 1366 | 1375 | } else if (builder.libc_file) |libc_file| { |
| 1367 | 1376 | try zig_args.append("--libc"); |
| 1368 | 1377 | try zig_args.append(libc_file); |
| ... | ... | @@ -1577,7 +1586,7 @@ fn make(step: *Step) !void { |
| 1577 | 1586 | } else { |
| 1578 | 1587 | const need_cross_glibc = self.target.isGnuLibC() and self.is_linking_libc; |
| 1579 | 1588 | |
| 1580 | | switch (self.builder.host.getExternalExecutor(self.target_info, .{ |
| 1589 | switch (builder.host.getExternalExecutor(self.target_info, .{ |
| 1581 | 1590 | .qemu_fixes_dl = need_cross_glibc and builder.glibc_runtimes_dir != null, |
| 1582 | 1591 | .link_libc = self.is_linking_libc, |
| 1583 | 1592 | })) { |
| ... | ... | @@ -1661,7 +1670,7 @@ fn make(step: *Step) !void { |
| 1661 | 1670 | switch (include_dir) { |
| 1662 | 1671 | .raw_path => |include_path| { |
| 1663 | 1672 | try zig_args.append("-I"); |
| 1664 | | try zig_args.append(self.builder.pathFromRoot(include_path)); |
| 1673 | try zig_args.append(builder.pathFromRoot(include_path)); |
| 1665 | 1674 | }, |
| 1666 | 1675 | .raw_path_system => |include_path| { |
| 1667 | 1676 | if (builder.sysroot != null) { |
| ... | ... | @@ -1670,7 +1679,7 @@ fn make(step: *Step) !void { |
| 1670 | 1679 | try zig_args.append("-isystem"); |
| 1671 | 1680 | } |
| 1672 | 1681 | |
| 1673 | | const resolved_include_path = self.builder.pathFromRoot(include_path); |
| 1682 | const resolved_include_path = builder.pathFromRoot(include_path); |
| 1674 | 1683 | |
| 1675 | 1684 | const common_include_path = if (builtin.os.tag == .windows and builder.sysroot != null and fs.path.isAbsolute(resolved_include_path)) blk: { |
| 1676 | 1685 | // We need to check for disk designator and strip it out from dir path so |
| ... | ... | @@ -1686,10 +1695,21 @@ fn make(step: *Step) !void { |
| 1686 | 1695 | |
| 1687 | 1696 | try zig_args.append(common_include_path); |
| 1688 | 1697 | }, |
| 1689 | | .other_step => |other| if (other.emit_h) { |
| 1690 | | const h_path = other.getOutputHSource().getPath(self.builder); |
| 1691 | | try zig_args.append("-isystem"); |
| 1692 | | try zig_args.append(fs.path.dirname(h_path).?); |
| 1698 | .other_step => |other| { |
| 1699 | if (other.emit_h) { |
| 1700 | const h_path = other.getOutputHSource().getPath(builder); |
| 1701 | try zig_args.append("-isystem"); |
| 1702 | try zig_args.append(fs.path.dirname(h_path).?); |
| 1703 | } |
| 1704 | if (other.installed_headers.items.len != 0) { |
| 1705 | for (other.installed_headers.items) |install_file| { |
| 1706 | try install_file.step.make(); |
| 1707 | } |
| 1708 | try zig_args.append("-I"); |
| 1709 | try zig_args.append(builder.pathJoin(&.{ |
| 1710 | other.builder.install_prefix, "include", |
| 1711 | })); |
| 1712 | } |
| 1693 | 1713 | }, |
| 1694 | 1714 | .config_header_step => |config_header| { |
| 1695 | 1715 | try zig_args.append("-I"); |
| ... | ... | @@ -1790,7 +1810,7 @@ fn make(step: *Step) !void { |
| 1790 | 1810 | if (self.override_lib_dir) |dir| { |
| 1791 | 1811 | try zig_args.append("--zig-lib-dir"); |
| 1792 | 1812 | try zig_args.append(builder.pathFromRoot(dir)); |
| 1793 | | } else if (self.builder.override_lib_dir) |dir| { |
| 1813 | } else if (builder.override_lib_dir) |dir| { |
| 1794 | 1814 | try zig_args.append("--zig-lib-dir"); |
| 1795 | 1815 | try zig_args.append(builder.pathFromRoot(dir)); |
| 1796 | 1816 | } |