Commit f02659d93c

Alex Rønne Petersen <alex@alexrp.com>
2024-11-28 17:09:55
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.
1 parent 8594f17
Changed files (1)
lib
lib/std/Target.zig
@@ -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) });
 }