authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-11-28 17:09:55+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-11-28 17:18:00+01:00
logf02659d93c1e825c6b40f675efb9e8c05c7dcafd
tree79e364c050d90a47ec1327491efc10c18eb1c05c
parent8594f179f9d70fbc3bf39111c4e1f147d4a6dc3c
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

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 files changed, 8 insertions(+), 0 deletions(-)

lib/std/Target.zig+8
...@@ -2023,6 +2023,14 @@ pub fn zigTriple(target: Target, allocator: Allocator) Allocator.Error![]u8 {...@@ -2023,6 +2023,14 @@ pub fn zigTriple(target: Target, allocator: Allocator) Allocator.Error![]u8 {
2023 return Query.fromTarget(target).zigTriple(allocator);2023 return Query.fromTarget(target).zigTriple(allocator);
2024}2024}
20252025
2026pub fn hurdTupleSimple(allocator: Allocator, arch: Cpu.Arch, abi: Abi) ![]u8 {
2027 return std.fmt.allocPrint(allocator, "{s}-{s}", .{ @tagName(arch), @tagName(abi) });
2028}
2029
2030pub fn hurdTuple(target: Target, allocator: Allocator) ![]u8 {
2031 return hurdTupleSimple(allocator, target.cpu.arch, target.abi);
2032}
2033
2026pub fn linuxTripleSimple(allocator: Allocator, arch: Cpu.Arch, os_tag: Os.Tag, abi: Abi) ![]u8 {2034pub fn linuxTripleSimple(allocator: Allocator, arch: Cpu.Arch, os_tag: Os.Tag, abi: Abi) ![]u8 {
2027 return std.fmt.allocPrint(allocator, "{s}-{s}-{s}", .{ @tagName(arch), @tagName(os_tag), @tagName(abi) });2035 return std.fmt.allocPrint(allocator, "{s}-{s}-{s}", .{ @tagName(arch), @tagName(os_tag), @tagName(abi) });
2028}2036}