diff options
Diffstat (limited to 'lib/systems')
-rw-r--r-- | lib/systems/default.nix | 61 | ||||
-rw-r--r-- | lib/systems/doubles.nix | 3 | ||||
-rw-r--r-- | lib/systems/examples.nix | 29 | ||||
-rw-r--r-- | lib/systems/flake-systems.nix | 7 | ||||
-rw-r--r-- | lib/systems/parse.nix | 6 | ||||
-rw-r--r-- | lib/systems/platforms.nix | 9 |
6 files changed, 76 insertions, 39 deletions
diff --git a/lib/systems/default.nix b/lib/systems/default.nix index 7e9aadeef72e5..40125c429781d 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -81,20 +81,24 @@ let && final.parsed.kernel == platform.parsed.kernel; isCompatible = _: throw "2022-05-23: isCompatible has been removed in favor of canExecute, refer to the 22.11 changelog for details"; # Derived meta-data + useLLVM = final.isFreeBSD || final.isOpenBSD; + libc = - /**/ if final.isDarwin then "libSystem" - else if final.isMinGW then "msvcrt" - else if final.isWasi then "wasilibc" - else if final.isRedox then "relibc" - else if final.isMusl then "musl" - else if final.isUClibc then "uclibc" - else if final.isAndroid then "bionic" - else if final.isLinux /* default */ then "glibc" - else if final.isFreeBSD then "fblibc" - else if final.isNetBSD then "nblibc" - else if final.isAvr then "avrlibc" - else if final.isGhcjs then null - else if final.isNone then "newlib" + /**/ if final.isDarwin then "libSystem" + else if final.isMinGW then "msvcrt" + else if final.isWasi then "wasilibc" + else if final.isWasm && !final.isWasi then null + else if final.isRedox then "relibc" + else if final.isMusl then "musl" + else if final.isUClibc then "uclibc" + else if final.isAndroid then "bionic" + else if final.isLinux /* default */ then "glibc" + else if final.isFreeBSD then "fblibc" + else if final.isOpenBSD then "oblibc" + else if final.isNetBSD then "nblibc" + else if final.isAvr then "avrlibc" + else if final.isGhcjs then null + else if final.isNone then "newlib" # TODO(@Ericson2314) think more about other operating systems else "native/impure"; # Choose what linker we wish to use by default. Someday we might also @@ -175,7 +179,8 @@ let hasSharedLibraries = with final; (isAndroid || isGnu || isMusl # Linux (allows multiple libcs) || isDarwin || isSunOS || isOpenBSD || isFreeBSD || isNetBSD # BSDs - || isCygwin || isMinGW # Windows + || isCygwin || isMinGW || isWindows # Windows + || isWasm # WASM ) && !isStatic; # The difference between `isStatic` and `hasSharedLibraries` is mainly the @@ -184,7 +189,7 @@ let # don't support dynamic linking, but don't get the `staticMarker`. # `pkgsStatic` sets `isStatic=true`, so `pkgsStatic.hostPlatform` always # has the `staticMarker`. - isStatic = final.isWasm || final.isRedox; + isStatic = final.isWasi || final.isRedox; # Just a guess, based on `system` inherit @@ -252,6 +257,22 @@ let if final.isMacOS then "MACOSX_DEPLOYMENT_TARGET" else if final.isiOS then "IPHONEOS_DEPLOYMENT_TARGET" else null; + + # Remove before 25.05 + androidSdkVersion = + if (args ? sdkVer && !args ? androidSdkVersion) then + throw "For android `sdkVer` has been renamed to `androidSdkVersion`" + else if (args ? androidSdkVersion) then + args.androidSdkVersion + else + null; + androidNdkVersion = + if (args ? ndkVer && !args ? androidNdkVersion) then + throw "For android `ndkVer` has been renamed to `androidNdkVersion`" + else if (args ? androidSdkVersion) then + args.androidNdkVersion + else + null; } // ( let selectEmulator = pkgs: @@ -277,8 +298,11 @@ let }; wine = (pkgs.winePackagesFor "wine${toString final.parsed.cpu.bits}").minimal; in + # Note: we guarantee that the return value is either `null` or a path + # to an emulator program. That is, if an emulator requires additional + # arguments, a wrapper should be used. if pkgs.stdenv.hostPlatform.canExecute final - then "${pkgs.runtimeShell} -c '\"$@\"' --" + then "${pkgs.execline}/bin/exec" else if final.isWindows then "${wine}/bin/wine${optionalString (final.parsed.cpu.bits == 64) "64"}" else if final.isLinux && pkgs.stdenv.hostPlatform.isLinux && final.qemuArch != null @@ -318,6 +342,7 @@ let os = /**/ if rust ? platform then rust.platform.os or "none" else if final.isDarwin then "macos" + else if final.isWasm && !final.isWasi then "unknown" # Needed for {wasm32,wasm64}-unknown-unknown. else final.parsed.kernel.name; # https://doc.rust-lang.org/reference/conditional-compilation.html#target_family @@ -334,7 +359,8 @@ let if isList f then f else [ f ] ) else optional final.isUnix "unix" - ++ optional final.isWindows "windows"; + ++ optional final.isWindows "windows" + ++ optional final.isWasm "wasm"; # https://doc.rust-lang.org/reference/conditional-compilation.html#target_vendor vendor = let @@ -353,6 +379,7 @@ let "armv7l" = "armv7"; "armv6l" = "arm"; "armv5tel" = "armv5te"; + "riscv32" = "riscv32gc"; "riscv64" = "riscv64gc"; }.${cpu.name} or cpu.name; vendor_ = final.rust.platform.vendor; diff --git a/lib/systems/doubles.nix b/lib/systems/doubles.nix index b4cd5acfcc5b2..6939e9a40c2d7 100644 --- a/lib/systems/doubles.nix +++ b/lib/systems/doubles.nix @@ -69,6 +69,7 @@ in { arm = filterDoubles predicates.isAarch32; armv7 = filterDoubles predicates.isArmv7; + aarch = filterDoubles predicates.isAarch; aarch64 = filterDoubles predicates.isAarch64; x86 = filterDoubles predicates.isx86; i686 = filterDoubles predicates.isi686; @@ -114,6 +115,4 @@ in { genode = filterDoubles predicates.isGenode; embedded = filterDoubles predicates.isNone; - - mesaPlatforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "armv7a-linux" "aarch64-linux" "powerpc64-linux" "powerpc64le-linux" "aarch64-darwin" "riscv64-linux"]; } diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 8a3726f369682..971f6b87364b2 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -59,24 +59,24 @@ rec { armv7a-android-prebuilt = { config = "armv7a-unknown-linux-androideabi"; - rustc.config = "armv7-linux-androideabi"; - sdkVer = "28"; - ndkVer = "24"; + rust.rustcTarget = "armv7-linux-androideabi"; + androidSdkVersion = "33"; + androidNdkVersion = "26"; useAndroidPrebuilt = true; } // platforms.armv7a-android; aarch64-android-prebuilt = { config = "aarch64-unknown-linux-android"; - rustc.config = "aarch64-linux-android"; - sdkVer = "28"; - ndkVer = "24"; + rust.rustcTarget = "aarch64-linux-android"; + androidSdkVersion = "33"; + androidNdkVersion = "26"; useAndroidPrebuilt = true; }; aarch64-android = { config = "aarch64-unknown-linux-android"; - sdkVer = "30"; - ndkVer = "24"; + androidSdkVersion = "33"; + androidNdkVersion = "26"; libc = "bionic"; useAndroidPrebuilt = false; useLLVM = true; @@ -207,7 +207,7 @@ rec { aarch64-embedded = { config = "aarch64-none-elf"; libc = "newlib"; - rustc.config = "aarch64-unknown-none"; + rust.rustcTarget = "aarch64-unknown-none"; }; aarch64be-embedded = { @@ -342,6 +342,11 @@ rec { useLLVM = true; }; + x86_64-openbsd = { + config = "x86_64-unknown-openbsd"; + useLLVM = true; + }; + # # WASM # @@ -351,6 +356,12 @@ rec { useLLVM = true; }; + wasm32-unknown-none = { + config = "wasm32-unknown-none"; + rust.rustcTarget = "wasm32-unknown-unknown"; + useLLVM = true; + }; + # Ghcjs ghcjs = { # This triple is special to GHC/Cabal/GHCJS and not recognized by autotools diff --git a/lib/systems/flake-systems.nix b/lib/systems/flake-systems.nix index b1988c6a4fbb0..851dc1af71818 100644 --- a/lib/systems/flake-systems.nix +++ b/lib/systems/flake-systems.nix @@ -16,14 +16,13 @@ "armv6l-linux" "armv7l-linux" "i686-linux" - "mipsel-linux" + # "mipsel-linux" is excluded because it is not bootstrapped # Other platforms with sufficient support in stdenv which is not formally # mandated by their platform tier. "aarch64-darwin" - "armv5tel-linux" + # "armv5tel-linux" is excluded because it is not bootstrapped "powerpc64le-linux" "riscv64-linux" - - # "x86_64-freebsd" is excluded because it is mostly broken + "x86_64-freebsd" ] diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix index 4890912d7fed4..a2ee288f2c1f8 100644 --- a/lib/systems/parse.nix +++ b/lib/systems/parse.nix @@ -466,10 +466,12 @@ rec { } # cpu-vendor-os else if elemAt l 1 == "apple" || - elem (elemAt l 2) [ "wasi" "redox" "mmixware" "ghcjs" "mingw32" ] || + elem (elemAt l 2) [ "redox" "mmixware" "ghcjs" "mingw32" ] || hasPrefix "freebsd" (elemAt l 2) || hasPrefix "netbsd" (elemAt l 2) || - hasPrefix "genode" (elemAt l 2) + hasPrefix "openbsd" (elemAt l 2) || + hasPrefix "genode" (elemAt l 2) || + hasPrefix "wasm32" (elemAt l 0) then { cpu = elemAt l 0; vendor = elemAt l 1; diff --git a/lib/systems/platforms.nix b/lib/systems/platforms.nix index d2e8f77bec03e..873c3c7fc7f50 100644 --- a/lib/systems/platforms.nix +++ b/lib/systems/platforms.nix @@ -201,8 +201,9 @@ rec { target = "zImage"; }; gcc = { - arch = "armv6"; - fpu = "vfp"; + # https://en.wikipedia.org/wiki/Raspberry_Pi#Specifications + arch = "armv6kz"; + fpu = "vfpv2"; }; }; @@ -535,11 +536,9 @@ rec { name = "riscv-multiplatform"; target = "Image"; autoModules = true; + preferBuiltin = true; baseConfig = "defconfig"; DTB = true; - extraConfig = '' - SERIAL_OF_PLATFORM y - ''; }; }; |