summary refs log tree commit diff
path: root/gnu/packages/gcc.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/gcc.scm')
-rw-r--r--gnu/packages/gcc.scm23
1 files changed, 22 insertions, 1 deletions
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index b297ef1fb1..bba35901a2 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -25,12 +25,27 @@
   #:use-module (gnu packages multiprecision)
   #:use-module (guix packages)
   #:use-module (guix download)
-  #:use-module (guix build-system gnu))
+  #:use-module (guix build-system gnu)
+  #:use-module (ice-9 regex))
 
 (define %gcc-infrastructure
   ;; Base URL for GCC's 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
   (let* ((stripped? #t)                           ; TODO: make this a parameter
          (maybe-target-tools
@@ -64,6 +79,12 @@
                                            "/include")
                             "--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))))))
     (package
       (name "gcc")