From mboxrd@z Thu Jan 1 00:00:00 1970 From: csanchezdll@gmail.com (Carlos =?utf-8?Q?S=C3=A1nchez?= de La Lama) Subject: [PATCH] gnu: bootstrap-tarballs: Cross-compile for powerpc-linux-gnu. Date: Tue, 29 Nov 2016 08:32:28 +0100 Message-ID: <7ta8ci68s3.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35639) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cBcv2-0006dR-Ft for guix-devel@gnu.org; Tue, 29 Nov 2016 02:33:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cBcuy-0004SA-GJ for guix-devel@gnu.org; Tue, 29 Nov 2016 02:33:36 -0500 Received: from mail-wm0-f44.google.com ([74.125.82.44]:36745) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cBcuy-0004Ru-7d for guix-devel@gnu.org; Tue, 29 Nov 2016 02:33:32 -0500 Received: by mail-wm0-f44.google.com with SMTP id g23so228661464wme.1 for ; Mon, 28 Nov 2016 23:33:31 -0800 (PST) Received: from boole (galileo.kdpof.com. [88.26.201.16]) by smtp.gmail.com with ESMTPSA id d17sm66073970wjr.14.2016.11.28.23.32.29 for (version=TLS1_1 cipher=AES128-SHA bits=128/128); Mon, 28 Nov 2016 23:32:29 -0800 (PST) List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org * 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 ;; . - (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