Unverified Commit a2b519e6 authored by Alyssa Ross's avatar Alyssa Ross Committed by GitHub
Browse files

uclibc-ng: improve detection of FPU, endianess and ABI (#458935)

parents 7f889f24 e8b38407
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -440,6 +440,11 @@ rec {
    isPE = {
      kernel.execFormat = execFormats.pe;
    };

    isEabi = {
      abi.eabi = true;
    };

  };

  # given two patterns, return a pattern which is their logical AND.
+11 −1
Original line number Diff line number Diff line
@@ -662,15 +662,19 @@ rec {
    # On ARM, this corresponds to ARMEABI.
    eabi = {
      float = "soft";
      eabi = true;
    };
    eabihf = {
      float = "hard";
      eabi = true;
    };

    # Other architectures should use ELF in embedded situations.
    elf = { };

    androideabi = { };
    androideabi = {
      eabi = true;
    };
    android = {
      assertions = [
        {
@@ -684,9 +688,11 @@ rec {

    gnueabi = {
      float = "soft";
      eabi = true;
    };
    gnueabihf = {
      float = "hard";
      eabi = true;
    };
    gnu = {
      assertions = [
@@ -730,17 +736,21 @@ rec {

    musleabi = {
      float = "soft";
      eabi = true;
    };
    musleabihf = {
      float = "hard";
      eabi = true;
    };
    musl = { };

    uclibceabi = {
      float = "soft";
      eabi = true;
    };
    uclibceabihf = {
      float = "hard";
      eabi = true;
    };
    uclibc = { };

+7 −0
Original line number Diff line number Diff line
@@ -1120,6 +1120,13 @@
    githubId = 82811;
    name = "Aldo Borrero";
  };
  aleclearmind = {
    email = "ale.nix@clearmind.me";
    matrix = "@bake.monorail:matrix.org";
    github = "aleclearmind";
    githubId = 2545644;
    name = "Alessandro Di Federico";
  };
  alejandrosame = {
    email = "alejandrosanchzmedina@gmail.com";
    matrix = "@alejandrosame:matrix.org";
+15 −10
Original line number Diff line number Diff line
@@ -26,16 +26,15 @@ let
            echo "parseconfig: removing $NAME"
            sed -i /^$NAME=/d .config

            #if test "$OPTION" != n; then
            echo "parseconfig: setting $NAME=$OPTION"
            echo "$NAME=$OPTION" >> .config
            #fi
        done
        set +x
    }
  '';

  # UCLIBC_SUSV4_LEGACY defines 'tmpnam', needed for gcc libstdc++ builds.
  # 'ftw' needed to build acl, a coreutils dependency
  nixConfig = ''
    RUNTIME_PREFIX "/"
    DEVEL_PREFIX "/"
@@ -52,13 +51,20 @@ let
  + lib.optionalString (stdenv.hostPlatform.gcc.float or "" == "soft") ''
    UCLIBC_HAS_FPU n
  ''
  + lib.optionalString (stdenv.hostPlatform.isAarch32 && isCross) ''
  + lib.optionalString stdenv.hostPlatform.isEabi ''
    CONFIG_ARM_EABI y
  ''
  + lib.optionalString stdenv.hostPlatform.isLittleEndian ''
    ARCH_WANTS_BIG_ENDIAN n
    ARCH_BIG_ENDIAN n
    ARCH_WANTS_LITTLE_ENDIAN y
    ARCH_LITTLE_ENDIAN y
    UCLIBC_HAS_FPU n
  ''
  + lib.optionalString stdenv.hostPlatform.isBigEndian ''
    ARCH_WANTS_BIG_ENDIAN y
    ARCH_BIG_ENDIAN y
    ARCH_WANTS_LITTLE_ENDIAN n
    ARCH_LITTLE_ENDIAN n
  '';
in
stdenv.mkDerivation (finalAttrs: {
@@ -70,9 +76,8 @@ stdenv.mkDerivation (finalAttrs: {
    hash = "sha256-X386r92yygj7KVvkVWHAGIQHED10Rs/SZLm4Iv7T7S0=";
  };

  # 'ftw' needed to build acl, a coreutils dependency
  configurePhase = ''
    make defconfig
    make defconfig ARCH=${stdenv.hostPlatform.linuxArch}
    ${configParser}
    cat << EOF | parseconfig
    ${nixConfig}
@@ -92,7 +97,7 @@ stdenv.mkDerivation (finalAttrs: {
  makeFlags = [
    "ARCH=${stdenv.hostPlatform.linuxArch}"
    "TARGET_ARCH=${stdenv.hostPlatform.linuxArch}"
    "VERBOSE=1"
    "V=1"
  ]
  ++ lib.optionals isCross [
    "CROSS=${stdenv.cc.targetPrefix}"
@@ -144,7 +149,7 @@ stdenv.mkDerivation (finalAttrs: {
      experimental and need more testing.
    '';
    license = lib.licenses.lgpl2Plus;
    maintainers = [ ];
    maintainers = with lib.maintainers; [ aleclearmind ];
    platforms = lib.platforms.linux;
    badPlatforms = lib.platforms.aarch64;
  };
+1 −1
Original line number Diff line number Diff line
@@ -6975,7 +6975,7 @@ with pkgs;
    else if libc == "bionic" then
      bionic
    else if libc == "uclibc" then
      uclibc
      uclibc-ng
    else if libc == "avrlibc" then
      avrlibc
    else if libc == "newlib" && stdenv.hostPlatform.isMsp430 then