sys-devel/clang: Obtain version from llvm-config
authorMichał Górny <mgorny@gentoo.org>
Sat, 14 Jan 2017 14:43:27 +0000 (15:43 +0100)
committerMichał Górny <mgorny@gentoo.org>
Sat, 14 Jan 2017 18:12:30 +0000 (19:12 +0100)
Obtain the clang version that is used for paths and executable names
from llvm-config, instead of hardcoding it in ebuild. This matches
the method used in upstream code (obtaining it from CMake files),
and works both for release and live ebuilds.

sys-devel/clang/clang-9999.ebuild

index 9baefac5751fa6e110c5f64041a9cc3c5a049129..9e4abc9388ec213d3483c483e8b6d17c1b519ed4 100644 (file)
@@ -131,8 +131,8 @@ src_prepare() {
 }
 
 multilib_src_configure() {
-       # TODO: read it?
-       local clang_version=4.0.0
+       local llvm_version=$(llvm-config --version) || die
+       local clang_version=$(get_version_component_range 1-3 "${llvm_version}")
        local libdir=$(get_libdir)
        local mycmakeargs=(
                -DLLVM_LIBDIR_SUFFIX=${libdir#lib}
@@ -222,7 +222,9 @@ src_install() {
        mv "${ED}usr/include/clangrt" "${ED}usr/lib/clang" || die
 
        # Apply CHOST and version suffix to clang tools
-       local clang_version=4.0
+       # note: we use two version components here (vs 3 in runtime path)
+       local llvm_version=$(llvm-config --version) || die
+       local clang_version=$(get_version_component_range 1-2 "${llvm_version}")
        local clang_tools=( clang clang++ clang-cl clang-cpp )
        local abi i