public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 1/8] llvm.org.eclass: New eclass to help maintaining LLVM
@ 2019-11-01 17:39 Michał Górny
  2019-11-01 17:39 ` [gentoo-dev] [PATCH 2/8] sys-devel/llvm-common: Port 9+ to llvm.org.eclass Michał Górny
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Michał Górny @ 2019-11-01 17:39 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

llvm.org eclass is meant to provide helper routines for maintaining
LLVM packages.  It takes care of covering the differences between
release, prerelease and git ebuilds in a unified API.  This will make
maintenance much easier.

Initially, the eclass takes care of fetching and unpacking the archives.
Later on, I will work on moving some more common stuff there.

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/llvm.org.eclass | 198 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 198 insertions(+)
 create mode 100644 eclass/llvm.org.eclass

// I'm following this up with a few example updates to ebuilds.  This
// patchset neither covers all ebuilds nor is final.

diff --git a/eclass/llvm.org.eclass b/eclass/llvm.org.eclass
new file mode 100644
index 000000000000..5a704c1d9805
--- /dev/null
+++ b/eclass/llvm.org.eclass
@@ -0,0 +1,198 @@
+# Copyright 2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: llvm.org.eclass
+# @MAINTAINER:
+# Michał Górny <mgorny@gentoo.org>
+# @AUTHOR:
+# Michał Górny <mgorny@gentoo.org>
+# @BLURB: Common bits for fetching & unpacking llvm.org projects
+# @DESCRIPTION:
+# The llvm.org eclass provides common code to fetch and unpack parts
+# of the llvm.org project tree.  It takes care of handling both git
+# checkouts and source tarballs, making it possible to unify the code
+# of live and release ebuilds and effectively reduce the work needed
+# to package new releases/RCs/branches.
+#
+# In order to use this eclass, the ebuild needs to declare
+# LLVM_COMPONENTS and then call llvm.org_set_globals.  If tests require
+# additional components, they need to be listed in LLVM_TEST_COMPONENTS.
+# The eclass exports an implementation of src_unpack() phase.
+#
+# Example:
+# @CODE
+# inherit llvm.org
+#
+# LLVM_COMPONENTS=( lld )
+# LLVM_TEST_COMPONENTS=( llvm/utils/lit )
+# llvm.org_set_globals
+# @CODE
+
+case "${EAPI:-0}" in
+	7)
+		;;
+	*)
+		die "Unsupported EAPI=${EAPI} for ${ECLASS}"
+		;;
+esac
+
+
+# == internal control bits ==
+
+# @ECLASS-VARIABLE: _LLVM_MASTER_MAJOR
+# @INTERNAL
+# @DESCRIPTION:
+# The major version of current LLVM trunk.  Used to determine
+# the correct branch to use.
+_LLVM_MASTER_MAJOR=10
+
+# @ECLASS-VARIABLE: _LLVM_SOURCE_TYPE
+# @INTERNAL
+# @DESCRIPTION:
+# Source type to use: 'git' or 'tar'.
+if [[ -z ${_LLVM_SOURCE_TYPE+1} ]]; then
+	if [[ ${PV} == *.9999 ]]; then
+		_LLVM_SOURCE_TYPE=git
+	else
+		_LLVM_SOURCE_TYPE=tar
+	fi
+fi
+
+[[ ${_LLVM_SOURCE_TYPE} == git ]] && inherit git-r3
+
+[[ ${PV} == ${_LLVM_MASTER_MAJOR}.* && ${_LLVM_SOURCE_TYPE} == tar ]] &&
+	die "${ECLASS}: Release ebuild for master branch?!"
+
+
+# == control variables ==
+
+# @ECLASS-VARIABLE: LLVM_COMPONENTS
+# @REQUIRED
+# @DESCRIPTION:
+# List of components needed unconditionally.  Specified as bash array
+# with paths relative to llvm-project git.  Automatically translated
+# for tarball releases.
+#
+# The first path specified is used to construct default S.
+
+# @ECLASS-VARIABLE: LLVM_TEST_COMPONENTS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# List of additional components needed for tests.
+
+
+# == global scope logic ==
+
+# @FUNCTION: _llvm.org_get_archives
+# @USAGE: <components>
+# @INTERNAL
+# @DESCRIPTION:
+# Set 'archives' array to list of unique archive filenames
+# for components passed as parameters.
+_llvm.org_get_archives() {
+	local c
+	archives=()
+
+	for c; do
+		local cn=${c%%/*}
+		case ${cn} in
+			clang) cn=cfe;;
+		esac
+
+		local a=${cn}-${PV}.src.tar.xz
+		has "${a}" "${archives[@]}" || archives+=( "${a}" )
+	done
+}
+
+# @FUNCTION: llvm.org_set_globals
+# @DESCRIPTION:
+# Set global variables.  This must be called after setting LLVM_*
+# variables used by the eclass.
+llvm.org_set_globals() {
+	if [[ $(declare -p LLVM_COMPONENTS) != "declare -a"* ]]; then
+		die 'LLVM_COMPONENTS must be an array.'
+	fi
+	if declare -p LLVM_TEST_COMPONENTS &>/dev/null; then
+		if [[ $(declare -p LLVM_TEST_COMPONENTS) != "declare -a"* ]]; then
+			die 'LLVM_TEST_COMPONENTS must be an array.'
+		fi
+	fi
+
+	if [[ ${_LLVM_SOURCE_TYPE} == git ]]; then
+		EGIT_REPO_URI="https://github.com/llvm/llvm-project.git"
+
+		[[ ${PV} != ${_LLVM_MASTER_MAJOR}.* ]] &&
+			EGIT_BRANCH="release/${PV%%.*}.x"
+	elif [[ ${_LLVM_SOURCE_TYPE} == tar ]]; then
+		local a archives=()
+		_llvm.org_get_archives "${LLVM_COMPONENTS[@]}"
+		for a in "${archives[@]}"; do
+			SRC_URI+="
+				https://releases.llvm.org/${PV}/${a}"
+		done
+	else
+		die "Invalid _LLVM_SOURCE_TYPE: ${LLVM_SOURCE_TYPE}"
+	fi
+
+	S=${WORKDIR}/${LLVM_COMPONENTS[0]}
+
+	if [[ -n ${LLVM_TEST_COMPONENTS+1} ]]; then
+		IUSE+=" test"
+		RESTRICT+=" !test? ( test )"
+
+		if [[ ${_LLVM_SOURCE_TYPE} == tar ]]; then
+			SRC_URI+="
+				test? ("
+
+			_llvm.org_get_archives "${LLVM_TEST_COMPONENTS[@]}"
+			for a in "${archives[@]}"; do
+				SRC_URI+="
+					https://releases.llvm.org/${PV}/${a}"
+			done
+
+			SRC_URI+="
+				)"
+		fi
+	fi
+
+	_LLVM_ORG_SET_GLOBALS_CALLED=1
+}
+
+
+# == phase functions ==
+
+EXPORT_FUNCTIONS src_unpack
+
+# @FUNCTION: llvm.org_src_unpack
+# @DESCRIPTION:
+# Unpack or checkout requested LLVM components.
+llvm.org_src_unpack() {
+	if [[ ! ${_LLVM_ORG_SET_GLOBALS_CALLED} ]]; then
+		die "llvm.org_set_globals must be called in global scope"
+	fi
+
+	local components=( "${LLVM_COMPONENTS[@]}" )
+	if [[ ${LLVM_TEST_COMPONENTS+1} ]] && use test; then
+		components+=( "${LLVM_TEST_COMPONENTS[@]}" )
+	fi
+
+	if [[ ${_LLVM_SOURCE_TYPE} == git ]]; then
+		git-r3_fetch
+		git-r3_checkout '' . '' "${components[@]}"
+	else
+		local c archives
+		# TODO: optimize this
+		for c in "${components[@]}"; do
+			local top_dir=${c%%/*}
+			_llvm.org_get_archives "${c}"
+			local sub_path=${archives[0]%.tar.xz}
+			[[ ${c} == */* ]] && sub_path+=/${c#*/}
+
+			ebegin "Unpacking ${sub_path} from ${archives[0]}"
+			mkdir -p "${top_dir}" || die
+			tar -C "${top_dir}" -x -J -o --strip-components 1 \
+				-f "${DISTDIR}/${archives[0]}" "${sub_path}" || die
+			eend
+		done
+	fi
+}
-- 
2.23.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-dev] [PATCH 2/8] sys-devel/llvm-common: Port 9+ to llvm.org.eclass
  2019-11-01 17:39 [gentoo-dev] [PATCH 1/8] llvm.org.eclass: New eclass to help maintaining LLVM Michał Górny
@ 2019-11-01 17:39 ` Michał Górny
  2019-11-01 17:39 ` [gentoo-dev] [PATCH 3/8] sys-devel/llvm: " Michał Górny
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Michał Górny @ 2019-11-01 17:39 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 .../llvm-common-10.0.0.9999.ebuild            | 18 ++++++------------
 .../llvm-common/llvm-common-9.0.0.ebuild      | 18 +++++++-----------
 .../llvm-common/llvm-common-9.0.1.9999.ebuild | 19 ++++++-------------
 3 files changed, 19 insertions(+), 36 deletions(-)

diff --git a/sys-devel/llvm-common/llvm-common-10.0.0.9999.ebuild b/sys-devel/llvm-common/llvm-common-10.0.0.9999.ebuild
index 7edf27153de4..9751f5cc6a22 100644
--- a/sys-devel/llvm-common/llvm-common-10.0.0.9999.ebuild
+++ b/sys-devel/llvm-common/llvm-common-10.0.0.9999.ebuild
@@ -3,13 +3,12 @@
 
 EAPI=7
 
-inherit git-r3
+inherit llvm.org
 
 DESCRIPTION="Common files shared between multiple slots of LLVM"
 HOMEPAGE="https://llvm.org/"
-SRC_URI=""
-EGIT_REPO_URI="https://github.com/llvm/llvm-project.git"
-S=${WORKDIR}/${P}/llvm
+LLVM_COMPONENTS=( llvm/utils/vim )
+llvm.org_set_globals
 
 LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA"
 SLOT="0"
@@ -18,19 +17,14 @@ IUSE=""
 
 RDEPEND="!sys-devel/llvm:0"
 
-src_unpack() {
-	git-r3_fetch
-	git-r3_checkout '' '' '' llvm/utils/vim
-}
-
 src_configure() { :; }
 src_compile() { :; }
 src_test() { :; }
 
 src_install() {
 	insinto /usr/share/vim/vimfiles
-	doins -r utils/vim/*/
+	doins -r */
 	# some users may find it useful
-	newdoc utils/vim/README README.vim
-	dodoc utils/vim/vimrc
+	newdoc README README.vim
+	dodoc vimrc
 }
diff --git a/sys-devel/llvm-common/llvm-common-9.0.0.ebuild b/sys-devel/llvm-common/llvm-common-9.0.0.ebuild
index 65eb4d232e33..b81e9311acd4 100644
--- a/sys-devel/llvm-common/llvm-common-9.0.0.ebuild
+++ b/sys-devel/llvm-common/llvm-common-9.0.0.ebuild
@@ -3,11 +3,12 @@
 
 EAPI=7
 
-MY_P=llvm-${PV/_/}.src
+inherit llvm.org
+
 DESCRIPTION="Common files shared between multiple slots of LLVM"
 HOMEPAGE="https://llvm.org/"
-SRC_URI="https://releases.llvm.org/${PV}/${MY_P}.tar.xz"
-S=${WORKDIR}/${MY_P}
+LLVM_COMPONENTS=( llvm/utils/vim )
+llvm.org_set_globals
 
 LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA"
 SLOT="0"
@@ -16,19 +17,14 @@ IUSE=""
 
 RDEPEND="!sys-devel/llvm:0"
 
-src_unpack() {
-	einfo "Unpacking parts of ${MY_P}.tar.xz ..."
-	tar -xJf "${DISTDIR}/${MY_P}.tar.xz" "${MY_P}/utils/vim" || die
-}
-
 src_configure() { :; }
 src_compile() { :; }
 src_test() { :; }
 
 src_install() {
 	insinto /usr/share/vim/vimfiles
-	doins -r utils/vim/*/
+	doins -r */
 	# some users may find it useful
-	newdoc utils/vim/README README.vim
-	dodoc utils/vim/vimrc
+	newdoc README README.vim
+	dodoc vimrc
 }
diff --git a/sys-devel/llvm-common/llvm-common-9.0.1.9999.ebuild b/sys-devel/llvm-common/llvm-common-9.0.1.9999.ebuild
index b3b79ac4e6c6..9751f5cc6a22 100644
--- a/sys-devel/llvm-common/llvm-common-9.0.1.9999.ebuild
+++ b/sys-devel/llvm-common/llvm-common-9.0.1.9999.ebuild
@@ -3,14 +3,12 @@
 
 EAPI=7
 
-inherit git-r3
+inherit llvm.org
 
 DESCRIPTION="Common files shared between multiple slots of LLVM"
 HOMEPAGE="https://llvm.org/"
-SRC_URI=""
-EGIT_REPO_URI="https://github.com/llvm/llvm-project.git"
-EGIT_BRANCH="release/9.x"
-S=${WORKDIR}/${P}/llvm
+LLVM_COMPONENTS=( llvm/utils/vim )
+llvm.org_set_globals
 
 LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA"
 SLOT="0"
@@ -19,19 +17,14 @@ IUSE=""
 
 RDEPEND="!sys-devel/llvm:0"
 
-src_unpack() {
-	git-r3_fetch
-	git-r3_checkout '' '' '' llvm/utils/vim
-}
-
 src_configure() { :; }
 src_compile() { :; }
 src_test() { :; }
 
 src_install() {
 	insinto /usr/share/vim/vimfiles
-	doins -r utils/vim/*/
+	doins -r */
 	# some users may find it useful
-	newdoc utils/vim/README README.vim
-	dodoc utils/vim/vimrc
+	newdoc README README.vim
+	dodoc vimrc
 }
-- 
2.23.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-dev] [PATCH 3/8] sys-devel/llvm: Port 9+ to llvm.org.eclass
  2019-11-01 17:39 [gentoo-dev] [PATCH 1/8] llvm.org.eclass: New eclass to help maintaining LLVM Michał Górny
  2019-11-01 17:39 ` [gentoo-dev] [PATCH 2/8] sys-devel/llvm-common: Port 9+ to llvm.org.eclass Michał Górny
@ 2019-11-01 17:39 ` Michał Górny
  2019-11-01 17:39 ` [gentoo-dev] [PATCH 4/8] dev-ml/llvm-ocaml: " Michał Górny
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Michał Górny @ 2019-11-01 17:39 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 sys-devel/llvm/llvm-10.0.0.9999.ebuild | 14 ++++----------
 sys-devel/llvm/llvm-9.0.0.ebuild       | 20 +++++++++++++++-----
 sys-devel/llvm/llvm-9.0.1.9999.ebuild  | 15 ++++-----------
 3 files changed, 23 insertions(+), 26 deletions(-)

diff --git a/sys-devel/llvm/llvm-10.0.0.9999.ebuild b/sys-devel/llvm/llvm-10.0.0.9999.ebuild
index c5cd658cd7b0..062bef474e01 100644
--- a/sys-devel/llvm/llvm-10.0.0.9999.ebuild
+++ b/sys-devel/llvm/llvm-10.0.0.9999.ebuild
@@ -8,14 +8,13 @@ EAPI=7
 CMAKE_MIN_VERSION=3.7.0-r1
 PYTHON_COMPAT=( python{2_7,3_{5,6,7}} )
 
-inherit cmake-utils git-r3 multilib-minimal multiprocessing pax-utils \
-	python-any-r1 toolchain-funcs
+inherit cmake-utils llvm.org multilib-minimal multiprocessing \
+	pax-utils python-any-r1 toolchain-funcs
 
 DESCRIPTION="Low Level Virtual Machine"
 HOMEPAGE="https://llvm.org/"
-SRC_URI=""
-EGIT_REPO_URI="https://github.com/llvm/llvm-project.git"
-S=${WORKDIR}/${P}/llvm
+LLVM_COMPONENTS=( llvm )
+llvm.org_set_globals
 
 # Those are in lib/Targets, without explicit CMakeLists.txt mention
 ALL_LLVM_EXPERIMENTAL_TARGETS=( ARC AVR )
@@ -91,11 +90,6 @@ python_check_deps() {
 	has_version -b "dev-python/sphinx[${PYTHON_USEDEP}]"
 }
 
-src_unpack() {
-	git-r3_fetch
-	git-r3_checkout '' '' '' llvm
-}
-
 check_live_ebuild() {
 	local prod_targets=(
 		$(sed -n -e '/set(LLVM_ALL_TARGETS/,/)/p' CMakeLists.txt \
diff --git a/sys-devel/llvm/llvm-9.0.0.ebuild b/sys-devel/llvm/llvm-9.0.0.ebuild
index 62d66ff6800b..3fee2f3dffd0 100644
--- a/sys-devel/llvm/llvm-9.0.0.ebuild
+++ b/sys-devel/llvm/llvm-9.0.0.ebuild
@@ -8,15 +8,15 @@ EAPI=7
 CMAKE_MIN_VERSION=3.7.0-r1
 PYTHON_COMPAT=( python{2_7,3_{5,6,7}} )
 
-inherit cmake-utils multilib-minimal multiprocessing pax-utils \
-	python-any-r1 toolchain-funcs
+inherit cmake-utils llvm.org multilib-minimal multiprocessing \
+	pax-utils python-any-r1 toolchain-funcs
 
-MY_P=${P}.src
 DESCRIPTION="Low Level Virtual Machine"
 HOMEPAGE="https://llvm.org/"
-SRC_URI="https://releases.llvm.org/${PV}/${MY_P}.tar.xz
+SRC_URI="
 	!doc? ( https://dev.gentoo.org/~mgorny/dist/llvm/${P}-manpages.tar.bz2 )"
-S=${WORKDIR}/${MY_P}
+LLVM_COMPONENTS=( llvm )
+llvm.org_set_globals
 
 # Keep in sync with CMakeLists.txt
 ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
@@ -88,6 +88,16 @@ python_check_deps() {
 	has_version -b "dev-python/sphinx[${PYTHON_USEDEP}]"
 }
 
+src_unpack() {
+	llvm.org_src_unpack
+
+	if ! use doc; then
+		ebegin "Unpacking llvm-${PV}-manpages.tar.bz2"
+		tar -xf "${DISTDIR}/llvm-${PV}-manpages.tar.bz2" || die
+		eend
+	fi
+}
+
 src_prepare() {
 	# Fix llvm-config for shared linking and sane flags
 	# https://bugs.gentoo.org/show_bug.cgi?id=565358
diff --git a/sys-devel/llvm/llvm-9.0.1.9999.ebuild b/sys-devel/llvm/llvm-9.0.1.9999.ebuild
index 45e29fba1c7b..09fb33203ad2 100644
--- a/sys-devel/llvm/llvm-9.0.1.9999.ebuild
+++ b/sys-devel/llvm/llvm-9.0.1.9999.ebuild
@@ -8,15 +8,13 @@ EAPI=7
 CMAKE_MIN_VERSION=3.7.0-r1
 PYTHON_COMPAT=( python{2_7,3_{5,6,7}} )
 
-inherit cmake-utils git-r3 multilib-minimal multiprocessing pax-utils \
-	python-any-r1 toolchain-funcs
+inherit cmake-utils llvm.org multilib-minimal multiprocessing \
+	pax-utils python-any-r1 toolchain-funcs
 
 DESCRIPTION="Low Level Virtual Machine"
 HOMEPAGE="https://llvm.org/"
-SRC_URI=""
-EGIT_REPO_URI="https://github.com/llvm/llvm-project.git"
-EGIT_BRANCH="release/9.x"
-S=${WORKDIR}/${P}/llvm
+LLVM_COMPONENTS=( llvm )
+llvm.org_set_globals
 
 # Keep in sync with CMakeLists.txt
 ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
@@ -88,11 +86,6 @@ python_check_deps() {
 	has_version -b "dev-python/sphinx[${PYTHON_USEDEP}]"
 }
 
-src_unpack() {
-	git-r3_fetch
-	git-r3_checkout '' '' '' llvm
-}
-
 src_prepare() {
 	# Fix llvm-config for shared linking and sane flags
 	# https://bugs.gentoo.org/show_bug.cgi?id=565358
-- 
2.23.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-dev] [PATCH 4/8] dev-ml/llvm-ocaml: Port 9+ to llvm.org.eclass
  2019-11-01 17:39 [gentoo-dev] [PATCH 1/8] llvm.org.eclass: New eclass to help maintaining LLVM Michał Górny
  2019-11-01 17:39 ` [gentoo-dev] [PATCH 2/8] sys-devel/llvm-common: Port 9+ to llvm.org.eclass Michał Górny
  2019-11-01 17:39 ` [gentoo-dev] [PATCH 3/8] sys-devel/llvm: " Michał Górny
@ 2019-11-01 17:39 ` Michał Górny
  2019-11-01 17:39 ` [gentoo-dev] [PATCH 5/8] dev-python/lit: " Michał Górny
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Michał Górny @ 2019-11-01 17:39 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 dev-ml/llvm-ocaml/llvm-ocaml-10.0.0.9999.ebuild | 12 +++---------
 dev-ml/llvm-ocaml/llvm-ocaml-9.0.0.ebuild       |  7 +++----
 dev-ml/llvm-ocaml/llvm-ocaml-9.0.1.9999.ebuild  | 13 +++----------
 3 files changed, 9 insertions(+), 23 deletions(-)

diff --git a/dev-ml/llvm-ocaml/llvm-ocaml-10.0.0.9999.ebuild b/dev-ml/llvm-ocaml/llvm-ocaml-10.0.0.9999.ebuild
index 664c0aa44847..37dbc834d6fc 100644
--- a/dev-ml/llvm-ocaml/llvm-ocaml-10.0.0.9999.ebuild
+++ b/dev-ml/llvm-ocaml/llvm-ocaml-10.0.0.9999.ebuild
@@ -8,13 +8,12 @@ EAPI=7
 CMAKE_MIN_VERSION=3.7.0-r1
 PYTHON_COMPAT=( python{2_7,3_{5,6,7}} )
 
-inherit cmake-utils git-r3 llvm multiprocessing python-any-r1
+inherit cmake-utils llvm llvm.org multiprocessing python-any-r1
 
 DESCRIPTION="OCaml bindings for LLVM"
 HOMEPAGE="https://llvm.org/"
-SRC_URI=""
-EGIT_REPO_URI="https://github.com/llvm/llvm-project.git"
-S=${WORKDIR}/${P}/llvm
+LLVM_COMPONENTS=( llvm )
+llvm.org_set_globals
 
 # Keep in sync with sys-devel/llvm
 ALL_LLVM_EXPERIMENTAL_TARGETS=( ARC AVR )
@@ -53,11 +52,6 @@ pkg_setup() {
 	python-any-r1_pkg_setup
 }
 
-src_unpack() {
-	git-r3_fetch
-	git-r3_checkout '' '' '' llvm
-}
-
 src_prepare() {
 	# Python is needed to run tests using lit
 	python_setup
diff --git a/dev-ml/llvm-ocaml/llvm-ocaml-9.0.0.ebuild b/dev-ml/llvm-ocaml/llvm-ocaml-9.0.0.ebuild
index 44c293f604cc..c62d0e0c7625 100644
--- a/dev-ml/llvm-ocaml/llvm-ocaml-9.0.0.ebuild
+++ b/dev-ml/llvm-ocaml/llvm-ocaml-9.0.0.ebuild
@@ -8,13 +8,12 @@ EAPI=7
 CMAKE_MIN_VERSION=3.7.0-r1
 PYTHON_COMPAT=( python{2_7,3_{5,6,7}} )
 
-inherit cmake-utils llvm multiprocessing python-any-r1
+inherit cmake-utils llvm llvm.org multiprocessing python-any-r1
 
-MY_P=llvm-${PV/_/}.src
 DESCRIPTION="OCaml bindings for LLVM"
 HOMEPAGE="https://llvm.org/"
-SRC_URI="https://releases.llvm.org/${PV}/${MY_P}.tar.xz"
-S=${WORKDIR}/${MY_P}
+LLVM_COMPONENTS=( llvm )
+llvm.org_set_globals
 
 # Keep in sync with sys-devel/llvm
 ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
diff --git a/dev-ml/llvm-ocaml/llvm-ocaml-9.0.1.9999.ebuild b/dev-ml/llvm-ocaml/llvm-ocaml-9.0.1.9999.ebuild
index d47587faed9b..78b08e83dab6 100644
--- a/dev-ml/llvm-ocaml/llvm-ocaml-9.0.1.9999.ebuild
+++ b/dev-ml/llvm-ocaml/llvm-ocaml-9.0.1.9999.ebuild
@@ -8,14 +8,12 @@ EAPI=7
 CMAKE_MIN_VERSION=3.7.0-r1
 PYTHON_COMPAT=( python{2_7,3_{5,6,7}} )
 
-inherit cmake-utils git-r3 llvm multiprocessing python-any-r1
+inherit cmake-utils llvm llvm.org multiprocessing python-any-r1
 
 DESCRIPTION="OCaml bindings for LLVM"
 HOMEPAGE="https://llvm.org/"
-SRC_URI=""
-EGIT_REPO_URI="https://github.com/llvm/llvm-project.git"
-EGIT_BRANCH="release/9.x"
-S=${WORKDIR}/${P}/llvm
+LLVM_COMPONENTS=( llvm )
+llvm.org_set_globals
 
 # Keep in sync with sys-devel/llvm
 ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
@@ -52,11 +50,6 @@ pkg_setup() {
 	python-any-r1_pkg_setup
 }
 
-src_unpack() {
-	git-r3_fetch
-	git-r3_checkout '' '' '' llvm
-}
-
 src_prepare() {
 	# Python is needed to run tests using lit
 	python_setup
-- 
2.23.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-dev] [PATCH 5/8] dev-python/lit: Port 9+ to llvm.org.eclass
  2019-11-01 17:39 [gentoo-dev] [PATCH 1/8] llvm.org.eclass: New eclass to help maintaining LLVM Michał Górny
                   ` (2 preceding siblings ...)
  2019-11-01 17:39 ` [gentoo-dev] [PATCH 4/8] dev-ml/llvm-ocaml: " Michał Górny
@ 2019-11-01 17:39 ` Michał Górny
  2019-11-01 17:39 ` [gentoo-dev] [PATCH 6/8] sys-devel/clang-common: " Michał Górny
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Michał Górny @ 2019-11-01 17:39 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 dev-python/lit/lit-10.0.0.9999.ebuild | 12 +++---------
 dev-python/lit/lit-9.0.0.ebuild       | 12 +++---------
 dev-python/lit/lit-9.0.1.9999.ebuild  | 13 +++----------
 3 files changed, 9 insertions(+), 28 deletions(-)

diff --git a/dev-python/lit/lit-10.0.0.9999.ebuild b/dev-python/lit/lit-10.0.0.9999.ebuild
index 05acb219e329..e051ca51410e 100644
--- a/dev-python/lit/lit-10.0.0.9999.ebuild
+++ b/dev-python/lit/lit-10.0.0.9999.ebuild
@@ -4,13 +4,12 @@
 EAPI=7
 
 PYTHON_COMPAT=( python2_7 python3_{5,6,7} )
-inherit distutils-r1 git-r3 multiprocessing
+inherit distutils-r1 llvm.org multiprocessing
 
 DESCRIPTION="A stand-alone install of the LLVM suite testing tool"
 HOMEPAGE="https://llvm.org/"
-SRC_URI=""
-EGIT_REPO_URI="https://github.com/llvm/llvm-project.git"
-S=${WORKDIR}/${P}/llvm/utils/lit
+LLVM_COMPONENTS=( llvm/utils/lit )
+llvm.org_set_globals
 
 LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA"
 SLOT="0"
@@ -27,11 +26,6 @@ BDEPEND="
 
 # TODO: move the manpage generation here (from sys-devel/llvm)
 
-src_unpack() {
-	git-r3_fetch
-	git-r3_checkout '' '' '' llvm/utils/lit
-}
-
 python_test() {
 	local -x LIT_PRESERVES_TMP=1
 	./lit.py -j "${LIT_JOBS:-$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")}" \
diff --git a/dev-python/lit/lit-9.0.0.ebuild b/dev-python/lit/lit-9.0.0.ebuild
index 379734458ba5..cbc3d5b9e6dd 100644
--- a/dev-python/lit/lit-9.0.0.ebuild
+++ b/dev-python/lit/lit-9.0.0.ebuild
@@ -4,13 +4,12 @@
 EAPI=7
 
 PYTHON_COMPAT=( python2_7 python3_{5,6,7} )
-inherit distutils-r1 multiprocessing
+inherit distutils-r1 llvm.org multiprocessing
 
-MY_P=llvm-${PV/_/}.src
 DESCRIPTION="A stand-alone install of the LLVM suite testing tool"
 HOMEPAGE="https://llvm.org/"
-SRC_URI="https://releases.llvm.org/${PV}/${MY_P}.tar.xz"
-S=${WORKDIR}/${MY_P}/utils/lit
+LLVM_COMPONENTS=( llvm/utils/lit )
+llvm.org_set_globals
 
 LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA"
 SLOT="0"
@@ -27,11 +26,6 @@ BDEPEND="
 
 # TODO: move the manpage generation here (from sys-devel/llvm)
 
-src_unpack() {
-	einfo "Unpacking parts of ${MY_P}.tar.xz ..."
-	tar -xJf "${DISTDIR}/${MY_P}.tar.xz" "${MY_P}/utils/lit" || die
-}
-
 python_test() {
 	local -x LIT_PRESERVES_TMP=1
 	./lit.py -j "${LIT_JOBS:-$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")}" \
diff --git a/dev-python/lit/lit-9.0.1.9999.ebuild b/dev-python/lit/lit-9.0.1.9999.ebuild
index ca1cce6c00b2..e051ca51410e 100644
--- a/dev-python/lit/lit-9.0.1.9999.ebuild
+++ b/dev-python/lit/lit-9.0.1.9999.ebuild
@@ -4,14 +4,12 @@
 EAPI=7
 
 PYTHON_COMPAT=( python2_7 python3_{5,6,7} )
-inherit distutils-r1 git-r3 multiprocessing
+inherit distutils-r1 llvm.org multiprocessing
 
 DESCRIPTION="A stand-alone install of the LLVM suite testing tool"
 HOMEPAGE="https://llvm.org/"
-SRC_URI=""
-EGIT_REPO_URI="https://github.com/llvm/llvm-project.git"
-EGIT_BRANCH="release/9.x"
-S=${WORKDIR}/${P}/llvm/utils/lit
+LLVM_COMPONENTS=( llvm/utils/lit )
+llvm.org_set_globals
 
 LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA"
 SLOT="0"
@@ -28,11 +26,6 @@ BDEPEND="
 
 # TODO: move the manpage generation here (from sys-devel/llvm)
 
-src_unpack() {
-	git-r3_fetch
-	git-r3_checkout '' '' '' llvm/utils/lit
-}
-
 python_test() {
 	local -x LIT_PRESERVES_TMP=1
 	./lit.py -j "${LIT_JOBS:-$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")}" \
-- 
2.23.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-dev] [PATCH 6/8] sys-devel/clang-common: Port 9+ to llvm.org.eclass
  2019-11-01 17:39 [gentoo-dev] [PATCH 1/8] llvm.org.eclass: New eclass to help maintaining LLVM Michał Górny
                   ` (3 preceding siblings ...)
  2019-11-01 17:39 ` [gentoo-dev] [PATCH 5/8] dev-python/lit: " Michał Górny
@ 2019-11-01 17:39 ` Michał Górny
  2019-11-01 17:39 ` [gentoo-dev] [PATCH 7/8] sys-devel/clang: " Michał Górny
  2019-11-01 17:39 ` [gentoo-dev] [PATCH 8/8] sys-devel/lld: " Michał Górny
  6 siblings, 0 replies; 8+ messages in thread
From: Michał Górny @ 2019-11-01 17:39 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 .../clang-common-10.0.0.9999.ebuild           | 19 +++++-------------
 .../clang-common/clang-common-9.0.0.ebuild    | 19 +++++-------------
 .../clang-common-9.0.1.9999.ebuild            | 20 +++++--------------
 3 files changed, 15 insertions(+), 43 deletions(-)

diff --git a/sys-devel/clang-common/clang-common-10.0.0.9999.ebuild b/sys-devel/clang-common/clang-common-10.0.0.9999.ebuild
index 6b707e3d41ff..d1bfe71d2f80 100644
--- a/sys-devel/clang-common/clang-common-10.0.0.9999.ebuild
+++ b/sys-devel/clang-common/clang-common-10.0.0.9999.ebuild
@@ -3,13 +3,13 @@
 
 EAPI=7
 
-inherit bash-completion-r1 git-r3
+inherit bash-completion-r1 llvm.org
 
 DESCRIPTION="Common files shared between multiple slots of clang"
 HOMEPAGE="https://llvm.org/"
-SRC_URI=""
-EGIT_REPO_URI="https://github.com/llvm/llvm-project.git"
-S=${WORKDIR}/${P}/clang
+LLVM_COMPONENTS=( clang/utils/bash-autocomplete.sh )
+llvm.org_set_globals
+S=${WORKDIR}/clang/utils
 
 LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA"
 SLOT="0"
@@ -18,15 +18,6 @@ IUSE=""
 
 PDEPEND="sys-devel/clang:*"
 
-src_unpack() {
-	git-r3_fetch
-	git-r3_checkout '' '' '' clang/utils/bash-autocomplete.sh
-}
-
-src_configure() { :; }
-src_compile() { :; }
-src_test() { :; }
-
 src_install() {
-	newbashcomp utils/bash-autocomplete.sh clang
+	newbashcomp bash-autocomplete.sh clang
 }
diff --git a/sys-devel/clang-common/clang-common-9.0.0.ebuild b/sys-devel/clang-common/clang-common-9.0.0.ebuild
index 609bdcde4cc0..3fc7a056a923 100644
--- a/sys-devel/clang-common/clang-common-9.0.0.ebuild
+++ b/sys-devel/clang-common/clang-common-9.0.0.ebuild
@@ -3,13 +3,13 @@
 
 EAPI=7
 
-inherit bash-completion-r1
+inherit bash-completion-r1 llvm.org
 
-MY_P=cfe-${PV/_/}.src
 DESCRIPTION="Common files shared between multiple slots of clang"
 HOMEPAGE="https://llvm.org/"
-SRC_URI="https://releases.llvm.org/${PV}/${MY_P}.tar.xz"
-S=${WORKDIR}/${MY_P}
+LLVM_COMPONENTS=( clang/utils/bash-autocomplete.sh )
+llvm.org_set_globals
+S=${WORKDIR}/clang/utils
 
 LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA"
 SLOT="0"
@@ -18,15 +18,6 @@ IUSE=""
 
 PDEPEND="sys-devel/clang:*"
 
-src_unpack() {
-	einfo "Unpacking parts of ${MY_P}.tar.xz ..."
-	tar -xJf "${DISTDIR}/${MY_P}.tar.xz" "${MY_P}/utils/bash-autocomplete.sh" || die
-}
-
-src_configure() { :; }
-src_compile() { :; }
-src_test() { :; }
-
 src_install() {
-	newbashcomp utils/bash-autocomplete.sh clang
+	newbashcomp bash-autocomplete.sh clang
 }
diff --git a/sys-devel/clang-common/clang-common-9.0.1.9999.ebuild b/sys-devel/clang-common/clang-common-9.0.1.9999.ebuild
index eecb0ff749dc..d1bfe71d2f80 100644
--- a/sys-devel/clang-common/clang-common-9.0.1.9999.ebuild
+++ b/sys-devel/clang-common/clang-common-9.0.1.9999.ebuild
@@ -3,14 +3,13 @@
 
 EAPI=7
 
-inherit bash-completion-r1 git-r3
+inherit bash-completion-r1 llvm.org
 
 DESCRIPTION="Common files shared between multiple slots of clang"
 HOMEPAGE="https://llvm.org/"
-SRC_URI=""
-EGIT_REPO_URI="https://github.com/llvm/llvm-project.git"
-EGIT_BRANCH="release/9.x"
-S=${WORKDIR}/${P}/clang
+LLVM_COMPONENTS=( clang/utils/bash-autocomplete.sh )
+llvm.org_set_globals
+S=${WORKDIR}/clang/utils
 
 LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA"
 SLOT="0"
@@ -19,15 +18,6 @@ IUSE=""
 
 PDEPEND="sys-devel/clang:*"
 
-src_unpack() {
-	git-r3_fetch
-	git-r3_checkout '' '' '' clang/utils/bash-autocomplete.sh
-}
-
-src_configure() { :; }
-src_compile() { :; }
-src_test() { :; }
-
 src_install() {
-	newbashcomp utils/bash-autocomplete.sh clang
+	newbashcomp bash-autocomplete.sh clang
 }
-- 
2.23.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-dev] [PATCH 7/8] sys-devel/clang: Port 9+ to llvm.org.eclass
  2019-11-01 17:39 [gentoo-dev] [PATCH 1/8] llvm.org.eclass: New eclass to help maintaining LLVM Michał Górny
                   ` (4 preceding siblings ...)
  2019-11-01 17:39 ` [gentoo-dev] [PATCH 6/8] sys-devel/clang-common: " Michał Górny
@ 2019-11-01 17:39 ` Michał Górny
  2019-11-01 17:39 ` [gentoo-dev] [PATCH 8/8] sys-devel/lld: " Michał Górny
  6 siblings, 0 replies; 8+ messages in thread
From: Michał Górny @ 2019-11-01 17:39 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 sys-devel/clang/clang-10.0.0.9999.ebuild | 28 ++++++++---------
 sys-devel/clang/clang-9.0.0.ebuild       | 39 +++++++++---------------
 sys-devel/clang/clang-9.0.1.9999.ebuild  | 29 ++++++++----------
 3 files changed, 40 insertions(+), 56 deletions(-)

diff --git a/sys-devel/clang/clang-10.0.0.9999.ebuild b/sys-devel/clang/clang-10.0.0.9999.ebuild
index 7213d45d1617..6ea6bad77fa5 100644
--- a/sys-devel/clang/clang-10.0.0.9999.ebuild
+++ b/sys-devel/clang/clang-10.0.0.9999.ebuild
@@ -8,15 +8,19 @@ EAPI=7
 CMAKE_MIN_VERSION=3.7.0-r1
 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 )
@@ -80,16 +84,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() {
@@ -246,7 +244,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)")}"
 	)
 
diff --git a/sys-devel/clang/clang-9.0.0.ebuild b/sys-devel/clang/clang-9.0.0.ebuild
index 2eabbee087ce..a91cefda2459 100644
--- a/sys-devel/clang/clang-9.0.0.ebuild
+++ b/sys-devel/clang/clang-9.0.0.ebuild
@@ -8,21 +8,21 @@ EAPI=7
 CMAKE_MIN_VERSION=3.7.0-r1
 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
@@ -98,24 +98,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
 }
 
@@ -150,7 +139,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)")}"
 	)
 
diff --git a/sys-devel/clang/clang-9.0.1.9999.ebuild b/sys-devel/clang/clang-9.0.1.9999.ebuild
index 788ba009941a..f681871f2015 100644
--- a/sys-devel/clang/clang-9.0.1.9999.ebuild
+++ b/sys-devel/clang/clang-9.0.1.9999.ebuild
@@ -8,16 +8,19 @@ EAPI=7
 CMAKE_MIN_VERSION=3.7.0-r1
 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
@@ -88,16 +91,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() {
@@ -131,7 +128,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)")}"
 	)
 
-- 
2.23.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-dev] [PATCH 8/8] sys-devel/lld: Port 9+ to llvm.org.eclass
  2019-11-01 17:39 [gentoo-dev] [PATCH 1/8] llvm.org.eclass: New eclass to help maintaining LLVM Michał Górny
                   ` (5 preceding siblings ...)
  2019-11-01 17:39 ` [gentoo-dev] [PATCH 7/8] sys-devel/clang: " Michał Górny
@ 2019-11-01 17:39 ` Michał Górny
  6 siblings, 0 replies; 8+ messages in thread
From: Michał Górny @ 2019-11-01 17:39 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 sys-devel/lld/lld-10.0.0.9999.ebuild | 17 +++++------------
 sys-devel/lld/lld-9.0.0.ebuild       | 23 ++++-------------------
 sys-devel/lld/lld-9.0.1.9999.ebuild  | 18 +++++-------------
 3 files changed, 14 insertions(+), 44 deletions(-)

diff --git a/sys-devel/lld/lld-10.0.0.9999.ebuild b/sys-devel/lld/lld-10.0.0.9999.ebuild
index c0a2e884c80d..0938eee4baad 100644
--- a/sys-devel/lld/lld-10.0.0.9999.ebuild
+++ b/sys-devel/lld/lld-10.0.0.9999.ebuild
@@ -8,13 +8,13 @@ EAPI=7
 CMAKE_MIN_VERSION=3.7.0-r1
 PYTHON_COMPAT=( python{2_7,3_{5,6,7}} )
 
-inherit cmake-utils git-r3 llvm multiprocessing python-any-r1
+inherit cmake-utils llvm llvm.org multiprocessing python-any-r1
 
 DESCRIPTION="The LLVM linker (link editor)"
 HOMEPAGE="https://llvm.org/"
-SRC_URI=""
-EGIT_REPO_URI="https://github.com/llvm/llvm-project.git"
-S=${WORKDIR}/${P}/lld
+LLVM_COMPONENTS=( lld )
+LLVM_TEST_COMPONENTS=( llvm/utils/{lit,unittest} )
+llvm.org_set_globals
 
 LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA"
 SLOT="0"
@@ -38,13 +38,6 @@ pkg_setup() {
 	use test && python-any-r1_pkg_setup
 }
 
-src_unpack() {
-	local dirs=( lld )
-	use test && dirs+=( llvm/utils/{lit,unittest} )
-	git-r3_fetch
-	git-r3_checkout '' '' '' "${dirs[@]}"
-}
-
 src_configure() {
 	local mycmakeargs=(
 		-DBUILD_SHARED_LIBS=OFF
@@ -53,7 +46,7 @@ src_configure() {
 	)
 	use test && mycmakeargs+=(
 		-DLLVM_BUILD_TESTS=ON
-		-DLLVM_MAIN_SRC_DIR="${WORKDIR}/${P}/llvm"
+		-DLLVM_MAIN_SRC_DIR="${WORKDIR}/llvm"
 		-DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
 		-DLLVM_LIT_ARGS="-vv;-j;${LIT_JOBS:-$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")}"
 	)
diff --git a/sys-devel/lld/lld-9.0.0.ebuild b/sys-devel/lld/lld-9.0.0.ebuild
index c938e81bb902..f411d28781d4 100644
--- a/sys-devel/lld/lld-9.0.0.ebuild
+++ b/sys-devel/lld/lld-9.0.0.ebuild
@@ -8,16 +8,13 @@ EAPI=7
 CMAKE_MIN_VERSION=3.7.0-r1
 PYTHON_COMPAT=( python{2_7,3_{5,6,7}} )
 
-inherit cmake-utils llvm multiprocessing python-any-r1
-
-MY_P=${P/_/}.src
-LLVM_P=llvm-${PV/_/}.src
+inherit cmake-utils llvm llvm.org multiprocessing python-any-r1
 
 DESCRIPTION="The LLVM linker (link editor)"
 HOMEPAGE="https://llvm.org/"
-SRC_URI="https://releases.llvm.org/${PV}/${MY_P}.tar.xz
-	test? ( https://releases.llvm.org/${PV}/${LLVM_P}.tar.xz )"
-S=${WORKDIR}/${MY_P}
+LLVM_COMPONENTS=( lld )
+LLVM_TEST_COMPONENTS=( llvm/utils/{lit,unittest} )
+llvm.org_set_globals
 
 LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA"
 SLOT="0"
@@ -41,18 +38,6 @@ pkg_setup() {
 	use test && python-any-r1_pkg_setup
 }
 
-src_unpack() {
-	einfo "Unpacking ${MY_P}.tar.xz ..."
-	tar -xf "${DISTDIR}/${MY_P}.tar.xz" || die
-
-	if use test; then
-		einfo "Unpacking parts of ${LLVM_P}.tar.xz ..."
-		tar -xf "${DISTDIR}/${LLVM_P}.tar.xz" \
-			"${LLVM_P}"/utils/{lit,unittest} || die
-		mv "${LLVM_P}" llvm || die
-	fi
-}
-
 src_configure() {
 	local mycmakeargs=(
 		-DBUILD_SHARED_LIBS=ON
diff --git a/sys-devel/lld/lld-9.0.1.9999.ebuild b/sys-devel/lld/lld-9.0.1.9999.ebuild
index 07ffc6f41c97..60ae216d4d6b 100644
--- a/sys-devel/lld/lld-9.0.1.9999.ebuild
+++ b/sys-devel/lld/lld-9.0.1.9999.ebuild
@@ -8,14 +8,13 @@ EAPI=7
 CMAKE_MIN_VERSION=3.7.0-r1
 PYTHON_COMPAT=( python{2_7,3_{5,6,7}} )
 
-inherit cmake-utils git-r3 llvm multiprocessing python-any-r1
+inherit cmake-utils llvm llvm.org multiprocessing python-any-r1
 
 DESCRIPTION="The LLVM linker (link editor)"
 HOMEPAGE="https://llvm.org/"
-SRC_URI=""
-EGIT_REPO_URI="https://github.com/llvm/llvm-project.git"
-EGIT_BRANCH="release/9.x"
-S=${WORKDIR}/${P}/lld
+LLVM_COMPONENTS=( lld )
+LLVM_TEST_COMPONENTS=( llvm/utils/{lit,unittest} )
+llvm.org_set_globals
 
 LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA"
 SLOT="0"
@@ -39,13 +38,6 @@ pkg_setup() {
 	use test && python-any-r1_pkg_setup
 }
 
-src_unpack() {
-	local dirs=( lld )
-	use test && dirs+=( llvm/utils/{lit,unittest} )
-	git-r3_fetch
-	git-r3_checkout '' '' '' "${dirs[@]}"
-}
-
 src_configure() {
 	local mycmakeargs=(
 		-DBUILD_SHARED_LIBS=ON
@@ -54,7 +46,7 @@ src_configure() {
 	)
 	use test && mycmakeargs+=(
 		-DLLVM_BUILD_TESTS=ON
-		-DLLVM_MAIN_SRC_DIR="${WORKDIR}/${P}/llvm"
+		-DLLVM_MAIN_SRC_DIR="${WORKDIR}/llvm"
 		-DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
 		-DLLVM_LIT_ARGS="-vv;-j;${LIT_JOBS:-$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")}"
 	)
-- 
2.23.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-11-01 17:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-01 17:39 [gentoo-dev] [PATCH 1/8] llvm.org.eclass: New eclass to help maintaining LLVM Michał Górny
2019-11-01 17:39 ` [gentoo-dev] [PATCH 2/8] sys-devel/llvm-common: Port 9+ to llvm.org.eclass Michał Górny
2019-11-01 17:39 ` [gentoo-dev] [PATCH 3/8] sys-devel/llvm: " Michał Górny
2019-11-01 17:39 ` [gentoo-dev] [PATCH 4/8] dev-ml/llvm-ocaml: " Michał Górny
2019-11-01 17:39 ` [gentoo-dev] [PATCH 5/8] dev-python/lit: " Michał Górny
2019-11-01 17:39 ` [gentoo-dev] [PATCH 6/8] sys-devel/clang-common: " Michał Górny
2019-11-01 17:39 ` [gentoo-dev] [PATCH 7/8] sys-devel/clang: " Michał Górny
2019-11-01 17:39 ` [gentoo-dev] [PATCH 8/8] sys-devel/lld: " Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox