unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] gnu: cross-base: Add libc/hurd cross-toolchain.
@ 2014-07-23 20:04 Manolis Ragkousis
  2014-09-28 10:39 ` Manolis Ragkousis
  0 siblings, 1 reply; 2+ messages in thread
From: Manolis Ragkousis @ 2014-07-23 20:04 UTC (permalink / raw)
  To: Guix-devel

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

I am sending the cross-toolchain I am using  to build glibc/hurd. It
works but it needs some reviewing.

Some questions:
1) Should I use "#:strip-binaries? #f " ?
2) In hurd headers I had to change the flag --host to --build. It's
the same problem with hurd-minimal when using the cross-toolchain.
Should I apply the hurd-minimal patch to hurd-headers as well? WDYT?

Thanks
Manolis

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

From 0823da0924c0fe5d971efb146cd2fc0683a7fc89 Mon Sep 17 00:00:00 2001
From: Manolis Ragkousis <manolis837@gmail.com>
Date: Wed, 23 Jul 2014 22:45:37 +0000
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 | 128 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 128 insertions(+)

diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index bba85e3..bd9642a 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -22,6 +22,7 @@
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages base)
   #:use-module (gnu packages linux)
+  #:use-module (gnu packages hurd)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix utils)
@@ -262,6 +263,133 @@ 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)))
+
+  (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))
+      ;; Need suggestion on a way to better do this. It's the same 
+      ;; problem with hurd-minimal, can't build with "--host=".
+      (arguments
+       `(#:phases (alist-replace
+                   'install
+                   (lambda _
+                     (zero? (system* "make" "install-headers" "no_deps=t")))
+                   (alist-delete 'build %standard-phases))
+      
+         #:configure-flags '("--build=i686-pc-gnu"
+                             "--without-parted")
+      
+         #:tests? #f))
+      (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 (assoc-ref inputs "cross-glibc-hurd-headers")))
+                (setenv "CROSS_CPATH"
+                        (string-append glibc "/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.0.1


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

* Re: [PATCH] gnu: cross-base: Add libc/hurd cross-toolchain.
  2014-07-23 20:04 [PATCH] gnu: cross-base: Add libc/hurd cross-toolchain Manolis Ragkousis
@ 2014-09-28 10:39 ` Manolis Ragkousis
  0 siblings, 0 replies; 2+ messages in thread
From: Manolis Ragkousis @ 2014-09-28 10:39 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guix-devel

[-- 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


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

end of thread, other threads:[~2014-09-28 10:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-23 20:04 [PATCH] gnu: cross-base: Add libc/hurd cross-toolchain Manolis Ragkousis
2014-09-28 10:39 ` 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).