authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2023-08-16 14:56:52+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2023-08-18 08:00:40+02:00
log23b4a2b8e1135a8a1d487d68961c2f24df84a712
tree75adda8e8f56ed777bafb7b046951a0dff589ae7
parent510802d25e4211c2f6403e49ece19450933e0f59

build: disambiguate system framework path (-iframework) from framework path (-F)


1 files changed, 26 insertions(+), 6 deletions(-)

lib/std/Build/Step/Compile.zig+26-6
...@@ -42,7 +42,7 @@ unwind_tables: ?bool,...@@ -42,7 +42,7 @@ unwind_tables: ?bool,
42compress_debug_sections: enum { none, zlib } = .none,42compress_debug_sections: enum { none, zlib } = .none,
43lib_paths: ArrayList(LazyPath),43lib_paths: ArrayList(LazyPath),
44rpaths: ArrayList(LazyPath),44rpaths: ArrayList(LazyPath),
45framework_dirs: ArrayList(LazyPath),45framework_dirs: ArrayList(FrameworkDir),
46frameworks: StringHashMap(FrameworkLinkInfo),46frameworks: StringHashMap(FrameworkLinkInfo),
47verbose_link: bool,47verbose_link: bool,
48verbose_cc: bool,48verbose_cc: bool,
...@@ -265,6 +265,11 @@ pub const IncludeDir = union(enum) {...@@ -265,6 +265,11 @@ pub const IncludeDir = union(enum) {
265 config_header_step: *Step.ConfigHeader,265 config_header_step: *Step.ConfigHeader,
266};266};
267267
268pub const FrameworkDir = union(enum) {
269 path: LazyPath,
270 path_system: LazyPath,
271};
272
268pub const Options = struct {273pub const Options = struct {
269 name: []const u8,274 name: []const u8,
270 root_source_file: ?LazyPath = null,275 root_source_file: ?LazyPath = null,
...@@ -442,7 +447,7 @@ pub fn create(owner: *std.Build, options: Options) *Compile {...@@ -442,7 +447,7 @@ pub fn create(owner: *std.Build, options: Options) *Compile {
442 .c_macros = ArrayList([]const u8).init(owner.allocator),447 .c_macros = ArrayList([]const u8).init(owner.allocator),
443 .lib_paths = ArrayList(LazyPath).init(owner.allocator),448 .lib_paths = ArrayList(LazyPath).init(owner.allocator),
444 .rpaths = ArrayList(LazyPath).init(owner.allocator),449 .rpaths = ArrayList(LazyPath).init(owner.allocator),
445 .framework_dirs = ArrayList(LazyPath).init(owner.allocator),450 .framework_dirs = ArrayList(FrameworkDir).init(owner.allocator),
446 .installed_headers = ArrayList(*Step).init(owner.allocator),451 .installed_headers = ArrayList(*Step).init(owner.allocator),
447 .c_std = std.Build.CStd.C99,452 .c_std = std.Build.CStd.C99,
448 .zig_lib_dir = null,453 .zig_lib_dir = null,
...@@ -1050,9 +1055,16 @@ pub fn addRPath(self: *Compile, directory_source: LazyPath) void {...@@ -1050,9 +1055,16 @@ pub fn addRPath(self: *Compile, directory_source: LazyPath) void {
1050 directory_source.addStepDependencies(&self.step);1055 directory_source.addStepDependencies(&self.step);
1051}1056}
10521057
1058pub fn addSystemFrameworkPath(self: *Compile, directory_source: LazyPath) void {
1059 const b = self.step.owner;
1060 self.framework_dirs.append(FrameworkDir{ .path_system = directory_source.dupe(b) }) catch
1061 @panic("OOM");
1062 directory_source.addStepDependencies(&self.step);
1063}
1064
1053pub fn addFrameworkPath(self: *Compile, directory_source: LazyPath) void {1065pub fn addFrameworkPath(self: *Compile, directory_source: LazyPath) void {
1054 const b = self.step.owner;1066 const b = self.step.owner;
1055 self.framework_dirs.append(directory_source.dupe(b)) catch @panic("OOM");1067 self.framework_dirs.append(FrameworkDir{ .path = directory_source.dupe(b) }) catch @panic("OOM");
1056 directory_source.addStepDependencies(&self.step);1068 directory_source.addStepDependencies(&self.step);
1057}1069}
10581070
...@@ -1828,9 +1840,17 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {...@@ -1828,9 +1840,17 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
1828 zig_args.appendAssumeCapacity(rpath.getPath2(b, step));1840 zig_args.appendAssumeCapacity(rpath.getPath2(b, step));
1829 }1841 }
18301842
1831 for (self.framework_dirs.items) |directory_source| {1843 for (self.framework_dirs.items) |framework_dir| {
1832 try zig_args.append("-F");1844 switch (framework_dir) {
1833 try zig_args.append(directory_source.getPath2(b, step));1845 .path => |p| {
1846 try zig_args.append("-F");
1847 try zig_args.append(p.getPath2(b, step));
1848 },
1849 .path_system => |p| {
1850 try zig_args.append("-iframework");
1851 try zig_args.append(p.getPath2(b, step));
1852 },
1853 }
1834 }1854 }
18351855
1836 {1856 {