about summary refs log tree commit diff
path: root/pkgs/development/compilers/flutter/engine/constants.nix
blob: 9b7907fc337f79a84cad3d4678c3d398713d32d0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{ lib, targetPlatform }:
rec {
  os =
    if targetPlatform.isLinux then
      "linux"
    else if targetPlatform.isDarwin then
      "macos"
    else if targetPlatform.isWindows then
      "windows"
    else
      throw "Unsupported OS \"${targetPlatform.parsed.kernel.name}\"";

  arch =
    if targetPlatform.isx86_64 then
      "amd64"
    else if targetPlatform.isx86 && targetPlatform.is32bit then
      "386"
    else if targetPlatform.isAarch64 then
      "arm64"
    else if targetPlatform.isMips && targetPlatform.parsed.cpu.significantByte == "littleEndian" then
      "mipsle"
    else if targetPlatform.isMips64 then
      "mips64${lib.optionalString (targetPlatform.parsed.cpu.significantByte == "littleEndian") "le"}"
    else if targetPlatform.isPower64 then
      "ppc64${lib.optionalString (targetPlatform.parsed.cpu.significantByte == "littleEndian") "le"}"
    else if targetPlatform.isS390x then
      "s390x"
    else
      throw "Unsupported CPU \"${targetPlatform.parsed.cpu.name}\"";

  alt-arch =
    if targetPlatform.isx86_64 then
      "x64"
    else if targetPlatform.isAarch64 then
      "arm64"
    else
      targetPlatform.parsed.cpu.name;

  platform = "${os}-${arch}";
  alt-platform = "${os}-${alt-arch}";
}