Add support for js-unknown-ghcjs

This adds enough logic to nixpkgs to support the `js-unknown-ghcjs` triple.
This commit is contained in:
Moritz Angermann 2019-08-23 18:53:22 +02:00 committed by John Ericson
parent 280795c163
commit 446f8c851d
5 changed files with 20 additions and 4 deletions

View File

@ -119,7 +119,7 @@ rec {
config = "aarch64-none-elf"; config = "aarch64-none-elf";
libc = "newlib"; libc = "newlib";
}; };
aarch64be-embedded = { aarch64be-embedded = {
config = "aarch64_be-none-elf"; config = "aarch64_be-none-elf";
libc = "newlib"; libc = "newlib";
@ -129,12 +129,12 @@ rec {
config = "powerpc-none-eabi"; config = "powerpc-none-eabi";
libc = "newlib"; libc = "newlib";
}; };
ppcle-embedded = { ppcle-embedded = {
config = "powerpcle-none-eabi"; config = "powerpcle-none-eabi";
libc = "newlib"; libc = "newlib";
}; };
alpha-embedded = { alpha-embedded = {
config = "alpha-elf"; config = "alpha-elf";
libc = "newlib"; libc = "newlib";
@ -212,4 +212,10 @@ rec {
libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
platform = {}; platform = {};
}; };
# Ghcjs
ghcjs = {
config = "js-unknown-ghcjs";
platform = {};
};
} }

View File

@ -49,6 +49,8 @@ rec {
isEfi = map (family: { cpu.family = family; }) isEfi = map (family: { cpu.family = family; })
[ "x86" "arm" "aarch64" ]; [ "x86" "arm" "aarch64" ];
isJavaScript = { cpu = cpuTypes.js; };
isGhcjs = { kernel = kernels.ghcjs; };
# Deprecated after 18.03 # Deprecated after 18.03
isArm = isAarch32; isArm = isAarch32;
}; };

View File

@ -106,10 +106,12 @@ rec {
wasm32 = { bits = 32; significantByte = littleEndian; family = "wasm"; }; wasm32 = { bits = 32; significantByte = littleEndian; family = "wasm"; };
wasm64 = { bits = 64; significantByte = littleEndian; family = "wasm"; }; wasm64 = { bits = 64; significantByte = littleEndian; family = "wasm"; };
alpha = { bits = 64; significantByte = littleEndian; family = "alpha"; }; alpha = { bits = 64; significantByte = littleEndian; family = "alpha"; };
avr = { bits = 8; family = "avr"; }; avr = { bits = 8; family = "avr"; };
js = { bits = 32; significantByte = littleEndian; family = "js"; };
}; };
################################################################################ ################################################################################
@ -188,6 +190,7 @@ rec {
openbsd = { execFormat = elf; families = { inherit bsd; }; }; openbsd = { execFormat = elf; families = { inherit bsd; }; };
solaris = { execFormat = elf; families = { }; }; solaris = { execFormat = elf; families = { }; };
windows = { execFormat = pe; families = { }; }; windows = { execFormat = pe; families = { }; };
ghcjs = { execFormat = unknown; families = { }; };
} // { # aliases } // { # aliases
# 'darwin' is the kernel for all of them. We choose macOS by default. # 'darwin' is the kernel for all of them. We choose macOS by default.
darwin = kernels.macos; darwin = kernels.macos;
@ -299,6 +302,8 @@ rec {
then { cpu = elemAt l 0; vendor = elemAt l 1; kernel = 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"]) else if (elem (elemAt l 2) ["eabi" "eabihf" "elf"])
then { cpu = elemAt l 0; vendor = "unknown"; kernel = elemAt l 1; abi = elemAt l 2; } 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"; 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; }; "4" = { cpu = elemAt l 0; vendor = elemAt l 1; kernel = elemAt l 2; abi = elemAt l 3; };
}.${toString (length l)} }.${toString (length l)}

View File

@ -54,6 +54,8 @@ in lib.init bootStages ++ [
then buildPackages.darwin.iosSdkPkgs.clang then buildPackages.darwin.iosSdkPkgs.clang
else if crossSystem.useAndroidPrebuilt or false else if crossSystem.useAndroidPrebuilt or false
then buildPackages."androidndkPkgs_${crossSystem.ndkVer}".gcc then buildPackages."androidndkPkgs_${crossSystem.ndkVer}".gcc
else if targetPlatform.isGhcjs
then null
else buildPackages.gcc; else buildPackages.gcc;
extraNativeBuildInputs = old.extraNativeBuildInputs extraNativeBuildInputs = old.extraNativeBuildInputs

View File

@ -9984,6 +9984,7 @@ in
else if name == "msvcrt" then targetPackages.windows.mingw_w64 or windows.mingw_w64 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 stdenv.targetPlatform.useiOSPrebuilt then targetPackages.darwin.iosSdkPkgs.libraries or darwin.iosSdkPkgs.libraries
else if name == "libSystem" then targetPackages.darwin.xcode else if name == "libSystem" then targetPackages.darwin.xcode
else if stdenv.targetPlatform.isGhcjs then null
else throw "Unknown libc"; else throw "Unknown libc";
libcCross = assert stdenv.targetPlatform != stdenv.buildPlatform; libcCrossChooser stdenv.targetPlatform.libc; libcCross = assert stdenv.targetPlatform != stdenv.buildPlatform; libcCrossChooser stdenv.targetPlatform.libc;