[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCHES] Use 'gcc-configure-flags-for-triplet' for native compilers too
From: |
Mark H Weaver |
Subject: |
[PATCHES] Use 'gcc-configure-flags-for-triplet' for native compilers too |
Date: |
Wed, 07 Jan 2015 10:25:45 -0500 |
Hello Guix,
These two patches change the 'gcc' packages so that the result of
'gcc-configure-flags-for-triplet' is passed to GCC's configure in all
cases. Previously, they were only used when building cross compilers.
On ARM, these extra flags are always needed to specify the hard-float
ABI and the default code generation options.
These are for core-updates, obviously. Comments and suggestions
welcome!
Mark
>From ed1644c06ce49658ba7399928512eaaaefcdffb3 Mon Sep 17 00:00:00 2001
From: Mark H Weaver <address@hidden>
Date: Wed, 31 Dec 2014 03:47:40 -0500
Subject: [PATCH 1/2] Move 'nix-system->gnu-triplet' to (guix utils) and export
it.
* gnu/packages/commencement.scm (nix-system->gnu-triplet): Move to...
* guix/utils.scm (nix-system->gnu-triplet): ... here. Fix docstring typo.
---
gnu/packages/commencement.scm | 13 -------------
guix/utils.scm | 14 ++++++++++++++
2 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 20831de..e6d03b1 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -122,19 +122,6 @@
("file" ,file-boot0)
,@%bootstrap-inputs))
-(define* (nix-system->gnu-triplet
- #:optional (system (%current-system)) (vendor "unknown"))
- "Return an a guess of the GNU triplet corresponding to Nix system
-identifier SYSTEM."
- (let* ((dash (string-index system #\-))
- (arch (substring system 0 dash))
- (os (substring system (+ 1 dash))))
- (string-append arch
- "-" vendor "-"
- (if (string=? os "linux")
- "linux-gnu"
- os))))
-
(define* (boot-triplet #:optional (system (%current-system)))
;; Return the triplet used to create the cross toolchain needed in the
;; first bootstrapping stage.
diff --git a/guix/utils.scm b/guix/utils.scm
index d0d2e8a..7ac586b 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -61,6 +61,7 @@
location-column
source-properties->location
+ nix-system->gnu-triplet
gnu-triplet->nix-system
%current-system
%current-target-system
@@ -476,6 +477,19 @@ previous value of the keyword argument."
(()
(reverse before)))))))
+(define* (nix-system->gnu-triplet
+ #:optional (system (%current-system)) (vendor "unknown"))
+ "Return a guess of the GNU triplet corresponding to Nix system
+identifier SYSTEM."
+ (let* ((dash (string-index system #\-))
+ (arch (substring system 0 dash))
+ (os (substring system (+ 1 dash))))
+ (string-append arch
+ "-" vendor "-"
+ (if (string=? os "linux")
+ "linux-gnu"
+ os))))
+
(define (gnu-triplet->nix-system triplet)
"Return the Nix system type corresponding to TRIPLET, a GNU triplet as
returned by `config.guess'."
--
2.1.2
>From 8ca1e958b2efe26ba7b7b90afe321b81248e6636 Mon Sep 17 00:00:00 2001
From: Mark H Weaver <address@hidden>
Date: Wed, 7 Jan 2015 15:00:44 +0000
Subject: [PATCH 2/2] gnu: gcc: Use 'gcc-configure-flags-for-triplet' for
native compilers too.
* gnu/packages/gcc.scm (gcc-configure-flags-for-triplet): Do not export it.
(gcc-4.7): Pass the result of 'gcc-configure-flags-for-triplet' to configure
for all builds, including native ones.
---
gnu/packages/cross-base.scm | 1 -
gnu/packages/gcc.scm | 12 ++++++------
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 0f32c9f..a9ae5ee 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -88,7 +88,6 @@ may be either a libc package or #f.)"
(substitute-keyword-arguments (package-arguments gcc-4.8)
((#:configure-flags flags)
`(append (list ,(string-append "--target=" target)
- ,@(gcc-configure-flags-for-triplet target)
,@(if libc
'()
`( ;; Disable features not needed at this stage.
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 02de128..e21f958 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -35,7 +35,7 @@
;; Base URL for GCC's infrastructure.
"ftp://gcc.gnu.org/pub/gcc/infrastructure/")
-(define-public (gcc-configure-flags-for-triplet 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.,
@@ -101,11 +101,11 @@ where the OS part is overloaded to denote a specific
ABI---into GCC
"/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)
- '())
+ ;; Pass the right options for the target triplet.
+ (let ((triplet
+ (or (%current-target-system)
+ (nix-system->gnu-triplet (%current-system)))))
+ (gcc-configure-flags-for-triplet triplet))
(maybe-target-tools))))))
(package
--
2.1.2
- [PATCHES] Use 'gcc-configure-flags-for-triplet' for native compilers too,
Mark H Weaver <=