#:use-module (gnu packages)
#:use-module (gnu packages gcc)
#:use-module (gnu packages base)
- #:use-module (gnu packages commencement)
#:use-module (gnu packages linux)
#:use-module (gnu packages hurd)
#:use-module (guix packages)
(native-inputs
`(("ld-wrapper-cross" ,(make-ld-wrapper
(string-append "ld-wrapper-" target)
- #:target target
+ #:target (const target)
#:binutils xbinutils))
("binutils-cross" ,xbinutils)
;; Call it differently so that the builder can check whether the "libc"
;; input is #f.
- ("libc-native" ,@(assoc-ref %final-inputs "libc"))
+ ("libc-native" ,@(assoc-ref (%final-inputs) "libc"))
;; Remaining inputs.
,@(let ((inputs (append (package-inputs %xgcc)
- (alist-delete "libc" %final-inputs))))
+ (alist-delete "libc" (%final-inputs)))))
(if libc
`(("libc" ,libc)
("xkernel-headers" ;the target headers
((or "i586-pc-gnu" "i586-gnu") glibc/hurd)
(_ glibc/linux)))
- (package (inherit glibc)
- (name (string-append "glibc-cross-" target))
- (arguments
- (substitute-keyword-arguments
- `(;; Disable stripping (see above.)
- #:strip-binaries? #f
+ ;; Use (cross-libc-for-target ...) to determine the correct libc to use.
+ (let ((libc (cross-libc-for-target target)))
+ (package (inherit libc)
+ (name (string-append "glibc-cross-" target))
+ (arguments
+ (substitute-keyword-arguments
+ `(;; Disable stripping (see above.)
+ #:strip-binaries? #f
- ;; This package is used as a target input, but it should not have
- ;; the usual cross-compilation inputs since that would include
- ;; itself.
- #:implicit-cross-inputs? #f
+ ;; This package is used as a target input, but it should not have
+ ;; the usual cross-compilation inputs since that would include
+ ;; itself.
+ #:implicit-cross-inputs? #f
- ;; We need SRFI 26.
- #:modules ((guix build gnu-build-system)
- (guix build utils)
- (srfi srfi-26))
+ ;; We need SRFI 26.
+ #:modules ((guix build gnu-build-system)
+ (guix build utils)
+ (srfi srfi-26))
- ;; Package-arguments does not use the correct libc, so we use
- ;; (cross-libc-for-target ...) to determine the correct one.
- ,@(package-arguments (cross-libc-for-target target)))
- ((#:configure-flags flags)
- `(cons ,(string-append "--host=" target)
+ ,@(package-arguments libc))
+ ((#:configure-flags flags)
+ `(cons ,(string-append "--host=" target)
,flags))
- ((#:phases phases)
- `(alist-cons-before
- 'configure 'set-cross-kernel-headers-path
- (lambda* (#:key inputs #:allow-other-keys)
- (let* ((kernel (assoc-ref inputs "kernel-headers"))
- (cpath (string-append kernel "/include")))
- (for-each (cut setenv <> cpath)
- '("CROSS_C_INCLUDE_PATH"
- "CROSS_CPLUS_INCLUDE_PATH"
- "CROSS_OBJC_INCLUDE_PATH"
- "CROSS_OBJCPLUS_INCLUDE_PATH"))
- (setenv "CROSS_LIBRARY_PATH"
- (string-append kernel "/lib")) ;for Hurd's libihash
- #t))
- ,phases))))
-
- ;; Shadow the native "kernel-headers" because glibc's recipe expects the
- ;; "kernel-headers" input to point to the right thing.
- (propagated-inputs `(("kernel-headers" ,xheaders)))
-
- ;; FIXME: 'static-bash' should really be an input, not a native input, but
- ;; to do that will require building an intermediate cross libc.
- (inputs '())
+ ((#:phases phases)
+ `(alist-cons-before
+ 'configure 'set-cross-kernel-headers-path
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let* ((kernel (assoc-ref inputs "kernel-headers"))
+ (cpath (string-append kernel "/include")))
+ (for-each (cut setenv <> cpath)
+ '("CROSS_C_INCLUDE_PATH"
+ "CROSS_CPLUS_INCLUDE_PATH"
+ "CROSS_OBJC_INCLUDE_PATH"
+ "CROSS_OBJCPLUS_INCLUDE_PATH"))
+ (setenv "CROSS_LIBRARY_PATH"
+ (string-append kernel "/lib")) ;for Hurd's libihash
+ #t))
+ ,phases))))
- (native-inputs `(("cross-gcc" ,xgcc)
- ("cross-binutils" ,xbinutils)
- ,@(if (string-match (or "i586-pc-gnu" "i586-gnu") target)
- `(("cross-mig"
- ,@(assoc-ref (package-native-inputs xheaders)
- "cross-mig")))
- '())
- ,@(package-inputs glibc) ;FIXME: static-bash
- ,@(package-native-inputs glibc)))))
+ ;; Shadow the native "kernel-headers" because glibc's recipe expects the
+ ;; "kernel-headers" input to point to the right thing.
+ (propagated-inputs `(("kernel-headers" ,xheaders)))
-\f
-;;;
-;;; Concrete cross toolchains.
-;;;
+ ;; FIXME: 'static-bash' should really be an input, not a native input, but
+ ;; to do that will require building an intermediate cross libc.
+ (inputs '())
+
+ (native-inputs `(("cross-gcc" ,xgcc)
+ ("cross-binutils" ,xbinutils)
+ ,@(if (string-match (or "i586-pc-gnu" "i586-gnu") target)
+ `(("cross-mig"
+ ,@(assoc-ref (package-native-inputs xheaders)
+ "cross-mig")))
+ '())
+ ,@(package-inputs libc) ;FIXME: static-bash
+ ,@(package-native-inputs libc))))))
-(define-public xgcc-mips64el
- (let* ((triplet "mips64el-linux-gnuabi64") ;N64 ABI
- (xgcc (cross-gcc triplet
- (cross-binutils triplet)
- (cross-libc triplet))))
- ;; Don't attempt to build this cross-compiler on i686;
- ;; see <http://bugs.gnu.org/19598>.
- (package (inherit xgcc)
- (supported-systems (fold delete
- (package-supported-systems xgcc)
- '("mips64el-linux" "i686-linux"))))))
-
-(define-public xgcc-xtensa
- ;; Bare-bones Xtensa cross-compiler, used to build the Atheros firmware.
- (cross-gcc "xtensa-elf"))
-
-(define-public xgcc-armhf
- (let* ((triplet "arm-linux-gnueabihf")
- (xgcc (cross-gcc triplet
- (cross-binutils triplet)
- (cross-libc triplet))))
- (package (inherit xgcc)
- (supported-systems (delete "armhf-linux" %supported-systems)))))
-
-;; (define-public xgcc-armel
-;; (let ((triplet "armel-linux-gnueabi"))
+\f
+;;; Concrete cross tool chains are instantiated like this:
+;;
+;; (define-public xgcc-armhf
+;; (let ((triplet "arm-linux-gnueabihf"))
;; (cross-gcc triplet
;; (cross-binutils triplet)
;; (cross-libc triplet))))
+;;
+;;; We don't do that here because we'd be referring to bindings from (gnu
+;;; packages gcc) from the top level, which doesn't play well with circular
+;;; dependencies among modules.