diff options
author | Marius Bakke <mbakke@fastmail.com> | 2019-07-31 14:28:56 +0200 |
---|---|---|
committer | Marius Bakke <mbakke@fastmail.com> | 2019-07-31 14:28:56 +0200 |
commit | 6a2e54236e1b2c428c8fd478ee0f3bd8130703fa (patch) | |
tree | af70155a2f474d35d90d003f8584b2d9ee0bbaa8 /gnu/packages/llvm.scm | |
parent | 2cf1e37c109c8d03fae75bc84f7012f3afa956e5 (diff) | |
parent | 3d88855dfdcc4c8ce11f494fdf9f0ac1d8eef530 (diff) | |
download | guix-patches-6a2e54236e1b2c428c8fd478ee0f3bd8130703fa.tar guix-patches-6a2e54236e1b2c428c8fd478ee0f3bd8130703fa.tar.gz |
Merge branch 'master' into core-updates
Diffstat (limited to 'gnu/packages/llvm.scm')
-rw-r--r-- | gnu/packages/llvm.scm | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm index 1fe9af38e0..9efb4a4841 100644 --- a/gnu/packages/llvm.scm +++ b/gnu/packages/llvm.scm @@ -46,7 +46,30 @@ #:use-module (gnu packages perl) #:use-module (gnu packages pkg-config) #:use-module (gnu packages python) - #:use-module (gnu packages xml)) + #:use-module (gnu packages xml) + #:export (system->llvm-target)) + +(define* (system->llvm-target #:optional + (system (or (and=> (%current-target-system) + gnu-triplet->nix-system) + (%current-system)))) + "Return the LLVM target name that corresponds to SYSTEM, a system type such +as \"x86_64-linux\"." + ;; See the 'lib/Target' directory of LLVM for a list of supported targets. + (letrec-syntax ((matches (syntax-rules (=>) + ((_ (system-prefix => target) rest ...) + (if (string-prefix? system-prefix system) + target + (matches rest ...))) + ((_) + (error "LLVM target for system is unknown" system))))) + (matches ("aarch64" => "AArch64") + ("armhf" => "ARM") + ("mips64el" => "Mips") + ("powerpc" => "PowerPC") + ("riscv" => "RISCV") + ("x86_64" => "X86") + ("i686" => "X86")))) (define-public llvm-8 (package |