Skip to content

Commit 042de00

Browse files
authored
[Runner] Set MACOSX_DEPLOYMENT_TARGET based on the actual macOS version (#217)
1 parent 6b45425 commit 042de00

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

src/Runner.jl

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,37 @@ function ld_library_path(target::AbstractPlatform,
106106
return join(paths, ":")
107107
end
108108

109+
function macos_version(kernel_version::Integer)
110+
# See https://en.wikipedia.org/wiki/Darwin_(operating_system)#Release_history
111+
kernel_to_macos = Dict(
112+
12 => "10.8",
113+
13 => "10.9",
114+
14 => "10.10",
115+
15 => "10.11",
116+
16 => "10.12",
117+
17 => "10.13",
118+
18 => "10.14",
119+
19 => "10.15",
120+
20 => "11.0",
121+
21 => "12.0",
122+
)
123+
return get(kernel_to_macos, kernel_version, nothing)
124+
end
125+
function macos_version(p::AbstractPlatform)
126+
if os(p) != "macos"
127+
return nothing
128+
end
129+
130+
# If no `os_version` is specified in `p`, default to the oldest we support in the Julia world,
131+
# which is `10.8`, but if it is actually specified, then set that corresponding value.
132+
#version = something(os_version(p), v"14.0.0")
133+
134+
# Eventually, we'll take this in `os_version(p)`, but not just yet. We need to fix the paths
135+
# to the compiler shards first, since right now they have `14` at the end
136+
version = something(os_version(p), v"14.0.0")
137+
return macos_version(version.major)
138+
end
139+
109140
"""
110141
generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::AbstractString,
111142
host_platform::AbstractPlatform = $(repr(default_host_platform)),
@@ -295,37 +326,6 @@ function generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::Abstr
295326
return flags
296327
end
297328

298-
function macos_version(kernel_version::Integer)
299-
# See https://en.wikipedia.org/wiki/Darwin_(operating_system)#Release_history
300-
kernel_to_macos = Dict(
301-
12 => "10.8",
302-
13 => "10.9",
303-
14 => "10.10",
304-
15 => "10.11",
305-
16 => "10.12",
306-
17 => "10.13",
307-
18 => "10.14",
308-
19 => "10.15",
309-
20 => "11.0",
310-
21 => "12.0",
311-
)
312-
return get(kernel_to_macos, kernel_version, nothing)
313-
end
314-
function macos_version(p::AbstractPlatform)
315-
if os(p) != "macos"
316-
return nothing
317-
end
318-
319-
# If no `os_version` is specified in `p`, default to the oldest we support in the Julia world,
320-
# which is `10.8`, but if it is actually specified, then set that corresponding value.
321-
#version = something(os_version(p), v"14.0.0")
322-
323-
# Eventually, we'll take this in `os_version(p)`, but not just yet. We need to fix the paths
324-
# to the compiler shards first, since right now they have `14` at the end
325-
version = something(os_version(p), v"14.0.0")
326-
return macos_version(version.major)
327-
end
328-
329329
function min_macos_version_flag(p::AbstractPlatform)
330330
# Ask compilers to compile for a minimum macOS version
331331
return "-mmacosx-version-min=$(macos_version(p))"
@@ -1076,7 +1076,7 @@ function platform_envs(platform::AbstractPlatform, src_name::AbstractString;
10761076
# If we're on macOS, we give a hint to things like `configure` that they should use this as the linker
10771077
if Sys.isapple(platform)
10781078
mapping["LD"] = "/opt/bin/$(triplet(platform))/ld"
1079-
mapping["MACOSX_DEPLOYMENT_TARGET"] = "10.8"
1079+
mapping["MACOSX_DEPLOYMENT_TARGET"] = macos_version(platform)
10801080
end
10811081

10821082
# There is no broad agreement on what host compilers should be called,

0 commit comments

Comments
 (0)