| ... | ... | @@ -495,16 +495,18 @@ pub const CrossTarget = struct { |
| 495 | 495 | return self.isNativeCpu() and self.isNativeOs() and self.abi == null; |
| 496 | 496 | } |
| 497 | 497 | |
| 498 | | pub fn zigTriple(self: CrossTarget, allocator: *mem.Allocator) error{OutOfMemory}![:0]u8 { |
| 498 | pub fn zigTriple(self: CrossTarget, allocator: *mem.Allocator) error{OutOfMemory}![]u8 { |
| 499 | 499 | if (self.isNative()) { |
| 500 | | return mem.dupeZ(allocator, u8, "native"); |
| 500 | return mem.dupe(allocator, u8, "native"); |
| 501 | 501 | } |
| 502 | 502 | |
| 503 | 503 | const arch_name = if (self.cpu_arch) |arch| @tagName(arch) else "native"; |
| 504 | 504 | const os_name = if (self.os_tag) |os_tag| @tagName(os_tag) else "native"; |
| 505 | 505 | |
| 506 | | var result = try std.Buffer.allocPrint(allocator, "{}-{}", .{ arch_name, os_name }); |
| 507 | | defer result.deinit(); |
| 506 | var result = std.ArrayList(u8).init(allocator); |
| 507 | errdefer result.deinit(); |
| 508 | |
| 509 | try result.outStream().print("{}-{}", .{ arch_name, os_name }); |
| 508 | 510 | |
| 509 | 511 | // The zig target syntax does not allow specifying a max os version with no min, so |
| 510 | 512 | // if either are present, we need the min. |
| ... | ... | @@ -532,13 +534,13 @@ pub const CrossTarget = struct { |
| 532 | 534 | return result.toOwnedSlice(); |
| 533 | 535 | } |
| 534 | 536 | |
| 535 | | pub fn allocDescription(self: CrossTarget, allocator: *mem.Allocator) ![:0]u8 { |
| 537 | pub fn allocDescription(self: CrossTarget, allocator: *mem.Allocator) ![]u8 { |
| 536 | 538 | // TODO is there anything else worthy of the description that is not |
| 537 | 539 | // already captured in the triple? |
| 538 | 540 | return self.zigTriple(allocator); |
| 539 | 541 | } |
| 540 | 542 | |
| 541 | | pub fn linuxTriple(self: CrossTarget, allocator: *mem.Allocator) ![:0]u8 { |
| 543 | pub fn linuxTriple(self: CrossTarget, allocator: *mem.Allocator) ![]u8 { |
| 542 | 544 | return Target.linuxTripleSimple(allocator, self.getCpuArch(), self.getOsTag(), self.getAbi()); |
| 543 | 545 | } |
| 544 | 546 | |
| ... | ... | @@ -549,7 +551,7 @@ pub const CrossTarget = struct { |
| 549 | 551 | pub const VcpkgLinkage = std.builtin.LinkMode; |
| 550 | 552 | |
| 551 | 553 | /// Returned slice must be freed by the caller. |
| 552 | | pub fn vcpkgTriplet(self: CrossTarget, allocator: *mem.Allocator, linkage: VcpkgLinkage) ![:0]u8 { |
| 554 | pub fn vcpkgTriplet(self: CrossTarget, allocator: *mem.Allocator, linkage: VcpkgLinkage) ![]u8 { |
| 553 | 555 | const arch = switch (self.getCpuArch()) { |
| 554 | 556 | .i386 => "x86", |
| 555 | 557 | .x86_64 => "x64", |
| ... | ... | @@ -580,7 +582,7 @@ pub const CrossTarget = struct { |
| 580 | 582 | .Dynamic => "", |
| 581 | 583 | }; |
| 582 | 584 | |
| 583 | | return std.fmt.allocPrint0(allocator, "{}-{}{}", .{ arch, os, static_suffix }); |
| 585 | return std.fmt.allocPrint(allocator, "{}-{}{}", .{ arch, os, static_suffix }); |
| 584 | 586 | } |
| 585 | 587 | |
| 586 | 588 | pub const Executor = union(enum) { |