GNU bug report logs - #54239
[PATCH] gnu: Add cross-clang.

Previous Next

Package: guix-patches;

Reported by: Julien Lepiller <julien <at> lepiller.eu>

Date: Thu, 3 Mar 2022 16:04:02 UTC

Severity: normal

Tags: patch

Full log


View this message in rfc822 format

From: Julien Lepiller <julien <at> lepiller.eu>
To: 54239 <at> debbugs.gnu.org
Subject: [bug#54239] [PATCH 1/5] gnu: Add cross-llvm.
Date: Thu,  3 Mar 2022 17:07:43 +0100
* gnu/packages/llvm.scm (cross-llvm): New variable.
---
 gnu/packages/llvm.scm | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index eb949bed1b..d6e9846699 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -18,7 +18,7 @@
 ;;; Copyright © 2020 Jakub Kądziołka <kuba <at> kadziolka.net>
 ;;; Copyright © 2021 Maxime Devos <maximedevos <at> telenet.be>
 ;;; Copyright © 2020, 2021 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
-;;; Copyright © 2021 Julien Lepiller <julien <at> lepiller.eu>
+;;; Copyright © 2021, 2022 Julien Lepiller <julien <at> lepiller.eu>
 ;;; Copyright © 2021 Lars-Dominik Braun <lars <at> 6xq.net>
 ;;; Copyright © 2021 Guillaume Le Vaillant <glv <at> posteo.net>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
@@ -74,7 +74,8 @@ (define-module (gnu packages llvm)
   #:use-module (srfi srfi-1)
   #:use-module (ice-9 match)
   #:export (make-lld-wrapper
-            system->llvm-target))
+            system->llvm-target
+            cross-llvm))
 
 (define* (system->llvm-target #:optional
                               (system (or (and=> (%current-target-system)
@@ -99,6 +100,22 @@ (define* (system->llvm-target #:optional
              ("i686"        => "X86")
              ("i586"        => "X86"))))
 
+(define (cross-llvm llvm target)
+  "Return a native LLVM package that targets a different system.  The resulting
+libraries are running on the host but target a different system by default.
+This packge can be used to control clang's default target."
+  (package
+    (inherit llvm)
+    (arguments
+     (substitute-keyword-arguments (package-arguments llvm)
+      ((#:configure-flags flags)
+       #~(append
+           (list
+             (string-append "-DLLVM_DEFAULT_TARGET_TRIPLE=" #$target)
+             (string-append "-DLLVM_TARGET_ARCH="
+                            #$(system->llvm-target (gnu-triplet->nix-system target))))
+           #$flags))))))
+
 (define (llvm-uri component version)
   ;; LLVM release candidate file names are formatted 'tool-A.B.C-rcN/tool-A.B.CrcN.src.tar.xz'
   ;; so we specify the version as A.B.C-rcN and delete the hyphen when referencing the file name.
-- 
2.34.0





This bug report was last modified 2 years and 329 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.