mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 23:13:19 +00:00
lib: Infer libc
field of platform if not specified
This is especially useful when not cross compiling. It means we can remove the `stdenv.isGlibc` predicate too. Additionally, use this to simplify the logic to choose the appropriate libiconv derivation.
This commit is contained in:
parent
2e7ec6fb70
commit
c5c6606048
@ -21,6 +21,12 @@ rec {
|
||||
config = parse.tripleFromSystem final.parsed;
|
||||
# Just a guess, based on `system`
|
||||
platform = platforms.selectBySystem final.system;
|
||||
libc =
|
||||
/**/ if final.isDarwin then "libSystem"
|
||||
else if final.isMinGW then "msvcrt"
|
||||
else if final.isLinux then "glibc"
|
||||
# TODO(@Ericson2314) think more about other operating systems
|
||||
else "native/impure";
|
||||
} // mapAttrs (n: v: v final.parsed) inspect.predicates
|
||||
// args;
|
||||
in final;
|
||||
|
@ -402,9 +402,6 @@ let
|
||||
|| system == "aarch64-linux"
|
||||
|| system == "mips64el-linux";
|
||||
isGNU = system == "i686-gnu"; # GNU/Hurd
|
||||
isGlibc = isGNU # useful for `stdenvNative'
|
||||
|| isLinux
|
||||
|| system == "x86_64-kfreebsd-gnu";
|
||||
isSunOS = system == "i686-solaris"
|
||||
|| system == "x86_64-solaris";
|
||||
isCygwin = system == "i686-cygwin"
|
||||
|
@ -8653,15 +8653,19 @@ with pkgs;
|
||||
|
||||
libgsf = callPackage ../development/libraries/libgsf { };
|
||||
|
||||
# glibc provides libiconv so systems with glibc don't need to build libiconv
|
||||
# separately, but we also provide libiconvReal, which will always be a
|
||||
# standalone libiconv, just in case you want it
|
||||
libiconv = if stdenv ? cross then
|
||||
(if stdenv.cross.libc == "glibc" then libcCross
|
||||
else if stdenv.cross.libc == "libSystem" then darwin.libiconv
|
||||
else libiconvReal)
|
||||
else if stdenv.isGlibc then glibcIconv stdenv.cc.libc
|
||||
else if stdenv.isDarwin then darwin.libiconv
|
||||
# GNU libc provides libiconv so systems with glibc don't need to build
|
||||
# libiconv separately. Additionally, Apple forked/repackaged libiconv so we
|
||||
# use that instead of the vanilla version on that OS.
|
||||
#
|
||||
# We also provide `libiconvReal`, which will always be a standalone libiconv,
|
||||
# just in case you want it regardless of platform.
|
||||
libiconv =
|
||||
if hostPlatform.libc == "glibc"
|
||||
then glibcIconv (if hostPlatform != buildPlatform
|
||||
then libcCross
|
||||
else stdenv.cc.libc)
|
||||
else if hostPlatform.isDarwin
|
||||
then darwin.libiconv
|
||||
else libiconvReal;
|
||||
|
||||
glibcIconv = libc: let
|
||||
|
Loading…
Reference in New Issue
Block a user