| ... | ... | @@ -853,14 +853,6 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { |
| 853 | 853 | break :blk false; |
| 854 | 854 | }; |
| 855 | 855 | |
| 856 | | const sysroot = blk: { |
| 857 | | if (options.sysroot) |sysroot| { |
| 858 | | break :blk sysroot; |
| 859 | | } else { |
| 860 | | break :blk null; |
| 861 | | } |
| 862 | | }; |
| 863 | | |
| 864 | 856 | const lto = blk: { |
| 865 | 857 | if (options.want_lto) |explicit| { |
| 866 | 858 | if (!use_lld and !options.target.isDarwin()) |
| ... | ... | @@ -946,6 +938,8 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { |
| 946 | 938 | options.libc_installation, |
| 947 | 939 | ); |
| 948 | 940 | |
| 941 | const sysroot = options.sysroot orelse libc_dirs.sysroot; |
| 942 | |
| 949 | 943 | const must_pie = target_util.requiresPIE(options.target); |
| 950 | 944 | const pie: bool = if (options.want_pie) |explicit| pie: { |
| 951 | 945 | if (!explicit and must_pie) { |
| ... | ... | @@ -4828,6 +4822,7 @@ const LibCDirs = struct { |
| 4828 | 4822 | libc_include_dir_list: []const []const u8, |
| 4829 | 4823 | libc_installation: ?*const LibCInstallation, |
| 4830 | 4824 | libc_framework_dir_list: []const []const u8, |
| 4825 | sysroot: ?[]const u8, |
| 4831 | 4826 | }; |
| 4832 | 4827 | |
| 4833 | 4828 | fn getZigShippedLibCIncludeDirsDarwin(arena: Allocator, zig_lib_dir: []const u8, target: Target) !LibCDirs { |
| ... | ... | @@ -4859,6 +4854,7 @@ fn getZigShippedLibCIncludeDirsDarwin(arena: Allocator, zig_lib_dir: []const u8, |
| 4859 | 4854 | .libc_include_dir_list = list, |
| 4860 | 4855 | .libc_installation = null, |
| 4861 | 4856 | .libc_framework_dir_list = &.{}, |
| 4857 | .sysroot = null, |
| 4862 | 4858 | }; |
| 4863 | 4859 | } |
| 4864 | 4860 | |
| ... | ... | @@ -4875,6 +4871,7 @@ fn detectLibCIncludeDirs( |
| 4875 | 4871 | .libc_include_dir_list = &[0][]u8{}, |
| 4876 | 4872 | .libc_installation = null, |
| 4877 | 4873 | .libc_framework_dir_list = &.{}, |
| 4874 | .sysroot = null, |
| 4878 | 4875 | }; |
| 4879 | 4876 | } |
| 4880 | 4877 | |
| ... | ... | @@ -4931,6 +4928,7 @@ fn detectLibCIncludeDirs( |
| 4931 | 4928 | .libc_include_dir_list = &[0][]u8{}, |
| 4932 | 4929 | .libc_installation = null, |
| 4933 | 4930 | .libc_framework_dir_list = &.{}, |
| 4931 | .sysroot = null, |
| 4934 | 4932 | }; |
| 4935 | 4933 | } |
| 4936 | 4934 | |
| ... | ... | @@ -4964,16 +4962,20 @@ fn detectLibCFromLibCInstallation(arena: Allocator, target: Target, lci: *const |
| 4964 | 4962 | list.appendAssumeCapacity(config_dir); |
| 4965 | 4963 | } |
| 4966 | 4964 | |
| 4965 | var sysroot: ?[]const u8 = null; |
| 4966 | |
| 4967 | 4967 | if (target.isDarwin()) d: { |
| 4968 | 4968 | const down1 = std.fs.path.dirname(lci.sys_include_dir.?) orelse break :d; |
| 4969 | 4969 | const down2 = std.fs.path.dirname(down1) orelse break :d; |
| 4970 | 4970 | try framework_list.append(try std.fs.path.join(arena, &.{ down2, "System", "Library", "Frameworks" })); |
| 4971 | sysroot = down2; |
| 4971 | 4972 | } |
| 4972 | 4973 | |
| 4973 | 4974 | return LibCDirs{ |
| 4974 | 4975 | .libc_include_dir_list = list.items, |
| 4975 | 4976 | .libc_installation = lci, |
| 4976 | 4977 | .libc_framework_dir_list = framework_list.items, |
| 4978 | .sysroot = sysroot, |
| 4977 | 4979 | }; |
| 4978 | 4980 | } |
| 4979 | 4981 | |
| ... | ... | @@ -5034,6 +5036,7 @@ fn detectLibCFromBuilding( |
| 5034 | 5036 | .libc_include_dir_list = list, |
| 5035 | 5037 | .libc_installation = null, |
| 5036 | 5038 | .libc_framework_dir_list = &.{}, |
| 5039 | .sysroot = null, |
| 5037 | 5040 | }; |
| 5038 | 5041 | } |
| 5039 | 5042 | |