unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Zheng Junjie <zhengjunjie@iscas.ac.cn>
To: 72543@debbugs.gnu.org
Subject: [bug#72543] [PATCH] gnu: cpu-features: Fix cross-compilation.
Date: Fri,  9 Aug 2024 22:07:05 +0800	[thread overview]
Message-ID: <a1a658989ed4df6ffadd49eadadbea66eab2abc1.1723212425.git.zhengjunjie@iscas.ac.cn> (raw)

* gnu/packages/assembly.scm (cpu-features)[arguments]<#:configure-flags>: When
cross-compilation, set CMAKE_SYSTEM_PROCESSOR.

Change-Id: I8b6f9bdeac66b85ab273f81a320e4b8e0d69b5d0
---
 gnu/packages/assembly.scm | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/assembly.scm b/gnu/packages/assembly.scm
index b7ccb153d3..5b2518277c 100644
--- a/gnu/packages/assembly.scm
+++ b/gnu/packages/assembly.scm
@@ -14,6 +14,7 @@
 ;;; Copyright © 2022 Felix Gruber <felgru@posteo.net>
 ;;; Copyright © 2023 Simon South <simon@simonsouth.net>
 ;;; Copyright © 2023 B. Wilson <elaexuotee@wilsonb.com>
+;;; Copyright © 2024 Zheng Junjie <873216071@qq.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -664,7 +665,24 @@ (define-public cpu-features
       #:tests? #f
       #:configure-flags
       #~(list "-DBUILD_TESTING=off" ;; XXX: insists on using bundled googletest
-              "-DBUILD_SHARED_LIBS=ON")))
+              "-DBUILD_SHARED_LIBS=ON"
+              #$@(let ((target (%current-target-system)))
+                   (if target
+                       (cond ((string-prefix? "arm" target)
+                              '("-DCMAKE_SYSTEM_PROCESSOR=arm"))
+                             ((string-prefix? "aarch64" target)
+                              '("-DCMAKE_SYSTEM_PROCESSOR=aarch64"))
+                             ((string-prefix? "i686" target)
+                              '("-DCMAKE_SYSTEM_PROCESSOR=x86"))
+                             ((string-prefix? "x86_64" target)
+                              '("-DCMAKE_SYSTEM_PROCESSOR=x86_64"))
+                             ;; 32-bit and 64-bit
+                             ((string-prefix? "powerpc" target)
+                              '("-DCMAKE_SYSTEM_PROCESSOR=powerpc"))
+                             ((string-prefix? "riscv64" target)
+                              '("-DCMAKE_SYSTEM_PROCESSOR=riscv64"))
+                             (else '()))
+                       '())))))
     (home-page "https://github.com/google/cpu_features")
     (synopsis "Cross platform C99 library to get cpu features at runtime")
     (description

base-commit: 20dbf225f332ccc707578263ed710dcf2a8fb78e
-- 
2.45.2





             reply	other threads:[~2024-08-09 14:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-09 14:07 Zheng Junjie [this message]
2024-08-14 10:13 ` bug#72543: [PATCH] gnu: cpu-features: Fix cross-compilation Christopher Baines

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a1a658989ed4df6ffadd49eadadbea66eab2abc1.1723212425.git.zhengjunjie@iscas.ac.cn \
    --to=zhengjunjie@iscas.ac.cn \
    --cc=72543@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).