about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAaron Lindsay <aerialx@users.noreply.github.com>2019-03-25 20:33:39 -0700
committerAaron Lindsay <aerialx@users.noreply.github.com>2019-03-25 20:39:51 -0700
commit1c7bb464d99301e42cbb0fe438c927c1440800c6 (patch)
treeab9626a3e3823b0d0b6d56bac7dda39ef6e568b1
parent02a1d3b24a94a21844ae545a9eb9ee00b61e0f63 (diff)
msp430: include vendor headers with stdenv
-rw-r--r--lib/systems/default.nix1
-rw-r--r--pkgs/development/misc/msp430/newlib.nix18
-rw-r--r--pkgs/top-level/all-packages.nix7
3 files changed, 26 insertions, 0 deletions
diff --git a/lib/systems/default.nix b/lib/systems/default.nix
index b3f7363fe6125..9c6b51400dcba 100644
--- a/lib/systems/default.nix
+++ b/lib/systems/default.nix
@@ -34,6 +34,7 @@ rec {
         else if final.isUClibc              then "uclibc"
         else if final.isAndroid             then "bionic"
         else if final.isLinux /* default */ then "glibc"
+        else if final.isMsp430              then "newlib"
         else if final.isAvr                 then "avrlibc"
         # TODO(@Ericson2314) think more about other operating systems
         else                                     "native/impure";
diff --git a/pkgs/development/misc/msp430/newlib.nix b/pkgs/development/misc/msp430/newlib.nix
new file mode 100644
index 0000000000000..9586a2ff21d39
--- /dev/null
+++ b/pkgs/development/misc/msp430/newlib.nix
@@ -0,0 +1,18 @@
+{ runCommand, lndir, newlib, msp430GccSupport }:
+
+runCommand "msp430-${newlib.name}" {
+  inherit newlib;
+  inherit msp430GccSupport;
+
+  preferLocalBuild = true;
+  allowSubstitutes = false;
+
+  passthru = {
+    inherit (newlib) incdir libdir;
+  };
+} ''
+  mkdir $out
+  ${lndir}/bin/lndir -silent $newlib $out
+  ${lndir}/bin/lndir -silent $msp430GccSupport/include $out/${newlib.incdir}
+  ${lndir}/bin/lndir -silent $msp430GccSupport/lib $out/${newlib.libdir}
+''
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index f7fdc29556ca4..08eb5a91c8a3f 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -8374,6 +8374,12 @@ in
 
   msp430GccSupport = callPackage ../development/misc/msp430/gcc-support.nix { };
 
+  msp430Newlib      = callPackage ../development/misc/msp430/newlib.nix { };
+  msp430NewlibCross = callPackage ../development/misc/msp430/newlib.nix {
+    inherit (pkgs.buildPackages.xorg) lndir;
+    newlib = pkgs.newlibCross;
+  };
+
   pharo-vms = callPackage ../development/pharo/vm { };
   pharo = pharo-vms.multi-vm-wrapper;
   pharo-cog32 = pharo-vms.cog32;
@@ -10146,6 +10152,7 @@ in
     else if name == "bionic" then targetPackages.bionic or bionic
     else if name == "uclibc" then targetPackages.uclibcCross or uclibcCross
     else if name == "avrlibc" then targetPackages.avrlibcCross or avrlibcCross
+    else if name == "newlib" && stdenv.targetPlatform.isMsp430 then targetPackages.msp430NewlibCross or msp430NewlibCross
     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