Skip to content

Commit b70924b

Browse files
committedMay 6, 2017
Revert "Merge pull request #25275 from Ericson2314/platform-normalize"
This reverts commit 2282a57, reversing changes made to 14adea9. The lib tests are bloking nixpkgs-unstable, and I don't like debugging it soon enough.
1 parent 37a48c9 commit b70924b

File tree

4 files changed

+53
-53
lines changed

4 files changed

+53
-53
lines changed
 

‎lib/systems/doubles.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ in rec {
3030
mips = filterDoubles (matchAttrs { cpu = { family = "mips"; }; });
3131
x86_64 = filterDoubles parse.isx86_64;
3232

33-
cygwin = filterDoubles parse.isCygwin;
33+
cygwin = filterDoubles (matchAttrs { kernel = parse.kernels.cygwin; });
3434
darwin = filterDoubles parse.isDarwin;
3535
freebsd = filterDoubles (matchAttrs { kernel = parse.kernels.freebsd; });
3636
gnu = filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnu; }); # Should be better

‎lib/systems/parse.nix

+26-32
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
# Define the list of system with their properties.
2-
#
3-
# See https://clang.llvm.org/docs/CrossCompilation.html and
4-
# http://llvm.org/docs/doxygen/html/Triple_8cpp_source.html especially
5-
# Triple::normalize. Parsing should essentially act as a more conservative
6-
# version of that last function.
1+
# Define the list of system with their properties. Only systems tested for
2+
# Nixpkgs are listed below
73

84
with import ../lists.nix;
95
with import ../types.nix;
@@ -13,7 +9,7 @@ let
139
lib = import ../default.nix;
1410
setTypesAssert = type: pred:
1511
mapAttrs (name: value:
16-
assert pred value;
12+
#assert pred value;
1713
setType type ({ inherit name; } // value));
1814
setTypes = type: setTypesAssert type (_: true);
1915

@@ -27,6 +23,7 @@ rec {
2723
littleEndian = {};
2824
};
2925

26+
3027
isCpuType = isType "cpu-type";
3128
cpuTypes = with significantBytes; setTypesAssert "cpu-type"
3229
(x: elem x.bits [8 16 32 64 128]
@@ -50,7 +47,6 @@ rec {
5047
vendors = setTypes "vendor" {
5148
apple = {};
5249
pc = {};
53-
5450
unknown = {};
5551
};
5652

@@ -60,42 +56,41 @@ rec {
6056
elf = {};
6157
macho = {};
6258
pe = {};
63-
6459
unknown = {};
6560
};
6661

6762
isKernelFamily = isType "kernel-family";
6863
kernelFamilies = setTypes "kernel-family" {
6964
bsd = {};
7065
unix = {};
66+
windows-nt = {};
67+
dos = {};
7168
};
7269

7370
isKernel = x: isType "kernel" x;
7471
kernels = with execFormats; with kernelFamilies; setTypesAssert "kernel"
7572
(x: isExecFormat x.execFormat && all isKernelFamily (attrValues x.families))
7673
{
74+
cygwin = { execFormat = pe; families = { inherit /*unix*/ windows-nt; }; };
7775
darwin = { execFormat = macho; families = { inherit unix; }; };
7876
freebsd = { execFormat = elf; families = { inherit unix bsd; }; };
7977
linux = { execFormat = elf; families = { inherit unix; }; };
8078
netbsd = { execFormat = elf; families = { inherit unix bsd; }; };
8179
none = { execFormat = unknown; families = { inherit unix; }; };
8280
openbsd = { execFormat = elf; families = { inherit unix bsd; }; };
8381
solaris = { execFormat = elf; families = { inherit unix; }; };
84-
windows = { execFormat = pe; families = { }; };
85-
} // { # aliases
86-
win32 = kernels.windows;
82+
win32 = { execFormat = pe; families = { inherit dos; }; };
8783
};
8884

85+
8986
isAbi = isType "abi";
9087
abis = setTypes "abi" {
91-
cygnus = {};
9288
gnu = {};
9389
msvc = {};
9490
eabi = {};
9591
androideabi = {};
9692
gnueabi = {};
9793
gnueabihf = {};
98-
9994
unknown = {};
10095
};
10196

@@ -114,25 +109,19 @@ rec {
114109
isDarwin = matchAttrs { kernel = kernels.darwin; };
115110
isLinux = matchAttrs { kernel = kernels.linux; };
116111
isUnix = matchAttrs { kernel = { families = { inherit (kernelFamilies) unix; }; }; };
117-
isWindows = matchAttrs { kernel = kernels.windows; };
118-
isCygwin = matchAttrs { kernel = kernels.windows; abi = abis.cygnus; };
119-
isMinGW = matchAttrs { kernel = kernels.windows; abi = abis.gnu; };
112+
isWindows = s: matchAttrs { kernel = { families = { inherit (kernelFamilies) windows-nt; }; }; } s
113+
|| matchAttrs { kernel = { families = { inherit (kernelFamilies) dos; }; }; } s;
120114

121115

122116
mkSkeletonFromList = l: {
123-
"2" = # We only do 2-part hacks for things Nix already supports
124-
if elemAt l 1 == "cygwin"
125-
then { cpu = elemAt l 0; kernel = "windows"; abi = "cygnus"; }
126-
else { cpu = elemAt l 0; kernel = elemAt l 1; };
117+
"2" = { cpu = elemAt l 0; kernel = elemAt l 1; };
118+
"4" = { cpu = elemAt l 0; vendor = elemAt l 1; kernel = elemAt l 2; abi = elemAt l 3; };
127119
"3" = # Awkwards hacks, beware!
128120
if elemAt l 1 == "apple"
129121
then { cpu = elemAt l 0; vendor = "apple"; kernel = elemAt l 2; }
130122
else if (elemAt l 1 == "linux") || (elemAt l 2 == "gnu")
131123
then { cpu = elemAt l 0; kernel = elemAt l 1; abi = elemAt l 2; }
132-
else if (elemAt l 2 == "mingw32") # autotools breaks on -gnu for window
133-
then { cpu = elemAt l 0; vendor = elemAt l 1; kernel = "windows"; abi = "gnu"; }
134124
else throw "Target specification with 3 components is ambiguous";
135-
"4" = { cpu = elemAt l 0; vendor = elemAt l 1; kernel = elemAt l 2; abi = elemAt l 3; };
136125
}.${toString (length l)}
137126
or (throw "system string has invalid number of hyphen-separated components");
138127

@@ -145,10 +134,18 @@ rec {
145134
, # Also inferred below
146135
abi ? assert false; null
147136
} @ args: let
148-
getCpu = name: cpuTypes.${name} or (throw "Unknown CPU type: ${name}");
149-
getVendor = name: vendors.${name} or (throw "Unknown vendor: ${name}");
150-
getKernel = name: kernels.${name} or (throw "Unknown kernel: ${name}");
151-
getAbi = name: abis.${name} or (throw "Unknown ABI: ${name}");
137+
getCpu = name:
138+
attrByPath [name] (throw "Unknown CPU type: ${name}")
139+
cpuTypes;
140+
getVendor = name:
141+
attrByPath [name] (throw "Unknown vendor: ${name}")
142+
vendors;
143+
getKernel = name:
144+
attrByPath [name] (throw "Unknown kernel: ${name}")
145+
kernels;
146+
getAbi = name:
147+
attrByPath [name] (throw "Unknown ABI: ${name}")
148+
abis;
152149

153150
system = rec {
154151
cpu = getCpu args.cpu;
@@ -169,10 +166,7 @@ rec {
169166

170167
mkSystemFromString = s: mkSystemFromSkeleton (mkSkeletonFromList (lib.splitString "-" s));
171168

172-
doubleFromSystem = { cpu, vendor, kernel, abi, ... }:
173-
if vendor == kernels.windows && abi == abis.cygnus
174-
then "${cpu.name}-cygwin"
175-
else "${cpu.name}-${kernel.name}";
169+
doubleFromSystem = { cpu, vendor, kernel, abi, ... }: "${cpu.name}-${kernel.name}";
176170

177171
tripleFromSystem = { cpu, vendor, kernel, abi, ... } @ sys: assert isSystem sys; let
178172
optAbi = lib.optionalString (abi != abis.unknown) "-${abi.name}";

‎pkgs/top-level/all-packages.nix

+3
Original file line numberDiff line numberDiff line change
@@ -5048,6 +5048,9 @@ with pkgs;
50485048
cross = targetPlatform;
50495049
crossStageStatic = false;
50505050

5051+
# XXX: We have troubles cross-compiling libstdc++ on MinGW (see
5052+
# <http://hydra.nixos.org/build/4268232>), so don't even try.
5053+
langCC = targetPlatform.config != "i686-pc-mingw32";
50515054
# Why is this needed?
50525055
inherit (forcedNativePackages) binutils;
50535056
};

‎pkgs/top-level/release-cross.nix

+23-20
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,12 @@ let
2020
/* Basic list of packages to be natively built,
2121
but need a crossSystem defined to get meaning */
2222
basicNativeDrv = {
23-
buildPackages.binutils = nativePlatforms;
2423
buildPackages.gccCrossStageFinal = nativePlatforms;
2524
buildPackages.gdbCross = nativePlatforms;
2625
};
2726

2827
basic = basicCrossDrv // basicNativeDrv;
2928

30-
windows = {
31-
buildPackages.binutils = nativePlatforms;
32-
buildPackages.gccCrossStageFinal = nativePlatforms;
33-
34-
coreutils = nativePlatforms;
35-
boehmgc = nativePlatforms;
36-
gmp = nativePlatforms;
37-
guile_1_8 = nativePlatforms;
38-
libffi = nativePlatforms;
39-
libtool = nativePlatforms;
40-
libunistring = nativePlatforms;
41-
windows.wxMSW = nativePlatforms;
42-
};
43-
4429
in
4530

4631
{
@@ -104,30 +89,48 @@ in
10489
/* Test some cross builds on 32 bit mingw-w64 */
10590
crossMingw32 = let
10691
crossSystem = {
107-
config = "i686-pc-mingw32";
92+
config = "i686-w64-mingw32";
10893
arch = "x86"; # Irrelevant
10994
libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
11095
platform = {};
11196
};
112-
in mapTestOnCross crossSystem windows;
97+
in mapTestOnCross crossSystem {
98+
coreutils = nativePlatforms;
99+
boehmgc = nativePlatforms;
100+
gmp = nativePlatforms;
101+
guile_1_8 = nativePlatforms;
102+
libffi = nativePlatforms;
103+
libtool = nativePlatforms;
104+
libunistring = nativePlatforms;
105+
windows.wxMSW = nativePlatforms;
106+
};
113107

114108

115109
/* Test some cross builds on 64 bit mingw-w64 */
116110
crossMingwW64 = let
117111
crossSystem = {
118112
# That's the triplet they use in the mingw-w64 docs.
119-
config = "x86_64-pc-mingw32";
113+
config = "x86_64-w64-mingw32";
120114
arch = "x86_64"; # Irrelevant
121115
libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
122116
platform = {};
123117
};
124-
in mapTestOnCross crossSystem windows;
118+
in mapTestOnCross crossSystem {
119+
coreutils = nativePlatforms;
120+
boehmgc = nativePlatforms;
121+
gmp = nativePlatforms;
122+
guile_1_8 = nativePlatforms;
123+
libffi = nativePlatforms;
124+
libtool = nativePlatforms;
125+
libunistring = nativePlatforms;
126+
windows.wxMSW = nativePlatforms;
127+
};
125128

126129

127130
/* Linux on the fuloong */
128131
fuloongminipc = let
129132
crossSystem = {
130-
config = "mips64el-unknown-linux-gnu";
133+
config = "mips64el-unknown-linux";
131134
bigEndian = false;
132135
arch = "mips";
133136
float = "hard";

0 commit comments

Comments
 (0)
Please sign in to comment.