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 = {
25 config = "powerpc64-unknown-linux-gnuabielfv2";
26 };
27 ppc64-musl = {
28 config = "powerpc64-unknown-linux-musl";
29 gcc = { abi = "elfv2"; };
30 };
31
32 sheevaplug = {
33 config = "armv5tel-unknown-linux-gnueabi";
34 } // platforms.sheevaplug;
35
36 raspberryPi = {
37 config = "armv6l-unknown-linux-gnueabihf";
38 } // platforms.raspberrypi;
39
40 bluefield2 = {
41 config = "aarch64-unknown-linux-gnu";
42 } // platforms.bluefield2;
43
44 remarkable1 = {
45 config = "armv7l-unknown-linux-gnueabihf";
46 } // platforms.zero-gravitas;
47
48 remarkable2 = {
49 config = "armv7l-unknown-linux-gnueabihf";
50 } // platforms.zero-sugar;
51
52 armv7l-hf-multiplatform = {
53 config = "armv7l-unknown-linux-gnueabihf";
54 };
55
56 aarch64-multiplatform = {
57 config = "aarch64-unknown-linux-gnu";
58 };
59
60 armv7a-android-prebuilt = {
61 config = "armv7a-unknown-linux-androideabi";
62 rustc.config = "armv7-linux-androideabi";
63 sdkVer = "28";
64 ndkVer = "24";
65 useAndroidPrebuilt = true;
66 } // platforms.armv7a-android;
67
68 aarch64-android-prebuilt = {
69 config = "aarch64-unknown-linux-android";
70 rustc.config = "aarch64-linux-android";
71 sdkVer = "28";
72 ndkVer = "24";
73 useAndroidPrebuilt = true;
74 };
75
76 aarch64-android = {
77 config = "aarch64-unknown-linux-android";
78 sdkVer = "30";
79 ndkVer = "24";
80 libc = "bionic";
81 useAndroidPrebuilt = false;
82 useLLVM = true;
83 };
84
85 pogoplug4 = {
86 config = "armv5tel-unknown-linux-gnueabi";
87 } // platforms.pogoplug4;
88
89 ben-nanonote = {
90 config = "mipsel-unknown-linux-uclibc";
91 } // platforms.ben_nanonote;
92
93 fuloongminipc = {
94 config = "mipsel-unknown-linux-gnu";
95 } // platforms.fuloong2f_n32;
96
97 # can execute on 32bit chip
98 mips-linux-gnu = { config = "mips-unknown-linux-gnu"; } // platforms.gcc_mips32r2_o32;
99 mipsel-linux-gnu = { config = "mipsel-unknown-linux-gnu"; } // platforms.gcc_mips32r2_o32;
100
101 # require 64bit chip (for more registers, 64-bit floating point, 64-bit "long long") but use 32bit pointers
102 mips64-linux-gnuabin32 = { config = "mips64-unknown-linux-gnuabin32"; } // platforms.gcc_mips64r2_n32;
103 mips64el-linux-gnuabin32 = { config = "mips64el-unknown-linux-gnuabin32"; } // platforms.gcc_mips64r2_n32;
104
105 # 64bit pointers
106 mips64-linux-gnuabi64 = { config = "mips64-unknown-linux-gnuabi64"; } // platforms.gcc_mips64r2_64;
107 mips64el-linux-gnuabi64 = { config = "mips64el-unknown-linux-gnuabi64"; } // platforms.gcc_mips64r2_64;
108
109 muslpi = raspberryPi // {
110 config = "armv6l-unknown-linux-musleabihf";
111 };
112
113 aarch64-multiplatform-musl = {
114 config = "aarch64-unknown-linux-musl";
115 };
116
117 gnu64 = { config = "x86_64-unknown-linux-gnu"; };
118 gnu64_simplekernel = gnu64 // platforms.pc_simplekernel; # see test/cross/default.nix
119 gnu32 = { config = "i686-unknown-linux-gnu"; };
120
121 musl64 = { config = "x86_64-unknown-linux-musl"; };
122 musl32 = { config = "i686-unknown-linux-musl"; };
123
124 riscv64 = riscv "64";
125 riscv32 = riscv "32";
126
127 riscv64-embedded = {
128 config = "riscv64-none-elf";
129 libc = "newlib";
130 };
131
132 riscv32-embedded = {
133 config = "riscv32-none-elf";
134 libc = "newlib";
135 };
136
137 mips64-embedded = {
138 config = "mips64-none-elf";
139 libc = "newlib";
140 };
141
142 mips-embedded = {
143 config = "mips-none-elf";
144 libc = "newlib";
145 };
146
147 loongarch64-linux = {
148 config = "loongarch64-unknown-linux-gnu";
149 };
150
151 mmix = {
152 config = "mmix-unknown-mmixware";
153 libc = "newlib";
154 };
155
156 rx-embedded = {
157 config = "rx-none-elf";
158 libc = "newlib";
159 };
160
161 msp430 = {
162 config = "msp430-elf";
163 libc = "newlib";
164 };
165
166 avr = {
167 config = "avr";
168 };
169
170 vc4 = {
171 config = "vc4-elf";
172 libc = "newlib";
173 };
174
175 or1k = {
176 config = "or1k-elf";
177 libc = "newlib";
178 };
179
180 m68k = {
181 config = "m68k-unknown-linux-gnu";
182 };
183
184 s390 = {
185 config = "s390-unknown-linux-gnu";
186 };
187
188 s390x = {
189 config = "s390x-unknown-linux-gnu";
190 };
191
192 arm-embedded = {
193 config = "arm-none-eabi";
194 libc = "newlib";
195 };
196 armhf-embedded = {
197 config = "arm-none-eabihf";
198 libc = "newlib";
199 # GCC8+ does not build without this
200 # (https://www.mail-archive.com/gcc-bugs@gcc.gnu.org/msg552339.html):
201 gcc = {
202 arch = "armv5t";
203 fpu = "vfp";
204 };
205 };
206
207 aarch64-embedded = {
208 config = "aarch64-none-elf";
209 libc = "newlib";
210 rustc.config = "aarch64-unknown-none";
211 };
212
213 aarch64be-embedded = {
214 config = "aarch64_be-none-elf";
215 libc = "newlib";
216 };
217
218 ppc-embedded = {
219 config = "powerpc-none-eabi";
220 libc = "newlib";
221 };
222
223 ppcle-embedded = {
224 config = "powerpcle-none-eabi";
225 libc = "newlib";
226 };
227
228 i686-embedded = {
229 config = "i686-elf";
230 libc = "newlib";
231 };
232
233 x86_64-embedded = {
234 config = "x86_64-elf";
235 libc = "newlib";
236 };
237
238 #
239 # Redox
240 #
241
242 x86_64-unknown-redox = {
243 config = "x86_64-unknown-redox";
244 libc = "relibc";
245 };
246
247 #
248 # Darwin
249 #
250
251 iphone64 = {
252 config = "aarch64-apple-ios";
253 # config = "aarch64-apple-darwin14";
254 sdkVer = "14.3";
255 xcodeVer = "12.3";
256 xcodePlatform = "iPhoneOS";
257 useiOSPrebuilt = true;
258 };
259
260 iphone32 = {
261 config = "armv7a-apple-ios";
262 # config = "arm-apple-darwin10";
263 sdkVer = "14.3";
264 xcodeVer = "12.3";
265 xcodePlatform = "iPhoneOS";
266 useiOSPrebuilt = true;
267 };
268
269 iphone64-simulator = {
270 config = "x86_64-apple-ios";
271 # config = "x86_64-apple-darwin14";
272 sdkVer = "14.3";
273 xcodeVer = "12.3";
274 xcodePlatform = "iPhoneSimulator";
275 darwinPlatform = "ios-simulator";
276 useiOSPrebuilt = true;
277 };
278
279 iphone32-simulator = {
280 config = "i686-apple-ios";
281 # config = "i386-apple-darwin11";
282 sdkVer = "14.3";
283 xcodeVer = "12.3";
284 xcodePlatform = "iPhoneSimulator";
285 darwinPlatform = "ios-simulator";
286 useiOSPrebuilt = true;
287 };
288
289 aarch64-darwin = {
290 config = "aarch64-apple-darwin";
291 xcodePlatform = "MacOSX";
292 platform = {};
293 };
294
295 x86_64-darwin = {
296 config = "x86_64-apple-darwin";
297 xcodePlatform = "MacOSX";
298 platform = {};
299 };
300
301 #
302 # Windows
303 #
304
305 # 32 bit mingw-w64
306 mingw32 = {
307 config = "i686-w64-mingw32";
308 libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
309 };
310
311 # 64 bit mingw-w64
312 mingwW64 = {
313 # That's the triplet they use in the mingw-w64 docs.
314 config = "x86_64-w64-mingw32";
315 libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
316 };
317
318 ucrt64 = {
319 config = "x86_64-w64-mingw32";
320 libc = "ucrt"; # This distinguishes the mingw (non posix) toolchain
321 };
322
323 # BSDs
324
325 x86_64-freebsd = {
326 config = "x86_64-unknown-freebsd13";
327 useLLVM = true;
328 };
329
330 x86_64-netbsd = {
331 config = "x86_64-unknown-netbsd";
332 };
333
334 # this is broken and never worked fully
335 x86_64-netbsd-llvm = {
336 config = "x86_64-unknown-netbsd";
337 useLLVM = true;
338 };
339
340 #
341 # WASM
342 #
343
344 wasi32 = {
345 config = "wasm32-unknown-wasi";
346 useLLVM = true;
347 };
348
349 # Ghcjs
350 ghcjs = {
351 # This triple is special to GHC/Cabal/GHCJS and not recognized by autotools
352 # See: https://gitlab.haskell.org/ghc/ghc/-/commit/6636b670233522f01d002c9b97827d00289dbf5c
353 # https://github.com/ghcjs/ghcjs/issues/53
354 config = "javascript-unknown-ghcjs";
355 };
356}