authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2023-03-23 22:34:31+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2023-03-23 22:35:27+01:00
log5d2892740a842378fd03ced7af1c1ce6d1411539
tree2e18306adb519e54c9c5518ae2b3a76b5ee4fe69
parent38ee46dda31101f349ea9eee762908f924fd384c

build: when parsing rpaths, do not expand special runtime paths on Darwin

Special runtime paths on Darwin are: `@executable_path` and `@loader_path`.

1 files changed, 16 insertions(+), 0 deletions(-)

lib/std/Build/CompileStep.zig+16
...@@ -1725,6 +1725,22 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {...@@ -1725,6 +1725,22 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
1725 try zig_args.ensureUnusedCapacity(2 * self.rpaths.items.len);1725 try zig_args.ensureUnusedCapacity(2 * self.rpaths.items.len);
1726 for (self.rpaths.items) |rpath| {1726 for (self.rpaths.items) |rpath| {
1727 zig_args.appendAssumeCapacity("-rpath");1727 zig_args.appendAssumeCapacity("-rpath");
1728
1729 if (self.target_info.target.isDarwin()) switch (rpath) {
1730 .path => |path| {
1731 // On Darwin, we should not try to expand special runtime paths such as
1732 // * @executable_path
1733 // * @loader_path
1734 if (mem.startsWith(u8, path, "@executable_path") or
1735 mem.startsWith(u8, path, "@loader_path"))
1736 {
1737 zig_args.appendAssumeCapacity(path);
1738 continue;
1739 }
1740 },
1741 .generated => {},
1742 };
1743
1728 zig_args.appendAssumeCapacity(rpath.getPath2(b, step));1744 zig_args.appendAssumeCapacity(rpath.getPath2(b, step));
1729 }1745 }
17301746