diff options
author | Maxime Devos <maximedevos@telenet.be> | 2021-09-23 23:08:25 +0200 |
---|---|---|
committer | Mathieu Othacehe <othacehe@gnu.org> | 2021-09-27 18:36:00 +0000 |
commit | 211c3ac4239e05fc98aa5577d65b96ba6aef8d2b (patch) | |
tree | 83af77f679a3851bf4c42abae5d45a906f416e67 /gnu/packages/llvm.scm | |
parent | de47a6e13baaf285deab339a7969fc7ee48e99b2 (diff) | |
download | guix-211c3ac4239e05fc98aa5577d65b96ba6aef8d2b.tar.gz |
gnu: llvm: Let it cross-compile.
The derivation when compiling natively remains the same, so this doesn't cause any rebuilds. * gnu/packages/llvm.scm (llvm-12)[arguments]<#:configure-flags>: Set LLVM_TABLEGEN, LLVM_DEFAULT_TARGET_TRIPLE, LLVM_TARGET_ARCH and LLVM_TARGETS_TO_BUILD when cross-compiling. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
Diffstat (limited to 'gnu/packages/llvm.scm')
-rw-r--r-- | gnu/packages/llvm.scm | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm index 7cfa02ec99..3d62965cb8 100644 --- a/gnu/packages/llvm.scm +++ b/gnu/packages/llvm.scm @@ -17,6 +17,7 @@ ;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org> ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net> ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com> +;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be> ;;; Copyright © 2021 Julien Lepiller <julien@lepiller.eu> ;;; Copyright © 2021 Lars-Dominik Braun <lars@6xq.net> ;;; @@ -39,6 +40,7 @@ #:use-module (guix packages) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix download) + #:use-module (guix gexp) #:use-module (guix git-download) #:use-module (guix memoization) #:use-module (guix utils) @@ -498,13 +500,30 @@ output), and Binutils.") (propagated-inputs `(("zlib" ,zlib))) ;to use output from llvm-config (arguments - `(#:configure-flags '("-DCMAKE_SKIP_BUILD_RPATH=FALSE" - "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE" - "-DBUILD_SHARED_LIBS:BOOL=TRUE" - "-DLLVM_ENABLE_FFI:BOOL=TRUE" - "-DLLVM_REQUIRES_RTTI=1" ; For some third-party utilities - "-DLLVM_INSTALL_UTILS=ON") ; Needed for rustc. - + ;; TODO(core-updates): Unconditionally use quasiquote + `(#:configure-flags + ,#~(#$(if (%current-target-system) + #~quasiquote + #~quote) + ;; These options are required for cross-compiling LLVM according to + ;; https://llvm.org/docs/HowToCrossCompileLLVM.html. + (#$@(if (%current-target-system) + #~(,(string-append "-DLLVM_TABLEGEN=" + #+(file-append this-package + "/bin/llvm-tblgen")) + #$(string-append "-DLLVM_DEFAULT_TARGET_TRIPLE=" + (%current-target-system)) + #$(string-append "-DLLVM_TARGET_ARCH=" + (system->llvm-target)) + #$(string-append "-DLLVM_TARGETS_TO_BUILD=" + (system->llvm-target))) + #~()) + "-DCMAKE_SKIP_BUILD_RPATH=FALSE" + "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE" + "-DBUILD_SHARED_LIBS:BOOL=TRUE" + "-DLLVM_ENABLE_FFI:BOOL=TRUE" + "-DLLVM_REQUIRES_RTTI=1" ; For some third-party utilities + "-DLLVM_INSTALL_UTILS=ON")) ; Needed for rustc. ;; Don't use '-g' during the build, to save space. #:build-type "Release" #:phases |