diff mbox

[v2,3/4] gnu: Add newlib-arm-none-eabi.

Message ID 20160920105015.1783-4-theodoros.for@openmailbox.org
State New
Headers show

Commit Message

Theodoros Foradis Sept. 20, 2016, 10:50 a.m. UTC
* gnu/packages/embedded.scm (newlib-arm-none-eabi): New procedure.
(newlib-nano-arm-none-eabi): New procedure.
---
 gnu/packages/embedded.scm | 59 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)
diff mbox

Patch

diff --git a/gnu/packages/embedded.scm b/gnu/packages/embedded.scm
index 56fbafb..29033b9 100644
--- a/gnu/packages/embedded.scm
+++ b/gnu/packages/embedded.scm
@@ -129,3 +129,62 @@ 
                       (cons
                        (search-patch "gcc-6-cross-environment-variables.patch")
                        (search-patches "gcc-6-arm-none-eabi-multilib.patch"))))))))
+
+(define (newlib-arm-none-eabi xgcc)
+  (package
+    (name "newlib")
+    (version "2.4.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "ftp://sourceware.org/pub/newlib/newlib-"
+                                  version ".tar.gz"))
+              (sha256
+               (base32
+                "01i7qllwicf05vsvh39qj7qp5fdifpvvky0x95hjq39mbqiksnsl"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:out-of-source? #t
+       #:configure-flags '("--target=arm-none-eabi"
+                           "--enable-newlib-io-long-long"
+                           "--enable-newlib-register-fini"
+                           "--disable-newlib-supplied-syscalls"
+                           "--disable-nls")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-shell-shebangs
+           (lambda _
+             (for-each patch-makefile-SHELL
+                       (find-files "." "Makefile.in")))))))
+    (native-inputs
+     `(("xbinutils" ,xbinutils-arm-none-eabi)
+       ("xgcc" ,xgcc)
+       ("texinfo" ,texinfo)))
+    (home-page "http://www.sourceware.org/newlib/")
+    (synopsis "C library for use on embedded systems")
+    (description "Newlib is a C library intended for use on embedded
+systems.  It is a conglomeration of several library parts that are easily
+usable on embedded products.")
+    (license (license:non-copyleft
+              "https://www.sourceware.org/newlib/COPYING.NEWLIB"))))
+
+(define (newlib-nano-arm-none-eabi xgcc)
+  (package
+    (inherit (newlib-arm-none-eabi xgcc))
+    (name "newlib-nano")
+    (arguments
+     (substitute-keyword-arguments (package-arguments (newlib-arm-none-eabi xgcc))
+       ((#:configure-flags flags)
+        ``("--target=arm-none-eabi"
+           "--enable-multilib"
+           "--disable-newlib-supplied-syscalls"
+           "--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"
+           "--disable-nls"))))))
+