@@ -85,108 +85,4 @@ function Base.BinaryPlatforms.validate_tags(tags::Dict)
8585 end
8686end
8787
88- # TODO using .BinaryPlatforms: arch_mapping, os_mapping, libc_mapping, call_abi_mapping,
89- # TODO libgfortran_version_mapping, cxxstring_abi_mapping, libstdcxx_version_mapping
90- # TODO
91- # TODO function Base.parse(::Type{Platform}, triplet::AbstractString; validate_strict::Bool = false)
92- # TODO # Re-insert the architecture because the global assignments above don't stick
93- # TODO CPUID.ISAs_by_family["riscv64"] = [
94- # TODO # We have no way to test riscv64 features yet, so we're only going to declare the lowest ISA:
95- # TODO "riscv64" => CPUID.ISA(Set{UInt32}()),
96- # TODO ]
97- # TODO BinaryPlatforms.arch_mapping["riscv64"] = "(rv64|riscv64)"
98- # TODO BinaryPlatforms.arch_march_isa_mapping["riscv64"] = ["riscv64" => get_set("riscv64", "riscv64")]
99- # TODO
100- # TODO # Helper function to collapse dictionary of mappings down into a regex of
101- # TODO # named capture groups joined by "|" operators
102- # TODO c(mapping) = string("(",join(["(?<$k>$v)" for (k, v) in mapping], "|"), ")")
103- # TODO
104- # TODO # We're going to build a mondo regex here to parse everything:
105- # TODO triplet_regex = Regex(string(
106- # TODO "^",
107- # TODO # First, the core triplet; arch/os/libc/call_abi
108- # TODO c(arch_mapping),
109- # TODO c(os_mapping),
110- # TODO c(libc_mapping),
111- # TODO c(call_abi_mapping),
112- # TODO # Next, optional things, like libgfortran/libstdcxx/cxxstring abi
113- # TODO c(libgfortran_version_mapping),
114- # TODO c(cxxstring_abi_mapping),
115- # TODO c(libstdcxx_version_mapping),
116- # TODO # Finally, the catch-all for extended tags
117- # TODO "(?<tags>(?:-[^-]+\\+[^-]+)*)?",
118- # TODO "\$",
119- # TODO ))
120- # TODO
121- # TODO m = match(triplet_regex, triplet)
122- # TODO if m !== nothing
123- # TODO # Helper function to find the single named field within the giant regex
124- # TODO # that is not `nothing` for each mapping we give it.
125- # TODO get_field(m, mapping) = begin
126- # TODO for k in keys(mapping)
127- # TODO if m[k] !== nothing
128- # TODO # Convert our sentinel `nothing` values to actual `nothing`
129- # TODO if endswith(k, "_nothing")
130- # TODO return nothing
131- # TODO end
132- # TODO # Convert libgfortran/libstdcxx version numbers
133- # TODO if startswith(k, "libgfortran")
134- # TODO return VersionNumber(parse(Int,k[12:end]))
135- # TODO elseif startswith(k, "libstdcxx")
136- # TODO return VersionNumber(3, 4, parse(Int,m[k][11:end]))
137- # TODO else
138- # TODO return k
139- # TODO end
140- # TODO end
141- # TODO end
142- # TODO end
143- # TODO
144- # TODO # Extract the information we're interested in:
145- # TODO arch = get_field(m, arch_mapping)
146- # TODO os = get_field(m, os_mapping)
147- # TODO libc = get_field(m, libc_mapping)
148- # TODO call_abi = get_field(m, call_abi_mapping)
149- # TODO libgfortran_version = get_field(m, libgfortran_version_mapping)
150- # TODO libstdcxx_version = get_field(m, libstdcxx_version_mapping)
151- # TODO cxxstring_abi = get_field(m, cxxstring_abi_mapping)
152- # TODO function split_tags(tagstr)
153- # TODO tag_fields = filter(!isempty, split(tagstr, "-"))
154- # TODO if isempty(tag_fields)
155- # TODO return Pair{String,String}[]
156- # TODO end
157- # TODO return map(v -> Symbol(v[1]) => v[2], split.(tag_fields, "+"))
158- # TODO end
159- # TODO tags = split_tags(m["tags"])
160- # TODO
161- # TODO # Special parsing of os version number, if any exists
162- # TODO function extract_os_version(os_name, pattern)
163- # TODO m_osvn = match(pattern, m[os_name])
164- # TODO if m_osvn !== nothing
165- # TODO return VersionNumber(m_osvn.captures[1])
166- # TODO end
167- # TODO return nothing
168- # TODO end
169- # TODO os_version = nothing
170- # TODO if os == "macos"
171- # TODO os_version = extract_os_version("macos", r".*darwin([\d\.]+)")
172- # TODO end
173- # TODO if os == "freebsd"
174- # TODO os_version = extract_os_version("freebsd", r".*freebsd([\d.]+)")
175- # TODO end
176- # TODO
177- # TODO return Platform(
178- # TODO arch, os;
179- # TODO validate_strict,
180- # TODO libc,
181- # TODO call_abi,
182- # TODO libgfortran_version,
183- # TODO cxxstring_abi,
184- # TODO libstdcxx_version,
185- # TODO os_version,
186- # TODO tags...,
187- # TODO )
188- # TODO end
189- # TODO throw(ArgumentError("Platform `$(triplet)` is not an officially supported platform"))
190- # TODO end
191-
19288end
0 commit comments