summary refs log tree commit diff
diff options
context:
space:
mode:
authorMoritz Angermann <moritz.angermann@gmail.com>2019-08-23 18:53:22 +0200
committerJohn Ericson <git@JohnEricson.me>2019-09-02 01:27:05 -0400
commit446f8c851d599326373a2c910841d092ff8e68ae (patch)
tree2fa26cf138d9f71c2b593274600f2a70016392f9
parent280795c163ba70d6d0c0c0fc2e87ce4c8801dbac (diff)
downloadnixpkgs-446f8c851d599326373a2c910841d092ff8e68ae.tar
nixpkgs-446f8c851d599326373a2c910841d092ff8e68ae.tar.gz
nixpkgs-446f8c851d599326373a2c910841d092ff8e68ae.tar.bz2
nixpkgs-446f8c851d599326373a2c910841d092ff8e68ae.tar.lz
nixpkgs-446f8c851d599326373a2c910841d092ff8e68ae.tar.xz
nixpkgs-446f8c851d599326373a2c910841d092ff8e68ae.tar.zst
nixpkgs-446f8c851d599326373a2c910841d092ff8e68ae.zip
Add support for `js-unknown-ghcjs`
This adds enough logic to nixpkgs to support the `js-unknown-ghcjs` triple.
-rw-r--r--lib/systems/examples.nix12
-rw-r--r--lib/systems/inspect.nix2
-rw-r--r--lib/systems/parse.nix7
-rw-r--r--pkgs/stdenv/cross/default.nix2
-rw-r--r--pkgs/top-level/all-packages.nix1
5 files changed, 20 insertions, 4 deletions
diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix
index ac1633a1a15..90068f566ed 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 e35e7b4a1ec..bf186126d4a 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 6947d41419e..a20b334311e 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)}
diff --git a/pkgs/stdenv/cross/default.nix b/pkgs/stdenv/cross/default.nix
index aafc0855dbe..1c211f890b0 100644
--- a/pkgs/stdenv/cross/default.nix
+++ b/pkgs/stdenv/cross/default.nix
@@ -54,6 +54,8 @@ in lib.init bootStages ++ [
              then buildPackages.darwin.iosSdkPkgs.clang
            else if crossSystem.useAndroidPrebuilt or false
              then buildPackages."androidndkPkgs_${crossSystem.ndkVer}".gcc
+           else if targetPlatform.isGhcjs
+             then null
            else buildPackages.gcc;
 
       extraNativeBuildInputs = old.extraNativeBuildInputs
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 422cb99479a..1f6cbe68daa 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -9984,6 +9984,7 @@ in
     else if name == "msvcrt" then targetPackages.windows.mingw_w64 or windows.mingw_w64
     else if stdenv.targetPlatform.useiOSPrebuilt then targetPackages.darwin.iosSdkPkgs.libraries or darwin.iosSdkPkgs.libraries
     else if name == "libSystem" then targetPackages.darwin.xcode
+    else if stdenv.targetPlatform.isGhcjs then null
     else throw "Unknown libc";
 
   libcCross = assert stdenv.targetPlatform != stdenv.buildPlatform; libcCrossChooser stdenv.targetPlatform.libc;