diff options
Diffstat (limited to 'nixpkgs/lib/systems')
-rw-r--r-- | nixpkgs/lib/systems/architectures.nix | 77 | ||||
-rw-r--r-- | nixpkgs/lib/systems/default.nix | 5 | ||||
-rw-r--r-- | nixpkgs/lib/systems/doubles.nix | 5 | ||||
-rw-r--r-- | nixpkgs/lib/systems/examples.nix | 17 | ||||
-rw-r--r-- | nixpkgs/lib/systems/inspect.nix | 3 | ||||
-rw-r--r-- | nixpkgs/lib/systems/parse.nix | 3 |
6 files changed, 104 insertions, 6 deletions
diff --git a/nixpkgs/lib/systems/architectures.nix b/nixpkgs/lib/systems/architectures.nix new file mode 100644 index 00000000000..bfecaec1ae8 --- /dev/null +++ b/nixpkgs/lib/systems/architectures.nix @@ -0,0 +1,77 @@ +{ lib }: + +rec { + # platform.gcc.arch to its features (as in /proc/cpuinfo) + features = { + default = [ ]; + # x86_64 Intel + westmere = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" ]; + sandybridge = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" ]; + ivybridge = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" ]; + haswell = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" "avx2" "fma" ]; + broadwell = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" "avx2" "fma" ]; + skylake = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" "avx2" "fma" ]; + skylake-avx512 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" "avx2" "avx512" "fma" ]; + # x86_64 AMD + btver1 = [ "sse3" "ssse3" "sse4_1" "sse4_2" ]; + btver2 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" ]; + bdver1 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "sse4a" "aes" "avx" "fma" "fma4" ]; + bdver2 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "sse4a" "aes" "avx" "fma" "fma4" ]; + bdver3 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "sse4a" "aes" "avx" "fma" "fma4" ]; + bdver4 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "sse4a" "aes" "avx" "avx2" "fma" "fma4" ]; + znver1 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "sse4a" "aes" "avx" "avx2" "fma" ]; + znver2 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "sse4a" "aes" "avx" "avx2" "fma" ]; + # other + armv5te = [ ]; + armv6 = [ ]; + armv7-a = [ ]; + armv8-a = [ ]; + mips32 = [ ]; + loongson2f = [ ]; + }; + + # a superior CPU has all the features of an inferior and is able to build and test code for it + inferiors = { + # x86_64 Intel + default = [ ]; + westmere = [ ]; + sandybridge = [ "westmere" ] ++ inferiors.westmere; + ivybridge = [ "sandybridge" ] ++ inferiors.sandybridge; + haswell = [ "ivybridge" ] ++ inferiors.ivybridge; + broadwell = [ "haswell" ] ++ inferiors.haswell; + skylake = [ "broadwell" ] ++ inferiors.broadwell; + skylake-avx512 = [ "skylake" ] ++ inferiors.skylake; + # x86_64 AMD + btver1 = [ ]; + btver2 = [ ]; # TODO: fill this (need testing) + bdver1 = [ ]; # TODO: fill this (need testing) + bdver2 = [ ]; # TODO: fill this (need testing) + bdver3 = [ ]; # TODO: fill this (need testing) + bdver4 = [ ]; # TODO: fill this (need testing) + znver1 = [ ]; # TODO: fill this (need testing) + znver2 = [ ]; # TODO: fill this (need testing) + # other + armv5te = [ ]; + armv6 = [ ]; + armv7-a = [ ]; + armv8-a = [ ]; + mips32 = [ ]; + loongson2f = [ ]; + }; + + predicates = let + featureSupport = feature: x: builtins.elem feature features.${x} or []; + in { + sse3Support = featureSupport "sse3"; + ssse3Support = featureSupport "ssse3"; + sse4_1Support = featureSupport "sse4_1"; + sse4_2Support = featureSupport "sse4_2"; + sse4_aSupport = featureSupport "sse4a"; + avxSupport = featureSupport "avx"; + avx2Support = featureSupport "avx2"; + avx512Support = featureSupport "avx512"; + aesSupport = featureSupport "aes"; + fmaSupport = featureSupport "fma"; + fma4Support = featureSupport "fma4"; + }; +} diff --git a/nixpkgs/lib/systems/default.nix b/nixpkgs/lib/systems/default.nix index 210674cc639..9939743157e 100644 --- a/nixpkgs/lib/systems/default.nix +++ b/nixpkgs/lib/systems/default.nix @@ -7,6 +7,7 @@ rec { inspect = import ./inspect.nix { inherit lib; }; platforms = import ./platforms.nix { inherit lib; }; examples = import ./examples.nix { inherit lib; }; + architectures = import ./architectures.nix { inherit lib; }; # Elaborate a `localSystem` or `crossSystem` so that it contains everything # necessary. @@ -32,6 +33,7 @@ rec { /**/ if final.isDarwin then "libSystem" else if final.isMinGW then "msvcrt" else if final.isWasi then "wasilibc" + else if final.isRedox then "relibc" else if final.isMusl then "musl" else if final.isUClibc then "uclibc" else if final.isAndroid then "bionic" @@ -65,6 +67,7 @@ rec { freebsd = "FreeBSD"; openbsd = "OpenBSD"; wasi = "Wasi"; + redox = "Redox"; genode = "Genode"; }.${final.parsed.kernel.name} or null; @@ -74,6 +77,7 @@ rec { # uname -r release = null; }; + isStatic = final.isWasm || final.isRedox; kernelArch = if final.isAarch32 then "arm" @@ -123,6 +127,7 @@ rec { else throw "Don't know how to run ${final.config} executables."; } // mapAttrs (n: v: v final.parsed) inspect.predicates + // mapAttrs (n: v: v final.platform.gcc.arch or "default") architectures.predicates // args; in assert final.useAndroidPrebuilt -> final.isAndroid; assert lib.foldl diff --git a/nixpkgs/lib/systems/doubles.nix b/nixpkgs/lib/systems/doubles.nix index a839b3d3d57..fb7d722e737 100644 --- a/nixpkgs/lib/systems/doubles.nix +++ b/nixpkgs/lib/systems/doubles.nix @@ -22,6 +22,8 @@ let "wasm64-wasi" "wasm32-wasi" + "x86_64-redox" + "powerpc64le-linux" "riscv32-linux" "riscv64-linux" @@ -36,7 +38,7 @@ let "js-ghcjs" - "aarch64-genode" "x86_64-genode" + "aarch64-genode" "i686-genode" "x86_64-genode" ]; allParsed = map parse.mkSystemFromString all; @@ -69,6 +71,7 @@ in { openbsd = filterDoubles predicates.isOpenBSD; unix = filterDoubles predicates.isUnix; wasi = filterDoubles predicates.isWasi; + redox = filterDoubles predicates.isRedox; windows = filterDoubles predicates.isWindows; genode = filterDoubles predicates.isGenode; diff --git a/nixpkgs/lib/systems/examples.nix b/nixpkgs/lib/systems/examples.nix index 19b3790ecbe..5403f73405c 100644 --- a/nixpkgs/lib/systems/examples.nix +++ b/nixpkgs/lib/systems/examples.nix @@ -46,16 +46,16 @@ rec { armv7a-android-prebuilt = { config = "armv7a-unknown-linux-androideabi"; - sdkVer = "24"; - ndkVer = "18b"; + sdkVer = "29"; + ndkVer = "21"; platform = platforms.armv7a-android; useAndroidPrebuilt = true; }; aarch64-android-prebuilt = { config = "aarch64-unknown-linux-android"; - sdkVer = "24"; - ndkVer = "18b"; + sdkVer = "29"; + ndkVer = "21"; platform = platforms.aarch64-multiplatform; useAndroidPrebuilt = true; }; @@ -164,6 +164,15 @@ rec { }; # + # Redox + # + + x86_64-unknown-redox = { + config = "x86_64-unknown-redox"; + libc = "relibc"; + }; + + # # Darwin # diff --git a/nixpkgs/lib/systems/inspect.nix b/nixpkgs/lib/systems/inspect.nix index 90a1fb6d80c..8fa63057250 100644 --- a/nixpkgs/lib/systems/inspect.nix +++ b/nixpkgs/lib/systems/inspect.nix @@ -33,7 +33,7 @@ rec { isBSD = { kernel = { families = { inherit (kernelFamilies) bsd; }; }; }; isDarwin = { kernel = { families = { inherit (kernelFamilies) darwin; }; }; }; - isUnix = [ isBSD isDarwin isLinux isSunOS isCygwin ]; + isUnix = [ isBSD isDarwin isLinux isSunOS isCygwin isRedox ]; isMacOS = { kernel = kernels.macos; }; isiOS = { kernel = kernels.ios; }; @@ -46,6 +46,7 @@ rec { isCygwin = { kernel = kernels.windows; abi = abis.cygnus; }; isMinGW = { kernel = kernels.windows; abi = abis.gnu; }; isWasi = { kernel = kernels.wasi; }; + isRedox = { kernel = kernels.redox; }; isGhcjs = { kernel = kernels.ghcjs; }; isGenode = { kernel = kernels.genode; }; isNone = { kernel = kernels.none; }; diff --git a/nixpkgs/lib/systems/parse.nix b/nixpkgs/lib/systems/parse.nix index 648e7c27024..6bd44a00746 100644 --- a/nixpkgs/lib/systems/parse.nix +++ b/nixpkgs/lib/systems/parse.nix @@ -277,6 +277,7 @@ rec { openbsd = { execFormat = elf; families = { inherit bsd; }; }; solaris = { execFormat = elf; families = { }; }; wasi = { execFormat = wasm; families = { }; }; + redox = { execFormat = elf; families = { }; }; windows = { execFormat = pe; families = { }; }; ghcjs = { execFormat = unknown; families = { }; }; genode = { execFormat = elf; families = { }; }; @@ -390,6 +391,8 @@ rec { then { cpu = elemAt l 0; vendor = elemAt l 1; kernel = "windows"; } else if (elemAt l 2 == "wasi") then { cpu = elemAt l 0; vendor = elemAt l 1; kernel = "wasi"; } + else if (elemAt l 2 == "redox") + then { cpu = elemAt l 0; vendor = elemAt l 1; kernel = "redox"; } else if hasPrefix "netbsd" (elemAt l 2) then { cpu = elemAt l 0; vendor = elemAt l 1; kernel = elemAt l 2; } else if (elem (elemAt l 2) ["eabi" "eabihf" "elf"]) |