| ... | @@ -495,16 +495,18 @@ pub const CrossTarget = struct { | ... | @@ -495,16 +495,18 @@ pub const CrossTarget = struct { |
| 495 | return self.isNativeCpu() and self.isNativeOs() and self.abi == null; | 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 | if (self.isNative()) { | 499 | if (self.isNative()) { |
| 500 | return mem.dupeZ(allocator, u8, "native"); | 500 | return mem.dupe(allocator, u8, "native"); |
| 501 | } | 501 | } |
| 502 | | 502 | |
| 503 | const arch_name = if (self.cpu_arch) |arch| @tagName(arch) else "native"; | 503 | const arch_name = if (self.cpu_arch) |arch| @tagName(arch) else "native"; |
| 504 | const os_name = if (self.os_tag) |os_tag| @tagName(os_tag) else "native"; | 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 }); | 506 | var result = std.ArrayList(u8).init(allocator); |
| 507 | defer result.deinit(); | 507 | errdefer result.deinit(); |
| | 508 | |
| | 509 | try result.outStream().print("{}-{}", .{ arch_name, os_name }); |
| 508 | | 510 | |
| 509 | // The zig target syntax does not allow specifying a max os version with no min, so | 511 | // The zig target syntax does not allow specifying a max os version with no min, so |
| 510 | // if either are present, we need the min. | 512 | // if either are present, we need the min. |
| ... | @@ -532,13 +534,13 @@ pub const CrossTarget = struct { | ... | @@ -532,13 +534,13 @@ pub const CrossTarget = struct { |
| 532 | return result.toOwnedSlice(); | 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 | // TODO is there anything else worthy of the description that is not | 538 | // TODO is there anything else worthy of the description that is not |
| 537 | // already captured in the triple? | 539 | // already captured in the triple? |
| 538 | return self.zigTriple(allocator); | 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 | return Target.linuxTripleSimple(allocator, self.getCpuArch(), self.getOsTag(), self.getAbi()); | 544 | return Target.linuxTripleSimple(allocator, self.getCpuArch(), self.getOsTag(), self.getAbi()); |
| 543 | } | 545 | } |
| 544 | | 546 | |
| ... | @@ -549,7 +551,7 @@ pub const CrossTarget = struct { | ... | @@ -549,7 +551,7 @@ pub const CrossTarget = struct { |
| 549 | pub const VcpkgLinkage = std.builtin.LinkMode; | 551 | pub const VcpkgLinkage = std.builtin.LinkMode; |
| 550 | | 552 | |
| 551 | /// Returned slice must be freed by the caller. | 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 | const arch = switch (self.getCpuArch()) { | 555 | const arch = switch (self.getCpuArch()) { |
| 554 | .i386 => "x86", | 556 | .i386 => "x86", |
| 555 | .x86_64 => "x64", | 557 | .x86_64 => "x64", |
| ... | @@ -580,7 +582,7 @@ pub const CrossTarget = struct { | ... | @@ -580,7 +582,7 @@ pub const CrossTarget = struct { |
| 580 | .Dynamic => "", | 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 | pub const Executor = union(enum) { | 588 | pub const Executor = union(enum) { |