mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-12 22:26:40 -05:00
gnu: cross-gcc: Enable multilib for AVR.
* gnu/build/cross-toolchain.scm (patch-multilib-shebang): New procedure. * gnu/packages/avr.scm (make-avr-gcc): Remove uneeded phases and flags for multilib. * gnu/packages/cross-base (cross-gcc-arguments) <#:configure-flags> [target-avr?]: Remove --disable-multilib and add --enable-multilib. Change-Id: Id68d803057ac898f0a670f10487b08bf0891ab0b Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
This commit is contained in:
parent
a075ac8854
commit
9095e10620
3 changed files with 20 additions and 16 deletions
|
@ -48,6 +48,12 @@ (define %gcc-cross-include-paths
|
||||||
;; Search path for target headers when cross-compiling.
|
;; Search path for target headers when cross-compiling.
|
||||||
(map (cut string-append "CROSS_" <>) %gcc-include-paths))
|
(map (cut string-append "CROSS_" <>) %gcc-include-paths))
|
||||||
|
|
||||||
|
(define* (patch-genmultilib-shebang #:key inputs native-inputs #:allow-other-keys)
|
||||||
|
"Patch-shebang in the gcc/genmultilib file doesn't work as it contains several
|
||||||
|
scripts inside, each with a #!/bin/sh that needs patching."
|
||||||
|
(substitute* "gcc/genmultilib"
|
||||||
|
(("#!/bin/sh") (string-append "#!" (which "sh")))))
|
||||||
|
|
||||||
(define* (make-cross-binutils-visible #:key outputs inputs target
|
(define* (make-cross-binutils-visible #:key outputs inputs target
|
||||||
#:allow-other-keys)
|
#:allow-other-keys)
|
||||||
"Create symlinks for 'as', 'nm', and 'ld' in the \"out\" output, under
|
"Create symlinks for 'as', 'nm', and 'ld' in the \"out\" output, under
|
||||||
|
@ -173,6 +179,8 @@ (define* (cross-gcc-build-phases target
|
||||||
"Modify PHASES to include everything needed to build a cross-GCC for TARGET,
|
"Modify PHASES to include everything needed to build a cross-GCC for TARGET,
|
||||||
a target triplet."
|
a target triplet."
|
||||||
(modify-phases phases
|
(modify-phases phases
|
||||||
|
(add-after 'unpack 'patch-genmultilib-shebang
|
||||||
|
patch-genmultilib-shebang)
|
||||||
(add-before 'configure 'set-cross-path
|
(add-before 'configure 'set-cross-path
|
||||||
;; This mingw32 target checking logic should match that of target-mingw?
|
;; This mingw32 target checking logic should match that of target-mingw?
|
||||||
;; in (guix utils), but (guix utils) is too large too copy over to the
|
;; in (guix utils), but (guix utils) is too large too copy over to the
|
||||||
|
|
|
@ -77,18 +77,7 @@ (define* (make-avr-gcc/implementation #:key (xgcc gcc))
|
||||||
(format #t
|
(format #t
|
||||||
"environment variable `CPLUS_INCLUDE_PATH' \
|
"environment variable `CPLUS_INCLUDE_PATH' \
|
||||||
changed to ~a~%"
|
changed to ~a~%"
|
||||||
(getenv "CPLUS_INCLUDE_PATH")))))
|
(getenv "CPLUS_INCLUDE_PATH")))))))))
|
||||||
;; Without a working multilib build, the resulting GCC lacks
|
|
||||||
;; support for nearly every AVR chip.
|
|
||||||
(add-after 'unpack 'fix-genmultilib
|
|
||||||
(lambda _
|
|
||||||
;; patch-shebang doesn't work here because there are
|
|
||||||
;; actually several scripts inside this script, each with
|
|
||||||
;; a #!/bin/sh that needs patching.
|
|
||||||
(substitute* "gcc/genmultilib"
|
|
||||||
(("#!/bin/sh") (string-append "#!" (which "sh"))))))))
|
|
||||||
((#:configure-flags flags)
|
|
||||||
#~(delete "--disable-multilib" #$flags))))
|
|
||||||
(native-search-paths
|
(native-search-paths
|
||||||
(list (search-path-specification
|
(list (search-path-specification
|
||||||
(variable "CROSS_C_INCLUDE_PATH")
|
(variable "CROSS_C_INCLUDE_PATH")
|
||||||
|
|
|
@ -197,12 +197,19 @@ (define (cross-gcc-arguments target xgcc libc)
|
||||||
#~((string-append "--with-toolexeclibdir="
|
#~((string-append "--with-toolexeclibdir="
|
||||||
(assoc-ref %outputs "lib")
|
(assoc-ref %outputs "lib")
|
||||||
"/" #$target "/lib"))
|
"/" #$target "/lib"))
|
||||||
|
#~())
|
||||||
|
|
||||||
|
#$@(if (target-avr? target)
|
||||||
|
#~("--enable-multilib")
|
||||||
#~()))
|
#~()))
|
||||||
|
|
||||||
#$(if libc
|
(remove
|
||||||
flags
|
(lambda (flag)
|
||||||
#~(remove (cut string-match "--enable-languages.*" <>)
|
(or (and #$libc
|
||||||
#$flags))))
|
(string-prefix? "--enable-languages" flag))
|
||||||
|
(and #$(target-avr? target)
|
||||||
|
(string=? flag "--disable-multilib"))))
|
||||||
|
#$flags)))
|
||||||
((#:make-flags flags)
|
((#:make-flags flags)
|
||||||
(if libc
|
(if libc
|
||||||
#~(let ((libc (assoc-ref %build-inputs "libc")))
|
#~(let ((libc (assoc-ref %build-inputs "libc")))
|
||||||
|
|
Loading…
Reference in a new issue