@@ -1,5 +1,7 @@
1−with import ./release-lib.nix { supportedSystems = []; };
1+with import ./release-lib.nix { supportedSystems = [ builtins.currentSystem ]; };
22let
3+ lib = import ../../lib;
4+
35 nativePlatforms = linux;
46
57 /* Basic list of packages to cross-build */
@@ -20,39 +22,68 @@ let
2022 basic = basicCrossDrv // basicNativeDrv;
2123
2224in
23−(
2425
25−/* Test some cross builds to the Sheevaplug */
26−let
27− crossSystem = {
28− config = "armv5tel-unknown-linux-gnueabi";
29− bigEndian = false;
30− arch = "arm";
31− float = "soft";
32− withTLS = true;
33− platform = pkgs.platforms.sheevaplug;
34− libc = "glibc";
35− openssl.system = "linux-generic32";
26+{
27+ # These `nativeDrv`s should be identical to their vanilla ones --- cross
28+ # compiling should not affect the native derivation.
29+ ensureUnaffected = let
30+ # Absurd values are fine here, as we are not building anything. In fact,
31+ # there probably a good idea to try to be "more parametric" --- i.e. avoid
32+ # any special casing.
33+ crossSystem = {
34+ config = "foosys";
35+ libc = "foolibc";
36+ };
37+
38+ # Converting to a string (drv path) before checking equality is probably a
39+ # good idea lest there be some irrelevant pass-through debug attrs that
40+ # cause false negatives.
41+ testEqualOne = path: system: let
42+ f = attrs: builtins.toString (lib.getAttrFromPath path (allPackages attrs));
43+ in assert f { inherit system; } == f { inherit system crossSystem; }; true;
44+
45+ testEqual = path: systems: forAllSupportedSystems systems (testEqualOne path);
46+
47+ mapTestEqual = lib.mapAttrsRecursive testEqual;
48+
49+ in mapTestEqual {
50+ boehmgc = nativePlatforms;
51+ libffi = nativePlatforms;
52+ libiconv = nativePlatforms;
53+ libtool = nativePlatforms;
54+ zlib = nativePlatforms;
55+ readline = nativePlatforms;
56+ libxml2 = nativePlatforms;
57+ guile = nativePlatforms;
3658 };
3759
38−in {
39− crossSheevaplugLinux = mapTestOnCross crossSystem (
40− basic //
41− {
42− ubootSheevaplug.crossDrv = nativePlatforms;
43− });
44−}) // (
4560
46−/* Test some cross builds on 32 bit mingw-w64 */
47−let
48− crossSystem = {
61+ /* Test some cross builds to the Sheevaplug */
62+ crossSheevaplugLinux = let
63+ crossSystem = {
64+ config = "armv5tel-unknown-linux-gnueabi";
65+ bigEndian = false;
66+ arch = "arm";
67+ float = "soft";
68+ withTLS = true;
69+ platform = pkgs.platforms.sheevaplug;
70+ libc = "glibc";
71+ openssl.system = "linux-generic32";
72+ };
73+ in mapTestOnCross crossSystem (basic // {
74+ ubootSheevaplug.crossDrv = nativePlatforms;
75+ });
76+
77+
78+ /* Test some cross builds on 32 bit mingw-w64 */
79+ crossMingw32 = let
80+ crossSystem = {
4981 config = "i686-w64-mingw32";
5082 arch = "x86"; # Irrelevant
5183 libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
5284 platform = {};
53− };
54−in {
55− crossMingw32 = mapTestOnCross crossSystem {
85+ };
86+ in mapTestOnCross crossSystem {
5687 coreutils.crossDrv = nativePlatforms;
5788 boehmgc.crossDrv = nativePlatforms;
5889 gmp.crossDrv = nativePlatforms;
@@ -62,19 +93,18 @@ in {
6293 libunistring.crossDrv = nativePlatforms;
6394 windows.wxMSW.crossDrv = nativePlatforms;
6495 };
65−}) // (
6696
67−/* Test some cross builds on 64 bit mingw-w64 */
68−let
69− crossSystem = {
97+
98+ /* Test some cross builds on 64 bit mingw-w64 */
99+ crossMingwW64 = let
100+ crossSystem = {
70101 # That's the triplet they use in the mingw-w64 docs.
71102 config = "x86_64-w64-mingw32";
72103 arch = "x86_64"; # Irrelevant
73104 libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
74105 platform = {};
75− };
76−in {
77− crossMingwW64 = mapTestOnCross crossSystem {
106+ };
107+ in mapTestOnCross crossSystem {
78108 coreutils.crossDrv = nativePlatforms;
79109 boehmgc.crossDrv = nativePlatforms;
80110 gmp.crossDrv = nativePlatforms;
@@ -84,63 +114,60 @@ in {
84114 libunistring.crossDrv = nativePlatforms;
85115 windows.wxMSW.crossDrv = nativePlatforms;
86116 };
87−}) // (
88117
89−/* Linux on the fuloong */
90−let
91− crossSystem = {
92− config = "mips64el-unknown-linux";
93− bigEndian = false;
94− arch = "mips";
95− float = "hard";
96− withTLS = true;
97− libc = "glibc";
98− platform = {
99− name = "fuloong-minipc";
100− kernelMajor = "2.6";
101− kernelBaseConfig = "lemote2f_defconfig";
102− kernelHeadersBaseConfig = "fuloong2e_defconfig";
103− uboot = null;
104− kernelArch = "mips";
105− kernelAutoModules = false;
106− kernelTarget = "vmlinux";
107− };
108− openssl.system = "linux-generic32";
109− gcc = {
110− arch = "loongson2f";
111− abi = "n32";
112− };
113− };
114−in {
115− fuloongminipc = mapTestOnCross crossSystem {
116118
119+ /* Linux on the fuloong */
120+ fuloongminipc = let
121+ crossSystem = {
122+ config = "mips64el-unknown-linux";
123+ bigEndian = false;
124+ arch = "mips";
125+ float = "hard";
126+ withTLS = true;
127+ libc = "glibc";
128+ platform = {
129+ name = "fuloong-minipc";
130+ kernelMajor = "2.6";
131+ kernelBaseConfig = "lemote2f_defconfig";
132+ kernelHeadersBaseConfig = "fuloong2e_defconfig";
133+ uboot = null;
134+ kernelArch = "mips";
135+ kernelAutoModules = false;
136+ kernelTarget = "vmlinux";
137+ };
138+ openssl.system = "linux-generic32";
139+ gcc = {
140+ arch = "loongson2f";
141+ abi = "n32";
142+ };
143+ };
144+ in mapTestOnCross crossSystem {
117145 coreutils.crossDrv = nativePlatforms;
118146 ed.crossDrv = nativePlatforms;
119147 patch.crossDrv = nativePlatforms;
120148 };
121−}) // (
122149
123−/* Linux on Raspberrypi */
124−let
125− crossSystem = {
126− config = "armv6l-unknown-linux-gnueabi";
127− bigEndian = false;
128− arch = "arm";
129− float = "hard";
130− fpu = "vfp";
131− withTLS = true;
132− libc = "glibc";
133− platform = pkgs.platforms.raspberrypi;
134− openssl.system = "linux-generic32";
135− gcc = {
136− arch = "armv6";
150+
151+ /* Linux on Raspberrypi */
152+ rpi = let
153+ crossSystem = {
154+ config = "armv6l-unknown-linux-gnueabi";
155+ bigEndian = false;
156+ arch = "arm";
157+ float = "hard";
137158 fpu = "vfp";
138− float = "softfp";
139− abi = "aapcs-linux";
159+ withTLS = true;
160+ libc = "glibc";
161+ platform = pkgs.platforms.raspberrypi;
162+ openssl.system = "linux-generic32";
163+ gcc = {
164+ arch = "armv6";
165+ fpu = "vfp";
166+ float = "softfp";
167+ abi = "aapcs-linux";
168+ };
140169 };
141− };
142−in {
143− rpi = mapTestOnCross crossSystem {
170+ in mapTestOnCross crossSystem {
144171 coreutils.crossDrv = nativePlatforms;
145172 ed.crossDrv = nativePlatforms;
146173 patch.crossDrv = nativePlatforms;
@@ -152,13 +179,12 @@ in {
152179 binutils.crossDrv = nativePlatforms;
153180 mpg123.crossDrv = nativePlatforms;
154181 };
155−}) // (
156182
157−/* Cross-built bootstrap tools for every supported platform */
158−let
159− tools = import ../stdenv/linux/make-bootstrap-tools-cross.nix { system = "x86_64-linux"; };
160− maintainers = [ pkgs.lib.maintainers.dezgeg ];
161− mkBootstrapToolsJob = bt: hydraJob' (pkgs.lib.addMetaAttrs { inherit maintainers; } bt.dist);
162−in {
163− bootstrapTools = pkgs.lib.mapAttrs (name: mkBootstrapToolsJob) tools;
164−})
183+
184+ /* Cross-built bootstrap tools for every supported platform */
185+ bootstrapTools = let
186+ tools = import ../stdenv/linux/make-bootstrap-tools-cross.nix { system = "x86_64-linux"; };
187+ maintainers = [ pkgs.lib.maintainers.dezgeg ];
188+ mkBootstrapToolsJob = bt: hydraJob' (pkgs.lib.addMetaAttrs { inherit maintainers; } bt.dist);
189+ in pkgs.lib.mapAttrs (name: mkBootstrapToolsJob) tools;
190+}