all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] gnu: bootstrap-tarballs: Cross-compile for powerpc-linux-gnu.
@ 2016-11-29  7:32 Carlos Sánchez de La Lama
  2016-11-29  7:38 ` Carlos Sánchez de La Lama
  2017-01-04 23:02 ` Ludovic Courtès
  0 siblings, 2 replies; 5+ messages in thread
From: Carlos Sánchez de La Lama @ 2016-11-29  7:32 UTC (permalink / raw)
  To: guix-devel


* gnu/packages/bootstrap.scm (glib-dynamic-linker): Add value for
powerpc-linux.
* gnu/packages/linux.scm (system->defconfig): New procedure.
(linux-libre-headers): Use system->defconfig.
* gnu/packages/cross-base.scm (xlinux-headers): Use system->defconfig.
* gnu/packages/gcc.scm (gcc-4.7): Add powerpc specific substitutions for
dynamic linker and start files locations.
* gnu/packages/make-bootstrap.scm (%gcc-static): Remove -lgcc_s added in
powerpc specific substitutions.
---
 gnu/packages/bootstrap.scm      |  1 +
 gnu/packages/cross-base.scm     |  3 ++-
 gnu/packages/gcc.scm            | 18 ++++++++++++++++--
 gnu/packages/linux.scm          | 15 ++++++++++++---
 gnu/packages/make-bootstrap.scm |  5 +++--
 5 files changed, 34 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm
index f6faba3..64a8239 100644
--- a/gnu/packages/bootstrap.scm
+++ b/gnu/packages/bootstrap.scm
@@ -168,6 +168,7 @@ successful, or false to signal an error."
         ((string=? system "i586-gnu") "/lib/ld.so.1")
         ((string=? system "i686-gnu") "/lib/ld.so.1")
         ((string=? system "aarch64-linux") "/lib/ld-linux-aarch64.so.1")
+        ((string=? system "powerpc-linux") "/lib/ld.so.1")
 
         ;; XXX: This one is used bare-bones, without a libc, so add a case
         ;; here just so we can keep going.
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index e6553dc..bfff1f2 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -315,7 +315,8 @@ GCC that does not target a libc; otherwise, target that libc."
               (setenv "ARCH" ,(system->linux-architecture target))
               (format #t "`ARCH' set to `~a' (cross compiling)~%" (getenv "ARCH"))
 
-              (and (zero? (system* "make" "defconfig"))
+              (and (zero? (system* "make"
+                                   ,(system->defconfig target)))
                    (zero? (system* "make" "mrproper" "headers_check"))))
             ,phases))))
       (native-inputs `(("cross-gcc" ,xgcc)
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index c26cc4f..cb53272 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -211,7 +211,7 @@ where the OS part is overloaded to denote a specific ABI---into GCC
 
                 ;; Fix the dynamic linker's file name.
                 (substitute* (find-files "gcc/config"
-                                         "^(linux|gnu)(64|-elf|-eabi)?\\.h$")
+                                         "^(linux|gnu|sysv4)(64|-elf|-eabi)?\\.h$")
                   (("#define GLIBC_DYNAMIC_LINKER([^ ]*).*$" _ suffix)
                    (format #f "#define GLIBC_DYNAMIC_LINKER~a \"~a\"~%"
                            suffix
@@ -240,7 +240,21 @@ where the OS part is overloaded to denote a specific ABI---into GCC
                    (format #f "#define STANDARD_STARTFILE_PREFIX_1 \"~a/lib\"
 #define STANDARD_STARTFILE_PREFIX_2 \"\"
 ~a"
-                           libc line))))
+                           libc line)))
+
+              ;; rs6000 (a.k.a. powerpc) config in gcc does not use
+              ;; GNU_USER_* defines. Do the above for this case.
+              (substitute*
+                  "gcc/config/rs6000/sysv4.h"
+                (("#define LIB_LINUX_SPEC (.*)$" _ suffix)
+                 (format #f "#define LIB_LINUX_SPEC \
+\"-L~a/lib %{!static:-rpath=~a/lib %{!static-libgcc:-rpath=~a/lib -lgcc_s}} \" ~a"
+                         libc libc libdir suffix))
+                (("#define	STARTFILE_LINUX_SPEC.*$" line)
+                 (format #f "#define STANDARD_STARTFILE_PREFIX_1 \"~a/lib\"
+#define STANDARD_STARTFILE_PREFIX_2 \"\"
+~a"
+                         libc line))))
 
               ;; Don't retain a dependency on the build-time sed.
               (substitute* "fixincludes/fixincl.x"
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index c504a12..57c11f3 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -98,6 +98,13 @@
           ((string-prefix? "aarch64" arch) "arm64")
           (else arch))))
 
+(define-public (system->defconfig system)
+  "Some systems (notably powerpc-linux) require a special target for kernel
+defconfig. Return the appropiate make target if applicable, otherwise return
+\"defconfig\"."
+  (cond ((string-prefix? "powerpc-" system) "pmac32_defconfig")
+        (else "defconfig")))
+
 (define (linux-libre-urls version)
   "Return a list of URLs for Linux-Libre VERSION."
   (list (string-append
@@ -137,11 +144,13 @@
            (lambda _
              (let ((arch ,(system->linux-architecture
                           (or (%current-target-system)
-                              (%current-system)))))
+                              (%current-system))))
+                   (defconfig ,(system->defconfig
+                               (or (%current-target-system)
+                                   (%current-system)))))
                (setenv "ARCH" arch)
                (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
-
-               (and (zero? (system* "make" "defconfig"))
+               (and (zero? (system* "make" defconfig))
                     (zero? (system* "make" "mrproper" "headers_check"))))))
          (replace 'install
            (lambda* (#:key outputs #:allow-other-keys)
diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm
index f31db6a..b4771a7 100644
--- a/gnu/packages/make-bootstrap.scm
+++ b/gnu/packages/make-bootstrap.scm
@@ -441,8 +441,9 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
                  ;; the 'pre-configure phase of our main gcc package, because
                  ;; that shared library is not present in this static gcc.  See
                  ;; <https://lists.gnu.org/archive/html/guix-devel/2015-01/msg00008.html>.
-                 (substitute* (find-files "gcc/config"
-                                          "^gnu-user.*\\.h$")
+                 (substitute* (cons* "gcc/config/rs6000/sysv4.h"
+                                     (find-files "gcc/config"
+                                                 "^gnu-user.*\\.h$"))
                    ((" -lgcc_s}}") "}}")))
                ,phases)))))
      (native-inputs
-- 
2.9.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-01-05 10:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-29  7:32 [PATCH] gnu: bootstrap-tarballs: Cross-compile for powerpc-linux-gnu Carlos Sánchez de La Lama
2016-11-29  7:38 ` Carlos Sánchez de La Lama
2017-01-04 23:02 ` Ludovic Courtès
2017-01-05  8:35   ` Carlos Sánchez de La Lama
2017-01-05 10:32     ` Ludovic Courtès

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.