guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: gnu: newlib-nano: Fix nano lib and header paths.


From: guix-commits
Subject: branch master updated: gnu: newlib-nano: Fix nano lib and header paths.
Date: Mon, 12 Apr 2021 04:25:24 -0400

This is an automated email from the git hooks/post-receive script.

efraim pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new 8799369  gnu: newlib-nano: Fix nano lib and header paths.
8799369 is described below

commit 8799369983315d799501b4f45a3954195b630ebb
Author: Morgan Smith <Morgan.J.Smith@outlook.com>
AuthorDate: Thu Apr 8 09:02:20 2021 -0400

    gnu: newlib-nano: Fix nano lib and header paths.
    
    * gnu/packages/embedded.scm (newlib-nano-arm-none-eabi)[arguments]: Hard 
link
    library files from *.a to *_nano.a. Hard link newlib.h to a common location.
    
    Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
---
 gnu/packages/embedded.scm | 37 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/embedded.scm b/gnu/packages/embedded.scm
index a3f1d85..480bbf7 100644
--- a/gnu/packages/embedded.scm
+++ b/gnu/packages/embedded.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2020 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
 ;;; Copyright © 2021 Julien Lepiller <julien@lepiller.eu>
+;;; Copyright © 2021 Morgan Smith <Morgan.J.Smith@outlook.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -229,7 +230,41 @@ usable on embedded products.")
            "--enable-lite-exit"
            "--enable-newlib-global-atexit"
            "--enable-newlib-nano-formatted-io"
-           "--disable-nls"))))
+           "--disable-nls"))
+       ((#:phases phases)
+        `(modify-phases ,phases
+           ;; XXX: Most arm toolchains offer both *.a and *_nano.a as newlib
+           ;; and newlib-nano respectively.  The headers are usually
+           ;; arm-none-eabi/include/newlib.h for newlib and
+           ;; arm-none-eabi/include/newlib-nano/newlib.h for newlib-nano.  We
+           ;; have two different toolchain packages for each which works but
+           ;; is a little strange.
+           (add-after 'install 'hardlink-newlib
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let ((out (assoc-ref outputs "out")))
+                 ;; The nano.specs file says that newlib-nano files should end
+                 ;; in "_nano.a" instead of just ".a".  Note that this applies
+                 ;; to all the multilib folders too.
+                 (for-each
+                  (lambda (file)
+                    (link file
+                          (string-append
+                           ;; Strip ".a" off the end
+                           (substring file 0 (- (string-length file) 2))
+                           ;; Add "_nano.a" onto the end
+                           "_nano.a")))
+                  (find-files
+                   out
+                   
"^(libc.a|libg.a|librdimon.a|libstdc\\+\\+.a|libsupc\\+\\+.a)$"))
+
+                 ;; newlib.h is usually in this location instead so both
+                 ;; newlib and newlib-nano can be in the toolchain at the same
+                 ;; time
+                 (mkdir (string-append out 
"/arm-none-eabi/include/newlib-nano"))
+                 (symlink
+                   "../newlib.h"
+                   (string-append out 
"/arm-none-eabi/include/newlib-nano/newlib.h"))
+                 #t)))))))
     (synopsis "Newlib variant for small systems with limited memory")))
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]