summaryrefslogtreecommitdiff
path: root/gnu/packages/cross-base.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/cross-base.scm')
-rw-r--r--gnu/packages/cross-base.scm225
1 files changed, 126 insertions, 99 deletions
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 2959616af6..8d0b41180b 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -46,6 +46,7 @@
#:export (cross-binutils
cross-libc
cross-gcc
+ cross-mig
cross-kernel-headers))
(define-syntax %xgcc
@@ -147,69 +148,69 @@ base compiler and using LIBC (which may be either a libc package or #f.)"
,@(package-arguments xgcc))))
(substitute-keyword-arguments args
((#:configure-flags flags)
- `(append (list ,(string-append "--target=" target)
- ,@(if libc
- `( ;; Disable libcilkrts because it is not
- ;; ported to GNU/Hurd.
- "--disable-libcilkrts"
- ;; When building a cross compiler, --with-sysroot is
- ;; implicitly set to "$gcc_tooldir/sys-root". This does
- ;; not work for us, because --with-native-system-header-dir
- ;; is searched for relative to this location. Thus, we set
- ;; it to "/" so GCC is able to find the target libc headers.
- ;; This is safe because in practice GCC uses CROSS_CPATH
- ;; & co to separate target and host libraries.
- "--with-sysroot=/")
- `( ;; Disable features not needed at this stage.
- "--disable-shared" "--enable-static"
- "--enable-languages=c,c++"
-
- ;; libstdc++ cannot be built at this stage
- ;; ("Link tests are not allowed after
- ;; GCC_NO_EXECUTABLES.").
- "--disable-libstdc++-v3"
-
- "--disable-threads" ;libgcc, would need libc
- "--disable-libatomic"
- "--disable-libmudflap"
- "--disable-libgomp"
- "--disable-libmpx"
- "--disable-libssp"
- "--disable-libquadmath"
- "--disable-decimal-float" ;would need libc
- "--disable-libcilkrts"
-
- ;; When target is any OS other than 'none' these
- ;; libraries will fail if there is no libc
- ;; present. See
- ;; <https://lists.gnu.org/archive/html/guix-devel/2016-02/msg01311.html>
- "--disable-libitm"
- "--disable-libvtv"
- "--disable-libsanitizer"
- ))
-
- ;; Install cross-built libraries such as libgcc_s.so in
- ;; the "lib" output.
- ,@(if libc
- `((string-append "--with-toolexeclibdir="
- (assoc-ref %outputs "lib")
- "/" ,target "/lib"))
- '()))
-
- ,(if libc
- flags
- `(remove (cut string-match "--enable-languages.*" <>)
- ,flags))))
+ #~(append (list #$(string-append "--target=" target)
+ #$@(if libc
+ #~( ;; Disable libcilkrts because it is not
+ ;; ported to GNU/Hurd.
+ "--disable-libcilkrts"
+ ;; When building a cross compiler, --with-sysroot is
+ ;; implicitly set to "$gcc_tooldir/sys-root". This does
+ ;; not work for us, because --with-native-system-header-dir
+ ;; is searched for relative to this location. Thus, we set
+ ;; it to "/" so GCC is able to find the target libc headers.
+ ;; This is safe because in practice GCC uses CROSS_CPATH
+ ;; & co to separate target and host libraries.
+ "--with-sysroot=/")
+ #~( ;; Disable features not needed at this stage.
+ "--disable-shared" "--enable-static"
+ "--enable-languages=c,c++"
+
+ ;; libstdc++ cannot be built at this stage
+ ;; ("Link tests are not allowed after
+ ;; GCC_NO_EXECUTABLES.").
+ "--disable-libstdc++-v3"
+
+ "--disable-threads" ;libgcc, would need libc
+ "--disable-libatomic"
+ "--disable-libmudflap"
+ "--disable-libgomp"
+ "--disable-libmpx"
+ "--disable-libssp"
+ "--disable-libquadmath"
+ "--disable-decimal-float" ;would need libc
+ "--disable-libcilkrts"
+
+ ;; When target is any OS other than 'none' these
+ ;; libraries will fail if there is no libc
+ ;; present. See
+ ;; <https://lists.gnu.org/archive/html/guix-devel/2016-02/msg01311.html>
+ "--disable-libitm"
+ "--disable-libvtv"
+ "--disable-libsanitizer"
+ ))
+
+ ;; Install cross-built libraries such as libgcc_s.so in
+ ;; the "lib" output.
+ #$@(if libc
+ #~((string-append "--with-toolexeclibdir="
+ (assoc-ref %outputs "lib")
+ "/" #$target "/lib"))
+ #~()))
+
+ #$(if libc
+ flags
+ #~(remove (cut string-match "--enable-languages.*" <>)
+ #$flags))))
((#:make-flags flags)
(if libc
- `(let ((libc (assoc-ref %build-inputs "libc")))
+ #~(let ((libc (assoc-ref %build-inputs "libc")))
;; FLAGS_FOR_TARGET are needed for the target libraries to receive
;; the -Bxxx for the startfiles.
- (cons (string-append "FLAGS_FOR_TARGET=-B" libc "/lib")
- ,flags))
+ (cons (string-append "FLAGS_FOR_TARGET=-B" libc "/lib")
+ #$flags))
flags))
((#:phases phases)
- `(cross-gcc-build-phases ,target ,phases))))))
+ #~(cross-gcc-build-phases #$target #$phases))))))
(define (cross-gcc-patches xgcc target)
"Return GCC patches needed for XGCC and TARGET."
@@ -365,6 +366,52 @@ target that libc."
#:xgcc xgcc
#:xbinutils xbinutils))
+(define* (cross-gnumach-headers target
+ #:key
+ (xgcc (cross-gcc target))
+ (xbinutils (cross-binutils target)))
+ (package
+ (inherit gnumach-headers)
+ (name (string-append (package-name gnumach-headers)
+ "-cross-" target))
+ (native-inputs
+ (modify-inputs (package-native-inputs gnumach-headers)
+ (prepend xgcc xbinutils)))))
+
+(define* (cross-mig target
+ #:key
+ (xgcc (cross-gcc target))
+ (xbinutils (cross-binutils target)))
+ "Return a cross-mig for TARGET, where TARGET is a GNU triplet. Use XGCC as
+the base compiler. Use XBINUTILS as the associated cross-Binutils."
+ (define xgnumach-headers
+ (cross-gnumach-headers target
+ #:xgcc xgcc
+ #:xbinutils xbinutils))
+ (package
+ (inherit mig)
+ (name (string-append "mig-cross"))
+ (arguments
+ (substitute-keyword-arguments (package-arguments mig)
+ ((#:configure-flags flags #~'())
+ #~(list #$(string-append "--target=" target)))
+ ((#:tests? _ #f)
+ #f)
+ ((#:phases phases #~%standard-phases)
+ #~(modify-phases #$phases
+ (add-before 'configure 'set-cross-headers-path
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let* ((mach #+xgnumach-headers)
+ (cpath (string-append mach "/include")))
+ (for-each (lambda (variable)
+ (setenv variable cpath))
+ '#$%gcc-cross-include-paths))))))))
+ (propagated-inputs
+ (list xgnumach-headers))
+ (native-inputs
+ (modify-inputs (package-native-inputs mig)
+ (prepend xgcc xbinutils)))))
+
(define* (cross-kernel-headers* target
#:key
(linux-headers linux-libre-headers)
@@ -399,40 +446,11 @@ target that libc."
("cross-binutils" ,xbinutils)
,@(package-native-inputs linux-headers)))))
- (define xgnumach-headers-name
- (string-append (package-name gnumach-headers) "-cross-" target))
+ (define xmig
+ (cross-mig target #:xgcc xgcc #:xbinutils xbinutils))
(define xgnumach-headers
- (package
- (inherit gnumach-headers)
- (name xgnumach-headers-name)
- (native-inputs
- (modify-inputs (package-native-inputs gnumach-headers)
- (prepend xgcc xbinutils)))))
-
- (define xmig
- (package
- (inherit mig)
- (name (string-append "mig-cross"))
- (arguments
- (substitute-keyword-arguments (package-arguments mig)
- ((#:configure-flags flags #~'())
- #~(list #$(string-append "--target=" target)))
- ((#:tests? _ #f)
- #f)
- ((#:phases phases #~%standard-phases)
- #~(modify-phases #$phases
- (add-before 'configure 'set-cross-headers-path
- (lambda* (#:key inputs #:allow-other-keys)
- (let* ((mach #+(this-package-input xgnumach-headers-name))
- (cpath (string-append mach "/include")))
- (for-each (lambda (variable)
- (setenv variable cpath))
- '#$%gcc-cross-include-paths))))))))
- (propagated-inputs (list xgnumach-headers))
- (native-inputs
- (modify-inputs (package-native-inputs mig)
- (prepend xgcc xbinutils)))))
+ (cross-gnumach-headers target #:xgcc xgcc #:xbinutils xbinutils))
(define xhurd-headers
(package
@@ -440,10 +458,17 @@ target that libc."
(name (string-append (package-name hurd-headers)
"-cross-" target))
+ (arguments
+ (substitute-keyword-arguments (package-arguments hurd-headers)
+ ((#:configure-flags flags)
+ `(cons* ,(string-append "--build=" (%current-system))
+ ,(string-append "--host=" target)
+ ,flags))))
+
(native-inputs `(("cross-gcc" ,xgcc)
("cross-binutils" ,xbinutils)
("cross-mig" ,xmig)
- ,@(alist-delete "mig"(package-native-inputs hurd-headers))))))
+ ,@(alist-delete "mig" (package-native-inputs hurd-headers))))))
(define xglibc/hurd-headers
(package
@@ -488,6 +513,10 @@ target that libc."
(guix build utils)
(srfi srfi-26))
,@(package-arguments hurd-minimal))
+ ((#:configure-flags flags)
+ `(cons* ,(string-append "--build=" (%current-system))
+ ,(string-append "--host=" target)
+ ,flags))
((#:phases phases)
`(modify-phases ,phases
(add-before 'configure 'set-cross-headers-path
@@ -513,12 +542,7 @@ target that libc."
(inputs `(("gnumach-headers" ,xgnumach-headers)
("hurd-headers" ,xhurd-headers)
- ("hurd-minimal" ,xhurd-minimal)))
-
- (native-inputs `(("cross-gcc" ,xgcc)
- ("cross-binutils" ,xbinutils)
- ("cross-mig" ,xmig)
- ,@(package-native-inputs hurd-core-headers)))))
+ ("hurd-minimal" ,xhurd-minimal)))))
(match target
((or "i586-pc-gnu" "i586-gnu") xhurd-core-headers)
@@ -577,7 +601,9 @@ and the cross tool chain."
((#:configure-flags flags)
`(cons ,(string-append "--host=" target)
,(if (target-hurd? target)
- `(cons "--disable-werror" ,flags)
+ `(append (list "--disable-werror"
+ ,@%glibc/hurd-configure-flags)
+ ,flags)
flags)))
((#:phases phases)
`(modify-phases ,phases
@@ -609,8 +635,9 @@ and the cross tool chain."
("cross-binutils" ,xbinutils)
,@(if (target-hurd? target)
`(("cross-mig"
- ,@(assoc-ref (package-native-inputs xheaders)
- "cross-mig")))
+ ,(cross-mig target
+ #:xgcc xgcc
+ #:xbinutils xbinutils)))
'())
,@(package-inputs libc) ;FIXME: static-bash
,@(package-native-inputs libc))))))