all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#35611] [PATCH 1/2] gnu: cross-base: Allow using non-default glibc.
@ 2019-05-06 22:21 Carl Dong
  2019-05-06 22:34 ` [bug#35611] [PATCH 2/2] gnu: Allow building gcc with non-default libc Carl Dong
  2019-05-12 21:40 ` [bug#35611] [PATCH 1/2] gnu: cross-base: Allow using non-default glibc Ludovic Courtès
  0 siblings, 2 replies; 7+ messages in thread
From: Carl Dong @ 2019-05-06 22:21 UTC (permalink / raw)
  To: 35611; +Cc: Carl Dong

* gnu/packages/cross-base.scm (cross-libc, native-libc, cross-newlib?):
  Add xlibc optional argument to specify using a non-default glibc
  package.
---
 gnu/packages/cross-base.scm | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 25caacb723..51e9e2962a 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -422,14 +422,15 @@ target that libc."
 
 (define* (cross-libc target
                      #:optional
+                     (xlibc glibc)
                      (xgcc (cross-gcc target))
                      (xbinutils (cross-binutils target))
                      (xheaders (cross-kernel-headers target)))
-  "Return a libc cross-built for TARGET, a GNU triplet.  Use XGCC and
-XBINUTILS and the cross tool chain."
-  (if (cross-newlib? target)
-      (native-libc target)
-      (let ((libc glibc))
+  "Return XLIBC cross-built for TARGET, a GNU triplet. Use XGCC and XBINUTILS
+and the cross tool chain."
+  (if (cross-newlib? target xlibc)
+      (native-libc target xlibc)
+      (let ((libc xlibc))
         (package (inherit libc)
           (name (string-append "glibc-cross-" target))
           (arguments
@@ -502,13 +503,17 @@ XBINUTILS and the cross tool chain."
                            ,@(package-inputs libc)     ;FIXME: static-bash
                            ,@(package-native-inputs libc)))))))
 
-(define (native-libc target)
+(define* (native-libc target
+                     #:optional
+                     (xlibc glibc))
   (if (target-mingw? target)
       mingw-w64
-      glibc))
+      xlibc))
 
-(define (cross-newlib? target)
-  (not (eq? (native-libc target) glibc)))
+(define* (cross-newlib? target
+                       #:optional
+                       (xlibc glibc))
+  (not (eq? (native-libc target xlibc) xlibc)))
 
 \f
 ;;; Concrete cross tool chains are instantiated like this:
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [bug#35611] [PATCH 2/2] gnu: Allow building gcc with non-default libc.
  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
  2019-05-12 21:41   ` Ludovic Courtès
  2019-05-12 21:40 ` [bug#35611] [PATCH 1/2] gnu: cross-base: Allow using non-default glibc Ludovic Courtès
  1 sibling, 1 reply; 7+ messages in thread
From: Carl Dong @ 2019-05-06 22:34 UTC (permalink / raw)
  To: 35611@debbugs.gnu.org

* 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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [bug#35611] [PATCH 1/2] gnu: cross-base: Allow using non-default glibc.
  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 ` [bug#35611] [PATCH 2/2] gnu: Allow building gcc with non-default libc Carl Dong
@ 2019-05-12 21:40 ` Ludovic Courtès
  2019-05-13  2:46   ` Carl Dong
  1 sibling, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2019-05-12 21:40 UTC (permalink / raw)
  To: Carl Dong; +Cc: 35611

Hi Carl,

Carl Dong <accounts@carldong.me> skribis:

> * gnu/packages/cross-base.scm (cross-libc, native-libc, cross-newlib?):
>   Add xlibc optional argument to specify using a non-default glibc
>   package.

[...]

>  (define* (cross-libc target
>                       #:optional
> +                     (xlibc glibc)
>                       (xgcc (cross-gcc target))
>                       (xbinutils (cross-binutils target))
>                       (xheaders (cross-kernel-headers target)))
> -  "Return a libc cross-built for TARGET, a GNU triplet.  Use XGCC and
> -XBINUTILS and the cross tool chain."
> -  (if (cross-newlib? target)
> -      (native-libc target)
> -      (let ((libc glibc))
> +  "Return XLIBC cross-built for TARGET, a GNU triplet. Use XGCC and XBINUTILS
> +and the cross tool chain."

Really a detail, but for clarity I would change “xlibc” to “libc”,
because this argument denotes a C library, not a cross-compiled C
library.

Ditto in other places.

You can send an updated patch or I can make this change on your behalf
if you prefer, let me know!

> -(define (native-libc target)
> +(define* (native-libc target
> +                     #:optional
> +                     (xlibc glibc))
>    (if (target-mingw? target)
>        mingw-w64
> -      glibc))
> +      xlibc))

This procedure is starting to look weird.  :-)  I wonder if we should
inline it at the call sites, but we can look into it later.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#35611] [PATCH 2/2] gnu: Allow building gcc with non-default libc.
  2019-05-06 22:34 ` [bug#35611] [PATCH 2/2] gnu: Allow building gcc with non-default libc Carl Dong
@ 2019-05-12 21:41   ` Ludovic Courtès
  0 siblings, 0 replies; 7+ messages in thread
From: Ludovic Courtès @ 2019-05-12 21:41 UTC (permalink / raw)
  To: Carl Dong; +Cc: 35611@debbugs.gnu.org

Carl Dong <contact@carldong.me> skribis:

> * 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.

Nice, LGTM!

(I’ll push it along with patch #1.)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#35611] [PATCH 1/2] gnu: cross-base: Allow using non-default glibc.
  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
  0 siblings, 2 replies; 7+ messages in thread
From: Carl Dong @ 2019-05-13  2:46 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 35611@debbugs.gnu.org

Hi Ludovic,

> Really a detail, but for clarity I would change “xlibc” to “libc”, because
> this argument denotes a C library, not a cross-compiled C library.
>
> Ditto in other places.
>
> You can send an updated patch or I can make this change on your behalf if you
> prefer, let me know!

Ah yes! That does make it more clear. Could you make this change for me? Thanks!

> This procedure is starting to look weird. :-) I wonder if we should inline it
> at the call sites, but we can look into it later.

Haha that's what I thought too... Inlining would probably make the most sense.
I'll submit another patch to this effect at some point!

Thank you so much for your help. Have an excellent day!

Cheers,
Carl Dong
accounts@carldong.me
"I fight for the users"

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#35611: [PATCH 1/2] gnu: cross-base: Allow using non-default glibc.
  2019-05-13  2:46   ` Carl Dong
@ 2019-05-13  7:45     ` Ludovic Courtès
  2019-05-13 10:09     ` [bug#35611] " Ludovic Courtès
  1 sibling, 0 replies; 7+ messages in thread
From: Ludovic Courtès @ 2019-05-13  7:45 UTC (permalink / raw)
  To: Carl Dong; +Cc: 35611@debbugs.gnu.org

Hi Carl,

Carl Dong <accounts@carldong.me> skribis:

>> Really a detail, but for clarity I would change “xlibc” to “libc”, because
>> this argument denotes a C library, not a cross-compiled C library.
>>
>> Ditto in other places.
>>
>> You can send an updated patch or I can make this change on your behalf if you
>> prefer, let me know!
>
> Ah yes! That does make it more clear. Could you make this change for me? Thanks!

Done!

>> This procedure is starting to look weird. :-) I wonder if we should inline it
>> at the call sites, but we can look into it later.
>
> Haha that's what I thought too... Inlining would probably make the most sense.
> I'll submit another patch to this effect at some point!

Awesome.  :-)

Thank you!

Ludo’.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#35611] [PATCH 1/2] gnu: cross-base: Allow using non-default glibc.
  2019-05-13  2:46   ` Carl Dong
  2019-05-13  7:45     ` bug#35611: " Ludovic Courtès
@ 2019-05-13 10:09     ` Ludovic Courtès
  1 sibling, 0 replies; 7+ messages in thread
From: Ludovic Courtès @ 2019-05-13 10:09 UTC (permalink / raw)
  To: Carl Dong; +Cc: 35611@debbugs.gnu.org

Carl Dong <accounts@carldong.me> skribis:

>> Really a detail, but for clarity I would change “xlibc” to “libc”, because
>> this argument denotes a C library, not a cross-compiled C library.
>>
>> Ditto in other places.
>>
>> You can send an updated patch or I can make this change on your behalf if you
>> prefer, let me know!
>
> Ah yes! That does make it more clear. Could you make this change for me? Thanks!

In commit 04a3ecc79ec01242acd0928f89bf982f50c866df, I had to remove the
pre-defined uses of ‘make-gcc-libc’ because of the circular top-level
references they introduced.

I suppose they were here mostly for illustrative purposes though, so
hopefully that’s OK.  Let me know!

Ludo’.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-05-13 10:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [bug#35611] [PATCH 2/2] gnu: Allow building gcc with non-default libc Carl Dong
2019-05-12 21:41   ` 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

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.