From d1c08981f676d9205080ffec5cba364257b50aa0 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Wed, 29 Sep 2021 21:18:21 -0400 Subject: [PATCH] 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 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;