From 8db71d9d773956d41778b88d88ead126a0138e67 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Fri, 19 Oct 2018 11:43:33 -0500 Subject: [PATCH] newlib: init at 3.0.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #47533 newlib seems to think it’s a compiler when it’s not. Anyway had to make host refer to build platform for things to work. --- pkgs/development/misc/newlib/default.nix | 34 ++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 8 +++++- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/misc/newlib/default.nix diff --git a/pkgs/development/misc/newlib/default.nix b/pkgs/development/misc/newlib/default.nix new file mode 100644 index 00000000000..e26f0f78f21 --- /dev/null +++ b/pkgs/development/misc/newlib/default.nix @@ -0,0 +1,34 @@ +{ stdenv, fetchurl, buildPackages }: + +let version = "3.0.0"; +in stdenv.mkDerivation { + name = "newlib-${version}"; + src = fetchurl { + url = "ftp://sourceware.org/pub/newlib/newlib-${version}.tar.gz"; + sha256 = "0chka3szh50krcz2dcxcsr1v1i000jylwnsrp2pgrrblxqsn6mn8"; + }; + + depsBuildBuild = [ buildPackages.stdenv.cc ]; + + # newlib expects CC to build for build platform, not host platform + preConfigure = '' + export CC=cc + ''; + + configurePlatforms = [ "build" "target" ]; + configureFlags = [ + "--host=${stdenv.buildPlatform.config}" + + "--disable-newlib-supplied-syscalls" + "--disable-nls" + "--enable-newlib-io-long-long" + "--enable-newlib-register-fini" + ]; + + dontDisableStatic = true; + + passthru = { + incdir = "/${stdenv.hostPlatform.config}/include"; + libdir = "/${stdenv.hostPlatform.config}/lib"; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c6e2205a0bb..d4749c1f49b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9743,7 +9743,8 @@ with pkgs; /**/ if name == "glibc" then targetPackages.glibcCross or glibcCross else if name == "bionic" then targetPackages.bionic else if name == "uclibc" then targetPackages.uclibcCross - else if name == "avrlibc" then targetPackages.avrlibcCross + else if name == "avrlibc" then targetPackages.avrlibcCross or avrlibcCross + else if name == "newlib" then targetPackages.newlibCross or newlibCross else if name == "musl" then targetPackages.muslCross or muslCross else if name == "msvcrt" then targetPackages.windows.mingw_w64 or windows.mingw_w64 else if stdenv.targetPlatform.useiOSPrebuilt then targetPackages.darwin.iosSdkPkgs.libraries @@ -22836,4 +22837,9 @@ with pkgs; }; tsung = callPackage ../applications/networking/tsung {}; + + newlib = callPackage ../development/misc/newlib { }; + newlibCross = callPackage ../development/misc/newlib { + stdenv = crossLibcStdenv; + }; }