From 61f56da975095071649e48a6e975ffcdd4dd8063 Mon Sep 17 00:00:00 2001 Message-ID: <61f56da975095071649e48a6e975ffcdd4dd8063.1711546964.git.zhengjunjie@iscas.ac.cn> From: Zheng Junjie Date: Sat, 23 Mar 2024 00:17:47 +0800 Subject: [PATCH] gnu: dmraid: Fix cross-compiling * gnu/packages/disk.scm (dmraid) [native-inputs]: When cross compiling, add config, autoconf, automake. [arguments]: When cross compiling, add update-config and fix-rpl_malloc phase. Change-Id: I491c43a6ce2c3fc3aed43ecab9d4a2ab251038bb --- gnu/packages/disk.scm | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/gnu/packages/disk.scm b/gnu/packages/disk.scm index b0117d77ce..35e75d89fe 100644 --- a/gnu/packages/disk.scm +++ b/gnu/packages/disk.scm @@ -27,7 +27,7 @@ ;;; Copyright © 2022 Disseminate Dissent ;;; Copyright © 2023 Timotej Lazar ;;; Copyright © 2023 Morgan Smith -;;; Copyright © 2023 Zheng Junjie <873216071@qq.com> +;;; Copyright © 2023, 2024 Zheng Junjie <873216071@qq.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -1145,7 +1145,13 @@ (define-public dmraid "1n7vsqvh7y6yvil682q129d21yhb0cmvd5fvsbkza7ypd78inhlk")))) (build-system gnu-build-system) (inputs (list lvm2)) - (native-inputs (list which)) + (native-inputs + (append (if (%current-target-system) + (list config + autoconf + automake) + '()) + (list which))) (arguments `(#:tests? #f ; No tests. ;; Prevent a race condition where some target would attempt to link @@ -1158,7 +1164,34 @@ (define-public dmraid (chdir (string-append ,version "/dmraid")) (substitute* "make.tmpl.in" (("/bin/sh") (which "sh"))) - #t))) + #t)) + ,@(if (%current-target-system) + `((add-after 'unpack 'update-config + (lambda* (#:key native-inputs inputs + #:allow-other-keys) + (with-directory-excursion + (string-append ,version "/dmraid/autoconf") + (for-each (lambda (file) + (install-file + (search-input-file + (or native-inputs inputs) + (string-append "/bin/" file)) + ".")) + '("config.guess" "config.sub"))))) + (add-after 'unpack 'fix-rpl_malloc + (lambda _ + ;; AC_FUNC_MALLOC and AC_FUNC_REALLOC usually + ;; unneeded, see + ;; https://lists.gnu.org/archive/html/autoconf/2003-02/msg00017.html + (with-directory-excursion + (string-append ,version "/dmraid") + (substitute* "configure.in" + (("AC_FUNC_MALLOC") "") + (("AC_FUNC_REALLOC") "")) + (delete-file "./configure") + (copy-file "configure.in" "configure.ac") + (invoke "autoreconf" "-fiv"))))) + '())) #:configure-flags (list ;; Make sure programs such as 'dmevent_tool' can ;; find libdmraid.so. (string-append "LDFLAGS=-Wl,-rpath=" base-commit: 656baadf83f2812c0ff79f4f2f0b5f1e927ed8a5 -- 2.41.0