From 446f8c851d599326373a2c910841d092ff8e68ae Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Fri, 23 Aug 2019 18:53:22 +0200 Subject: Add support for `js-unknown-ghcjs` This adds enough logic to nixpkgs to support the `js-unknown-ghcjs` triple. --- lib/systems/examples.nix | 12 +++++++++--- lib/systems/inspect.nix | 2 ++ lib/systems/parse.nix | 7 ++++++- 3 files changed, 17 insertions(+), 4 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index ac1633a1a15f..90068f566ed0 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -119,7 +119,7 @@ rec { config = "aarch64-none-elf"; libc = "newlib"; }; - + aarch64be-embedded = { config = "aarch64_be-none-elf"; libc = "newlib"; @@ -129,12 +129,12 @@ rec { config = "powerpc-none-eabi"; libc = "newlib"; }; - + ppcle-embedded = { config = "powerpcle-none-eabi"; libc = "newlib"; }; - + alpha-embedded = { config = "alpha-elf"; libc = "newlib"; @@ -212,4 +212,10 @@ rec { libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain platform = {}; }; + + # Ghcjs + ghcjs = { + config = "js-unknown-ghcjs"; + platform = {}; + }; } diff --git a/lib/systems/inspect.nix b/lib/systems/inspect.nix index e35e7b4a1ec7..bf186126d4a9 100644 --- a/lib/systems/inspect.nix +++ b/lib/systems/inspect.nix @@ -49,6 +49,8 @@ rec { isEfi = map (family: { cpu.family = family; }) [ "x86" "arm" "aarch64" ]; + isJavaScript = { cpu = cpuTypes.js; }; + isGhcjs = { kernel = kernels.ghcjs; }; # Deprecated after 18.03 isArm = isAarch32; }; diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix index 6947d41419e3..a20b334311ef 100644 --- a/lib/systems/parse.nix +++ b/lib/systems/parse.nix @@ -106,10 +106,12 @@ rec { wasm32 = { bits = 32; significantByte = littleEndian; family = "wasm"; }; wasm64 = { bits = 64; significantByte = littleEndian; family = "wasm"; }; - + alpha = { bits = 64; significantByte = littleEndian; family = "alpha"; }; avr = { bits = 8; family = "avr"; }; + + js = { bits = 32; significantByte = littleEndian; family = "js"; }; }; ################################################################################ @@ -188,6 +190,7 @@ rec { openbsd = { execFormat = elf; families = { inherit bsd; }; }; solaris = { execFormat = elf; families = { }; }; windows = { execFormat = pe; families = { }; }; + ghcjs = { execFormat = unknown; families = { }; }; } // { # aliases # 'darwin' is the kernel for all of them. We choose macOS by default. darwin = kernels.macos; @@ -299,6 +302,8 @@ rec { then { cpu = elemAt l 0; vendor = elemAt l 1; kernel = elemAt l 2; } else if (elem (elemAt l 2) ["eabi" "eabihf" "elf"]) then { cpu = elemAt l 0; vendor = "unknown"; kernel = elemAt l 1; abi = elemAt l 2; } + else if (elemAt l 2 == "ghcjs") + then { cpu = elemAt l 0; vendor = "unknown"; kernel = elemAt l 2; } else throw "Target specification with 3 components is ambiguous"; "4" = { cpu = elemAt l 0; vendor = elemAt l 1; kernel = elemAt l 2; abi = elemAt l 3; }; }.${toString (length l)} -- cgit v1.2.3 From 3d8cf087068c4d2f011d06d11453e3dd966da321 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 2 Sep 2019 01:38:22 -0400 Subject: lib: Sort platform predicates --- lib/systems/inspect.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/inspect.nix b/lib/systems/inspect.nix index bf186126d4a9..b099ca0ad715 100644 --- a/lib/systems/inspect.nix +++ b/lib/systems/inspect.nix @@ -21,6 +21,7 @@ rec { isSparc = { cpu = { family = "sparc"; }; }; isWasm = { cpu = { family = "wasm"; }; }; isAvr = { cpu = { family = "avr"; }; }; + isJavaScript = { cpu = cpuTypes.js; }; is32bit = { cpu = { bits = 32; }; }; is64bit = { cpu = { bits = 64; }; }; @@ -41,6 +42,7 @@ rec { isWindows = { kernel = kernels.windows; }; isCygwin = { kernel = kernels.windows; abi = abis.cygnus; }; isMinGW = { kernel = kernels.windows; abi = abis.gnu; }; + isGhcjs = { kernel = kernels.ghcjs; }; isAndroid = [ { abi = abis.android; } { abi = abis.androideabi; } ]; isMusl = with abis; map (a: { abi = a; }) [ musl musleabi musleabihf ]; @@ -49,8 +51,6 @@ rec { isEfi = map (family: { cpu.family = family; }) [ "x86" "arm" "aarch64" ]; - isJavaScript = { cpu = cpuTypes.js; }; - isGhcjs = { kernel = kernels.ghcjs; }; # Deprecated after 18.03 isArm = isAarch32; }; -- cgit v1.2.3 From a77a2cfe4a61c8fda4108fb3670605f04246f857 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 2 Sep 2019 01:55:38 -0400 Subject: lib: Further clean up systems list --- lib/systems/inspect.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/inspect.nix b/lib/systems/inspect.nix index b099ca0ad715..129c7a94d3db 100644 --- a/lib/systems/inspect.nix +++ b/lib/systems/inspect.nix @@ -12,7 +12,7 @@ rec { isx86_32 = { cpu = { family = "x86"; bits = 32; }; }; isx86_64 = { cpu = { family = "x86"; bits = 64; }; }; isPowerPC = { cpu = cpuTypes.powerpc; }; - isPower = { cpu = { family = "power"; }; }; + isPower = { cpu = { family = "power"; }; }; isx86 = { cpu = { family = "x86"; }; }; isAarch32 = { cpu = { family = "arm"; bits = 32; }; }; isAarch64 = { cpu = { family = "arm"; bits = 64; }; }; @@ -21,7 +21,7 @@ rec { isSparc = { cpu = { family = "sparc"; }; }; isWasm = { cpu = { family = "wasm"; }; }; isAvr = { cpu = { family = "avr"; }; }; - isJavaScript = { cpu = cpuTypes.js; }; + isJavaScript = { cpu = cpuTypes.js; }; is32bit = { cpu = { bits = 32; }; }; is64bit = { cpu = { bits = 64; }; }; @@ -42,7 +42,7 @@ rec { isWindows = { kernel = kernels.windows; }; isCygwin = { kernel = kernels.windows; abi = abis.cygnus; }; isMinGW = { kernel = kernels.windows; abi = abis.gnu; }; - isGhcjs = { kernel = kernels.ghcjs; }; + isGhcjs = { kernel = kernels.ghcjs; }; isAndroid = [ { abi = abis.android; } { abi = abis.androideabi; } ]; isMusl = with abis; map (a: { abi = a; }) [ musl musleabi musleabihf ]; -- cgit v1.2.3