diff options
author | Michał Górny <mgorny@gentoo.org> | 2013-07-21 10:00:50 +0000 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2013-07-21 10:00:50 +0000 |
commit | a1adf8d4592099900068fbd3f3866aefcb86b51c (patch) | |
tree | 612bb33b6df644d433083b596dce6397b6babb3b /sys-devel | |
parent | Cleanup due http://gentoo.2317880.n4.nabble.com/sgml-herd-has-no-maintainers-... (diff) | |
download | gentoo-2-a1adf8d4592099900068fbd3f3866aefcb86b51c.tar.gz gentoo-2-a1adf8d4592099900068fbd3f3866aefcb86b51c.tar.bz2 gentoo-2-a1adf8d4592099900068fbd3f3866aefcb86b51c.zip |
Include the improved ebuild from ::mgorny. Integrate clang, introduce multilib support, fix rpath issues. Bug #477432.
(Portage version: 2.2.0_alpha188/cvs/Linux x86_64, signed Manifest commit with key 9627F456F9DA7643!)
Diffstat (limited to 'sys-devel')
-rw-r--r-- | sys-devel/llvm/ChangeLog | 12 | ||||
-rw-r--r-- | sys-devel/llvm/files/clang-3.3-gentoo-install.patch | 71 | ||||
-rw-r--r-- | sys-devel/llvm/files/llvm-3.3-gentoo-install.patch | 149 | ||||
-rw-r--r-- | sys-devel/llvm/files/llvm-3.4-gentoo-install.patch | 145 | ||||
-rw-r--r-- | sys-devel/llvm/llvm-3.3-r1.ebuild | 403 | ||||
-rw-r--r-- | sys-devel/llvm/llvm-9999-r1.ebuild | 374 | ||||
-rw-r--r-- | sys-devel/llvm/metadata.xml | 2 |
7 files changed, 1155 insertions, 1 deletions
diff --git a/sys-devel/llvm/ChangeLog b/sys-devel/llvm/ChangeLog index 3cb30ff525e3..78c541799320 100644 --- a/sys-devel/llvm/ChangeLog +++ b/sys-devel/llvm/ChangeLog @@ -1,6 +1,16 @@ # ChangeLog for sys-devel/llvm # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-devel/llvm/ChangeLog,v 1.115 2013/06/24 14:43:00 voyageur Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-devel/llvm/ChangeLog,v 1.116 2013/07/21 10:00:50 mgorny Exp $ + +*llvm-9999-r1 (21 Jul 2013) +*llvm-3.3-r1 (21 Jul 2013) + + 21 Jul 2013; Michał Górny <mgorny@gentoo.org> + +files/clang-3.3-gentoo-install.patch, +files/llvm-3.3-gentoo-install.patch, + +files/llvm-3.4-gentoo-install.patch, +llvm-3.3-r1.ebuild, + +llvm-9999-r1.ebuild, metadata.xml: + Include the improved ebuild from ::mgorny. Integrate clang, introduce multilib + support, fix rpath issues. Bug #477432. 24 Jun 2013; Bernard Cafarelli <voyageur@gentoo.org> llvm-3.3.ebuild, +files/llvm-3.3-R600_debug.patch: diff --git a/sys-devel/llvm/files/clang-3.3-gentoo-install.patch b/sys-devel/llvm/files/clang-3.3-gentoo-install.patch new file mode 100644 index 000000000000..b8291f21dc30 --- /dev/null +++ b/sys-devel/llvm/files/clang-3.3-gentoo-install.patch @@ -0,0 +1,71 @@ +From 1a539a8868070e49966c6b5f5e4b9f1257acd7dc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <gentoo@mgorny.alt.pl> +Date: Fri, 19 Jul 2013 10:23:57 +0200 +Subject: [PATCH] clang gentoo install + +--- + tools/clang/lib/Driver/Tools.cpp | 4 ++-- + tools/clang/tools/scan-build/scan-build | 4 ++-- + tools/clang/tools/scan-view/scan-view | 2 +- + 3 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/tools/clang/lib/Driver/Tools.cpp b/tools/clang/lib/Driver/Tools.cpp +index e014980..6e60513 100644 +--- a/tools/clang/lib/Driver/Tools.cpp ++++ b/tools/clang/lib/Driver/Tools.cpp +@@ -219,7 +219,7 @@ static void addProfileRT(const ToolChain &TC, const ArgList &Args, + // libprofile_rt.so. We used to use the -l:libprofile_rt.a syntax, but that is + // not supported by old linkers. + std::string ProfileRT = +- std::string(TC.getDriver().Dir) + "/../lib/libprofile_rt.a"; ++ std::string(TC.getDriver().Dir) + "/../@libdir@/llvm/libprofile_rt.a"; + + CmdArgs.push_back(Args.MakeArgString(ProfileRT)); + } +@@ -6177,7 +6177,7 @@ void gnutools::Link::ConstructJob(Compilation &C, const JobAction &JA, + // forward. + if (D.IsUsingLTO(Args) || Args.hasArg(options::OPT_use_gold_plugin)) { + CmdArgs.push_back("-plugin"); +- std::string Plugin = ToolChain.getDriver().Dir + "/../lib/LLVMgold.so"; ++ std::string Plugin = ToolChain.getDriver().Dir + "/../@libdir@/llvm/LLVMgold.so"; + CmdArgs.push_back(Args.MakeArgString(Plugin)); + + // Try to pass driver level flags relevant to LTO code generation down to +diff --git a/tools/clang/tools/scan-build/scan-build b/tools/clang/tools/scan-build/scan-build +index 22d5289..dcb4822 100755 +--- a/tools/clang/tools/scan-build/scan-build ++++ b/tools/clang/tools/scan-build/scan-build +@@ -410,7 +410,7 @@ sub CopyFiles { + + my $Dir = shift; + +- my $JS = Cwd::realpath("$RealBin/sorttable.js"); ++ my $JS = Cwd::realpath("@EPREFIX@/usr/share/llvm/sorttable.js"); + + DieDiag("Cannot find 'sorttable.js'.\n") + if (! -r $JS); +@@ -420,7 +420,7 @@ sub CopyFiles { + DieDiag("Could not copy 'sorttable.js' to '$Dir'.\n") + if (! -r "$Dir/sorttable.js"); + +- my $CSS = Cwd::realpath("$RealBin/scanview.css"); ++ my $CSS = Cwd::realpath("@EPREFIX@/usr/share/llvm/scanview.css"); + + DieDiag("Cannot find 'scanview.css'.\n") + if (! -r $CSS); +diff --git a/tools/clang/tools/scan-view/scan-view b/tools/clang/tools/scan-view/scan-view +index fb27da6..1f8ddb8 100755 +--- a/tools/clang/tools/scan-view/scan-view ++++ b/tools/clang/tools/scan-view/scan-view +@@ -54,7 +54,7 @@ def start_browser(port, options): + webbrowser.open(url) + + def run(port, options, root): +- import ScanView ++ from clang import ScanView + try: + print 'Starting scan-view at: http://%s:%d'%(options.host, + port) +-- +1.8.3.2 + diff --git a/sys-devel/llvm/files/llvm-3.3-gentoo-install.patch b/sys-devel/llvm/files/llvm-3.3-gentoo-install.patch new file mode 100644 index 000000000000..8b19353d4b33 --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.3-gentoo-install.patch @@ -0,0 +1,149 @@ +From 378109dbae7e4772d9b096384904c638a6a34028 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <gentoo@mgorny.alt.pl> +Date: Fri, 19 Jul 2013 10:10:52 +0200 +Subject: [PATCH 1/2] gentoo install fixes + +--- + Makefile.config.in | 6 +++--- + Makefile.rules | 7 +++---- + tools/gold/Makefile | 2 +- + tools/llvm-config/BuildVariables.inc.in | 2 ++ + tools/llvm-config/Makefile | 4 ++++ + tools/llvm-config/llvm-config.cpp | 5 +++-- + utils/FileCheck/Makefile | 2 +- + 7 files changed, 17 insertions(+), 11 deletions(-) + +diff --git a/Makefile.config.in b/Makefile.config.in +index fd4f6ef..5634ecc 100644 +--- a/Makefile.config.in ++++ b/Makefile.config.in +@@ -95,10 +95,10 @@ PROJ_internal_prefix := $(prefix) + endif + + PROJ_bindir := $(PROJ_prefix)/bin +-PROJ_libdir := $(PROJ_prefix)/lib ++PROJ_libdir := $(PROJ_prefix)/$(GENTOO_LIBDIR)/llvm + PROJ_datadir := $(PROJ_prefix)/share +-PROJ_docsdir := $(PROJ_prefix)/docs/llvm +-PROJ_etcdir := $(PROJ_prefix)/etc/llvm ++PROJ_docsdir := $(PROJ_prefix)/share/doc/@PF@ ++PROJ_etcdir := @EPREFIX@/etc/llvm + PROJ_includedir := $(PROJ_prefix)/include + PROJ_infodir := $(PROJ_prefix)/info + PROJ_mandir := $(PROJ_prefix)/share/man +diff --git a/Makefile.rules b/Makefile.rules +index f0c542b..db252f7 100644 +--- a/Makefile.rules ++++ b/Makefile.rules +@@ -276,7 +276,7 @@ ifeq ($(ENABLE_OPTIMIZED),1) + # Don't use -fomit-frame-pointer on Darwin or FreeBSD. + ifneq ($(HOST_OS),FreeBSD) + ifneq ($(HOST_OS),Darwin) +- OmitFramePointer := -fomit-frame-pointer ++ OmitFramePointer := + endif + endif + +@@ -601,7 +601,6 @@ endif + ifdef SHARED_LIBRARY + ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) + ifneq ($(HOST_OS),Darwin) +- LD.Flags += $(RPATH) -Wl,'$$ORIGIN' + endif + endif + endif +@@ -639,7 +638,7 @@ endif + ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) + ifneq ($(HOST_OS), Darwin) + ifdef TOOLNAME +- LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib' ++ LD.Flags += $(RPATH) -Wl,'$(PROJ_libdir)' + ifdef EXAMPLE_TOOL + LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(DynamicFlag) + else +@@ -648,7 +647,7 @@ ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) + endif + else + ifneq ($(DARWIN_MAJVERS),4) +- LD.Flags += $(RPATH) -Wl,@executable_path/../lib ++ LD.Flags += $(RPATH) -Wl,'$(PROJ_libdir)' + endif + ifeq ($(RC_XBS),YES) + TempFile := $(shell mkdir -p ${OBJROOT}/dSYMs ; mktemp ${OBJROOT}/dSYMs/llvm-lto.XXXXXX) +diff --git a/tools/gold/Makefile b/tools/gold/Makefile +index 496e31c..d36b340 100644 +--- a/tools/gold/Makefile ++++ b/tools/gold/Makefile +@@ -24,7 +24,7 @@ include $(LEVEL)/Makefile.config + # Because off_t is used in the public API, the largefile parts are required for + # ABI compatibility. + CXXFLAGS += -I$(BINUTILS_INCDIR) -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 +-LDFLAGS += -L$(SharedLibDir)/$(SharedPrefix) ++LDFLAGS += -L$(PROJ_libdir) + + include $(LEVEL)/Makefile.common + +diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in +index fe87afb..fd9f2c6 100644 +--- a/tools/llvm-config/BuildVariables.inc.in ++++ b/tools/llvm-config/BuildVariables.inc.in +@@ -25,3 +25,5 @@ + #define LLVM_BUILDMODE "@LLVM_BUILDMODE@" + #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@" + #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@" ++#define LLVM_RPATH "@LLVM_RPATH@" ++#define LLVM_LIBDIR "@LLVM_LIBDIR@" +diff --git a/tools/llvm-config/Makefile b/tools/llvm-config/Makefile +index b20b6bf..fc56781 100644 +--- a/tools/llvm-config/Makefile ++++ b/tools/llvm-config/Makefile +@@ -55,6 +55,10 @@ $(ObjDir)/BuildVariables.inc: $(BUILDVARIABLES_SRCPATH) Makefile $(ObjDir)/.dir + >> temp.sed + $(Verb) $(ECHO) 's/@LLVM_TARGETS_BUILT@/$(subst /,\/,$(TARGETS_TO_BUILD))/' \ + >> temp.sed ++ $(Verb) $(ECHO) 's/@LLVM_RPATH@/$(subst /,\/,$(RPATH))/' \ ++ >> temp.sed ++ $(Verb) $(ECHO) 's/@LLVM_LIBDIR@/$(subst /,\/,$(GENTOO_LIBDIR))/' \ ++ >> temp.sed + $(Verb) $(SED) -f temp.sed < $< > $@ + $(Verb) $(RM) temp.sed + +diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp +index 7edf5ec..4541c28 100644 +--- a/tools/llvm-config/llvm-config.cpp ++++ b/tools/llvm-config/llvm-config.cpp +@@ -250,7 +250,7 @@ int main(int argc, char **argv) { + ActivePrefix = CurrentExecPrefix; + ActiveIncludeDir = ActivePrefix + "/include"; + ActiveBinDir = ActivePrefix + "/bin"; +- ActiveLibDir = ActivePrefix + "/lib"; ++ ActiveLibDir = ActivePrefix + "/" LLVM_LIBDIR "/llvm"; + ActiveIncludeOption = "-I" + ActiveIncludeDir; + } + +@@ -277,7 +277,8 @@ int main(int argc, char **argv) { + } else if (Arg == "--cxxflags") { + OS << ActiveIncludeOption << ' ' << LLVM_CXXFLAGS << '\n'; + } else if (Arg == "--ldflags") { +- OS << "-L" << ActiveLibDir << ' ' << LLVM_LDFLAGS ++ OS << "-L" << ActiveLibDir << ' ' ++ << LLVM_RPATH << " -Wl," << ActiveLibDir << ' ' << LLVM_LDFLAGS + << ' ' << LLVM_SYSTEM_LIBS << '\n'; + } else if (Arg == "--libs") { + PrintLibs = true; +diff --git a/utils/FileCheck/Makefile b/utils/FileCheck/Makefile +index 268b7bc..e7674f9 100644 +--- a/utils/FileCheck/Makefile ++++ b/utils/FileCheck/Makefile +@@ -15,7 +15,7 @@ USEDLIBS = LLVMSupport.a + TOOL_NO_EXPORTS = 1 + + # Don't install this utility +-NO_INSTALL = 1 ++#NO_INSTALL = 1 + + include $(LEVEL)/Makefile.common + +-- +1.8.3.2 + diff --git a/sys-devel/llvm/files/llvm-3.4-gentoo-install.patch b/sys-devel/llvm/files/llvm-3.4-gentoo-install.patch new file mode 100644 index 000000000000..659486ae6c57 --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.4-gentoo-install.patch @@ -0,0 +1,145 @@ +From be2ee7ba7ab4c1aec86d3d9e49e1be241afd8abd Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <gentoo@mgorny.alt.pl> +Date: Fri, 19 Jul 2013 10:10:52 +0200 +Subject: [PATCH 1/2] gentoo install fixes + +--- + Makefile.config.in | 6 +++--- + Makefile.rules | 7 +++---- + tools/gold/Makefile | 2 +- + tools/llvm-config/BuildVariables.inc.in | 2 ++ + tools/llvm-config/Makefile | 4 ++++ + tools/llvm-config/llvm-config.cpp | 5 +++-- + utils/FileCheck/Makefile | 2 +- + 7 files changed, 17 insertions(+), 11 deletions(-) + +diff --git a/Makefile.config.in b/Makefile.config.in +index dcca45f..e75ae2e 100644 +--- a/Makefile.config.in ++++ b/Makefile.config.in +@@ -95,10 +95,10 @@ PROJ_internal_prefix := $(prefix) + endif + + PROJ_bindir := $(PROJ_prefix)/bin +-PROJ_libdir := $(PROJ_prefix)/lib ++PROJ_libdir := $(PROJ_prefix)/$(GENTOO_LIBDIR)/llvm + PROJ_datadir := $(PROJ_prefix)/share +-PROJ_docsdir := $(PROJ_prefix)/docs/llvm +-PROJ_etcdir := $(PROJ_prefix)/etc/llvm ++PROJ_docsdir := $(PROJ_prefix)/share/doc/@PF@ ++PROJ_etcdir := @EPREFIX@/etc/llvm + PROJ_includedir := $(PROJ_prefix)/include + PROJ_infodir := $(PROJ_prefix)/info + PROJ_mandir := $(PROJ_prefix)/share/man +diff --git a/Makefile.rules b/Makefile.rules +index 1bc78f1..60cd228 100644 +--- a/Makefile.rules ++++ b/Makefile.rules +@@ -277,7 +277,7 @@ ifeq ($(ENABLE_OPTIMIZED),1) + ifneq ($(HOST_OS),FreeBSD) + ifneq ($(HOST_OS),GNU/kFreeBSD) + ifneq ($(HOST_OS),Darwin) +- OmitFramePointer := -fomit-frame-pointer ++ OmitFramePointer := + endif + endif + endif +@@ -605,7 +605,6 @@ endif + ifdef SHARED_LIBRARY + ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) + ifneq ($(HOST_OS),Darwin) +- LD.Flags += $(RPATH) -Wl,'$$ORIGIN' + endif + endif + endif +@@ -643,11 +642,11 @@ endif + ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) + ifneq ($(HOST_OS), Darwin) + ifdef TOOLNAME +- LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib' $(DynamicFlag) ++ LD.Flags += $(RPATH) -Wl,'$(PROJ_libdir)' $(DynamicFlag) + endif + else + ifneq ($(DARWIN_MAJVERS),4) +- LD.Flags += $(RPATH) -Wl,@executable_path/../lib ++ LD.Flags += $(RPATH) -Wl,'$(PROJ_libdir)' + endif + ifeq ($(RC_XBS),YES) + TempFile := $(shell mkdir -p ${OBJROOT}/dSYMs ; mktemp ${OBJROOT}/dSYMs/llvm-lto.XXXXXX) +diff --git a/tools/gold/Makefile b/tools/gold/Makefile +index 496e31c..d36b340 100644 +--- a/tools/gold/Makefile ++++ b/tools/gold/Makefile +@@ -24,7 +24,7 @@ include $(LEVEL)/Makefile.config + # Because off_t is used in the public API, the largefile parts are required for + # ABI compatibility. + CXXFLAGS += -I$(BINUTILS_INCDIR) -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 +-LDFLAGS += -L$(SharedLibDir)/$(SharedPrefix) ++LDFLAGS += -L$(PROJ_libdir) + + include $(LEVEL)/Makefile.common + +diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in +index fe87afb..fd9f2c6 100644 +--- a/tools/llvm-config/BuildVariables.inc.in ++++ b/tools/llvm-config/BuildVariables.inc.in +@@ -25,3 +25,5 @@ + #define LLVM_BUILDMODE "@LLVM_BUILDMODE@" + #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@" + #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@" ++#define LLVM_RPATH "@LLVM_RPATH@" ++#define LLVM_LIBDIR "@LLVM_LIBDIR@" +diff --git a/tools/llvm-config/Makefile b/tools/llvm-config/Makefile +index b20b6bf..fc56781 100644 +--- a/tools/llvm-config/Makefile ++++ b/tools/llvm-config/Makefile +@@ -55,6 +55,10 @@ $(ObjDir)/BuildVariables.inc: $(BUILDVARIABLES_SRCPATH) Makefile $(ObjDir)/.dir + >> temp.sed + $(Verb) $(ECHO) 's/@LLVM_TARGETS_BUILT@/$(subst /,\/,$(TARGETS_TO_BUILD))/' \ + >> temp.sed ++ $(Verb) $(ECHO) 's/@LLVM_RPATH@/$(subst /,\/,$(RPATH))/' \ ++ >> temp.sed ++ $(Verb) $(ECHO) 's/@LLVM_LIBDIR@/$(subst /,\/,$(GENTOO_LIBDIR))/' \ ++ >> temp.sed + $(Verb) $(SED) -f temp.sed < $< > $@ + $(Verb) $(RM) temp.sed + +diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp +index 3924e2e..f439c60 100644 +--- a/tools/llvm-config/llvm-config.cpp ++++ b/tools/llvm-config/llvm-config.cpp +@@ -250,7 +250,7 @@ int main(int argc, char **argv) { + ActivePrefix = CurrentExecPrefix; + ActiveIncludeDir = ActivePrefix + "/include"; + ActiveBinDir = ActivePrefix + "/bin"; +- ActiveLibDir = ActivePrefix + "/lib"; ++ ActiveLibDir = ActivePrefix + "/" LLVM_LIBDIR "/llvm"; + ActiveIncludeOption = "-I" + ActiveIncludeDir; + } + +@@ -277,7 +277,8 @@ int main(int argc, char **argv) { + } else if (Arg == "--cxxflags") { + OS << ActiveIncludeOption << ' ' << LLVM_CXXFLAGS << '\n'; + } else if (Arg == "--ldflags") { +- OS << "-L" << ActiveLibDir << ' ' << LLVM_LDFLAGS ++ OS << "-L" << ActiveLibDir << ' ' ++ << LLVM_RPATH << " -Wl," << ActiveLibDir << ' ' << LLVM_LDFLAGS + << ' ' << LLVM_SYSTEM_LIBS << '\n'; + } else if (Arg == "--libs") { + PrintLibs = true; +diff --git a/utils/FileCheck/Makefile b/utils/FileCheck/Makefile +index 268b7bc..e7674f9 100644 +--- a/utils/FileCheck/Makefile ++++ b/utils/FileCheck/Makefile +@@ -15,7 +15,7 @@ USEDLIBS = LLVMSupport.a + TOOL_NO_EXPORTS = 1 + + # Don't install this utility +-NO_INSTALL = 1 ++#NO_INSTALL = 1 + + include $(LEVEL)/Makefile.common + +-- +1.8.3.2 + diff --git a/sys-devel/llvm/llvm-3.3-r1.ebuild b/sys-devel/llvm/llvm-3.3-r1.ebuild new file mode 100644 index 000000000000..9ac1c00c9288 --- /dev/null +++ b/sys-devel/llvm/llvm-3.3-r1.ebuild @@ -0,0 +1,403 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-devel/llvm/llvm-3.3-r1.ebuild,v 1.1 2013/07/21 10:00:50 mgorny Exp $ + +EAPI=5 + +PYTHON_COMPAT=( python{2_5,2_6,2_7} pypy{1_9,2_0} ) + +inherit eutils flag-o-matic multilib multilib-minimal \ + python-r1 toolchain-funcs pax-utils + +DESCRIPTION="Low Level Virtual Machine" +HOMEPAGE="http://llvm.org/" +SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.gz + clang? ( http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.gz + http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.gz ) + !doc? ( http://dev.gentoo.org/~voyageur/distfiles/${P}-manpages.tar.bz2 )" + +LICENSE="UoI-NCSA" +SLOT="0" +KEYWORDS="~amd64 ~arm ~ppc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos" +IUSE="clang debug doc gold kernel_FreeBSD +libffi multitarget ocaml python + +static-analyzer test udis86 video_cards_radeon" + +DEPEND="dev-lang/perl + >=sys-devel/make-3.79 + >=sys-devel/flex-2.5.4 + >=sys-devel/bison-1.875d + || ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1 ) + || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-3.2.3 ) + sys-libs/zlib + doc? ( dev-python/sphinx ) + gold? ( >=sys-devel/binutils-2.22[cxx] ) + libffi? ( virtual/pkgconfig + virtual/libffi[${MULTILIB_USEDEP}] ) + ocaml? ( dev-lang/ocaml ) + udis86? ( dev-libs/udis86[pic(+),${MULTILIB_USEDEP}] ) + ${PYTHON_DEPS}" +RDEPEND="dev-lang/perl + libffi? ( virtual/libffi[${MULTILIB_USEDEP}] ) + clang? ( python? ( ${PYTHON_DEPS} ) ) + udis86? ( dev-libs/udis86[pic(+),${MULTILIB_USEDEP}] ) + clang? ( !<=sys-devel/clang-3.3-r99 + !>=sys-devel/clang-9999 ) + abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224 + !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )" + +# pypy gives me around 1700 unresolved tests due to open file limit +# being exceeded. probably GC does not close them fast enough. +REQUIRED_USE="${PYTHON_REQUIRED_USE} + test? ( || ( $(python_gen_useflags 'python*') ) )" + +S=${WORKDIR}/${P}.src + +pkg_setup() { + # need to check if the active compiler is ok + + broken_gcc=" 3.2.2 3.2.3 3.3.2 4.1.1 " + broken_gcc_x86=" 3.4.0 3.4.2 " + broken_gcc_amd64=" 3.4.6 " + + gcc_vers=$(gcc-fullversion) + + if [[ ${broken_gcc} == *" ${version} "* ]] ; then + elog "Your version of gcc is known to miscompile llvm." + elog "Check http://www.llvm.org/docs/GettingStarted.html for" + elog "possible solutions." + die "Your currently active version of gcc is known to miscompile llvm" + fi + + if [[ ${CHOST} == i*86-* && ${broken_gcc_x86} == *" ${version} "* ]] ; then + elog "Your version of gcc is known to miscompile llvm on x86" + elog "architectures. Check" + elog "http://www.llvm.org/docs/GettingStarted.html for possible" + elog "solutions." + die "Your currently active version of gcc is known to miscompile llvm" + fi + + if [[ ${CHOST} == x86_64-* && ${broken_gcc_amd64} == *" ${version} "* ]]; + then + elog "Your version of gcc is known to miscompile llvm in amd64" + elog "architectures. Check" + elog "http://www.llvm.org/docs/GettingStarted.html for possible" + elog "solutions." + die "Your currently active version of gcc is known to miscompile llvm" + fi +} + +src_unpack() { + default + + rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \ + || die "symlinks removal failed" + + if use clang; then + mv "${WORKDIR}"/cfe-${PV}.src "${S}"/tools/clang \ + || die "clang source directory move failed" + mv "${WORKDIR}"/compiler-rt-${PV}.src "${S}"/projects/compiler-rt \ + || die "compiler-rt source directory move failed" + fi +} + +src_prepare() { + if use clang; then + # Automatically select active system GCC's libraries, bugs #406163 and #417913 + epatch "${FILESDIR}"/clang-3.1-gentoo-runtime-gcc-detection-v3.patch + + # Fix search paths on FreeBSD, bug #409269 + # This patch causes problem for multilib on fbsd, see comments in the patch + # (aballier@g.o) + # epatch "${FILESDIR}"/clang-3.1-gentoo-freebsd-fix-lib-path.patch + + # Fix regression caused by removal of USE=system-cxx-headers, bug #417541 + # Needs to be updated for 3.2 + #epatch "${FILESDIR}"/clang-3.1-gentoo-freebsd-fix-cxx-paths-v2.patch + fi + + epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch + epatch "${FILESDIR}"/${P}-R600_debug.patch + epatch "${FILESDIR}"/${PN}-3.3-gentoo-install.patch + use clang && epatch "${FILESDIR}"/clang-3.3-gentoo-install.patch + + # Fix insecure RPATHs that were removed upstream already. + epatch "${FILESDIR}"/${P}-insecure-rpath.patch + + local sub_files=( + Makefile.config.in + Makefile.rules + tools/llvm-config/llvm-config.cpp + ) + use clang && sub_files+=( + tools/clang/lib/Driver/Tools.cpp + tools/clang/tools/scan-build/scan-build + ) + + # unfortunately ./configure won't listen to --mandir and the-like, so take + # care of this. + # note: we're setting the main libdir intentionally. + # where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make. + einfo "Fixing install dirs" + sed -e "s,@libdir@,$(get_libdir),g" \ + -e "s,@PF@,${PF},g" \ + -e "s,@EPREFIX@,${EPREFIX},g" \ + -i "${sub_files[@]}" \ + || die "install paths sed failed" + + # User patches + epatch_user +} + +llvm_add_ldpath() { + # Add LLVM built libraries to LD_LIBRARY_PATH. + # This way we don't have to hack RPATHs of executables. + local libpath + if use debug; then + libpath=${BUILD_DIR}/Debug+Asserts+Checks/lib + else + libpath=${BUILD_DIR}/Release/lib + fi + + export LD_LIBRARY_PATH=${libpath}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} +} + +multilib_src_configure() { + local CONF_FLAGS="--enable-keep-symbols + --enable-shared + --with-optimize-option= + $(use_enable !debug optimized) + $(use_enable debug assertions) + $(use_enable debug expensive-checks)" + + if use clang; then + CONF_FLAGS+=" + --with-clang-resource-dir=../lib/clang/${PV}" + fi + + if use multitarget; then + CONF_FLAGS="${CONF_FLAGS} --enable-targets=all" + else + CONF_FLAGS="${CONF_FLAGS} --enable-targets=host,cpp" + fi + + if [[ ${ABI} == amd64 ]]; then + CONF_FLAGS="${CONF_FLAGS} --enable-pic" + fi + + if multilib_is_native_abi && use gold; then + CONF_FLAGS="${CONF_FLAGS} --with-binutils-include=${EPREFIX}/usr/include/" + fi + if multilib_is_native_abi && use ocaml; then + CONF_FLAGS="${CONF_FLAGS} --enable-bindings=ocaml" + else + CONF_FLAGS="${CONF_FLAGS} --enable-bindings=none" + fi + + if use udis86; then + CONF_FLAGS="${CONF_FLAGS} --with-udis86" + fi + + if use video_cards_radeon; then + CONF_FLAGS="${CONF_FLAGS} + --enable-experimental-targets=R600" + fi + + if use libffi; then + append-cppflags "$(pkg-config --cflags libffi)" + fi + CONF_FLAGS="${CONF_FLAGS} $(use_enable libffi)" + + # build with a suitable Python version + python_export_best + + # llvm prefers clang over gcc, so we may need to force that + tc-export CC CXX + + ECONF_SOURCE=${S} \ + econf ${CONF_FLAGS} +} + +multilib_src_compile() { + local mymakeopts=( + VERBOSE=1 + REQUIRES_RTTI=1 + GENTOO_LIBDIR="$(get_libdir)" + ) + + local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH} + llvm_add_ldpath + + # 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 + use clang && emake -C tools/clang "${mymakeopts[@]}" + fi + + if multilib_is_native_abi && use doc; then + emake -C "${S}"/docs -f Makefile.sphinx man html + fi + + if use debug; then + pax-mark m Debug+Asserts+Checks/bin/llvm-rtdyld + pax-mark m Debug+Asserts+Checks/bin/lli + else + pax-mark m Release/bin/llvm-rtdyld + pax-mark m Release/bin/lli + fi + if use test; then + pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests + pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests + pax-mark m unittests/Support/Release/SupportTests + fi +} + +multilib_src_test() { + local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH} + llvm_add_ldpath + + default + + use clang && emake -C tools/clang test +} + +src_install() { + local MULTILIB_WRAPPED_HEADERS=( + /usr/include/llvm/Config/config.h + /usr/include/llvm/Config/llvm-config.h + ) + + use clang && MULTILIB_WRAPPED_HEADERS+=( + /usr/include/clang/Config/config.h + ) + + multilib-minimal_src_install + + # Remove unnecessary headers on FreeBSD, bug #417171 + use kernel_FreeBSD && use clang && rm "${ED}"usr/lib/clang/${PV}/include/{arm_neon,std,float,iso,limits,tgmath,varargs}*.h +} + +multilib_src_install() { + local mymakeopts=( + DESTDIR="${D}" + GENTOO_LIBDIR="$(get_libdir)" + ) + + local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH} + llvm_add_ldpath + + if multilib_is_native_abi; then + emake "${mymakeopts[@]}" install + + # Move files back. + if path_exists -o "${ED}"/tmp/llvm-config.*; then + mv "${ED}"/tmp/llvm-config.* "${ED}"/usr/bin || die + fi + 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 + use clang && 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 + + # Fix install_names on Darwin. The build system is too complicated + # to just fix this, so we correct it post-install + local lib= f= odylib= libpv=${PV} + if [[ ${CHOST} == *-darwin* ]] ; then + eval $(grep PACKAGE_VERSION= configure) + [[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION} + for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib {BugpointPasses,LLVMHello}.dylib ; do + # libEnhancedDisassembly is Darwin10 only, so non-fatal + # + omit clang libs if not enabled + [[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue + + ebegin "fixing install_name of $lib" + install_name_tool \ + -id "${EPREFIX}"/usr/lib/${PN}/${lib} \ + "${ED}"/usr/lib/${PN}/${lib} + eend $? + done + for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}/lib{LTO,clang}.dylib ; do + # omit clang libs if not enabled + [[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue + + odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${libpv}.dylib) + ebegin "fixing install_name reference to ${odylib} of ${f##*/}" + install_name_tool \ + -change "${odylib}" \ + "${EPREFIX}"/usr/lib/${PN}/libLLVM-${libpv}.dylib \ + -change "@rpath/libclang.dylib" \ + "${EPREFIX}"/usr/lib/llvm/libclang.dylib \ + -change "${S}"/Release/lib/libclang.dylib \ + "${EPREFIX}"/usr/lib/llvm/libclang.dylib \ + "${f}" + eend $? + done + fi +} + +multilib_src_install_all() { + if use doc; then + doman docs/_build/man/*.1 + dohtml -r docs/_build/html/ + else + doman "${WORKDIR}"/${P}-manpages/*.1 + fi + + insinto /usr/share/vim/vimfiles/syntax + doins utils/vim/*.vim + + if use clang; then + cd tools/clang || die + + if use static-analyzer ; then + dobin tools/scan-build/ccc-analyzer + dosym ccc-analyzer /usr/bin/c++-analyzer + dobin tools/scan-build/scan-build + + insinto /usr/share/${PN} + doins tools/scan-build/scanview.css + doins tools/scan-build/sorttable.js + fi + + python_inst() { + if use static-analyzer ; then + pushd tools/scan-view >/dev/null || die + + python_doscript scan-view + + touch __init__.py || die + python_moduleinto clang + python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py + + popd >/dev/null || die + fi + + if use python ; then + pushd bindings/python/clang >/dev/null || die + + python_moduleinto clang + python_domodule __init__.py cindex.py enumerations.py + + popd >/dev/null || die + fi + + # AddressSanitizer symbolizer (currently separate) + python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py + } + python_foreach_impl python_inst + fi +} diff --git a/sys-devel/llvm/llvm-9999-r1.ebuild b/sys-devel/llvm/llvm-9999-r1.ebuild new file mode 100644 index 000000000000..216e37bb223d --- /dev/null +++ b/sys-devel/llvm/llvm-9999-r1.ebuild @@ -0,0 +1,374 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-devel/llvm/llvm-9999-r1.ebuild,v 1.1 2013/07/21 10:00:50 mgorny Exp $ + +EAPI=5 + +PYTHON_COMPAT=( python{2_5,2_6,2_7} pypy{1_9,2_0} ) + +inherit subversion eutils flag-o-matic multilib multilib-minimal \ + python-r1 toolchain-funcs pax-utils + +DESCRIPTION="Low Level Virtual Machine" +HOMEPAGE="http://llvm.org/" +SRC_URI="" +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 video_cards_radeon" + +DEPEND="dev-lang/perl + dev-python/sphinx + >=sys-devel/make-3.79 + >=sys-devel/flex-2.5.4 + >=sys-devel/bison-1.875d + || ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1 ) + || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-3.2.3 ) + sys-libs/zlib + gold? ( >=sys-devel/binutils-2.22[cxx] ) + libffi? ( virtual/pkgconfig + virtual/libffi[${MULTILIB_USEDEP}] ) + ocaml? ( dev-lang/ocaml ) + udis86? ( dev-libs/udis86[pic(+),${MULTILIB_USEDEP}] ) + ${PYTHON_DEPS}" +RDEPEND="dev-lang/perl + libffi? ( virtual/libffi[${MULTILIB_USEDEP}] ) + clang? ( python? ( ${PYTHON_DEPS} ) ) + udis86? ( dev-libs/udis86[pic(+),${MULTILIB_USEDEP}] ) + clang? ( !<=sys-devel/clang-9999-r99 ) + abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224 + !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )" + +# pypy gives me around 1700 unresolved tests due to open file limit +# being exceeded. probably GC does not close them fast enough. +REQUIRED_USE="${PYTHON_REQUIRED_USE} + test? ( || ( $(python_gen_useflags 'python*') ) )" + +pkg_setup() { + # need to check if the active compiler is ok + + broken_gcc=" 3.2.2 3.2.3 3.3.2 4.1.1 " + broken_gcc_x86=" 3.4.0 3.4.2 " + broken_gcc_amd64=" 3.4.6 " + + gcc_vers=$(gcc-fullversion) + + if [[ ${broken_gcc} == *" ${version} "* ]] ; then + elog "Your version of gcc is known to miscompile llvm." + elog "Check http://www.llvm.org/docs/GettingStarted.html for" + elog "possible solutions." + die "Your currently active version of gcc is known to miscompile llvm" + fi + + if [[ ${CHOST} == i*86-* && ${broken_gcc_x86} == *" ${version} "* ]] ; then + elog "Your version of gcc is known to miscompile llvm on x86" + elog "architectures. Check" + elog "http://www.llvm.org/docs/GettingStarted.html for possible" + elog "solutions." + die "Your currently active version of gcc is known to miscompile llvm" + fi + + if [[ ${CHOST} == x86_64-* && ${broken_gcc_amd64} == *" ${version} "* ]]; + then + elog "Your version of gcc is known to miscompile llvm in amd64" + elog "architectures. Check" + elog "http://www.llvm.org/docs/GettingStarted.html for possible" + elog "solutions." + die "Your currently active version of gcc is known to miscompile llvm" + fi +} + +src_unpack() { + if use clang; then + ESVN_PROJECT=compiler-rt S="${S}"/projects/compiler-rt subversion_fetch "http://llvm.org/svn/llvm-project/compiler-rt/trunk" + + # Force version match between LLVM, compiler-rt & clang + # but first work-around subversion.eclass smartness, bug #282486. + subversion_wc_info "http://llvm.org/svn/llvm-project/compiler-rt/trunk" + local ESVN_REVISION=${ESVN_WC_REVISION} + + ESVN_PROJECT=clang S="${S}"/tools/clang subversion_fetch "http://llvm.org/svn/llvm-project/cfe/trunk" + fi + + # Do llvm last so that ESVN_WC_* is top-level. + subversion_src_unpack +} + +src_prepare() { + epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch + epatch "${FILESDIR}"/${PN}-3.4-gentoo-install.patch + use clang && epatch "${FILESDIR}"/clang-3.3-gentoo-install.patch + + local sub_files=( + Makefile.config.in + Makefile.rules + tools/llvm-config/llvm-config.cpp + ) + use clang && sub_files+=( + tools/clang/lib/Driver/Tools.cpp + tools/clang/tools/scan-build/scan-build + ) + + # unfortunately ./configure won't listen to --mandir and the-like, so take + # care of this. + # note: we're setting the main libdir intentionally. + # where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make. + einfo "Fixing install dirs" + sed -e "s,@libdir@,$(get_libdir),g" \ + -e "s,@PF@,${PF},g" \ + -e "s,@EPREFIX@,${EPREFIX},g" \ + -i "${sub_files[@]}" \ + || die "install paths sed failed" + + # User patches + epatch_user +} + +llvm_add_ldpath() { + # Add LLVM built libraries to LD_LIBRARY_PATH. + # This way we don't have to hack RPATHs of executables. + local libpath + if use debug; then + libpath=${BUILD_DIR}/Debug+Asserts+Checks/lib + else + libpath=${BUILD_DIR}/Release/lib + fi + + export LD_LIBRARY_PATH=${libpath}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} +} + +multilib_src_configure() { + local CONF_FLAGS="--enable-keep-symbols + --enable-shared + --with-optimize-option= + $(use_enable !debug optimized) + $(use_enable debug assertions) + $(use_enable debug expensive-checks)" + + if use clang; then + CONF_FLAGS+=" + --with-clang-resource-dir=../lib/clang/3.4" + fi + + if use multitarget; then + CONF_FLAGS="${CONF_FLAGS} --enable-targets=all" + else + CONF_FLAGS="${CONF_FLAGS} --enable-targets=host,cpp" + if use video_cards_radeon; then + CONF_FLAGS="${CONF_FLAGS},r600" + fi + fi + + if [[ ${ABI} == amd64 ]]; then + CONF_FLAGS="${CONF_FLAGS} --enable-pic" + fi + + if multilib_is_native_abi && use gold; then + CONF_FLAGS="${CONF_FLAGS} --with-binutils-include=${EPREFIX}/usr/include/" + fi + if multilib_is_native_abi && use ocaml; then + CONF_FLAGS="${CONF_FLAGS} --enable-bindings=ocaml" + else + CONF_FLAGS="${CONF_FLAGS} --enable-bindings=none" + fi + + if use udis86; then + CONF_FLAGS="${CONF_FLAGS} --with-udis86" + fi + + if use libffi; then + append-cppflags "$(pkg-config --cflags libffi)" + fi + CONF_FLAGS="${CONF_FLAGS} $(use_enable libffi)" + + # build with a suitable Python version + python_export_best + + # llvm prefers clang over gcc, so we may need to force that + tc-export CC CXX + + ECONF_SOURCE=${S} \ + econf ${CONF_FLAGS} +} + +multilib_src_compile() { + local mymakeopts=( + VERBOSE=1 + REQUIRES_RTTI=1 + GENTOO_LIBDIR="$(get_libdir)" + ) + + local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH} + llvm_add_ldpath + + # 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 + use clang && emake -C tools/clang "${mymakeopts[@]}" + fi + + if multilib_is_native_abi; then + emake -C "${S}"/docs -f Makefile.sphinx man + use doc && emake -C "${S}"/docs -f Makefile.sphinx html + fi + + if use debug; then + pax-mark m Debug+Asserts+Checks/bin/llvm-rtdyld + pax-mark m Debug+Asserts+Checks/bin/lli + else + pax-mark m Release/bin/llvm-rtdyld + pax-mark m Release/bin/lli + fi + if use test; then + pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests + pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests + pax-mark m unittests/Support/Release/SupportTests + fi +} + +multilib_src_test() { + local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH} + llvm_add_ldpath + + default + + use clang && emake -C tools/clang test +} + +src_install() { + local MULTILIB_WRAPPED_HEADERS=( + /usr/include/llvm/Config/config.h + /usr/include/llvm/Config/llvm-config.h + ) + + use clang && MULTILIB_WRAPPED_HEADERS+=( + /usr/include/clang/Config/config.h + ) + + multilib-minimal_src_install +} + +multilib_src_install() { + local mymakeopts=( + DESTDIR="${D}" + GENTOO_LIBDIR="$(get_libdir)" + ) + + local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH} + llvm_add_ldpath + + if multilib_is_native_abi; then + emake "${mymakeopts[@]}" install + + # Move files back. + if path_exists -o "${ED}"/tmp/llvm-config.*; then + mv "${ED}"/tmp/llvm-config.* "${ED}"/usr/bin || die + fi + 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 + use clang && 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 + + # Fix install_names on Darwin. The build system is too complicated + # to just fix this, so we correct it post-install + local lib= f= odylib= libpv=${PV} + if [[ ${CHOST} == *-darwin* ]] ; then + eval $(grep PACKAGE_VERSION= configure) + [[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION} + for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib {BugpointPasses,LLVMHello}.dylib ; do + # libEnhancedDisassembly is Darwin10 only, so non-fatal + # + omit clang libs if not enabled + [[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue + + ebegin "fixing install_name of $lib" + install_name_tool \ + -id "${EPREFIX}"/usr/lib/${PN}/${lib} \ + "${ED}"/usr/lib/${PN}/${lib} + eend $? + done + for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}/lib{LTO,clang}.dylib ; do + # omit clang libs if not enabled + [[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue + + odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${libpv}.dylib) + ebegin "fixing install_name reference to ${odylib} of ${f##*/}" + install_name_tool \ + -change "${odylib}" \ + "${EPREFIX}"/usr/lib/${PN}/libLLVM-${libpv}.dylib \ + -change "@rpath/libclang.dylib" \ + "${EPREFIX}"/usr/lib/llvm/libclang.dylib \ + -change "${S}"/Release/lib/libclang.dylib \ + "${EPREFIX}"/usr/lib/llvm/libclang.dylib \ + "${f}" + eend $? + done + fi +} + +multilib_src_install_all() { + doman docs/_build/man/*.1 + use doc && dohtml -r docs/_build/html/ + + insinto /usr/share/vim/vimfiles/syntax + doins utils/vim/*.vim + + if use clang; then + cd tools/clang || die + + if use static-analyzer ; then + dobin tools/scan-build/ccc-analyzer + dosym ccc-analyzer /usr/bin/c++-analyzer + dobin tools/scan-build/scan-build + + insinto /usr/share/${PN} + doins tools/scan-build/scanview.css + doins tools/scan-build/sorttable.js + fi + + python_inst() { + if use static-analyzer ; then + pushd tools/scan-view >/dev/null || die + + python_doscript scan-view + + touch __init__.py || die + python_moduleinto clang + python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py + + popd >/dev/null || die + fi + + if use python ; then + pushd bindings/python/clang >/dev/null || die + + python_moduleinto clang + python_domodule __init__.py cindex.py enumerations.py + + popd >/dev/null || die + fi + + # AddressSanitizer symbolizer (currently separate) + python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py + } + python_foreach_impl python_inst + fi +} diff --git a/sys-devel/llvm/metadata.xml b/sys-devel/llvm/metadata.xml index 4428300ba5df..7d349003815c 100644 --- a/sys-devel/llvm/metadata.xml +++ b/sys-devel/llvm/metadata.xml @@ -15,10 +15,12 @@ 3. A compiler infrastructure - LLVM is also a collection of source code that implements the language and compilation strategy. The primary components of the LLVM infrastructure are a GCC-based C and C++ front-end, a link-time optimization framework with a growing set of global and interprocedural analyses and transformations, static back-ends for many popular (and some obscure) architectures, a back-end which emits portable C code, and a Just-In-Time compilers for several architectures. 4. LLVM does not imply things that you would expect from a high-level virtual machine. It does not require garbage collection or run-time code generation (In fact, LLVM makes a great static compiler!). Note that optional LLVM components can be used to build high-level virtual machines and other systems that need these services.</longdescription> <use> + <flag name='clang'>Build the clang C/C++ compiler</flag> <flag name='doc'>Build and install the HTML documentation and regenerate the man pages</flag> <flag name='gold'>Build the gold linker plugin</flag> <flag name='llvm-gcc'>Build LLVM with <pkg>sys-devel/llvm-gcc</pkg></flag> <flag name='multitarget'>Build all host targets (default: host only)</flag> + <flag name='static-analyzer'>Install the Clang static analyzer (requires USE=clang)</flag> <flag name='udis86'>Enable support for <pkg>dev-libs/udis86</pkg> disassembler library</flag> </use> </pkgmetadata> |