summaryrefslogtreecommitdiff
path: root/gnu/packages/llvm.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-12-16 16:50:36 +0100
committerLudovic Courtès <ludo@gnu.org>2022-01-01 15:23:24 +0100
commit0a767f02d408100b7f834586adb49b0091fef01d (patch)
tree21703251c782013866751bd39ae9381c1818b27c /gnu/packages/llvm.scm
parent2576e2019d2f5049ad3dc51404c7e991af45d1d6 (diff)
gnu: clang: Add 'compiler-cpu-architectures' property.
* gnu/packages/llvm.scm (clang-from-llvm): Add #:properties and honor it. (clang-properties): New procedures. (make-clang-toolchain): Set 'properties' field.
Diffstat (limited to 'gnu/packages/llvm.scm')
-rw-r--r--gnu/packages/llvm.scm71
1 files changed, 70 insertions, 1 deletions
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 3c925bd3c6..dbd3461264 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -155,7 +155,9 @@ compiler. In LLVM this library is called \"compiler-rt\".")
(supported-systems (delete "mips64el-linux" %supported-systems))))
(define* (clang-from-llvm llvm clang-runtime hash
- #:key (patches '()) tools-extra)
+ #:key (patches '()) tools-extra
+ (properties
+ (clang-properties (package-version llvm))))
"Produce Clang with dependencies on LLVM and CLANG-RUNTIME, and applying the
given PATCHES. When TOOLS-EXTRA is given, it must point to the
'clang-tools-extra' tarball, which contains code for 'clang-tidy', 'pp-trace',
@@ -426,10 +428,76 @@ given PATCHES. When TOOLS-EXTRA is given, it must point to the
Objective-C++ programming languages. It uses LLVM as its back end. The Clang
project includes the Clang front end, the Clang static analyzer, and several
code analysis tools.")
+ (properties properties)
(license (if (version>=? version "9.0")
license:asl2.0 ;with LLVM exceptions
license:ncsa))))
+(define (clang-properties version)
+ "Return package properties for Clang VERSION."
+ `((compiler-cpu-architectures
+ ("x86_64"
+ ;; This list was obtained by running:
+ ;;
+ ;; guix shell clang -- llc -march=x86-64 -mattr=help
+ ;;
+ ;; filtered from uninteresting entries such as "i686" and "pentium".
+ ,@(if (version>=? version "10.0") ;TODO: refine
+ '("atom"
+ "barcelona"
+ "bdver1"
+ "bdver2"
+ "bdver3"
+ "bdver4"
+ "bonnell"
+ "broadwell"
+ "btver1"
+ "btver2"
+ "c3"
+ "c3-2"
+ "cannonlake"
+ "cascadelake"
+ "cooperlake"
+ "core-avx-i"
+ "core-avx2"
+ "core2"
+ "corei7"
+ "corei7-avx"
+ "generic"
+ "geode"
+ "goldmont"
+ "goldmont-plus"
+ "haswell"
+ "icelake-client"
+ "icelake-server"
+ "ivybridge"
+ "k8"
+ "k8-sse3"
+ "knl"
+ "knm"
+ "lakemont"
+ "nehalem"
+ "nocona"
+ "opteron"
+ "opteron-sse3"
+ "sandybridge"
+ "silvermont"
+ "skx"
+ "skylake"
+ "skylake-avx512"
+ "slm"
+ "tigerlake"
+ "tremont"
+ "westmere"
+ "x86-64"
+ "x86-64-v2"
+ "x86-64-v3"
+ "x86-64-v4"
+ "znver1"
+ "znver2"
+ "znver3")
+ '())))))
+
(define (make-clang-toolchain clang)
(package
(name (string-append (package-name clang) "-toolchain"))
@@ -471,6 +539,7 @@ code analysis tools.")
(search-paths (package-search-paths clang))
(license (package-license clang))
+ (properties (package-properties clang)) ;for 'compiler-cpu-architectures'
(home-page "https://clang.llvm.org")
(synopsis "Complete Clang toolchain for C/C++ development")
(description "This package provides a complete Clang toolchain for C/C++