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