unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Manolis Ragkousis <manolis837@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: Guix-devel <Guix-devel@gnu.org>
Subject: Re: [PATCH 10/10] gnu: base: Added glibc-for-target macro.
Date: Tue, 19 May 2015 01:53:39 +0300	[thread overview]
Message-ID: <CAFtzXzPAtVO6tcnON4BEV2CvVQcpti5o8+-EcJL0dCdG=J1p=w@mail.gmail.com> (raw)
In-Reply-To: <CAFtzXzOyWRnrzdwZJse3CUZmXJa6TnGSg7KR5c5wNSstKeE3cQ@mail.gmail.com>

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

Because of my mistake in [8/10] the previous patch won't apply. Here
is the updated one. :-)

[-- Attachment #2: 0010-gnu-base-Added-glibc-for-target-macro.patch --]
[-- Type: text/x-patch, Size: 8495 bytes --]

From 8534372800703610b1436870da2caf1fa3c9796c Mon Sep 17 00:00:00 2001
From: Manolis Ragkousis <manolis837@gmail.com>
Date: Tue, 19 May 2015 01:42:14 +0300
Subject: [PATCH 10/10] gnu: base: Added glibc-for-target macro.

gnu/packages/base.scm (glibc): Add macro.
---
 gnu/packages/base.scm | 177 +++++++++++++++++++++++++++-----------------------
 1 file changed, 94 insertions(+), 83 deletions(-)

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 3af1498..0296616 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -43,7 +43,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:
 ;;;
@@ -432,7 +434,7 @@ store.")
 
 (export make-ld-wrapper)
 
-(define-public glibc
+(define-public glibc/linux
   (package
    (name "glibc")
    (version "2.21")
@@ -600,6 +602,96 @@ with the Linux kernel.")
    (license lgpl2.0+)
    (home-page "http://www.gnu.org/software/libc/")))
 
+(define-public glibc/hurd
+  (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-20150515" ".tar.gz"))
+              (sha256
+               (base32
+                "0fkmn1kfsbhyrkf1wqqvc47dl5bzflnbcggjjfp5s9c489z916zw"))
+              (patches (map search-patch
+                            '("glibc-hurd-extern-inline.patch")))))
+
+    ;; Libc provides <hurd.h>, which includes a bunch of Hurd and Mach headers,
+    ;; so both should be propagated.
+    (propagated-inputs `(("gnumach-headers" ,gnumach-headers)
+                         ("hurd-headers" ,hurd-headers)
+                         ("hurd-minimal" ,hurd-minimal)))
+    (native-inputs
+     `(,@(package-native-inputs glibc/linux)
+       ("mig" ,mig)
+       ("perl" ,perl)))
+
+    (arguments
+     (substitute-keyword-arguments (package-arguments glibc/linux)
+       ((#:configure-flags original-configure-flags)
+        `(append (list "--host=i686-pc-gnu"
+
+                       ;; 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 (or (string-prefix? "--with-headers=" flag)
+                                    (string-prefix? "--enable-kernel=" flag))))
+                         ;; Evaluate 'original-configure-flags' in a
+                         ;; lexical environment that has a dummy
+                         ;; "linux-headers" input, to prevent errors.
+                         (let ((%build-inputs `(("linux-headers" . "@DUMMY@")
+                                                ,@%build-inputs)))
+                           ,original-configure-flags))))))))
+
+(define-public glibc/hurd-headers
+  (package (inherit glibc/hurd)
+    (name "glibc-hurd-headers")
+    (outputs '("out"))
+    (arguments
+     (substitute-keyword-arguments (package-arguments glibc/hurd)
+       ;; We just pass the flags really needed to build the headers.
+       ((#:configure-flags _)
+        `(list "--enable-add-ons"
+               "--host=i686-pc-gnu"
+               "--enable-obsolete-rpc"))
+       ((#:phases _)
+        '(alist-replace
+          'install
+          (lambda* (#:key outputs #:allow-other-keys)
+            (and (zero? (system* "make" "install-headers"))
+
+                 ;; Make an empty stubs.h to work around not being able to
+                 ;; produce a valid stubs.h and causing the build to fail. See
+                 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-04/msg00233.html>.
+                 (let ((out (assoc-ref outputs "out")))
+                   (close-port
+                    (open-output-file
+                     (string-append out "/include/gnu/stubs.h"))))))
+
+          ;; Nothing to build.
+          (alist-delete
+           'build
+
+           (alist-cons-before
+            'configure 'pre-configure
+            (lambda _
+              ;; Use the right 'pwd'.
+              (substitute* "configure"
+                (("/bin/pwd") "pwd")))
+            %standard-phases))))))))
+
+(define (glibc-for-target target)
+  "Return the glibc for TARGET, glibc/linux for a linux host or
+glibc/hurd for a hurd host"
+  (match target
+    ("i686-pc-gnu" glibc/hurd)
+    (_ glibc/linux)))
+
+(define-syntax glibc
+  (identifier-syntax (glibc-for-target (or (%current-target-system) (%current-system)))))
+
 (define-public glibc-locales
   (package
     (inherit glibc)
@@ -696,87 +788,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
-  (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-20150515" ".tar.gz"))
-              (sha256
-               (base32
-                "0fkmn1kfsbhyrkf1wqqvc47dl5bzflnbcggjjfp5s9c489z916zw"))
-              (patches (map search-patch
-                            '("glibc-hurd-extern-inline.patch")))))
-
-    ;; Libc provides <hurd.h>, which includes a bunch of Hurd and Mach headers,
-    ;; so both should be propagated.
-    (propagated-inputs `(("gnumach-headers" ,gnumach-headers)
-                         ("hurd-headers" ,hurd-headers)
-                         ("hurd-minimal" ,hurd-minimal)))
-    (native-inputs
-     `(,@(package-native-inputs glibc)
-       ("mig" ,mig)
-       ("perl" ,perl)))
-
-    (arguments
-     (substitute-keyword-arguments (package-arguments glibc)
-       ((#:configure-flags original-configure-flags)
-        `(append (list "--host=i686-pc-gnu"
-
-                       ;; 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 (or (string-prefix? "--with-headers=" flag)
-                                    (string-prefix? "--enable-kernel=" flag))))
-                         ;; Evaluate 'original-configure-flags' in a
-                         ;; lexical environment that has a dummy
-                         ;; "linux-headers" input, to prevent errors.
-                         (let ((%build-inputs `(("linux-headers" . "@DUMMY@")
-                                                ,@%build-inputs)))
-                           ,original-configure-flags))))))))
-
-
-(define-public glibc/hurd-headers
-  (package (inherit glibc/hurd)
-    (name "glibc-hurd-headers")
-    (outputs '("out"))
-    (arguments
-     (substitute-keyword-arguments (package-arguments glibc/hurd)
-       ;; We just pass the flags really needed to build the headers.
-       ((#:configure-flags _)
-        `(list "--enable-add-ons"
-               "--host=i686-pc-gnu"
-               "--enable-obsolete-rpc"))
-       ((#:phases _)
-        '(alist-replace
-          'install
-          (lambda* (#:key outputs #:allow-other-keys)
-            (and (zero? (system* "make" "install-headers"))
-
-                 ;; Make an empty stubs.h to work around not being able to
-                 ;; produce a valid stubs.h and causing the build to fail. See
-                 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-04/msg00233.html>.
-                 (let ((out (assoc-ref outputs "out")))
-                   (close-port
-                    (open-output-file
-                     (string-append out "/include/gnu/stubs.h"))))))
-
-          ;; Nothing to build.
-          (alist-delete
-           'build
-
-           (alist-cons-before
-            'configure 'pre-configure
-            (lambda _
-              ;; Use the right 'pwd'.
-              (substitute* "configure"
-                (("/bin/pwd") "pwd")))
-            %standard-phases))))))))
-
 (define-public tzdata
   (package
     (name "tzdata")
-- 
2.4.1


  parent reply	other threads:[~2015-05-18 22:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-18 22:25 [PATCH 10/10] gnu: base: Added glibc-for-target macro Manolis Ragkousis
     [not found] ` <CAFtzXzOyWRnrzdwZJse3CUZmXJa6TnGSg7KR5c5wNSstKeE3cQ@mail.gmail.com>
2015-05-18 22:53   ` Manolis Ragkousis [this message]
2015-05-20 12:47     ` Ludovic Courtès
2015-05-22  9:02       ` Manolis Ragkousis
2015-05-25 13:13         ` Ludovic Courtès
2015-06-08 22:11           ` Manolis Ragkousis
2015-06-09 15:52             ` 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='CAFtzXzPAtVO6tcnON4BEV2CvVQcpti5o8+-EcJL0dCdG=J1p=w@mail.gmail.com' \
    --to=manolis837@gmail.com \
    --cc=Guix-devel@gnu.org \
    --cc=ludo@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).