unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] gnu: base: Add glibc-for-target macro.
@ 2016-06-06 14:39 Manolis Ragkousis
  2016-06-07 13:48 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Manolis Ragkousis @ 2016-06-06 14:39 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 267 bytes --]

Hello everyone,

This patch is from wip-hurd. It offers a unified way to packages to
access the libc without worrying about the kernel.

This patches applies on core-updates. Note that you have to run make
clean && make after applying this patch.

Thank you,
Manolis

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-base-Add-glibc-for-target-macro.patch --]
[-- Type: text/x-patch; name="0001-gnu-base-Add-glibc-for-target-macro.patch", Size: 7063 bytes --]

From b19ac63ee9605c4e84c447668c5701bda284114f Mon Sep 17 00:00:00 2001
From: Manolis Ragkousis <manolis837@gmail.com>
Date: Mon, 6 Jun 2016 17:21:51 +0300
Subject: [PATCH] gnu: base: Add glibc-for-target macro.

* gnu/packages/base.scm (glibc): Add macro.
  (glibc/linux): Rename glibc to glibc/linux.
  (glibc/hurd): Adjust accordingly.
---
 gnu/packages/base.scm | 132 ++++++++++++++++++++++++++++----------------------
 1 file changed, 73 insertions(+), 59 deletions(-)

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 689ab2d..23f438d 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -44,7 +44,9 @@
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
-  #:use-module (guix build-system trivial))
+  #:use-module (guix build-system trivial)
+  #:use-module (ice-9 match)
+  #:export (glibc))
 
 ;;; Commentary:
 ;;;
@@ -464,7 +466,7 @@ store.")
 
 (export make-ld-wrapper)
 
-(define-public glibc
+(define-public glibc/linux
   (package
    (name "glibc")
    (version "2.23")
@@ -638,6 +640,75 @@ with the Linux kernel.")
    (license lgpl2.0+)
    (home-page "http://www.gnu.org/software/libc/")))
 
+(define-public glibc/hurd
+  ;; The Hurd's libc variant.
+  (package (inherit glibc/linux)
+    (name "glibc-hurd")
+    (version "2.19")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://alpha.gnu.org/gnu/hurd/glibc-"
+                                  version "-hurd+libpthread-20160518" ".tar.gz"))
+              (sha256
+               (base32
+                "12zmdjviybpsdb2kq4cg98rds7909f0cc96fzdahdfrzlxx1q0px"))))
+
+    ;; Libc provides <hurd.h>, which includes a bunch of Hurd and Mach headers,
+    ;; so both should be propagated.
+    (propagated-inputs `(("hurd-core-headers" ,hurd-core-headers)))
+    (native-inputs
+     `(,@(package-native-inputs glibc/linux)
+       ("mig" ,mig)
+       ("perl" ,perl)))
+
+    (arguments
+     (substitute-keyword-arguments (package-arguments glibc/linux)
+       ((#:phases original-phases)
+        ;; Add libmachuser.so and libhurduser.so to libc.so's search path.
+        ;; See <http://lists.gnu.org/archive/html/bug-hurd/2015-07/msg00051.html>.
+        `(alist-cons-after
+          'install 'augment-libc.so
+          (lambda* (#:key outputs #:allow-other-keys)
+            (let* ((out (assoc-ref outputs "out")))
+              (substitute* (string-append out "/lib/libc.so")
+                (("/[^ ]+/lib/libc.so.0.3")
+                 (string-append out "/lib/libc.so.0.3" " libmachuser.so" " libhurduser.so"))))
+            #t)
+          (alist-cons-after
+           'pre-configure 'pre-configure-set-pwd
+           (lambda _
+             ;; Use the right 'pwd'.
+             (substitute* "configure"
+               (("/bin/pwd") "pwd")))
+          ,original-phases)))
+        ((#:configure-flags original-configure-flags)
+        `(append (list "--host=i586-pc-gnu"
+
+                       ;; We need this to get a working openpty() function.
+                       "--enable-pt_chown"
+
+                       ;; nscd fails to build for GNU/Hurd:
+                       ;; <https://lists.gnu.org/archive/html/bug-hurd/2014-07/msg00006.html>.
+                       ;; Disable it.
+                       "--disable-nscd")
+                 (filter (lambda (flag)
+                           (not (string-prefix? "--enable-kernel=" flag)))
+                         ,original-configure-flags)))))
+    (synopsis "The GNU C Library (GNU Hurd variant)")
+    (supported-systems %hurd-systems)))
+
+(define* (glibc-for-target #:optional
+                           (target (or (%current-target-system)
+                                       (%current-system))))
+  "Return the glibc for TARGET, GLIBC/LINUX for a Linux host or
+GLIBC/HURD for a Hurd host"
+  (match target
+    ((or "i586-pc-gnu" "i586-gnu") glibc/hurd)
+    (_ glibc/linux)))
+
+(define-syntax glibc
+  (identifier-syntax (glibc-for-target)))
+
 (define-public glibc-2.21
   ;; The old libc, which we use mostly to build locale data in the old format
   ;; (which the new libc can cope with.)
@@ -757,63 +828,6 @@ variety of options.  It is an alternative to the shell \"type\" built-in
 command.")
     (license gpl3+))) ; some files are under GPLv2+
 
-(define-public glibc/hurd
-  ;; The Hurd's libc variant.
-  (package (inherit glibc)
-    (name "glibc-hurd")
-    (version "2.19")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "http://alpha.gnu.org/gnu/hurd/glibc-"
-                                  version "-hurd+libpthread-20160518" ".tar.gz"))
-              (sha256
-               (base32
-                "12zmdjviybpsdb2kq4cg98rds7909f0cc96fzdahdfrzlxx1q0px"))))
-
-    ;; Libc provides <hurd.h>, which includes a bunch of Hurd and Mach headers,
-    ;; so both should be propagated.
-    (propagated-inputs `(("hurd-core-headers" ,hurd-core-headers)))
-    (native-inputs
-     `(,@(package-native-inputs glibc)
-       ("mig" ,mig)
-       ("perl" ,perl)))
-
-    (arguments
-     (substitute-keyword-arguments (package-arguments glibc)
-       ((#:phases original-phases)
-        ;; Add libmachuser.so and libhurduser.so to libc.so's search path.
-        ;; See <http://lists.gnu.org/archive/html/bug-hurd/2015-07/msg00051.html>.
-        `(alist-cons-after
-          'install 'augment-libc.so
-          (lambda* (#:key outputs #:allow-other-keys)
-            (let* ((out (assoc-ref outputs "out")))
-              (substitute* (string-append out "/lib/libc.so")
-                (("/[^ ]+/lib/libc.so.0.3")
-                 (string-append out "/lib/libc.so.0.3" " libmachuser.so" " libhurduser.so"))))
-            #t)
-          (alist-cons-after
-           'pre-configure 'pre-configure-set-pwd
-           (lambda _
-             ;; Use the right 'pwd'.
-             (substitute* "configure"
-               (("/bin/pwd") "pwd")))
-          ,original-phases)))
-        ((#:configure-flags original-configure-flags)
-        `(append (list "--host=i586-pc-gnu"
-
-                       ;; We need this to get a working openpty() function.
-                       "--enable-pt_chown"
-
-                       ;; nscd fails to build for GNU/Hurd:
-                       ;; <https://lists.gnu.org/archive/html/bug-hurd/2014-07/msg00006.html>.
-                       ;; Disable it.
-                       "--disable-nscd")
-                 (filter (lambda (flag)
-                           (not (string-prefix? "--enable-kernel=" flag)))
-                         ,original-configure-flags)))))
-    (synopsis "The GNU C Library (GNU Hurd variant)")
-    (supported-systems %hurd-systems)))
-
 (define-public glibc/hurd-headers
   (package (inherit glibc/hurd)
     (name "glibc-hurd-headers")
-- 
2.8.2


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

* Re: [PATCH] gnu: base: Add glibc-for-target macro.
  2016-06-06 14:39 [PATCH] gnu: base: Add glibc-for-target macro Manolis Ragkousis
@ 2016-06-07 13:48 ` Ludovic Courtès
  2016-06-07 16:18   ` Manolis Ragkousis
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2016-06-07 13:48 UTC (permalink / raw)
  To: Manolis Ragkousis; +Cc: guix-devel

Manolis Ragkousis <manolis837@gmail.com> skribis:

> From b19ac63ee9605c4e84c447668c5701bda284114f Mon Sep 17 00:00:00 2001
> From: Manolis Ragkousis <manolis837@gmail.com>
> Date: Mon, 6 Jun 2016 17:21:51 +0300
> Subject: [PATCH] gnu: base: Add glibc-for-target macro.
>
> * gnu/packages/base.scm (glibc): Add macro.
>   (glibc/linux): Rename glibc to glibc/linux.
>   (glibc/hurd): Adjust accordingly.

LGTM, but please double-check that:

  ./pre-inst-env guix build inkscape -d

is the same both with and without the patch.

> +(define-public glibc/hurd
> +  ;; The Hurd's libc variant.
> +  (package (inherit glibc/linux)
> +    (name "glibc-hurd")

I assume this definition was just moved higher in the file, right?

OK for core-updates, thanks!

Ludo’.

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

* Re: [PATCH] gnu: base: Add glibc-for-target macro.
  2016-06-07 13:48 ` Ludovic Courtès
@ 2016-06-07 16:18   ` Manolis Ragkousis
  0 siblings, 0 replies; 3+ messages in thread
From: Manolis Ragkousis @ 2016-06-07 16:18 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Hello Ludo,

On 06/07/16 16:48, Ludovic Courtès wrote:
> LGTM, but please double-check that:
> 
>   ./pre-inst-env guix build inkscape -d
> 
> is the same both with and without the patch.

Yes it produced the same derivation.

> 
>> +(define-public glibc/hurd
>> +  ;; The Hurd's libc variant.
>> +  (package (inherit glibc/linux)
>> +    (name "glibc-hurd")
> 
> I assume this definition was just moved higher in the file, right?

Yes it was just moved higher in the file so the macro could work properly.

Pushed to core-updates.

Thank you,
Manolis

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

end of thread, other threads:[~2016-06-07 16:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-06 14:39 [PATCH] gnu: base: Add glibc-for-target macro Manolis Ragkousis
2016-06-07 13:48 ` Ludovic Courtès
2016-06-07 16:18   ` Manolis Ragkousis

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