@@ -89,56 +89,60 @@ (define (contains-keyword? args)
(find keyword? args))
(define* (cross-binutils . args)
+ "Return a cross-Binutils for TARGET using BINUTILS."
(if (or (= (length args) 1) (contains-keyword? args))
(apply cross-binutils* args)
(apply cross-binutils/deprecated args)))
+(define* (cross-binutils* target #:key (binutils binutils))
+ (cross-binutils/implementation target binutils))
+
(define* (cross-binutils/deprecated target #:optional (binutils binutils))
(warning (G_ "'cross-binutils' must be used with keyword arguments~%"))
- (cross-binutils* target #:binutils binutils))
-
-(define* (cross-binutils* target #:key (binutils binutils))
- "Return a cross-Binutils for TARGET using BINUTILS."
- (let ((binutils (package
- (inherit binutils)
- (arguments
- (substitute-keyword-arguments (package-arguments
- binutils)
- ((#:configure-flags flags)
- ;; Build with `--with-sysroot' so that ld honors
- ;; DT_RUNPATH entries when searching for a needed
- ;; library. This works because as a side effect
- ;; `genscripts.sh' sets `USE_LIBPATH=yes', which tells
- ;; elf32.em to use DT_RUNPATH in its search list.
- ;; See <http://sourceware.org/ml/binutils/2013-05/msg00312.html>.
- ;;
- ;; In theory choosing / as the sysroot could lead ld
- ;; to pick up native libs instead of target ones. In
- ;; practice the RUNPATH of target libs only refers to
- ;; target libs, not native libs, so this is safe.
- `(cons "--with-sysroot=/" ,flags)))))))
-
- ;; For Xtensa, apply Qualcomm's patch.
- (cross (cond ((string-prefix? "xtensa-" target)
- (package-with-patches binutils
- (search-patches
- "ath9k-htc-firmware-binutils.patch")))
- ((target-mingw? target)
- (package-with-extra-patches
- (package-with-extra-configure-variable
- ;; mingw binutils does not work correctly when configured
- ;; with `--enable-compressed-debug-sections`. An error
- ;; like the following will occur whenever you try to link:
- ;;
- ;; x86_64-w64-mingw32-ld: final link failed: bad value
- ;;
- ;; TODO: This seems like a deeper problem that warrants
- ;; deeper investigation.
- binutils "--enable-compressed-debug-sections" "no")
- (search-patches "binutils-mingw-w64-timestamp.patch"
- "binutils-mingw-w64-deterministic.patch")))
- (else binutils))
- target)))
+ (cross-binutils/implementation target binutils))
+
+(define cross-binutils/implementation
+ (mlambda (target binutils)
+ (let ((binutils (package
+ (inherit binutils)
+ (arguments
+ (substitute-keyword-arguments (package-arguments
+ binutils)
+ ((#:configure-flags flags)
+ ;; Build with `--with-sysroot' so that ld honors
+ ;; DT_RUNPATH entries when searching for a needed
+ ;; library. This works because as a side effect
+ ;; `genscripts.sh' sets `USE_LIBPATH=yes', which tells
+ ;; elf32.em to use DT_RUNPATH in its search list.
+ ;; See <http://sourceware.org/ml/binutils/2013-05/msg00312.html>.
+ ;;
+ ;; In theory choosing / as the sysroot could lead ld
+ ;; to pick up native libs instead of target ones. In
+ ;; practice the RUNPATH of target libs only refers to
+ ;; target libs, not native libs, so this is safe.
+ `(cons "--with-sysroot=/" ,flags)))))))
+
+ ;; For Xtensa, apply Qualcomm's patch.
+ (cross (cond ((string-prefix? "xtensa-" target)
+ (package-with-patches binutils
+ (search-patches
+ "ath9k-htc-firmware-binutils.patch")))
+ ((target-mingw? target)
+ (package-with-extra-patches
+ (package-with-extra-configure-variable
+ ;; mingw binutils does not work correctly when configured
+ ;; with `--enable-compressed-debug-sections`. An error
+ ;; like the following will occur whenever you try to link:
+ ;;
+ ;; x86_64-w64-mingw32-ld: final link failed: bad value
+ ;;
+ ;; TODO: This seems like a deeper problem that warrants
+ ;; deeper investigation.
+ binutils "--enable-compressed-debug-sections" "no")
+ (search-patches "binutils-mingw-w64-timestamp.patch"
+ "binutils-mingw-w64-deterministic.patch")))
+ (else binutils))
+ target))))
(define (cross-gcc-arguments target xgcc libc)
"Return build system arguments for a cross-gcc for TARGET, using XGCC as the