diff --git a/pkgs/development/misc/newlib/default.nix b/pkgs/development/misc/newlib/default.nix index 193ec53d5ad..93c50ea3cc5 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 +}: let version = "3.3.0"; in stdenv.mkDerivation { @@ -22,10 +27,21 @@ in stdenv.mkDerivation { "--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; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 94ceaf0f720..3470d482a8c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15006,6 +15006,7 @@ in 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 @@ -31621,7 +31622,15 @@ in 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 { };