From 5ea6bb839e7bd773f6c995ca6018b68cb8ace7aa Mon Sep 17 00:00:00 2001 From: John Ericson Date: Wed, 29 Sep 2021 21:18:21 -0400 Subject: [PATCH 1/2] newlib: Add parameter for "nano" variant --- pkgs/development/misc/newlib/default.nix | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/pkgs/development/misc/newlib/default.nix b/pkgs/development/misc/newlib/default.nix index 870aa068afe8..60ad50a8e4f7 100644 --- a/pkgs/development/misc/newlib/default.nix +++ b/pkgs/development/misc/newlib/default.nix @@ -1,4 +1,9 @@ -{ stdenv, fetchurl, buildPackages }: +{ stdenv, fetchurl, buildPackages +, # "newlib-nano" is what the official ARM embedded toolchain calls this build + # configuration that prioritizes low space usage. We include it as a preset + # for embedded projects striving for a similar configuration. + nanoizeNewlib ? false +}: stdenv.mkDerivation rec { pname = "newlib"; @@ -22,10 +27,21 @@ stdenv.mkDerivation rec { "--disable-newlib-supplied-syscalls" "--disable-nls" + "--enable-newlib-retargetable-locking" + ] ++ (if !nanoizeNewlib then [ "--enable-newlib-io-long-long" "--enable-newlib-register-fini" - "--enable-newlib-retargetable-locking" - ]; + ] else [ + "--enable-newlib-reent-small" + "--disable-newlib-fvwrite-in-streamio" + "--disable-newlib-fseek-optimization" + "--disable-newlib-wide-orient" + "--enable-newlib-nano-malloc" + "--disable-newlib-unbuf-stream-opt" + "--enable-lite-exit" + "--enable-newlib-global-atexit" + "--enable-newlib-nano-formatted-io" + ]); dontDisableStatic = true; From e3ff6189f6aa641e108876de32ad83a542259b60 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 30 Sep 2021 20:49:31 -0400 Subject: [PATCH 2/2] newlib-nano: Init This ensures CI tests the nano variant. It also makes it easier to use with `libc = "newlib-nano";` in a platform description. --- pkgs/top-level/all-packages.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e95132f3699e..9bbffa3d2930 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15985,6 +15985,7 @@ with pkgs; else if name == "newlib" && stdenv.targetPlatform.isVc4 then targetPackages.vc4-newlib or vc4-newlib else if name == "newlib" && stdenv.targetPlatform.isOr1k then targetPackages.or1k-newlib or or1k-newlib else if name == "newlib" then targetPackages.newlibCross or newlibCross + else if name == "newlib-nano" then targetPackages.newlib-nanoCross or newlib-nanoCross else if name == "musl" then targetPackages.muslCross or muslCross else if name == "msvcrt" then targetPackages.windows.mingw_w64 or windows.mingw_w64 else if name == "libSystem" then @@ -32840,7 +32841,15 @@ with pkgs; newlib = callPackage ../development/misc/newlib { }; newlibCross = callPackage ../development/misc/newlib { stdenv = crossLibcStdenv; - }; + }; + + newlib-nano = callPackage ../development/misc/newlib { + nanoizeNewlib = true; + }; + newlib-nanoCross = callPackage ../development/misc/newlib { + nanoizeNewlib = true; + stdenv = crossLibcStdenv; + }; omnisharp-roslyn = callPackage ../development/tools/omnisharp-roslyn { dotnet-sdk = dotnet-sdk_5; };