depot/third_party/nixpkgs/pkgs/development/compilers/flutter/engine/constants.nix
Default email bcb2f287e1 Project import generated by Copybara.
GitOrigin-RevId: d603719ec6e294f034936c0d0dc06f689d91b6c3
2024-06-20 20:27:18 +05:30

41 lines
1.2 KiB
Nix

{ 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}";
}