sys-devel/clang: Port 9+ to llvm.org.eclass
authorMichał Górny <mgorny@gentoo.org>
Fri, 1 Nov 2019 17:37:43 +0000 (18:37 +0100)
committerMichał Górny <mgorny@gentoo.org>
Sun, 3 Nov 2019 11:46:14 +0000 (12:46 +0100)
Signed-off-by: Michał Górny <mgorny@gentoo.org>
sys-devel/clang/clang-10.0.0.9999.ebuild
sys-devel/clang/clang-9.0.0.ebuild
sys-devel/clang/clang-9.0.1.9999.ebuild

index 62dad56817217df0d67ac10e456b270e35dd370e..6910230d08e5960af3cb72f7c2e69be5e31c7383 100644 (file)
@@ -4,15 +4,19 @@
 EAPI=7
 
 PYTHON_COMPAT=( python{2_7,3_{5,6,7}} )
-inherit cmake-utils git-r3 llvm multilib-minimal multiprocessing \
+inherit cmake-utils llvm llvm.org multilib-minimal multiprocessing \
        pax-utils python-single-r1 toolchain-funcs
 
 DESCRIPTION="C language family frontend for LLVM"
 HOMEPAGE="https://llvm.org/"
-SRC_URI=""
-EGIT_REPO_URI="https://github.com/llvm/llvm-project.git"
+LLVM_COMPONENTS=( clang clang-tools-extra )
+LLVM_TEST_COMPONENTS=(
+       llvm/lib/Testing/Support
+       llvm/utils/{lit,llvm-lit,unittest}
+)
+llvm.org_set_globals
 # We need extra level of indirection for CLANG_RESOURCE_DIR
-S=${WORKDIR}/x/${P}/clang
+S=${WORKDIR}/x/y/clang
 
 # Keep in sync with sys-devel/llvm
 ALL_LLVM_EXPERIMENTAL_TARGETS=( ARC AVR )
@@ -76,16 +80,10 @@ pkg_setup() {
 
 src_unpack() {
        # create extra parent dir for CLANG_RESOURCE_DIR
-       mkdir -p x || die
-
-       local dirs=( clang clang-tools-extra )
-       use test && dirs+=(
-               llvm/lib/Testing/Support llvm/utils/{lit,llvm-lit,unittest}
-       )
-       git-r3_fetch
-       git-r3_checkout "${EGIT_REPO_URI}" "${WORKDIR}/x/${P}" '' "${dirs[@]}"
-       mv "${WORKDIR}/x/${P}/clang-tools-extra" \
-               "${WORKDIR}/x/${P}/clang/tools/extra" || die
+       mkdir -p x/y || die
+       cd x/y || die
+       llvm.org_src_unpack
+       mv clang-tools-extra clang/tools/extra || die
 }
 
 check_distribution_components() {
@@ -242,7 +240,7 @@ multilib_src_configure() {
                -DCLANG_ENABLE_STATIC_ANALYZER=$(usex static-analyzer)
        )
        use test && mycmakeargs+=(
-               -DLLVM_MAIN_SRC_DIR="${WORKDIR}/x/${P}/llvm"
+               -DLLVM_MAIN_SRC_DIR="${WORKDIR}/x/y/llvm"
                -DLLVM_LIT_ARGS="-vv;-j;${LIT_JOBS:-$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")}"
        )
 
index 9d3313fc33df554f6a3536772b656cf1fb7573b1..d6ca87c13d50fd9f0dfe9be0a76c6cc92580f942 100644 (file)
@@ -4,21 +4,21 @@
 EAPI=7
 
 PYTHON_COMPAT=( python{2_7,3_{5,6,7}} )
-inherit cmake-utils llvm multilib-minimal multiprocessing \
+inherit cmake-utils llvm llvm.org multilib-minimal multiprocessing \
        pax-utils python-single-r1 toolchain-funcs
 
-MY_P=cfe-${PV/_/}.src
-EXTRA_P=clang-tools-extra-${PV/_/}.src
-LLVM_P=llvm-${PV/_/}.src
-
 DESCRIPTION="C language family frontend for LLVM"
 HOMEPAGE="https://llvm.org/"
-SRC_URI="https://releases.llvm.org/${PV}/${MY_P}.tar.xz
-       https://releases.llvm.org/${PV}/${EXTRA_P}.tar.xz
-       test? ( https://releases.llvm.org/${PV}/${LLVM_P}.tar.xz )
+SRC_URI="
        !doc? ( https://dev.gentoo.org/~mgorny/dist/llvm/llvm-${PV}-manpages.tar.bz2 )"
+LLVM_COMPONENTS=( clang clang-tools-extra )
+LLVM_TEST_COMPONENTS=(
+       llvm/lib/Testing/Support
+       llvm/utils/{lit,llvm-lit,unittest}
+)
+llvm.org_set_globals
 # We need extra level of indirection for CLANG_RESOURCE_DIR
-S=${WORKDIR}/x/y/${MY_P}
+S=${WORKDIR}/x/y/clang
 
 # Keep in sync with sys-devel/llvm
 ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
@@ -94,24 +94,13 @@ src_unpack() {
        # create extra parent dir for CLANG_RESOURCE_DIR
        mkdir -p x/y || die
        cd x/y || die
-
-       einfo "Unpacking ${MY_P}.tar.xz ..."
-       tar -xf "${DISTDIR}/${MY_P}.tar.xz" || die
-       einfo "Unpacking ${EXTRA_P}.tar.xz ..."
-       tar -xf "${DISTDIR}/${EXTRA_P}.tar.xz" || die
-
-       mv "${EXTRA_P}" "${S}"/tools/extra || die
-       if use test; then
-               einfo "Unpacking parts of ${LLVM_P}.tar.xz ..."
-               tar -xf "${DISTDIR}/${LLVM_P}.tar.xz" \
-                       "${LLVM_P}"/lib/Testing/Support \
-                       "${LLVM_P}"/utils/{lit,llvm-lit,unittest} || die
-               mv "${LLVM_P}" "${WORKDIR}"/llvm || die
-       fi
+       llvm.org_src_unpack
+       mv clang-tools-extra clang/tools/extra || die
 
        if ! use doc; then
-               einfo "Unpacking llvm-${PV}-manpages.tar.bz2 ..."
+               ebegin "Unpacking llvm-${PV}-manpages.tar.bz2"
                tar -xf "${DISTDIR}/llvm-${PV}-manpages.tar.bz2" || die
+               eend
        fi
 }
 
@@ -146,7 +135,7 @@ multilib_src_configure() {
                -DCLANG_ENABLE_STATIC_ANALYZER=$(usex static-analyzer)
        )
        use test && mycmakeargs+=(
-               -DLLVM_MAIN_SRC_DIR="${WORKDIR}/llvm"
+               -DLLVM_MAIN_SRC_DIR="${WORKDIR}/x/y/llvm"
                -DLLVM_LIT_ARGS="-vv;-j;${LIT_JOBS:-$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")}"
        )
 
index 638896ff089a09ba0036b463a44a9a474ab1ef99..1042dac71eef229ded417dd35fee1840e59495b1 100644 (file)
@@ -4,16 +4,19 @@
 EAPI=7
 
 PYTHON_COMPAT=( python{2_7,3_{5,6,7}} )
-inherit cmake-utils git-r3 llvm multilib-minimal multiprocessing \
+inherit cmake-utils llvm llvm.org multilib-minimal multiprocessing \
        pax-utils python-single-r1 toolchain-funcs
 
 DESCRIPTION="C language family frontend for LLVM"
 HOMEPAGE="https://llvm.org/"
-SRC_URI=""
-EGIT_REPO_URI="https://github.com/llvm/llvm-project.git"
-EGIT_BRANCH="release/9.x"
+LLVM_COMPONENTS=( clang clang-tools-extra )
+LLVM_TEST_COMPONENTS=(
+       llvm/lib/Testing/Support
+       llvm/utils/{lit,llvm-lit,unittest}
+)
+llvm.org_set_globals
 # We need extra level of indirection for CLANG_RESOURCE_DIR
-S=${WORKDIR}/x/${P}/clang
+S=${WORKDIR}/x/y/clang
 
 # Keep in sync with sys-devel/llvm
 ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
@@ -84,16 +87,10 @@ pkg_setup() {
 
 src_unpack() {
        # create extra parent dir for CLANG_RESOURCE_DIR
-       mkdir -p x || die
-
-       local dirs=( clang clang-tools-extra )
-       use test && dirs+=(
-               llvm/lib/Testing/Support llvm/utils/{lit,llvm-lit,unittest}
-       )
-       git-r3_fetch
-       git-r3_checkout "${EGIT_REPO_URI}" "${WORKDIR}/x/${P}" '' "${dirs[@]}"
-       mv "${WORKDIR}/x/${P}/clang-tools-extra" \
-               "${WORKDIR}/x/${P}/clang/tools/extra" || die
+       mkdir -p x/y || die
+       cd x/y || die
+       llvm.org_src_unpack
+       mv clang-tools-extra clang/tools/extra || die
 }
 
 multilib_src_configure() {
@@ -127,7 +124,7 @@ multilib_src_configure() {
                -DCLANG_ENABLE_STATIC_ANALYZER=$(usex static-analyzer)
        )
        use test && mycmakeargs+=(
-               -DLLVM_MAIN_SRC_DIR="${WORKDIR}/x/${P}/llvm"
+               -DLLVM_MAIN_SRC_DIR="${WORKDIR}/x/y/llvm"
                -DLLVM_LIT_ARGS="-vv;-j;${LIT_JOBS:-$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")}"
        )