| author | |
| committer | |
| log | e687c87d691518d63414aed4f355dabbd8565dc3 |
| tree | 244d77229edd3ebabd3a89582cc309256b45e26c |
| parent | 020105d0dde614538a5839ede697e63a43bf6aa6 |
3 files changed, 3 insertions(+), 54 deletions(-)
src/link/MachO.zig-42| ... | @@ -870,48 +870,6 @@ fn resolveLibSystemInDirs(arena: Allocator, dirs: []const []const u8, out_libs: | ... | @@ -870,48 +870,6 @@ fn resolveLibSystemInDirs(arena: Allocator, dirs: []const []const u8, out_libs: |
| 870 | return false; | 870 | return false; |
| 871 | } | 871 | } |
| 872 | 872 | ||
| 873 | pub fn resolveSearchDir( | ||
| 874 | arena: Allocator, | ||
| 875 | dir: []const u8, | ||
| 876 | syslibroot: ?[]const u8, | ||
| 877 | ) !?[]const u8 { | ||
| 878 | var candidates = std.ArrayList([]const u8).init(arena); | ||
| 879 | |||
| 880 | if (fs.path.isAbsolute(dir)) { | ||
| 881 | if (syslibroot) |root| { | ||
| 882 | const common_dir = if (builtin.os.tag == .windows) blk: { | ||
| 883 | // We need to check for disk designator and strip it out from dir path so | ||
| 884 | // that we can concat dir with syslibroot. | ||
| 885 | // TODO we should backport this mechanism to 'MachO.Dylib.parseDependentLibs()' | ||
| 886 | const disk_designator = fs.path.diskDesignatorWindows(dir); | ||
| 887 | |||
| 888 | if (mem.indexOf(u8, dir, disk_designator)) |where| { | ||
| 889 | break :blk dir[where + disk_designator.len ..]; | ||
| 890 | } | ||
| 891 | |||
| 892 | break :blk dir; | ||
| 893 | } else dir; | ||
| 894 | const full_path = try fs.path.join(arena, &[_][]const u8{ root, common_dir }); | ||
| 895 | try candidates.append(full_path); | ||
| 896 | } | ||
| 897 | } | ||
| 898 | |||
| 899 | try candidates.append(dir); | ||
| 900 | |||
| 901 | for (candidates.items) |candidate| { | ||
| 902 | // Verify that search path actually exists | ||
| 903 | var tmp = fs.cwd().openDir(candidate, .{}) catch |err| switch (err) { | ||
| 904 | error.FileNotFound => continue, | ||
| 905 | else => |e| return e, | ||
| 906 | }; | ||
| 907 | defer tmp.close(); | ||
| 908 | |||
| 909 | return candidate; | ||
| 910 | } | ||
| 911 | |||
| 912 | return null; | ||
| 913 | } | ||
| 914 | |||
| 915 | pub fn resolveLib( | 873 | pub fn resolveLib( |
| 916 | arena: Allocator, | 874 | arena: Allocator, |
| 917 | search_dir: []const u8, | 875 | search_dir: []const u8, |
src/link/MachO/zld.zig+2-11| ... | @@ -3560,17 +3560,8 @@ pub fn linkWithZld(macho_file: *MachO, comp: *Compilation, prog_node: *std.Progr | ... | @@ -3560,17 +3560,8 @@ pub fn linkWithZld(macho_file: *MachO, comp: *Compilation, prog_node: *std.Progr |
| 3560 | try MachO.resolveLibSystem(arena, comp, options.sysroot, target, options.lib_dirs, &libs); | 3560 | try MachO.resolveLibSystem(arena, comp, options.sysroot, target, options.lib_dirs, &libs); |
| 3561 | 3561 | ||
| 3562 | // frameworks | 3562 | // frameworks |
| 3563 | var framework_dirs = std.ArrayList([]const u8).init(arena); | ||
| 3564 | for (options.framework_dirs) |dir| { | ||
| 3565 | if (try MachO.resolveSearchDir(arena, dir, options.sysroot)) |search_dir| { | ||
| 3566 | try framework_dirs.append(search_dir); | ||
| 3567 | } else { | ||
| 3568 | log.warn("directory not found for '-F{s}'", .{dir}); | ||
| 3569 | } | ||
| 3570 | } | ||
| 3571 | |||
| 3572 | outer: for (options.frameworks.keys()) |f_name| { | 3563 | outer: for (options.frameworks.keys()) |f_name| { |
| 3573 | for (framework_dirs.items) |dir| { | 3564 | for (options.framework_dirs) |dir| { |
| 3574 | for (&[_][]const u8{ ".tbd", ".dylib", "" }) |ext| { | 3565 | for (&[_][]const u8{ ".tbd", ".dylib", "" }) |ext| { |
| 3575 | if (try MachO.resolveFramework(arena, dir, f_name, ext)) |full_path| { | 3566 | if (try MachO.resolveFramework(arena, dir, f_name, ext)) |full_path| { |
| 3576 | const info = options.frameworks.get(f_name).?; | 3567 | const info = options.frameworks.get(f_name).?; |
| ... | @@ -3590,7 +3581,7 @@ pub fn linkWithZld(macho_file: *MachO, comp: *Compilation, prog_node: *std.Progr | ... | @@ -3590,7 +3581,7 @@ pub fn linkWithZld(macho_file: *MachO, comp: *Compilation, prog_node: *std.Progr |
| 3590 | 3581 | ||
| 3591 | if (framework_not_found) { | 3582 | if (framework_not_found) { |
| 3592 | log.warn("Framework search paths:", .{}); | 3583 | log.warn("Framework search paths:", .{}); |
| 3593 | for (framework_dirs.items) |dir| { | 3584 | for (options.framework_dirs) |dir| { |
| 3594 | log.warn(" {s}", .{dir}); | 3585 | log.warn(" {s}", .{dir}); |
| 3595 | } | 3586 | } |
| 3596 | } | 3587 | } |
src/main.zig+1-1| ... | @@ -2566,7 +2566,7 @@ fn buildOutputType( | ... | @@ -2566,7 +2566,7 @@ fn buildOutputType( |
| 2566 | want_native_include_dirs = true; | 2566 | want_native_include_dirs = true; |
| 2567 | } | 2567 | } |
| 2568 | 2568 | ||
| 2569 | // Resolve the library path arguments with respect to sysroot. | 2569 | // Resolve the library and framework path arguments with respect to sysroot. |
| 2570 | var lib_dirs = std.ArrayList([]const u8).init(arena); | 2570 | var lib_dirs = std.ArrayList([]const u8).init(arena); |
| 2571 | if (sysroot) |root| { | 2571 | if (sysroot) |root| { |
| 2572 | for (lib_dir_args.items) |dir| { | 2572 | for (lib_dir_args.items) |dir| { |