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] gnu: cross-base: Add libc/hurd cross-toolchain.
Date: Sun, 28 Sep 2014 13:39:55 +0300	[thread overview]
Message-ID: <CAFtzXzMrqeY15xK0rP9hAsTy3_KyN3YLbaB_HxFuOtU3gNN33w@mail.gmail.com> (raw)
In-Reply-To: <CAFtzXzP-FMbDciBe17t0EZg4Lv8_aDxHZBZRjaWnr=rAL4SXpw@mail.gmail.com>

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

Updated patch.

With this patch applied in wip-hurd you can build glibc/hurd with
>./pre-inst-env guix build -e '((@@ (gnu packages cross-base) cross-libc/hurd) "i686-pc-gnu")'

[-- Attachment #2: 0001-gnu-cross-base-Add-libc-hurd-cross-toolchain.patch --]
[-- Type: text/x-patch, Size: 5937 bytes --]

From fba5b72b199babc7d0b2ff156bda085739d87ab8 Mon Sep 17 00:00:00 2001
From: Manolis Ragkousis <manolis837@gmail.com>
Date: Sun, 28 Sep 2014 12:50:33 +0300
Subject: [PATCH] gnu: cross-base: Add libc/hurd cross-toolchain.

* gnu/packages/cross-base.scm (cross-libc/hurd): New variable.
---
 gnu/packages/cross-base.scm | 118 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 118 insertions(+)

diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 90fc606..5547274 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -23,6 +23,7 @@
   #:use-module (gnu packages base)
   #:use-module (gnu packages commencement)
   #:use-module (gnu packages linux)
+  #:use-module (gnu packages hurd)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix utils)
@@ -263,6 +264,123 @@ XBINUTILS and the cross tool chain."
                      ("cross-binutils" ,xbinutils)
                      ,@(package-native-inputs glibc)))))
 
+(define* (cross-libc/hurd target
+                          #:optional
+                          (xgcc (cross-gcc target))
+                          (xbinutils (cross-binutils target)))
+
+  "Return a libc cross-built for TARGET=i686-pc-gnu. Use XGCC and 
+XBINUTILS and the cross tool chain."
+
+  (define xgnumach-headers
+    (package (inherit gnumach-headers)
+      (name (string-append (package-name gnumach-headers)
+                           "-cross-" target))
+
+      (native-inputs `(("cross-gcc" ,xgcc)
+                       ("cross-binutils" ,xbinutils)
+                       ,@(package-native-inputs gnumach-headers)))))
+
+  (define xmig
+    (package (inherit mig)
+      (name (string-append "mig-cross"))
+      (arguments
+       (substitute-keyword-arguments (package-arguments mig)
+         ((#:configure-flags flags)
+          `(cons ,(string-append "--host=" target)
+                 ,flags))))
+
+      (propagated-inputs `(("cross-gnumach-headers" ,xgnumach-headers)))
+      (native-inputs `(("cross-gcc" ,xgcc)
+                       ("cross-binutils" ,xbinutils)
+                       ,@(package-native-inputs mig)))))
+
+  (define xhurd-headers
+    (package (inherit hurd-headers)
+      (name (string-append (package-name hurd-headers)
+                           "-cross-" target))
+
+      (native-inputs `(("cross-gcc" ,xgcc)
+                       ("cross-binutils" ,xbinutils)
+                       ("cross-mig" ,xmig)
+                       ,@(alist-delete "mig"(package-native-inputs hurd-headers))))))
+
+  (define xglibc/hurd-headers
+    (package (inherit glibc/hurd-headers)
+      (name (string-append (package-name glibc/hurd-headers)
+                           "-cross-" target))
+
+      (arguments
+       (substitute-keyword-arguments (package-arguments glibc/hurd-headers)
+         ((#:phases phases)
+          `(alist-cons-before
+            'pre-configure 'set-cross-headers-path
+            (lambda* (#:key inputs #:allow-other-keys)
+              (let ((mach (assoc-ref inputs "gnumach-headers"))
+                    (hurd (assoc-ref inputs "hurd-headers")))
+                (setenv "CROSS_CPATH"
+                        (string-append mach "/include:"
+                                       hurd "/include"))))
+            ,phases))))
+
+      (propagated-inputs `(("gnumach-headers" ,xgnumach-headers)
+                           ("hurd-headers" ,xhurd-headers)))
+
+      (native-inputs `(("cross-gcc" ,xgcc)
+                       ("cross-binutils" ,xbinutils)
+                       ("cross-mig" ,xmig)
+                       ,@(alist-delete "mig"(package-native-inputs glibc/hurd-headers))))))
+
+  (define xhurd-minimal
+    (package (inherit hurd-minimal)
+      (name (string-append (package-name hurd-minimal)
+                           "-cross-" target))
+
+      (arguments
+       (substitute-keyword-arguments (package-arguments hurd-minimal)
+         ((#:phases phases)
+          `(alist-cons-before
+            'configure 'set-cross-headers-path
+            (lambda* (#:key inputs #:allow-other-keys)
+              (let ((glibc-headers (assoc-ref inputs "cross-glibc-hurd-headers")))
+                (setenv "CROSS_CPATH"
+                        (string-append glibc-headers "/include"))))
+            ,phases))))
+
+      (inputs `(("cross-glibc-hurd-headers" ,xglibc/hurd-headers)))
+
+      (native-inputs `(("cross-gcc" ,xgcc)
+                       ("cross-binutils" ,xbinutils)
+                       ("cross-mig" ,xmig)
+                       ,@(alist-delete "mig"(package-native-inputs hurd-headers))))))
+
+  (package (inherit glibc/hurd)
+    (name (string-append "glibc-hurd-cross-" target))
+    (arguments
+     (substitute-keyword-arguments (package-arguments glibc/hurd)
+       ((#:phases phases)
+        `(alist-cons-before
+          'pre-configure 'set-cross-hurd-headers-path
+          (lambda* (#:key inputs #:allow-other-keys)
+            (let ((mach (assoc-ref inputs "cross-gnumach-headers"))
+                  (hurd (assoc-ref inputs "cross-hurd-headers"))
+                  (hurd-minimal (assoc-ref inputs "cross-hurd-minimal")))
+              (setenv "CROSS_CPATH"
+                      (string-append mach "/include:"
+                                     hurd "/include"))
+              (setenv "CROSS_LIBRARY_PATH"
+                      (string-append hurd-minimal "/lib:"))))
+          ,phases))))
+
+    (propagated-inputs `(("cross-gnumach-headers" ,xgnumach-headers)
+                         ("cross-hurd-headers" ,xhurd-headers)
+                         ("cross-hurd-minimal" ,xhurd-minimal)))
+
+    (native-inputs `(("cross-gcc" ,xgcc)
+                     ("cross-binutils" ,xbinutils)
+                     ("cross-mig" ,xmig)
+                     ,@(alist-delete "mig"(package-native-inputs glibc/hurd))))))
+
 \f
 ;;;
 ;;; Concrete cross toolchains.
-- 
2.1.1


      reply	other threads:[~2014-09-28 10:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-23 20:04 [PATCH] gnu: cross-base: Add libc/hurd cross-toolchain Manolis Ragkousis
2014-09-28 10:39 ` Manolis Ragkousis [this message]

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=CAFtzXzMrqeY15xK0rP9hAsTy3_KyN3YLbaB_HxFuOtU3gNN33w@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).