gnu: cross-base: Externalize cross-gcc arguments.
* gnu/packages/cross-base.scm (cross-gcc-arguments): New procedure. (cross-gcc): Use it. [No functional change.]
This commit is contained in:
parent
0d5a559f0f
commit
cdb4b4b3ed
1 changed files with 97 additions and 93 deletions
|
@ -66,33 +66,10 @@
|
||||||
`(cons "--with-sysroot=/" ,flags)))))))
|
`(cons "--with-sysroot=/" ,flags)))))))
|
||||||
(cross binutils target)))
|
(cross binutils target)))
|
||||||
|
|
||||||
(define* (cross-gcc target
|
(define (cross-gcc-arguments target libc)
|
||||||
#:optional (xbinutils (cross-binutils target)) libc)
|
"Return build system arguments for a cross-gcc for TARGET, using LIBC (which
|
||||||
"Return a cross-compiler for TARGET, where TARGET is a GNU triplet. Use
|
may be either a libc package or #f.)"
|
||||||
XBINUTILS as the associated cross-Binutils. If LIBC is false, then build a
|
(substitute-keyword-arguments (package-arguments gcc-4.8)
|
||||||
GCC that does not target a libc; otherwise, target that libc."
|
|
||||||
(package (inherit gcc-4.8)
|
|
||||||
(name (string-append "gcc-cross-"
|
|
||||||
(if libc "" "sans-libc-")
|
|
||||||
target))
|
|
||||||
(source (origin (inherit (package-source gcc-4.8))
|
|
||||||
(patches
|
|
||||||
(list (search-patch
|
|
||||||
"gcc-cross-environment-variables.patch")))))
|
|
||||||
|
|
||||||
;; For simplicity, use a single output. Otherwise libgcc_s & co. are not
|
|
||||||
;; found by default, etc.
|
|
||||||
(outputs '("out"))
|
|
||||||
|
|
||||||
(arguments
|
|
||||||
`(#:implicit-inputs? #f
|
|
||||||
#:modules ((guix build gnu-build-system)
|
|
||||||
(guix build utils)
|
|
||||||
(ice-9 regex)
|
|
||||||
(srfi srfi-1)
|
|
||||||
(srfi srfi-26))
|
|
||||||
|
|
||||||
,@(substitute-keyword-arguments (package-arguments gcc-4.8)
|
|
||||||
((#:configure-flags flags)
|
((#:configure-flags flags)
|
||||||
`(append (list ,(string-append "--target=" target)
|
`(append (list ,(string-append "--target=" target)
|
||||||
,@(gcc-configure-flags-for-triplet target)
|
,@(gcc-configure-flags-for-triplet target)
|
||||||
|
@ -101,10 +78,9 @@ GCC that does not target a libc; otherwise, target that libc."
|
||||||
`(;; Disable features not needed at this stage.
|
`(;; Disable features not needed at this stage.
|
||||||
"--disable-shared" "--enable-static"
|
"--disable-shared" "--enable-static"
|
||||||
|
|
||||||
;; Disable C++ because libstdc++'s
|
;; Disable C++ because libstdc++'s configure
|
||||||
;; configure script otherwise fails with
|
;; script otherwise fails with "Link tests are not
|
||||||
;; "Link tests are not allowed after
|
;; allowed after GCC_NO_EXECUTABLES."
|
||||||
;; GCC_NO_EXECUTABLES."
|
|
||||||
"--enable-languages=c"
|
"--enable-languages=c"
|
||||||
|
|
||||||
"--disable-threads" ;libgcc, would need libc
|
"--disable-threads" ;libgcc, would need libc
|
||||||
|
@ -123,8 +99,8 @@ GCC that does not target a libc; otherwise, target that libc."
|
||||||
((#:make-flags flags)
|
((#:make-flags flags)
|
||||||
(if libc
|
(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
|
;; FLAGS_FOR_TARGET are needed for the target libraries to receive
|
||||||
;; receive the -Bxxx for the startfiles.
|
;; the -Bxxx for the startfiles.
|
||||||
(cons (string-append "FLAGS_FOR_TARGET=-B" libc "/lib")
|
(cons (string-append "FLAGS_FOR_TARGET=-B" libc "/lib")
|
||||||
,flags))
|
,flags))
|
||||||
flags))
|
flags))
|
||||||
|
@ -150,8 +126,8 @@ GCC that does not target a libc; otherwise, target that libc."
|
||||||
`(alist-cons-before
|
`(alist-cons-before
|
||||||
'configure 'set-cross-path
|
'configure 'set-cross-path
|
||||||
(lambda* (#:key inputs #:allow-other-keys)
|
(lambda* (#:key inputs #:allow-other-keys)
|
||||||
;; Add the cross Linux headers to CROSS_CPATH, and remove
|
;; Add the cross Linux headers to CROSS_CPATH, and remove them
|
||||||
;; them from CPATH.
|
;; from CPATH.
|
||||||
(let ((libc (assoc-ref inputs "libc"))
|
(let ((libc (assoc-ref inputs "libc"))
|
||||||
(linux (assoc-ref inputs
|
(linux (assoc-ref inputs
|
||||||
"libc/linux-headers")))
|
"libc/linux-headers")))
|
||||||
|
@ -180,11 +156,39 @@ GCC that does not target a libc; otherwise, target that libc."
|
||||||
,phases)
|
,phases)
|
||||||
phases)))
|
phases)))
|
||||||
((#:strip-binaries? _)
|
((#:strip-binaries? _)
|
||||||
;; Disable stripping as this can break binaries, with object files
|
;; Disable stripping as this can break binaries, with object files of
|
||||||
;; of libgcc.a showing up as having an unknown architecture. See
|
;; libgcc.a showing up as having an unknown architecture. See
|
||||||
;; <http://lists.fedoraproject.org/pipermail/arm/2010-August/000663.html>
|
;; <http://lists.fedoraproject.org/pipermail/arm/2010-August/000663.html>
|
||||||
;; for instance.
|
;; for instance.
|
||||||
#f))))
|
#f)))
|
||||||
|
|
||||||
|
(define* (cross-gcc target
|
||||||
|
#:optional (xbinutils (cross-binutils target)) libc)
|
||||||
|
"Return a cross-compiler for TARGET, where TARGET is a GNU triplet. Use
|
||||||
|
XBINUTILS as the associated cross-Binutils. If LIBC is false, then build a
|
||||||
|
GCC that does not target a libc; otherwise, target that libc."
|
||||||
|
(package (inherit gcc-4.8)
|
||||||
|
(name (string-append "gcc-cross-"
|
||||||
|
(if libc "" "sans-libc-")
|
||||||
|
target))
|
||||||
|
(source (origin (inherit (package-source gcc-4.8))
|
||||||
|
(patches
|
||||||
|
(list (search-patch
|
||||||
|
"gcc-cross-environment-variables.patch")))))
|
||||||
|
|
||||||
|
;; For simplicity, use a single output. Otherwise libgcc_s & co. are not
|
||||||
|
;; found by default, etc.
|
||||||
|
(outputs '("out"))
|
||||||
|
|
||||||
|
(arguments
|
||||||
|
`(#:implicit-inputs? #f
|
||||||
|
#:modules ((guix build gnu-build-system)
|
||||||
|
(guix build utils)
|
||||||
|
(ice-9 regex)
|
||||||
|
(srfi srfi-1)
|
||||||
|
(srfi srfi-26))
|
||||||
|
|
||||||
|
,@(cross-gcc-arguments target libc)))
|
||||||
|
|
||||||
(native-inputs
|
(native-inputs
|
||||||
`(("binutils-cross" ,xbinutils)
|
`(("binutils-cross" ,xbinutils)
|
||||||
|
|
Reference in a new issue