public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] dev/mgorny:master commit in: sys-devel/llvm/
Date: Fri, 12 Jul 2013 16:46:49 +0000 (UTC)	[thread overview]
Message-ID: <1373647598.ab766db3fd6ad20316eca1c6c9ce55762d335542.mgorny@gentoo> (raw)

commit:     ab766db3fd6ad20316eca1c6c9ce55762d335542
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 12 16:46:38 2013 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jul 12 16:46:38 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=dev/mgorny.git;a=commit;h=ab766db3

sys-devel/llvm: convert to multilib and clean up.

---
 sys-devel/llvm/llvm-9999-r1.ebuild | 148 +++++++++++++++++++++++++------------
 1 file changed, 102 insertions(+), 46 deletions(-)

diff --git a/sys-devel/llvm/llvm-9999-r1.ebuild b/sys-devel/llvm/llvm-9999-r1.ebuild
index 18e1a20..1e48dcc 100644
--- a/sys-devel/llvm/llvm-9999-r1.ebuild
+++ b/sys-devel/llvm/llvm-9999-r1.ebuild
@@ -6,7 +6,8 @@ EAPI=5
 
 PYTHON_COMPAT=( python{2_5,2_6,2_7} pypy{1_9,2_0} )
 
-inherit subversion eutils flag-o-matic multilib python-r1 toolchain-funcs pax-utils
+inherit subversion eutils flag-o-matic multilib multilib-minimal \
+	python-r1 toolchain-funcs pax-utils
 
 DESCRIPTION="Low Level Virtual Machine"
 HOMEPAGE="http://llvm.org/"
@@ -16,7 +17,8 @@ ESVN_REPO_URI="http://llvm.org/svn/llvm-project/llvm/trunk"
 LICENSE="UoI-NCSA"
 SLOT="0"
 KEYWORDS=""
-IUSE="clang debug doc gold +libffi multitarget ocaml python +static-analyzer test udis86 vim-syntax video_cards_radeon"
+IUSE="clang debug doc gold +libffi multitarget ocaml python
+	+static-analyzer test udis86 vim-syntax video_cards_radeon"
 
 DEPEND="dev-lang/perl
 	dev-python/sphinx
@@ -30,11 +32,12 @@ DEPEND="dev-lang/perl
 	libffi? ( virtual/pkgconfig
 		virtual/libffi )
 	ocaml? ( dev-lang/ocaml )
-	udis86? ( dev-libs/udis86[pic(+)] )
+	udis86? ( dev-libs/udis86[pic(+),${MULTILIB_USEDEP}] )
 	${PYTHON_DEPS}"
 RDEPEND="dev-lang/perl
 	libffi? ( virtual/libffi )
 	python? ( ${PYTHON_DEPS} )
+	udis86? ( dev-libs/udis86[pic(+),${MULTILIB_USEDEP}] )
 	vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )
 	!<=sys-devel/clang-9999-r99"
 
@@ -91,20 +94,30 @@ src_unpack() {
 }
 
 src_prepare() {
-	# unfortunately ./configure won't listen to --mandir and the-like, so take
-	# care of this.
-	einfo "Fixing install dirs"
-	sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \
-		-e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \
-		-e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/${PN}, \
-		-i Makefile.config.in || die "Makefile.config sed failed"
-	sed -e "/ActiveLibDir = ActivePrefix/s/lib/$(get_libdir)\/${PN}/" \
-		-i tools/llvm-config/llvm-config.cpp || die "llvm-config sed failed"
-
-	einfo "Fixing rpath and CFLAGS"
-	sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \
-		-e '/OmitFramePointer/s/-fomit-frame-pointer//' \
-		-i Makefile.rules || die "rpath sed failed"
+	multilib_src_prepare() {
+		cd "${BUILD_DIR}" || die
+
+		# unfortunately ./configure won't listen to --mandir and the-like, so take
+		# care of this.
+		einfo "Fixing install dirs"
+		sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \
+			-e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \
+			-e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/${PN}, \
+			-i Makefile.config.in || die "Makefile.config sed failed"
+		sed -e "/ActiveLibDir = ActivePrefix/s/lib/$(get_libdir)\/${PN}/" \
+			-i tools/llvm-config/llvm-config.cpp || die "llvm-config sed failed"
+
+		einfo "Fixing rpath and CFLAGS"
+		sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \
+			-e '/OmitFramePointer/s/-fomit-frame-pointer//' \
+			-i Makefile.rules || die "rpath sed failed"
+
+		# Set correct path for the coverage lib
+		sed -e "s#lib\(/libprofile_rt.a\)#$(get_libdir)/llvm\1#" \
+			-i  tools/clang/lib/Driver/Tools.cpp \
+			|| die "driver tools paths sed failed"
+	}
+
 	if use gold; then
 		sed -e 's,\$(SharedLibDir),'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \
 			-i tools/gold/Makefile || die "gold rpath sed failed"
@@ -115,16 +128,6 @@ src_prepare() {
 		|| die "FileCheck Makefile sed failed"
 
 	if use clang; then
-		# multilib-strict
-		sed -e "/PROJ_headers\|HeaderDir/s#lib/clang#$(get_libdir)/clang#" \
-			-i tools/clang/lib/Headers/Makefile \
-			|| die "clang Makefile sed failed"
-		sed -e "/PROJ_resources\|ResourceDir/s#lib/clang#$(get_libdir)/clang#" \
-			-i tools/clang/runtime/compiler-rt/Makefile \
-			|| die "compiler-rt Makefile sed failed"
-		sed -e "s#/lib/#/lib{{(32|64)?}}/#" \
-			-i tools/clang/test/Preprocessor/iwithprefix.c \
-			|| die "clang test sed failed"
 		# fix the static analyzer for in-tree install
 		sed -e 's/import ScanView/from clang \0/'  \
 			-i tools/clang/tools/scan-view/scan-view \
@@ -132,9 +135,8 @@ src_prepare() {
 		sed -e "/scanview.css\|sorttable.js/s#\$RealBin#${EPREFIX}/usr/share/${PN}#" \
 			-i tools/clang/tools/scan-build/scan-build \
 			|| die "scan-build sed failed"
-		# Set correct path for gold plugin and coverage lib
+		# Set correct path for gold plugin
 		sed -e "/LLVMgold.so/s#lib/#$(get_libdir)/llvm/#" \
-			-e "s#lib\(/libprofile_rt.a\)#$(get_libdir)/llvm\1#" \
 			-i  tools/clang/lib/Driver/Tools.cpp \
 			|| die "driver tools paths sed failed"
 	fi
@@ -143,9 +145,12 @@ src_prepare() {
 
 	# User patches
 	epatch_user
+
+	multilib_copy_sources
+	multilib_foreach_abi multilib_src_prepare
 }
 
-src_configure() {
+multilib_src_configure() {
 	local CONF_FLAGS="--enable-shared
 		--with-optimize-option=
 		$(use_enable !debug optimized)
@@ -166,14 +171,14 @@ src_configure() {
 		fi
 	fi
 
-	if use amd64; then
+	if [[ ${ABI} == amd64 ]]; then
 		CONF_FLAGS="${CONF_FLAGS} --enable-pic"
 	fi
 
-	if use gold; then
+	if multilib_is_native_abi && use gold; then
 		CONF_FLAGS="${CONF_FLAGS} --with-binutils-include=${EPREFIX}/usr/include/"
 	fi
-	if use ocaml; then
+	if multilib_is_native_abi && use ocaml; then
 		CONF_FLAGS="${CONF_FLAGS} --enable-bindings=ocaml"
 	else
 		CONF_FLAGS="${CONF_FLAGS} --enable-bindings=none"
@@ -196,11 +201,28 @@ src_configure() {
 	econf ${CONF_FLAGS}
 }
 
-src_compile() {
-	emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1
+multilib_src_compile() {
+	local mymakeopts=(
+		VERBOSE=1
+		KEEP_SYMBOLS=1
+		REQUIRES_RTTI=1
+	)
+
+	# Tests need all the LLVM built.
+	if multilib_is_native_abi || use test; then
+		emake "${mymakeopts[@]}"
+	else
+		# we need to build libs for llvm, then whole clang,
+		# since libs-only omits clang dir
+		# and clang fails to sub-compile with libs-only.
+		emake "${mymakeopts[@]}" libs-only
+		emake -C tools/clang "${mymakeopts[@]}"
+	fi
 
-	emake -C docs -f Makefile.sphinx man
-	use doc && emake -C docs -f Makefile.sphinx html
+	if multilib_is_native_abi; then
+		emake -C docs -f Makefile.sphinx man
+		use doc && emake -C docs -f Makefile.sphinx html
+	fi
 
 	if use debug; then
 		pax-mark m Debug+Asserts+Checks/bin/lli
@@ -214,24 +236,51 @@ src_compile() {
 	fi
 }
 
-src_test() {
+multilib_src_test() {
 	default
 
 	emake -C tools/clang test
 }
 
-src_install() {
-	emake KEEP_SYMBOLS=1 DESTDIR="${D}" install
+MULTILIB_WRAPPED_HEADERS=(
+	/usr/include/llvm/Config/config.h
+	/usr/include/llvm/Config/llvm-config.h
+	/usr/include/clang/Config/config.h
+)
 
-	doman docs/_build/man/*.1
-	use doc && dohtml -r docs/_build/html/
+multilib_src_install() {
+	local mymakeopts=(
+		KEEP_SYMBOLS=1
+		DESTDIR="${D}"
+	)
 
-	if use vim-syntax; then
-		insinto /usr/share/vim/vimfiles/syntax
-		doins utils/vim/*.vim
+	if multilib_is_native_abi; then
+		emake "${mymakeopts[@]}" install
+
+		# Move files back.
+		mv "${ED}"/tmp/llvm-config.* "${ED}"/usr/bin || die
+	else
+		# we need to install libs for llvm, then whole clang
+		# since libs-only omits clang dir
+		# and clang install-libs doesn't install headers and stuff
+		# (we build it anyway, so install is not a problem)
+		emake "${mymakeopts[@]}" install-libs
+		emake -C tools/clang "${mymakeopts[@]}" install
+
+		# Preserve ABI-variant of llvm-config,
+		# then drop all the executables since LLVM doesn't like to
+		# clobber when installing.
+		mkdir -p "${ED}"/tmp || die
+		mv "${ED}"/usr/bin/llvm-config "${ED}"/tmp/llvm-config.${ABI} || die
+		rm -r "${ED}"/usr/bin || die
 	fi
 
-	if use clang; then
+	if multilib_is_native_abi; then
+		doman docs/_build/man/*.1
+		use doc && dohtml -r docs/_build/html/
+	fi
+
+	if multilib_is_native_abi && use clang; then
 		cd tools/clang || die
 
 		if use static-analyzer ; then
@@ -307,3 +356,10 @@ src_install() {
 		done
 	fi
 }
+
+multilib_src_install_all() {
+	if use vim-syntax; then
+		insinto /usr/share/vim/vimfiles/syntax
+		doins utils/vim/*.vim
+	fi
+}


             reply	other threads:[~2013-07-12 16:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-12 16:46 Michał Górny [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-07-20 10:28 [gentoo-commits] dev/mgorny:master commit in: sys-devel/llvm/ Michał Górny
2013-07-20  7:15 Michał Górny
2013-07-20  6:28 Michał Górny
2013-07-19 21:24 Michał Górny
2013-07-19 21:24 Michał Górny
2013-07-19 13:11 Michał Górny
2013-07-15 16:15 Michał Górny
2013-07-14 21:47 Michał Górny
2013-07-14 21:38 Michał Górny
2013-07-14 21:18 Michał Górny
2013-07-14 21:11 Michał Górny
2013-07-14 20:04 Michał Górny
2013-07-14 11:14 Michał Górny
2013-07-13 22:03 Michał Górny
2013-07-10  9:58 Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1373647598.ab766db3fd6ad20316eca1c6c9ce55762d335542.mgorny@gentoo \
    --to=mgorny@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox