1 /* This file defines some basic smoke tests for cross compilation.
2 Individual jobs can be tested by running:
4 $ nix-build pkgs/top-level/release-cross.nix -A <jobname>.<package> --arg supportedSystems '[builtins.currentSystem]'
8 $ nix-build pkgs/top-level/release-cross.nix -A crossMingw32.nixUnstable --arg supportedSystems '[builtins.currentSystem]'
11 { # The platforms *from* which we cross compile.
12 supportedSystems ? [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" ]
13 , # Strip most of attributes when evaluating to spare memory usage
15 , # Attributes passed to nixpkgs. Don't build packages marked as unfree.
16 nixpkgsArgs ? { config = { allowUnfree = false; inHydra = true; }; }
19 with import ./release-lib.nix { inherit supportedSystems scrubJobs nixpkgsArgs; };
22 nativePlatforms = all;
25 buildPackages.binutils = nativePlatforms;
26 buildPackages.gcc = nativePlatforms;
27 libcCross = nativePlatforms;
31 buildPackages.binutils = nativePlatforms;
32 gmp = nativePlatforms;
33 libcCross = nativePlatforms;
34 nix = nativePlatforms;
35 nixUnstable = nativePlatforms;
36 mesa = nativePlatforms;
39 gnuCommon = lib.recursiveUpdate common {
40 buildPackages.gcc = nativePlatforms;
41 coreutils = nativePlatforms;
42 haskell.packages.ghcHEAD.hello = nativePlatforms;
43 haskellPackages.hello = nativePlatforms;
46 linuxCommon = lib.recursiveUpdate gnuCommon {
47 buildPackages.gdb = nativePlatforms;
49 bison = nativePlatforms;
50 busybox = nativePlatforms;
51 dropbear = nativePlatforms;
53 ncurses = nativePlatforms;
54 patch = nativePlatforms;
57 windowsCommon = lib.recursiveUpdate gnuCommon {
58 boehmgc = nativePlatforms;
59 guile_1_8 = nativePlatforms;
60 libffi = nativePlatforms;
61 libtool = nativePlatforms;
62 libunistring = nativePlatforms;
63 windows.wxMSW = nativePlatforms;
64 windows.mingw_w64_pthreads = nativePlatforms;
68 gmp = nativePlatforms;
69 boehmgc = nativePlatforms;
70 hello = nativePlatforms;
71 zlib = nativePlatforms;
75 buildPackages.binutils = darwin;
78 rpiCommon = linuxCommon // {
79 vim = nativePlatforms;
80 unzip = nativePlatforms;
81 ddrescue = nativePlatforms;
82 lynx = nativePlatforms;
83 patchelf = nativePlatforms;
84 buildPackages.binutils = nativePlatforms;
85 mpg123 = nativePlatforms;
90 # These derivations from a cross package set's `buildPackages` should be
91 # identical to their vanilla equivalents --- none of these package should
92 # observe the target platform which is the only difference between those
94 ensureUnaffected = let
95 # Absurd values are fine here, as we are not building anything. In fact,
96 # there probably a good idea to try to be "more parametric" --- i.e. avoid
99 config = "mips64el-apple-windows-gnu";
103 # Converting to a string (drv path) before checking equality is probably a
104 # good idea lest there be some irrelevant pass-through debug attrs that
105 # cause false negatives.
106 testEqualOne = path: system: let
107 f = path: crossSystem: system: builtins.toString (lib.getAttrFromPath path (pkgsForCross crossSystem system));
111 f (["buildPackages"] ++ path) crossSystem system
114 testEqual = path: systems: forMatchingSystems systems (testEqualOne path);
116 mapTestEqual = lib.mapAttrsRecursive testEqual;
119 boehmgc = nativePlatforms;
120 libffi = nativePlatforms;
121 libiconv = nativePlatforms;
122 libtool = nativePlatforms;
123 zlib = nativePlatforms;
124 readline = nativePlatforms;
125 libxml2 = nativePlatforms;
126 guile = nativePlatforms;
129 crossIphone64 = mapTestOnCross lib.systems.examples.iphone64 darwinCommon;
131 crossIphone32 = mapTestOnCross lib.systems.examples.iphone32 darwinCommon;
133 /* Test some cross builds to the Sheevaplug */
134 crossSheevaplugLinux = mapTestOnCross lib.systems.examples.sheevaplug (linuxCommon // {
135 ubootSheevaplug = nativePlatforms;
138 /* Test some cross builds on 32 bit mingw-w64 */
139 crossMingw32 = mapTestOnCross lib.systems.examples.mingw32 windowsCommon;
141 /* Test some cross builds on 64 bit mingw-w64 */
142 crossMingwW64 = mapTestOnCross lib.systems.examples.mingwW64 windowsCommon;
144 /* Linux on mipsel */
145 fuloongminipc = mapTestOnCross lib.systems.examples.fuloongminipc linuxCommon;
146 ben-nanonote = mapTestOnCross lib.systems.examples.ben-nanonote linuxCommon;
149 ghcjs = mapTestOnCross lib.systems.examples.ghcjs {
150 haskell.packages.ghcjs.hello = nativePlatforms;
153 /* Linux on Raspberrypi */
154 rpi = mapTestOnCross lib.systems.examples.raspberryPi rpiCommon;
155 rpi-musl = mapTestOnCross lib.systems.examples.muslpi rpiCommon;
157 /* Linux on the Remarkable */
158 remarkable1 = mapTestOnCross lib.systems.examples.remarkable1 linuxCommon;
159 remarkable2 = mapTestOnCross lib.systems.examples.remarkable2 linuxCommon;
161 /* Linux on armv7l-hf */
162 armv7l-hf = mapTestOnCross lib.systems.examples.armv7l-hf-multiplatform linuxCommon;
164 pogoplug4 = mapTestOnCross lib.systems.examples.pogoplug4 linuxCommon;
166 /* Linux on aarch64 */
167 aarch64 = mapTestOnCross lib.systems.examples.aarch64-multiplatform linuxCommon;
168 aarch64-musl = mapTestOnCross lib.systems.examples.aarch64-multiplatform-musl linuxCommon;
171 riscv64 = mapTestOnCross lib.systems.examples.riscv64 linuxCommon;
172 riscv32 = mapTestOnCross lib.systems.examples.riscv32 linuxCommon;
174 m68k = mapTestOnCross lib.systems.examples.m68k linuxCommon;
175 s390x = mapTestOnCross lib.systems.examples.s390x linuxCommon;
177 /* (Cross-compiled) Linux on x86 */
178 x86_64-musl = mapTestOnCross lib.systems.examples.musl64 linuxCommon;
179 x86_64-gnu = mapTestOnCross lib.systems.examples.gnu64 linuxCommon;
180 i686-musl = mapTestOnCross lib.systems.examples.musl32 linuxCommon;
181 i686-gnu = mapTestOnCross lib.systems.examples.gnu32 linuxCommon;
183 ppc64le = mapTestOnCross lib.systems.examples.powernv linuxCommon;
184 ppc64le-musl = mapTestOnCross lib.systems.examples.musl-power linuxCommon;
186 android64 = mapTestOnCross lib.systems.examples.aarch64-android-prebuilt linuxCommon;
187 android32 = mapTestOnCross lib.systems.examples.armv7a-android-prebuilt linuxCommon;
189 wasi32 = mapTestOnCross lib.systems.examples.wasi32 wasiCommon;
191 msp430 = mapTestOnCross lib.systems.examples.msp430 embedded;
192 mmix = mapTestOnCross lib.systems.examples.mmix embedded;
193 vc4 = mapTestOnCross lib.systems.examples.vc4 embedded;
194 or1k = mapTestOnCross lib.systems.examples.or1k embedded;
195 avr = mapTestOnCross lib.systems.examples.avr embedded;
196 arm-embedded = mapTestOnCross lib.systems.examples.arm-embedded embedded;
197 armhf-embedded = mapTestOnCross lib.systems.examples.armhf-embedded embedded;
198 aarch64-embedded = mapTestOnCross lib.systems.examples.aarch64-embedded embedded;
199 aarch64be-embedded = mapTestOnCross lib.systems.examples.aarch64be-embedded embedded;
200 powerpc-embedded = mapTestOnCross lib.systems.examples.ppc-embedded embedded;
201 powerpcle-embedded = mapTestOnCross lib.systems.examples.ppcle-embedded embedded;
202 i686-embedded = mapTestOnCross lib.systems.examples.i686-embedded embedded;
203 x86_64-embedded = mapTestOnCross lib.systems.examples.x86_64-embedded embedded;
204 riscv64-embedded = mapTestOnCross lib.systems.examples.riscv64-embedded embedded;
205 riscv32-embedded = mapTestOnCross lib.systems.examples.riscv32-embedded embedded;
206 rx-embedded = mapTestOnCross lib.systems.examples.rx-embedded embedded;
208 x86_64-netbsd = mapTestOnCross lib.systems.examples.x86_64-netbsd common;
210 # we test `embedded` instead of `linuxCommon` because very few packages
211 # successfully cross-compile to Redox so far
212 x86_64-redox = mapTestOnCross lib.systems.examples.x86_64-unknown-redox embedded;
214 /* Cross-built bootstrap tools for every supported platform */
216 tools = import ../stdenv/linux/make-bootstrap-tools-cross.nix { system = "x86_64-linux"; };
217 maintainers = [ lib.maintainers.dezgeg ];
218 mkBootstrapToolsJob = drv:
219 assert lib.elem drv.system supportedSystems;
220 hydraJob' (lib.addMetaAttrs { inherit maintainers; } drv);
221 in lib.mapAttrsRecursiveCond (as: !lib.isDerivation as) (name: mkBootstrapToolsJob) tools;