unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Carl Dong <contact@carldong.me>
To: "35611@debbugs.gnu.org" <35611@debbugs.gnu.org>
Subject: [bug#35611] [PATCH 2/2] gnu: Allow building gcc with non-default libc.
Date: Mon, 06 May 2019 22:34:15 +0000	[thread overview]
Message-ID: <SR06qX6GvJElwSOhwVRsSr_56vN_MGzzJkycuP41EBD-Q-J-uNkxcOxjHeVnYUuxu2KipPiIYLqvLI73D6v_2wL3S8P6dD1V4u-yjdxmCsQ=@carldong.me> (raw)
In-Reply-To: <lIPG7Aip1kvx4dmDzDQOSQ8OGS0G9_f3COv4CgIvX_FKd56k9096gjgd2FrXPGXcO4scp8HrRHMpEipnDtjOGI0MwCep2Vi3r-utcOX2eG8=@carldong.me>

* gnu/packages/base.scm (make-gcc-libc): New procedure, returns a gcc
  that targets a specified libc.
  (gcc-glibc-2.26, gcc-glibc-2.27): New public variables.
---
 gnu/packages/base.scm | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index e33e3c52c8..5c0cd36c14 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -1009,6 +1009,35 @@ with the Linux kernel.")
                   (("/bin/pwd") "pwd"))
                 #t))))))))

+(define (make-gcc-libc base-gcc libc)
+  "Return a GCC that targets LIBC."
+  (package (inherit base-gcc)
+           (name (string-append (package-name base-gcc) "-"
+                                (package-name libc) "-"
+                                (package-version libc)))
+           (arguments
+            (substitute-keyword-arguments
+             (ensure-keyword-arguments (package-arguments base-gcc)
+                                       '(#:implicit-inputs? #f))
+             ((#:make-flags flags)
+              `(let ((libc (assoc-ref %build-inputs "libc")))
+                 ;; FLAGS_FOR_TARGET are needed for the target libraries to receive
+                 ;; the -Bxxx for the startfiles.
+                 (cons (string-append "FLAGS_FOR_TARGET=-B" libc "/lib")
+                       ,flags)))))
+           (native-inputs
+            `(("libc" ,libc)
+              ("libc:static" ,libc "static")
+              ,@(append (package-inputs base-gcc)
+                        (fold alist-delete (%final-inputs) '("libc" "libc:static")))))
+           (inputs '())))
+
+(define-public gcc-glibc-2.27
+  (make-gcc-libc gcc glibc-2.27))
+
+(define-public gcc-glibc-2.26
+  (make-gcc-libc gcc glibc-2.26))
+
 (define-public (make-glibc-locales glibc)
   (package
     (inherit glibc)
--
2.21.0

  reply	other threads:[~2019-05-06 22:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-06 22:21 [bug#35611] [PATCH 1/2] gnu: cross-base: Allow using non-default glibc Carl Dong
2019-05-06 22:34 ` Carl Dong [this message]
2019-05-12 21:41   ` [bug#35611] [PATCH 2/2] gnu: Allow building gcc with non-default libc Ludovic Courtès
2019-05-12 21:40 ` [bug#35611] [PATCH 1/2] gnu: cross-base: Allow using non-default glibc Ludovic Courtès
2019-05-13  2:46   ` Carl Dong
2019-05-13  7:45     ` bug#35611: " Ludovic Courtès
2019-05-13 10:09     ` [bug#35611] " Ludovic Courtès

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

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='SR06qX6GvJElwSOhwVRsSr_56vN_MGzzJkycuP41EBD-Q-J-uNkxcOxjHeVnYUuxu2KipPiIYLqvLI73D6v_2wL3S8P6dD1V4u-yjdxmCsQ=@carldong.me' \
    --to=contact@carldong.me \
    --cc=35611@debbugs.gnu.org \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).