authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-01-21 01:31:27-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-01-21 01:31:27-05:00
log0c2dde2fda29e84be25296d0b65bcb92dc9d4946
tree909cd45ccd4e45e23580023a49f6b9a281588b52
parent39759b90fce2fa114f59793958390778275c0477
signaturelock-open Commit is signed but in an unrecognized format.

add libc and glibcs to self-hosted zig targets


1 files changed, 118 insertions(+), 14 deletions(-)

src-self-hosted/print_targets.zig+118-14
...@@ -5,6 +5,101 @@ const mem = std.mem;...@@ -5,6 +5,101 @@ const mem = std.mem;
5const Allocator = mem.Allocator;5const Allocator = mem.Allocator;
6const Target = std.Target;6const Target = std.Target;
77
8// TODO this is hard-coded until self-hosted gains this information canonically
9const available_libcs = [_][]const u8{
10 "aarch64_be-linux-gnu",
11 "aarch64_be-linux-musl",
12 "aarch64_be-windows-gnu",
13 "aarch64-linux-gnu",
14 "aarch64-linux-musl",
15 "aarch64-windows-gnu",
16 "armeb-linux-gnueabi",
17 "armeb-linux-gnueabihf",
18 "armeb-linux-musleabi",
19 "armeb-linux-musleabihf",
20 "armeb-windows-gnu",
21 "arm-linux-gnueabi",
22 "arm-linux-gnueabihf",
23 "arm-linux-musleabi",
24 "arm-linux-musleabihf",
25 "arm-windows-gnu",
26 "i386-linux-gnu",
27 "i386-linux-musl",
28 "i386-windows-gnu",
29 "mips64el-linux-gnuabi64",
30 "mips64el-linux-gnuabin32",
31 "mips64el-linux-musl",
32 "mips64-linux-gnuabi64",
33 "mips64-linux-gnuabin32",
34 "mips64-linux-musl",
35 "mipsel-linux-gnu",
36 "mipsel-linux-musl",
37 "mips-linux-gnu",
38 "mips-linux-musl",
39 "powerpc64le-linux-gnu",
40 "powerpc64le-linux-musl",
41 "powerpc64-linux-gnu",
42 "powerpc64-linux-musl",
43 "powerpc-linux-gnu",
44 "powerpc-linux-musl",
45 "riscv64-linux-gnu",
46 "riscv64-linux-musl",
47 "s390x-linux-gnu",
48 "s390x-linux-musl",
49 "sparc-linux-gnu",
50 "sparcv9-linux-gnu",
51 "wasm32-freestanding-musl",
52 "x86_64-linux-gnu (native)",
53 "x86_64-linux-gnux32",
54 "x86_64-linux-musl",
55 "x86_64-windows-gnu",
56};
57
58// TODO this is hard-coded until self-hosted gains this information canonically
59const available_glibcs = [_][]const u8{
60 "2.0",
61 "2.1",
62 "2.1.1",
63 "2.1.2",
64 "2.1.3",
65 "2.2",
66 "2.2.1",
67 "2.2.2",
68 "2.2.3",
69 "2.2.4",
70 "2.2.5",
71 "2.2.6",
72 "2.3",
73 "2.3.2",
74 "2.3.3",
75 "2.3.4",
76 "2.4",
77 "2.5",
78 "2.6",
79 "2.7",
80 "2.8",
81 "2.9",
82 "2.10",
83 "2.11",
84 "2.12",
85 "2.13",
86 "2.14",
87 "2.15",
88 "2.16",
89 "2.17",
90 "2.18",
91 "2.19",
92 "2.22",
93 "2.23",
94 "2.24",
95 "2.25",
96 "2.26",
97 "2.27",
98 "2.28",
99 "2.29",
100 "2.30",
101};
102
8pub fn cmdTargets(103pub fn cmdTargets(
9 allocator: *Allocator,104 allocator: *Allocator,
10 args: []const []const u8,105 args: []const []const u8,
...@@ -52,25 +147,33 @@ pub fn cmdTargets(...@@ -52,25 +147,33 @@ pub fn cmdTargets(
52147
53 try jws.objectField("os");148 try jws.objectField("os");
54 try jws.beginArray();149 try jws.beginArray();
55 {150 inline for (@typeInfo(Target.Os).Enum.fields) |field| {
56 comptime var i: usize = 0;151 try jws.arrayElem();
57 inline while (i < @memberCount(Target.Os)) : (i += 1) {152 try jws.emitString(field.name);
58 const os_tag = @memberName(Target.Os, i);
59 try jws.arrayElem();
60 try jws.emitString(os_tag);
61 }
62 }153 }
63 try jws.endArray();154 try jws.endArray();
64155
65 try jws.objectField("abi");156 try jws.objectField("abi");
66 try jws.beginArray();157 try jws.beginArray();
67 {158 inline for (@typeInfo(Target.Abi).Enum.fields) |field| {
68 comptime var i: usize = 0;159 try jws.arrayElem();
69 inline while (i < @memberCount(Target.Abi)) : (i += 1) {160 try jws.emitString(field.name);
70 const abi_tag = @memberName(Target.Abi, i);161 }
71 try jws.arrayElem();162 try jws.endArray();
72 try jws.emitString(abi_tag);163
73 }164 try jws.objectField("libc");
165 try jws.beginArray();
166 for (available_libcs) |libc| {
167 try jws.arrayElem();
168 try jws.emitString(libc);
169 }
170 try jws.endArray();
171
172 try jws.objectField("glibc");
173 try jws.beginArray();
174 for (available_glibcs) |glibc| {
175 try jws.arrayElem();
176 try jws.emitString(glibc);
74 }177 }
75 try jws.endArray();178 try jws.endArray();
76179
...@@ -105,6 +208,7 @@ pub fn cmdTargets(...@@ -105,6 +208,7 @@ pub fn cmdTargets(
105 }208 }
106 try jws.endArray();209 try jws.endArray();
107 }210 }
211 // TODO implement native glibc version detection in self-hosted
108 try jws.endObject();212 try jws.endObject();
109213
110 try jws.endObject();214 try jws.endObject();