gnu: gcc: Fix libgcc_s directory in RUNPATH for cross-compiled binaries.

* gnu/packages/gcc.scm (gcc-4.7): Add 'libdir' procedure.  Use it to
  determine the right libdir, including when cross-compiling.  This
  fixes a bug whereby the RUNPATH of cross-compiled binaries would be
  set to $crossgcc/lib instead of $crossgcc/$triplet/lib.
  See <http://hydra.gnu.org/build/354389/nixlog/1/raw> for an example.
This commit is contained in:
Ludovic Courtès 2015-04-02 10:26:15 +02:00
parent c2366e3ce4
commit 7e3c9f741b
1 changed files with 9 additions and 2 deletions

View File

@ -85,6 +85,14 @@ where the OS part is overloaded to denote a specific ABI---into GCC
'("CC" "CXX" "LD" "AR" "NM" "RANLIB" "STRIP")
'("gcc" "g++" "ld" "ar" "nm" "ranlib" "strip"))
'()))))
(libdir
(let ((base '(or (assoc-ref outputs "lib")
(assoc-ref outputs "out"))))
(lambda ()
;; Return the directory that contains lib/libgcc_s.so et al.
(if (%current-target-system)
`(string-append ,base "/" ,(%current-target-system))
base))))
(configure-flags
(lambda ()
;; This is terrible. Since we have two levels of quasiquotation,
@ -185,8 +193,7 @@ where the OS part is overloaded to denote a specific ABI---into GCC
(alist-cons-before
'configure 'pre-configure
(lambda* (#:key inputs outputs #:allow-other-keys)
(let ((libdir (or (assoc-ref outputs "lib")
(assoc-ref outputs "out")))
(let ((libdir ,(libdir))
(libc (assoc-ref inputs "libc")))
(when libc
;; The following is not performed for `--without-headers'