sys-libs/compiler-rt-sanitizers: Add slotted version
authorMichał Górny <mgorny@gentoo.org>
Mon, 30 Jan 2017 08:10:03 +0000 (09:10 +0100)
committerMichał Górny <mgorny@gentoo.org>
Wed, 15 Feb 2017 12:47:17 +0000 (13:47 +0100)
sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-4.0.0_rc1-r1.ebuild [moved from sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-4.0.0_rc1.ebuild with 63% similarity]
sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-9999.ebuild

similarity index 63%
rename from sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-4.0.0_rc1.ebuild
rename to sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-4.0.0_rc1-r1.ebuild
index e80334139e90c10af4c3082febb46cfead430b8b..679d166d733f29b3b46fed1f37f2c4be5a6a7d86 100644 (file)
@@ -9,7 +9,7 @@ EAPI=6
 CMAKE_MIN_VERSION=3.7.0-r1
 PYTHON_COMPAT=( python2_7 )
 
-inherit cmake-utils flag-o-matic python-any-r1
+inherit cmake-utils flag-o-matic python-any-r1 versionator
 
 DESCRIPTION="Compiler runtime libraries for clang (sanitizers & xray)"
 HOMEPAGE="http://llvm.org/"
@@ -17,23 +17,22 @@ SRC_URI="http://www.llvm.org/pre-releases/${PV/_//}/compiler-rt-${PV/_/}.src.tar
        test? ( http://www.llvm.org/pre-releases/${PV/_//}/llvm-${PV/_/}.src.tar.xz )"
 
 LICENSE="|| ( UoI-NCSA MIT )"
-SLOT="0/${PV%.*}"
+SLOT="${PV%_*}"
 KEYWORDS="~amd64 ~arm64 ~x86"
 IUSE="test"
 
-RDEPEND="!<sys-devel/llvm-${PV}"
+LLVM_SLOT=${SLOT%%.*}
+RDEPEND="!=sys-libs/compiler-rt-sanitizers-${SLOT}*:0"
 # llvm-4 needed for --cmakedir
-DEPEND="${RDEPEND}
+DEPEND="
        >=sys-devel/llvm-4
        test? (
                app-portage/unsandbox
                $(python_gen_any_dep "~dev-python/lit-${PV}[\${PYTHON_USEDEP}]")
-               ~sys-devel/clang-${PV}
-               ~sys-libs/compiler-rt-${PV} )
+               =sys-devel/clang-${PV%_*}*:${LLVM_SLOT}
+               sys-libs/compiler-rt:${SLOT} )
        ${PYTHON_DEPS}"
 
-REQUIRED_USE="${PYTHON_REQUIRED_USE}"
-
 S=${WORKDIR}/compiler-rt-${PV/_/}.src
 
 # least intrusive of all
@@ -51,14 +50,11 @@ src_configure() {
        # pre-set since we need to pass it to cmake
        BUILD_DIR=${WORKDIR}/${P}_build
 
-       local llvm_version=$(llvm-config --version) || die
-       local clang_version=$(get_version_component_range 1-3 "${llvm_version}")
-       local libdir=$(get_libdir)
        local mycmakeargs=(
-               -DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${clang_version}"
+               -DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${SLOT}"
                # use a build dir structure consistent with install
                # this makes it possible to easily deploy test-friendly clang
-               -DCOMPILER_RT_OUTPUT_DIR="${BUILD_DIR}/lib/clang/${clang_version}"
+               -DCOMPILER_RT_OUTPUT_DIR="${BUILD_DIR}/lib/clang/${SLOT}"
 
                -DCOMPILER_RT_INCLUDE_TESTS=$(usex test)
                # built-ins installed by sys-libs/compiler-rt
@@ -72,8 +68,8 @@ src_configure() {
                        -DLIT_COMMAND="${EPREFIX}/usr/bin/unsandbox;${EPREFIX}/usr/bin/lit"
 
                        # they are created during src_test()
-                       -DCOMPILER_RT_TEST_COMPILER="${BUILD_DIR}/bin/clang"
-                       -DCOMPILER_RT_TEST_CXX_COMPILER="${BUILD_DIR}/bin/clang++"
+                       -DCOMPILER_RT_TEST_COMPILER="${BUILD_DIR}/lib/llvm/${LLVM_SLOT}/bin/clang"
+                       -DCOMPILER_RT_TEST_CXX_COMPILER="${BUILD_DIR}/lib/llvm/${LLVM_SLOT}/bin/clang++"
                )
 
                # same flags are passed for build & tests, so we need to strip
@@ -84,23 +80,23 @@ src_configure() {
        cmake-utils_src_configure
 
        if use test; then
-               local sys_dir=( "${EPREFIX}/usr/lib/clang/${clang_version}/lib"/* )
+               local sys_dir=( "${EPREFIX}"/usr/lib/clang/${SLOT}/lib/* )
                [[ -e ${sys_dir} ]] || die "Unable to find ${sys_dir}"
-               [[ ${#sys_dir[@]} -eq 1 ]] || die "Non-deterministic compiler-rt install: ${sys_dir[@]}"
+               [[ ${#sys_dir[@]} -eq 1 ]] || die "Non-deterministic compiler-rt install: ${sys_dir[*]}"
 
                # copy clang over since resource_dir is located relatively to binary
                # therefore, we can put our new libraries in it
-               mkdir -p "${BUILD_DIR}"/{bin,$(get_libdir),lib/clang/"${clang_version}"/include} || die
-               cp "${EPREFIX}/usr/bin/clang" "${EPREFIX}/usr/bin/clang++" \
-                       "${BUILD_DIR}"/bin/ || die
-               cp "${EPREFIX}/usr/lib/clang/${clang_version}/include"/*.h \
-                       "${BUILD_DIR}/lib/clang/${clang_version}/include/" || die
+               mkdir -p "${BUILD_DIR}"/lib/{llvm/${LLVM_SLOT}/{bin,$(get_libdir)},clang/${SLOT}/include} || die
+               cp "${EPREFIX}"/usr/lib/llvm/${LLVM_SLOT}/bin/clang{,++} \
+                       "${BUILD_DIR}"/lib/llvm/${LLVM_SLOT}/bin/ || die
+               cp "${EPREFIX}"/usr/lib/clang/${SLOT}/include/*.h \
+                       "${BUILD_DIR}"/lib/clang/${SLOT}/include/ || die
                cp "${sys_dir}"/*builtins*.a \
-                       "${BUILD_DIR}/lib/clang/${clang_version}/lib/${sys_dir##*/}/" || die
+                       "${BUILD_DIR}/lib/clang/${SLOT}/lib/${sys_dir##*/}/" || die
                # we also need LLVMgold.so for gold-based tests
-               if [[ -f ${EPREFIX}/usr/$(get_libdir)/LLVMgold.so ]]; then
-                       ln -s "${EPREFIX}/usr/$(get_libdir)/LLVMgold.so" \
-                               "${BUILD_DIR}/$(get_libdir)/" || die
+               if [[ -f ${EPREFIX}/usr/lib/llvm/${LLVM_SLOT}/$(get_libdir)/LLVMgold.so ]]; then
+                       ln -s "${EPREFIX}"/usr/lib/llvm/${LLVM_SLOT}/$(get_libdir)/LLVMgold.so \
+                               "${BUILD_DIR}"/lib/llvm/${LLVM_SLOT}/$(get_libdir)/ || die
                fi
        fi
 }
index 83addde698481d27e07ab417d7a215d351367aac..6e4198615177810042860cbccdbffaf4d5b63bae 100644 (file)
@@ -9,7 +9,7 @@ EAPI=6
 CMAKE_MIN_VERSION=3.7.0-r1
 PYTHON_COMPAT=( python2_7 )
 
-inherit cmake-utils flag-o-matic git-r3 python-any-r1
+inherit cmake-utils flag-o-matic git-r3 python-any-r1 versionator
 
 DESCRIPTION="Compiler runtime libraries for clang (sanitizers & xray)"
 HOMEPAGE="http://llvm.org/"
@@ -18,23 +18,22 @@ EGIT_REPO_URI="http://llvm.org/git/compiler-rt.git
        https://github.com/llvm-mirror/compiler-rt.git"
 
 LICENSE="|| ( UoI-NCSA MIT )"
-SLOT="0/${PV%.*}"
+# Note: this needs to be updated to match version of clang-9999
+SLOT="5.0.0"
 KEYWORDS=""
 IUSE="test"
 
-RDEPEND="!<sys-devel/llvm-${PV}"
+LLVM_SLOT=${SLOT%%.*}
 # llvm-4 needed for --cmakedir
-DEPEND="${RDEPEND}
+DEPEND="
        >=sys-devel/llvm-4
        test? (
                app-portage/unsandbox
                $(python_gen_any_dep "~dev-python/lit-${PV}[\${PYTHON_USEDEP}]")
-               ~sys-devel/clang-${PV}
-               ~sys-libs/compiler-rt-${PV} )
+               =sys-devel/clang-${PV%_*}*:${LLVM_SLOT}
+               sys-libs/compiler-rt:${SLOT} )
        ${PYTHON_DEPS}"
 
-REQUIRED_USE="${PYTHON_REQUIRED_USE}"
-
 # least intrusive of all
 CMAKE_BUILD_TYPE=RelWithDebInfo
 
@@ -57,14 +56,11 @@ src_configure() {
        # pre-set since we need to pass it to cmake
        BUILD_DIR=${WORKDIR}/${P}_build
 
-       local llvm_version=$(llvm-config --version) || die
-       local clang_version=$(get_version_component_range 1-3 "${llvm_version}")
-       local libdir=$(get_libdir)
        local mycmakeargs=(
-               -DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${clang_version}"
+               -DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${SLOT}"
                # use a build dir structure consistent with install
                # this makes it possible to easily deploy test-friendly clang
-               -DCOMPILER_RT_OUTPUT_DIR="${BUILD_DIR}/lib/clang/${clang_version}"
+               -DCOMPILER_RT_OUTPUT_DIR="${BUILD_DIR}/lib/clang/${SLOT}"
 
                -DCOMPILER_RT_INCLUDE_TESTS=$(usex test)
                # built-ins installed by sys-libs/compiler-rt
@@ -78,8 +74,8 @@ src_configure() {
                        -DLIT_COMMAND="${EPREFIX}/usr/bin/unsandbox;${EPREFIX}/usr/bin/lit"
 
                        # they are created during src_test()
-                       -DCOMPILER_RT_TEST_COMPILER="${BUILD_DIR}/bin/clang"
-                       -DCOMPILER_RT_TEST_CXX_COMPILER="${BUILD_DIR}/bin/clang++"
+                       -DCOMPILER_RT_TEST_COMPILER="${BUILD_DIR}/lib/llvm/${LLVM_SLOT}/bin/clang"
+                       -DCOMPILER_RT_TEST_CXX_COMPILER="${BUILD_DIR}/lib/llvm/${LLVM_SLOT}/bin/clang++"
                )
 
                # same flags are passed for build & tests, so we need to strip
@@ -90,23 +86,23 @@ src_configure() {
        cmake-utils_src_configure
 
        if use test; then
-               local sys_dir=( "${EPREFIX}/usr/lib/clang/${clang_version}/lib"/* )
+               local sys_dir=( "${EPREFIX}"/usr/lib/clang/${SLOT}/lib/* )
                [[ -e ${sys_dir} ]] || die "Unable to find ${sys_dir}"
-               [[ ${#sys_dir[@]} -eq 1 ]] || die "Non-deterministic compiler-rt install: ${sys_dir[@]}"
+               [[ ${#sys_dir[@]} -eq 1 ]] || die "Non-deterministic compiler-rt install: ${sys_dir[*]}"
 
                # copy clang over since resource_dir is located relatively to binary
                # therefore, we can put our new libraries in it
-               mkdir -p "${BUILD_DIR}"/{bin,$(get_libdir),lib/clang/"${clang_version}"/include} || die
-               cp "${EPREFIX}/usr/bin/clang" "${EPREFIX}/usr/bin/clang++" \
-                       "${BUILD_DIR}"/bin/ || die
-               cp "${EPREFIX}/usr/lib/clang/${clang_version}/include"/*.h \
-                       "${BUILD_DIR}/lib/clang/${clang_version}/include/" || die
+               mkdir -p "${BUILD_DIR}"/lib/{llvm/${LLVM_SLOT}/{bin,$(get_libdir)},clang/${SLOT}/include} || die
+               cp "${EPREFIX}"/usr/lib/llvm/${LLVM_SLOT}/bin/clang{,++} \
+                       "${BUILD_DIR}"/lib/llvm/${LLVM_SLOT}/bin/ || die
+               cp "${EPREFIX}"/usr/lib/clang/${SLOT}/include/*.h \
+                       "${BUILD_DIR}"/lib/clang/${SLOT}/include/ || die
                cp "${sys_dir}"/*builtins*.a \
-                       "${BUILD_DIR}/lib/clang/${clang_version}/lib/${sys_dir##*/}/" || die
+                       "${BUILD_DIR}/lib/clang/${SLOT}/lib/${sys_dir##*/}/" || die
                # we also need LLVMgold.so for gold-based tests
-               if [[ -f ${EPREFIX}/usr/$(get_libdir)/LLVMgold.so ]]; then
-                       ln -s "${EPREFIX}/usr/$(get_libdir)/LLVMgold.so" \
-                               "${BUILD_DIR}/$(get_libdir)/" || die
+               if [[ -f ${EPREFIX}/usr/lib/llvm/${LLVM_SLOT}/$(get_libdir)/LLVMgold.so ]]; then
+                       ln -s "${EPREFIX}"/usr/lib/llvm/${LLVM_SLOT}/$(get_libdir)/LLVMgold.so \
+                               "${BUILD_DIR}"/lib/llvm/${LLVM_SLOT}/$(get_libdir)/ || die
                fi
        fi
 }