gnu: gcc: Use `gcc-configure-flags-for-triplet' when cross-compiling GCC.

* gnu/packages/cross-base.scm (gcc-configure-flags-for-triplet): Move to...
* gnu/packages/gcc.scm (gcc-configure-flags-for-triplet): ... here.  New
  procedure.
  (gcc-4.7): Use it when (%current-target-system) is true.
This commit is contained in:
Ludovic Courtès 2013-06-26 23:02:49 +02:00
parent 58ab9f9b8e
commit ca16cb9606
2 changed files with 22 additions and 16 deletions

View File

@ -30,7 +30,6 @@
#:use-module (srfi srfi-1) #:use-module (srfi srfi-1)
#:use-module (srfi srfi-26) #:use-module (srfi srfi-26)
#:use-module (ice-9 match) #:use-module (ice-9 match)
#:use-module (ice-9 regex)
#:export (cross-binutils #:export (cross-binutils
cross-libc cross-libc
cross-gcc)) cross-gcc))
@ -66,20 +65,6 @@
`(cons "--with-sysroot=/" ,flags))))))) `(cons "--with-sysroot=/" ,flags)))))))
(cross binutils target))) (cross binutils target)))
(define (gcc-configure-flags-for-triplet target)
"Return a list of additional GCC `configure' flags for TARGET, a GNU triplet.
The purpose of this procedure is to translate extended GNU triplets---e.g.,
where the OS part is overloaded to denote a specific ABI---into GCC
`configure' options. We take extended GNU triplets that glibc recognizes."
(cond ((string-match "^mips64el.*gnuabin?64$" target)
;; Triplets recognized by glibc as denoting the N64 ABI; see
;; ports/sysdeps/mips/preconfigure.
'("--with-abi=64"))
(else
;; TODO: Add `armel.*gnueabi', `hf', etc.
'())))
(define* (cross-gcc target (define* (cross-gcc target
#:optional (xbinutils (cross-binutils target)) libc) #:optional (xbinutils (cross-binutils target)) libc)
"Return a cross-compiler for TARGET, where TARGET is a GNU triplet. Use "Return a cross-compiler for TARGET, where TARGET is a GNU triplet. Use

View File

@ -25,12 +25,27 @@
#:use-module (gnu packages multiprecision) #:use-module (gnu packages multiprecision)
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (guix download) #:use-module (guix download)
#:use-module (guix build-system gnu)) #:use-module (guix build-system gnu)
#:use-module (ice-9 regex))
(define %gcc-infrastructure (define %gcc-infrastructure
;; Base URL for GCC's infrastructure. ;; Base URL for GCC's infrastructure.
"ftp://gcc.gnu.org/pub/gcc/infrastructure/") "ftp://gcc.gnu.org/pub/gcc/infrastructure/")
(define-public (gcc-configure-flags-for-triplet target)
"Return a list of additional GCC `configure' flags for TARGET, a GNU triplet.
The purpose of this procedure is to translate extended GNU triplets---e.g.,
where the OS part is overloaded to denote a specific ABI---into GCC
`configure' options. We take extended GNU triplets that glibc recognizes."
(cond ((string-match "^mips64el.*gnuabin?64$" target)
;; Triplets recognized by glibc as denoting the N64 ABI; see
;; ports/sysdeps/mips/preconfigure.
'("--with-abi=64"))
(else
;; TODO: Add `armel.*gnueabi', `hf', etc.
'())))
(define-public gcc-4.7 (define-public gcc-4.7
(let* ((stripped? #t) ; TODO: make this a parameter (let* ((stripped? #t) ; TODO: make this a parameter
(maybe-target-tools (maybe-target-tools
@ -64,6 +79,12 @@
"/include") "/include")
"--without-headers"))) "--without-headers")))
;; When cross-compiling GCC, pass the right options for the
;; target triplet.
(or (and=> (%current-target-system)
gcc-configure-flags-for-triplet)
'())
(maybe-target-tools)))))) (maybe-target-tools))))))
(package (package
(name "gcc") (name "gcc")