1# These can be passed to nixpkgs as either the `localSystem` or
2# `crossSystem`. They are put here for user convenience, but also used by cross
3# tests and linux cross stdenv building, so handle with care!
4{ lib }:
5let
6 platforms = import ./platforms.nix { inherit lib; };
7
8 riscv = bits: {
9 config = "riscv${bits}-unknown-linux-gnu";
10 };
11in
12
13rec {
14 #
15 # Linux
16 #
17 powernv = {
18 config = "powerpc64le-unknown-linux-gnu";
19 };
20 musl-power = {
21 config = "powerpc64le-unknown-linux-musl";
22 };
23
24 ppc64-elfv1 = {
25 config = "powerpc64-unknown-linux-gnuabielfv1";
26 rust.rustcTarget = "powerpc64-unknown-linux-gnu";
27 };
28 ppc64-elfv2 = {
29 config = "powerpc64-unknown-linux-gnuabielfv2";
30 };
31 ppc64 = ppc64-elfv2;
32 ppc64-musl = {
33 config = "powerpc64-unknown-linux-musl";
34 gcc = {
35 abi = "elfv2";
36 };
37 };
38
39 ppc32 = {
40 config = "powerpc-unknown-linux-gnu";
41 rust.rustcTarget = "powerpc-unknown-linux-gnu";
42 };
43
44 sheevaplug = {
45 config = "armv5tel-unknown-linux-gnueabi";
46 }
47 // platforms.sheevaplug;
48
49 raspberryPi = {
50 config = "armv6l-unknown-linux-gnueabihf";
51 }
52 // platforms.raspberrypi;
53
54 bluefield2 = {
55 config = "aarch64-unknown-linux-gnu";
56 }
57 // platforms.bluefield2;
58
59 remarkable1 = {
60 config = "armv7l-unknown-linux-gnueabihf";
61 }
62 // platforms.zero-gravitas;
63
64 remarkable2 = {
65 config = "armv7l-unknown-linux-gnueabihf";
66 }
67 // platforms.zero-sugar;
68
69 armv7l-hf-multiplatform = {
70 config = "armv7l-unknown-linux-gnueabihf";
71 };
72
73 aarch64-multiplatform = {
74 config = "aarch64-unknown-linux-gnu";
75 };
76
77 armv7a-android-prebuilt = {
78 config = "armv7a-unknown-linux-androideabi";
79 rust.rustcTarget = "armv7-linux-androideabi";
80 androidSdkVersion = "35";
81 androidNdkVersion = "27";
82 useAndroidPrebuilt = true;
83 }
84 // platforms.armv7a-android;
85
86 aarch64-android-prebuilt = {
87 config = "aarch64-unknown-linux-android";
88 rust.rustcTarget = "aarch64-linux-android";
89 androidSdkVersion = "35";
90 androidNdkVersion = "27";
91 useAndroidPrebuilt = true;
92 };
93
94 aarch64-android = {
95 config = "aarch64-unknown-linux-android";
96 androidSdkVersion = "35";
97 androidNdkVersion = "27";
98 libc = "bionic";
99 useAndroidPrebuilt = false;
100 useLLVM = true;
101 };
102
103 pogoplug4 = {
104 config = "armv5tel-unknown-linux-gnueabi";
105 }
106 // platforms.pogoplug4;
107
108 ben-nanonote = {
109 config = "mipsel-unknown-linux-uclibc";
110 }
111 // platforms.ben_nanonote;
112
113 fuloongminipc = {
114 config = "mipsel-unknown-linux-gnu";
115 }
116 // platforms.fuloong2f_n32;
117
118 # can execute on 32bit chip
119 mips-linux-gnu = {
120 config = "mips-unknown-linux-gnu";
121 }
122 // platforms.gcc_mips32r2_o32;
123 mipsel-linux-gnu = {
124 config = "mipsel-unknown-linux-gnu";
125 }
126 // platforms.gcc_mips32r2_o32;
127
128 # require 64bit chip (for more registers, 64-bit floating point, 64-bit "long long") but use 32bit pointers
129 mips64-linux-gnuabin32 = {
130 config = "mips64-unknown-linux-gnuabin32";
131 }
132 // platforms.gcc_mips64r2_n32;
133 mips64el-linux-gnuabin32 = {
134 config = "mips64el-unknown-linux-gnuabin32";
135 }
136 // platforms.gcc_mips64r2_n32;
137
138 # 64bit pointers
139 mips64-linux-gnuabi64 = {
140 config = "mips64-unknown-linux-gnuabi64";
141 }
142 // platforms.gcc_mips64r2_64;
143 mips64el-linux-gnuabi64 = {
144 config = "mips64el-unknown-linux-gnuabi64";
145 }
146 // platforms.gcc_mips64r2_64;
147
148 muslpi = raspberryPi // {
149 config = "armv6l-unknown-linux-musleabihf";
150 };
151
152 aarch64-multiplatform-musl = {
153 config = "aarch64-unknown-linux-musl";
154 };
155
156 gnu64 = {
157 config = "x86_64-unknown-linux-gnu";
158 };
159 gnu64_simplekernel = gnu64 // platforms.pc_simplekernel; # see test/cross/default.nix
160 gnu32 = {
161 config = "i686-unknown-linux-gnu";
162 };
163
164 musl64 = {
165 config = "x86_64-unknown-linux-musl";
166 };
167 musl32 = {
168 config = "i686-unknown-linux-musl";
169 };
170
171 riscv64 = riscv "64";
172 riscv32 = riscv "32";
173
174 riscv64-musl = {
175 config = "riscv64-unknown-linux-musl";
176 };
177
178 riscv64-embedded = {
179 config = "riscv64-none-elf";
180 libc = "newlib";
181 };
182
183 riscv32-embedded = {
184 config = "riscv32-none-elf";
185 libc = "newlib";
186 };
187
188 mips64-embedded = {
189 config = "mips64-none-elf";
190 libc = "newlib";
191 };
192
193 mips-embedded = {
194 config = "mips-none-elf";
195 libc = "newlib";
196 };
197
198 # https://github.com/loongson/la-softdev-convention/blob/master/la-softdev-convention.adoc#10-operating-system-package-build-requirements
199 loongarch64-linux = lib.recursiveUpdate platforms.loongarch64-multiplatform {
200 config = "loongarch64-unknown-linux-gnu";
201 };
202 loongarch64-linux-embedded = lib.recursiveUpdate platforms.loongarch64-multiplatform {
203 config = "loongarch64-unknown-linux-gnu";
204 gcc = {
205 arch = "loongarch64";
206 strict-align = true;
207 };
208 };
209
210 mmix = {
211 config = "mmix-unknown-mmixware";
212 libc = "newlib";
213 };
214
215 rx-embedded = {
216 config = "rx-none-elf";
217 libc = "newlib";
218 };
219
220 msp430 = {
221 config = "msp430-elf";
222 libc = "newlib";
223 };
224
225 avr = {
226 config = "avr";
227 };
228
229 vc4 = {
230 config = "vc4-elf";
231 libc = "newlib";
232 };
233
234 or1k = {
235 config = "or1k-elf";
236 libc = "newlib";
237 };
238
239 m68k = {
240 config = "m68k-unknown-linux-gnu";
241 };
242
243 s390 = {
244 config = "s390-unknown-linux-gnu";
245 };
246
247 s390x = {
248 config = "s390x-unknown-linux-gnu";
249 };
250
251 arm-embedded = {
252 config = "arm-none-eabi";
253 libc = "newlib";
254 };
255 arm-embedded-nano = {
256 config = "arm-none-eabi";
257 libc = "newlib-nano";
258 };
259 armhf-embedded = {
260 config = "arm-none-eabihf";
261 libc = "newlib";
262 # GCC8+ does not build without this
263 # (https://www.mail-archive.com/gcc-bugs@gcc.gnu.org/msg552339.html):
264 gcc = {
265 arch = "armv5t";
266 fpu = "vfp";
267 };
268 };
269
270 aarch64-embedded = {
271 config = "aarch64-none-elf";
272 libc = "newlib";
273 rust.rustcTarget = "aarch64-unknown-none";
274 };
275
276 aarch64be-embedded = {
277 config = "aarch64_be-none-elf";
278 libc = "newlib";
279 };
280
281 ppc-embedded = {
282 config = "powerpc-none-eabi";
283 libc = "newlib";
284 };
285
286 ppcle-embedded = {
287 config = "powerpcle-none-eabi";
288 libc = "newlib";
289 };
290
291 i686-embedded = {
292 config = "i686-elf";
293 libc = "newlib";
294 };
295
296 x86_64-embedded = {
297 config = "x86_64-elf";
298 libc = "newlib";
299 };
300
301 microblaze-embedded = {
302 config = "microblazeel-none-elf";
303 libc = "newlib";
304 };
305
306 #
307 # Redox
308 #
309
310 x86_64-unknown-redox = {
311 config = "x86_64-unknown-redox";
312 libc = "relibc";
313 };
314
315 #
316 # Darwin
317 #
318
319 iphone64 = {
320 config = "arm64-apple-ios";
321 # config = "aarch64-apple-darwin14";
322 darwinSdkVersion = "14.3";
323 xcodeVer = "12.3";
324 xcodePlatform = "iPhoneOS";
325 useiOSPrebuilt = true;
326 };
327
328 iphone64-simulator = {
329 config = "x86_64-apple-ios";
330 # config = "x86_64-apple-darwin14";
331 darwinSdkVersion = "14.3";
332 xcodeVer = "12.3";
333 xcodePlatform = "iPhoneSimulator";
334 darwinPlatform = "ios-simulator";
335 useiOSPrebuilt = true;
336 };
337
338 aarch64-darwin = {
339 config = "arm64-apple-darwin";
340 xcodePlatform = "MacOSX";
341 platform = { };
342 };
343
344 x86_64-darwin = {
345 config = "x86_64-apple-darwin";
346 xcodePlatform = "MacOSX";
347 platform = { };
348 };
349
350 #
351 # Windows
352 #
353
354 # 32 bit mingw-w64
355 mingw32 = {
356 config = "i686-w64-mingw32";
357 libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
358 };
359
360 # 64 bit mingw-w64
361 mingwW64 = {
362 # That's the triplet they use in the mingw-w64 docs.
363 config = "x86_64-w64-mingw32";
364 libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
365 };
366
367 ucrt64 = {
368 config = "x86_64-w64-mingw32";
369 libc = "ucrt"; # This distinguishes the mingw (non posix) toolchain
370 };
371
372 # LLVM-based mingw-w64 for ARM
373 ucrtAarch64 = {
374 config = "aarch64-w64-mingw32";
375 libc = "ucrt";
376 rust.rustcTarget = "aarch64-pc-windows-gnullvm";
377 useLLVM = true;
378 };
379
380 # Target the MSVC ABI
381 x86_64-windows = {
382 config = "x86_64-pc-windows-msvc";
383 useLLVM = true;
384 };
385
386 aarch64-windows = {
387 config = "aarch64-pc-windows-msvc";
388 useLLVM = true;
389 };
390
391 x86_64-cygwin = {
392 config = "x86_64-pc-cygwin";
393 };
394
395 # BSDs
396
397 aarch64-freebsd = {
398 config = "aarch64-unknown-freebsd";
399 useLLVM = true;
400 };
401
402 x86_64-freebsd = {
403 config = "x86_64-unknown-freebsd";
404 useLLVM = true;
405 };
406
407 x86_64-netbsd = {
408 config = "x86_64-unknown-netbsd";
409 };
410
411 # this is broken and never worked fully
412 x86_64-netbsd-llvm = {
413 config = "x86_64-unknown-netbsd";
414 useLLVM = true;
415 };
416
417 x86_64-openbsd = {
418 config = "x86_64-unknown-openbsd";
419 useLLVM = true;
420 };
421
422 #
423 # WASM
424 #
425
426 wasi32 = {
427 config = "wasm32-unknown-wasi";
428 useLLVM = true;
429 };
430
431 wasm32-unknown-none = {
432 config = "wasm32-unknown-none";
433 rust.rustcTarget = "wasm32-unknown-unknown";
434 useLLVM = true;
435 };
436
437 # Ghcjs
438 ghcjs = {
439 # This triple is special to GHC/Cabal/GHCJS and not recognized by autotools
440 # See: https://gitlab.haskell.org/ghc/ghc/-/commit/6636b670233522f01d002c9b97827d00289dbf5c
441 # https://github.com/ghcjs/ghcjs/issues/53
442 config = "javascript-unknown-ghcjs";
443 };
444}