From 0823da0924c0fe5d971efb146cd2fc0683a7fc89 Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis
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)))))) + ;;; ;;; Concrete cross toolchains. -- 2.0.1