From 18646591894aac4a33ba6ebe761cd06038f3fc8b Mon Sep 17 00:00:00 2001 From: Zheng Junjie Date: Mon, 9 Sep 2024 18:00:11 +0800 Subject: [PATCH] gnu: freeipmi: Fix cross-compilation to riscv64-linux-gnu. * gnu/packages/freeipmi.scm (freeipmi)[arguments]: When cross-compilation to riscv64-linux-gnu, add update-config-scripts phase. [native-inputs]: When cross compiling to riscv64-linux-gnu, add config. Change-Id: I0059d2048524b476703514ddbe111870257f4ac6 --- gnu/packages/freeipmi.scm | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/gnu/packages/freeipmi.scm b/gnu/packages/freeipmi.scm index 55ffa6a53b..d5fdae13ab 100644 --- a/gnu/packages/freeipmi.scm +++ b/gnu/packages/freeipmi.scm @@ -20,9 +20,12 @@ (define-module (gnu packages freeipmi) #:use-module (guix packages) + #:use-module (guix utils) + #:use-module (guix gexp) #:use-module (guix licenses) #:use-module (guix download) #:use-module (guix build-system gnu) + #:use-module (gnu packages autotools) #:use-module (gnu packages gnupg)) (define-public freeipmi @@ -38,13 +41,32 @@ (define-public freeipmi "1dgd2izbp6mqk7l0bgw9fkpvl4mjz672p8baz3ac9k5pfrfaqg8s")))) (build-system gnu-build-system) (arguments - `(#:configure-flags '("--disable-static" - ,@(if (%current-target-system) - ;; We cannot check for these devices - ;; when cross compiling. - `("ac_cv_file__dev_random=yes" - "ac_cv_file__dev_urandom=yes") - '())))) + (append (if (and (%current-target-system) + (target-riscv64?)) + (list #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'update-config-scripts + (lambda* (#:key inputs native-inputs #:allow-other-keys) + ;; Replace outdated config.guess and config.sub. + (for-each (lambda (file) + (install-file + (search-input-file + (or native-inputs inputs) + (string-append "/bin/" file)) "config")) + '("config.guess" "config.sub")))))) + '()) + `(#:configure-flags '("--disable-static" + ,@(if (%current-target-system) + ;; We cannot check for these devices + ;; when cross compiling. + `("ac_cv_file__dev_random=yes" + "ac_cv_file__dev_urandom=yes") + '()))))) + (native-inputs + (if (and (%current-target-system) + (target-riscv64?)) + (list config) + '())) (inputs (list libgcrypt)) (home-page "https://www.gnu.org/software/freeipmi/")