summary refs log tree commit diff
path: root/pkgs/development/misc/newlib/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/misc/newlib/default.nix')
-rw-r--r--pkgs/development/misc/newlib/default.nix35
1 files changed, 35 insertions, 0 deletions
diff --git a/pkgs/development/misc/newlib/default.nix b/pkgs/development/misc/newlib/default.nix
new file mode 100644
index 000000000000..693cfa093b08
--- /dev/null
+++ b/pkgs/development/misc/newlib/default.nix
@@ -0,0 +1,35 @@
+{ 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"
+    "--enable-newlib-retargetable-locking"
+  ];
+
+  dontDisableStatic = true;
+
+  passthru = {
+    incdir = "/${stdenv.targetPlatform.config}/include";
+    libdir = "/${stdenv.targetPlatform.config}/lib";
+  };
+}