summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAustin English <wizardedit@gentoo.org>2016-06-27 16:58:07 -0500
committerAustin English <wizardedit@gentoo.org>2016-07-01 13:42:09 -0500
commit6597a608fe6462be6f7736bc0b28c4288b488779 (patch)
treea4b278918e02de94084cd7df0b8452d5e6214e60 /eclass/toolchain-funcs.eclass
parenteclass/toolchain-funcs: avoid backticks (diff)
downloadgentoo-6597a608fe6462be6f7736bc0b28c4288b488779.tar.gz
gentoo-6597a608fe6462be6f7736bc0b28c4288b488779.tar.bz2
gentoo-6597a608fe6462be6f7736bc0b28c4288b488779.zip
eclass/toolchain-funcs: add clang version functions
Diffstat (limited to 'eclass/toolchain-funcs.eclass')
-rw-r--r--eclass/toolchain-funcs.eclass33
1 files changed, 33 insertions, 0 deletions
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index fb8b2f92742c..9bb5232d2f9f 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -642,6 +642,39 @@ gcc-micro-version() {
_gcc_fullversion '$3' "$@"
}
+# Internal func. Based on _gcc_fullversion() above.
+_clang_fullversion() {
+ local ver="$1"; shift
+ set -- $($(tc-getCPP "$@") -E -P - <<<"__clang_major__ __clang_minor__ __clang_patchlevel__")
+ eval echo "$ver"
+}
+
+# @FUNCTION: clang-fullversion
+# @RETURN: compiler version (major.minor.micro: [3.4.6])
+clang-fullversion() {
+ _clang_fullversion '$1.$2.$3' "$@"
+}
+# @FUNCTION: clang-version
+# @RETURN: compiler version (major.minor: [3.4].6)
+clang-version() {
+ _clang_fullversion '$1.$2' "$@"
+}
+# @FUNCTION: clang-major-version
+# @RETURN: major compiler version (major: [3].4.6)
+clang-major-version() {
+ _clang_fullversion '$1' "$@"
+}
+# @FUNCTION: clang-minor-version
+# @RETURN: minor compiler version (minor: 3.[4].6)
+clang-minor-version() {
+ _clang_fullversion '$2' "$@"
+}
+# @FUNCTION: clang-micro-version
+# @RETURN: micro compiler version (micro: 3.4.[6])
+clang-micro-version() {
+ _clang_fullversion '$3' "$@"
+}
+
# Returns the installation directory - internal toolchain
# function for use by _gcc-specs-exists (for flag-o-matic).
_gcc-install-dir() {