diff mbox series

[bug#47182,03/18] gnu: gcc-4.7: On powerpc64le, fix /lib64 references.

Message ID 20210316064511.2891553-3-cmmarusich@gmail.com
State Accepted
Headers show
Series Add support for powerpc64le-linux (wip-ppc64le-for-master) | expand

Checks

Context Check Description
cbaines/submitting builds success
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Christopher Marusich March 16, 2021, 6:44 a.m. UTC
Fixes: <https://bugs.gnu.org/46253>.

* gnu/packages/gcc.scm (gcc-4.7)[#:phases][pre-configure]: When the
gcc/config/rs6000 directory exists, replace "/lib64" with "/lib" in all files
within it.  Note that this fix will be picked up by any package that re-uses
the pre-configure phase from gcc-4.7 (e.g., all the usual gcc packages).
(make-libstdc++)[#:phases][fix-rs6000-libdir]: New phase, which does the same
as above.  It was necessary to duplicate the fix here because make-libstdc++
does not re-use the pre-configure phase from gcc-4.7.
---
 gnu/packages/gcc.scm | 38 +++++++++++++++++++++++++++++++-------
 1 file changed, 31 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 4d5aaa70701..3ea8695cf18 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -3,13 +3,14 @@ 
 ;;; Copyright © 2014, 2015, 2018 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2014, 2015, 2016, 2017, 2019 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
-;;; Copyright © 2015, 2016, 2017, 2018, 2020 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2015, 2016, 2017, 2018, 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016 Carlos Sánchez de La Lama <csanchezdll@gmail.com>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018, 2020 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2020 Joseph LaFreniere <joseph@lafreniere.xyz>
 ;;; Copyright © 2020 Guy Fleury Iteriteka <gfleury@disroot.org>
 ;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
+;;; Copyright © 2021 Chris Marusich <cmmarusich@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -273,6 +274,14 @@  where the OS part is overloaded to denote a specific ABI---into GCC
 ~a"
                                libc line))))
 
+                  ;; TODO: Make this unconditional in core-updates.
+                  ,@(if (target-powerpc?)
+                      `((when (file-exists? "gcc/config/rs6000")
+                          ;; Force powerpc libdir to be /lib and not /lib64
+                          (substitute* (find-files "gcc/config/rs6000")
+                            (("/lib64") "/lib"))))
+                      `())
+
                   ;; Don't retain a dependency on the build-time sed.
                   (substitute* "fixincludes/fixincl.x"
                     (("static char const sed_cmd_z\\[\\] =.*;")
@@ -598,12 +607,27 @@  using compilers other than GCC."
     (name "libstdc++")
     (arguments
      `(#:out-of-source? #t
-       #:phases (alist-cons-before
-                 'configure 'chdir
-                 (lambda _
-                   (chdir "libstdc++-v3")
-                   #t)
-                 %standard-phases)
+       #:phases
+       ;; TODO: Use the target-powerpc arm for everyone.
+        ,(if (target-powerpc?)
+           `(modify-phases %standard-phases
+              ;; Force rs6000 (i.e., powerpc) libdir to be /lib and not /lib64.
+              (add-before 'chdir 'fix-rs6000-libdir
+                (lambda _
+                  (when (file-exists? "gcc/config/rs6000")
+                    (substitute* (find-files "gcc/config/rs6000")
+                      (("/lib64") "/lib")))
+                  #t))
+              (add-before 'configure 'chdir
+                (lambda _
+                  (chdir "libstdc++-v3")
+                  #t)))
+           `(alist-cons-before 'configure 'chdir
+              (lambda _
+                (chdir "libstdc++-v3")
+                #t)
+              %standard-phases))
+
        #:configure-flags `("--disable-libstdcxx-pch"
                            ,(string-append "--with-gxx-include-dir="
                                            (assoc-ref %outputs "out")