From 9fc297bec8397ee8ed7d27f0cfb9b5c14ac1dffc Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis
Date: Sun, 30 Nov 2014 20:43:30 +0000 Subject: [PATCH] gnu: cross-base: Add libc/hurd. * gnu/packages/cross-base.scm (cross-libc): Added libc/hurd. --- gnu/packages/cross-base.scm | 159 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 136 insertions(+), 23 deletions(-) diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 90fc606..9f9d377 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) @@ -238,30 +239,142 @@ XBINUTILS and the cross tool chain." (native-inputs `(("cross-gcc" ,xgcc) ("cross-binutils" ,xbinutils) ,@(package-native-inputs linux-libre-headers))))) + + (define xgnumach-headers + (package (inherit gnumach-headers) + (name (string-append (package-name gnumach-headers) + "-cross-" target)) - (package (inherit glibc) - (name (string-append "glibc-cross-" target)) - (arguments - (substitute-keyword-arguments - `(#:strip-binaries? #f ; disable stripping (see above) - ,@(package-arguments glibc)) - ((#:configure-flags flags) - `(cons ,(string-append "--host=" target) - ,flags)) - ((#:phases phases) - `(alist-cons-before - 'configure 'set-cross-linux-headers-path - (lambda* (#:key inputs #:allow-other-keys) - (let ((linux (assoc-ref inputs "cross-linux-headers"))) - (setenv "CROSS_CPATH" - (string-append linux "/include")) - #t)) - ,phases)))) - - (propagated-inputs `(("cross-linux-headers" ,xlinux-headers))) - (native-inputs `(("cross-gcc" ,xgcc) - ("cross-binutils" ,xbinutils) - ,@(package-native-inputs glibc))))) + (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-minimal)))))) + + ;; Choose libc based on target + (match target + ("i686-pc-gnu" + (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)))))) + (_ + (package (inherit glibc) + (name (string-append "glibc-cross-" target)) + (arguments + (substitute-keyword-arguments + `(#:strip-binaries? #f ; disable stripping (see above) + ,@(package-arguments glibc)) + ((#:configure-flags flags) + `(cons ,(string-append "--host=" target) + ,flags)) + ((#:phases phases) + `(alist-cons-before + 'configure 'set-cross-linux-headers-path + (lambda* (#:key inputs #:allow-other-keys) + (let ((linux (assoc-ref inputs "cross-linux-headers")) ) + (setenv "CROSS_CPATH" + (string-append linux "/include:")) + #t)) + ,phases)))) + + (propagated-inputs `(("cross-linux-headers" ,xlinux-headers))) + + (native-inputs `(("cross-gcc" ,xgcc) + ("cross-binutils" ,xbinutils) + ,@(package-native-inputs glibc))))))) ;;; -- 2.1.3