lib.systems: allow specifying libc = null

It makes sense to allow platform definitions to opt out of having libc
at all.  One use case would be targetting some obscure new Linux
target that doesn't have a libc implementation yet, and another is
UEFI, which is basically libc-less Windows.

Not having libc is not commonly specified in (GNU) triples (even
Linux's build system will just target either -gnu or -musl depending
on the platform), so instead, we use a separate attribute for it.
This commit is contained in:
Alyssa Ross 2023-04-26 13:07:19 +00:00
parent 3e0cb1ab7d
commit e5d1511d5b
2 changed files with 3 additions and 2 deletions

View File

@ -50,6 +50,7 @@ rec {
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"
# TODO(@Ericson2314) think more about other operating systems
else "native/impure";

View File

@ -20400,7 +20400,8 @@ with pkgs;
libcCrossChooser = name:
# libc is hackily often used from the previous stage. This `or`
# hack fixes the hack, *sigh*.
/**/ if name == "glibc" then targetPackages.glibcCross or glibcCross
/**/ if name == null then null
else if name == "glibc" then targetPackages.glibcCross or glibcCross
else if name == "bionic" then targetPackages.bionic or bionic
else if name == "uclibc" then targetPackages.uclibcCross or uclibcCross
else if name == "avrlibc" then targetPackages.avrlibcCross or avrlibcCross
@ -20419,7 +20420,6 @@ with pkgs;
else if name == "nblibc" then targetPackages.netbsdCross.libc or netbsdCross.libc
else if name == "wasilibc" then targetPackages.wasilibc or wasilibc
else if name == "relibc" then targetPackages.relibc or relibc
else if stdenv.targetPlatform.isGhcjs then null
else throw "Unknown libc ${name}";
libcCross = assert stdenv.targetPlatform != stdenv.buildPlatform; libcCrossChooser stdenv.targetPlatform.libc;