From: Morgan.J.Smith@outlook.com
To: 47325@debbugs.gnu.org
Cc: Morgan Smith <Morgan.J.Smith@outlook.com>, anothersms@gmail.com
Subject: bug#47325: [PATCH] gnu: newlib-nano: Fix nano lib and header paths
Date: Thu, 8 Apr 2021 09:02:20 -0400 [thread overview]
Message-ID: <BYAPR05MB4023C6AEC80E53FED3A4C55FC5749@BYAPR05MB4023.namprd05.prod.outlook.com> (raw)
In-Reply-To: <87ft0nnm7r.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me>
From: Morgan Smith <Morgan.J.Smith@outlook.com>
* 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.
---
I CC'd Efraim because they commited my last gcc-arm-none-eabi patch. I hope
that's ok. I'm not really sure who is responsible for this toolchain.
I successfully compiled some QMK firmware using this patch, something that
failed previously.
gnu/packages/embedded.scm | 36 +++++++++++++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/embedded.scm b/gnu/packages/embedded.scm
index a3f1d85580..ea5bfdbdd1 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,40 @@ (define-public newlib-nano-arm-none-eabi
"--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"))
+ (link (string-append out "/arm-none-eabi/include/newlib.h")
+ (string-append out "/arm-none-eabi/include/newlib-nano/newlib.h"))
+ #t)))))))
(synopsis "Newlib variant for small systems with limited memory")))
\f
--
2.31.1
next prev parent reply other threads:[~2021-04-08 13:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-22 17:15 bug#47325: newlib-nano: are lib names wrong? Nicolò Balzarotti
2021-03-26 20:42 ` Morgan Smith
2021-04-08 13:02 ` Morgan.J.Smith [this message]
2021-04-12 8:25 ` bug#47325: [PATCH] gnu: newlib-nano: Fix nano lib and header paths Efraim Flashner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BYAPR05MB4023C6AEC80E53FED3A4C55FC5749@BYAPR05MB4023.namprd05.prod.outlook.com \
--to=morgan.j.smith@outlook.com \
--cc=47325@debbugs.gnu.org \
--cc=anothersms@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.