guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#49025] [PATCH v4 core-updates 34/36] libelf: Use the cross-compiler


From: Maxime Devos
Subject: [bug#49025] [PATCH v4 core-updates 34/36] libelf: Use the cross-compiler when cross-compiling.
Date: Sat, 19 Jun 2021 17:04:56 +0200

* gnu/packages/elf.scm
  (libelf)[arguments]<#:phases>{delete-configure}: Regenerate
  the configure script when cross-compiling.
  (libelf)[arguments]<#:phases>{configure}: Do not replace
  when cross-compiling.
  (libelf)[native-inputs]: Add autoconf when cross-compiling.
---
 gnu/packages/elf.scm | 48 +++++++++++++++++++++++++++++---------------
 1 file changed, 32 insertions(+), 16 deletions(-)

diff --git a/gnu/packages/elf.scm b/gnu/packages/elf.scm
index 0309dd95b5..66c2334e5c 100644
--- a/gnu/packages/elf.scm
+++ b/gnu/packages/elf.scm
@@ -9,6 +9,7 @@
 ;;; Copyright © 2020 Mark Wielaard <mark@klomp.org>
 ;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de>
 ;;; Copyright © 2021 Leo Le Bouter <lle-bout@zaclys.net>
+;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -32,6 +33,7 @@
   #:use-module (guix build-system gnu)
   #:use-module ((guix licenses) #:select (gpl3+ lgpl3+ lgpl2.0+))
   #:use-module (gnu packages)
+  #:use-module (gnu packages autotools)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages gcc)
@@ -205,22 +207,36 @@ static analysis of the ELF binaries at hand.")
     (arguments
      `(#:phases
        (modify-phases %standard-phases
-         (replace 'configure
-           (lambda* (#:key outputs #:allow-other-keys)
-             ;; This old `configure' script doesn't support
-             ;; variables passed as arguments.
-             (let ((out (assoc-ref outputs "out")))
-               (setenv "CONFIG_SHELL" (which "bash"))
-               (invoke "./configure"
-                       (string-append "--prefix=" out)
-                       ,@(if (string=? "powerpc64le-linux"
-                                       (%current-system))
-                             '("--host=powerpc64le-unknown-linux-gnu")
-                             '())
-                       ,@(if (string=? "aarch64-linux"
-                                       (%current-system))
-                             '("--host=aarch64-unknown-linux-gnu")
-                             '()))))))))
+         ,(if (%current-target-system)
+              ;; This old 'configure' script doesn't
+              ;; support cross-compilation well. E.g., it fails
+              ;; to find the cross-compiler.
+              `(add-before 'bootstrap 'delete-configure
+                 (lambda _
+                   (delete-file "configure")))
+              `(replace 'configure
+                 ;; This old `configure' script doesn't support
+                 ;; variables passed as arguments. TODO: would
+                 ;; simply regenerating 'configure' work
+                 ;; well enough, even if compiling natively
+                 ;; on powerpc or aarch64?
+                 (lambda* (#:key outputs #:allow-other-keys)
+                   (let ((out (assoc-ref outputs "out")))
+                     (setenv "CONFIG_SHELL" (which "bash"))
+                     (invoke "./configure"
+                             (string-append "--prefix=" out)
+                             ,@(if (string=? "powerpc64le-linux"
+                                             (%current-system))
+                                   '("--host=powerpc64le-unknown-linux-gnu")
+                                   '())
+                             ,@(if (string=? "aarch64-linux"
+                                             (%current-system))
+                                   '("--host=aarch64-unknown-linux-gnu")
+                                   '())))))))))
+    (native-inputs
+     (if (%current-target-system)
+         `(("autoconf" ,autoconf))
+         '()))
     (home-page (string-append "https://web.archive.org/web/20181111033959/";
                               "http://www.mr511.de/software/english.html";))
     (synopsis "ELF object file access library")
-- 
2.32.0






reply via email to

[Prev in Thread] Current Thread [Next in Thread]