std.Target: Add hurdTuple() and hurdTupleSimple() functions.

These serve the same purpose as the linuxTriple() and linuxTripleSimple()
functions, i.e. to return a triple understood by the GNU ecosystem.
This commit is contained in:
Alex Rønne Petersen
2024-11-28 17:09:55 +01:00
parent 8594f179f9
commit f02659d93c

View File

@@ -2023,6 +2023,14 @@ pub fn zigTriple(target: Target, allocator: Allocator) Allocator.Error![]u8 {
return Query.fromTarget(target).zigTriple(allocator);
}
pub fn hurdTupleSimple(allocator: Allocator, arch: Cpu.Arch, abi: Abi) ![]u8 {
return std.fmt.allocPrint(allocator, "{s}-{s}", .{ @tagName(arch), @tagName(abi) });
}
pub fn hurdTuple(target: Target, allocator: Allocator) ![]u8 {
return hurdTupleSimple(allocator, target.cpu.arch, target.abi);
}
pub fn linuxTripleSimple(allocator: Allocator, arch: Cpu.Arch, os_tag: Os.Tag, abi: Abi) ![]u8 {
return std.fmt.allocPrint(allocator, "{s}-{s}-{s}", .{ @tagName(arch), @tagName(os_tag), @tagName(abi) });
}