From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id B4A441381F3 for ; Wed, 10 Jul 2013 09:27:52 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 45D4AE0953; Wed, 10 Jul 2013 09:27:50 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id BA027E0953 for ; Wed, 10 Jul 2013 09:27:49 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 953D333E8A5 for ; Wed, 10 Jul 2013 09:27:48 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 34859E468F for ; Wed, 10 Jul 2013 09:27:47 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1373448456.9992ad68ac225d789398f4fe395dfce6fe3591f7.mgorny@gentoo> Subject: [gentoo-commits] dev/mgorny:master commit in: sys-devel/llvm/files/, sys-devel/clang/, sys-devel/llvm/ X-VCS-Repository: dev/mgorny X-VCS-Files: sys-devel/clang/clang-9999-r100.ebuild sys-devel/clang/metadata.xml sys-devel/llvm/files/llvm-3.2-nodoctargz.patch sys-devel/llvm/llvm-9999.ebuild sys-devel/llvm/metadata.xml X-VCS-Directories: sys-devel/llvm/files/ sys-devel/clang/ sys-devel/llvm/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 9992ad68ac225d789398f4fe395dfce6fe3591f7 X-VCS-Branch: master Date: Wed, 10 Jul 2013 09:27:47 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: ab1d3f9e-f8f1-4659-ada1-0a7037cef587 X-Archives-Hash: d89eed118ca60c8398327d9009b8f8eb commit: 9992ad68ac225d789398f4fe395dfce6fe3591f7 Author: Michał Górny gentoo org> AuthorDate: Wed Jul 10 09:27:36 2013 +0000 Commit: Michał Górny gentoo org> CommitDate: Wed Jul 10 09:27:36 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=dev/mgorny.git;a=commit;h=9992ad68 Integrated clang & llvm ebuild, for testing. --- sys-devel/clang/clang-9999-r100.ebuild | 20 ++ sys-devel/clang/metadata.xml | 38 +++ sys-devel/llvm/files/llvm-3.2-nodoctargz.patch | 45 ++++ sys-devel/llvm/llvm-9999.ebuild | 309 +++++++++++++++++++++++++ sys-devel/llvm/metadata.xml | 26 +++ 5 files changed, 438 insertions(+) diff --git a/sys-devel/clang/clang-9999-r100.ebuild b/sys-devel/clang/clang-9999-r100.ebuild new file mode 100644 index 0000000..d60b42b --- /dev/null +++ b/sys-devel/clang/clang-9999-r100.ebuild @@ -0,0 +1,20 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header$ + +EAPI=5 + +DESCRIPTION="C language family frontend for LLVM (meta-ebuild)" +HOMEPAGE="http://clang.llvm.org/" +SRC_URI="" + +LICENSE="UoI-NCSA" +SLOT="0" +KEYWORDS="" +IUSE="debug multitarget python +static-analyzer" + +RDEPEND="sys-devel/llvm[clang(-),debug=,multitarget=,python=,static-analyzer=]" + +# Please keep this package around since it's quite likely that we'll +# return to separate LLVM & clang ebuilds when the cmake build system +# is complete. diff --git a/sys-devel/clang/metadata.xml b/sys-devel/clang/metadata.xml new file mode 100644 index 0000000..5e2e8e0 --- /dev/null +++ b/sys-devel/clang/metadata.xml @@ -0,0 +1,38 @@ + + + + + voyageur@gentoo.org + Bernard Cafarelli + + + mgorny@gentoo.org + Michał Górny + + + ryao@gentoo.org + Richard Yao + + The goal of the Clang project is to create a new C, C++, Objective C and Objective C++ front-end for the LLVM compiler. + +Features and Goals + +Some of the goals for the project include the following: + +End-User Features: +Fast compiles and low memory use +Expressive diagnostics +GCC compatibility +Utility and Applications: + +Modular library based architecture +Support diverse clients (refactoring, static analysis, code generation, etc) +Allow tight integration with IDEs +Use the LLVM BSD License +Internal Design and Implementation: + +A real-world, production quality compiler +A simple and hackable code base +A single unified parser for C, Objective C, C++, and Objective C++ +Conformance with C/C++/ObjC and their variants + diff --git a/sys-devel/llvm/files/llvm-3.2-nodoctargz.patch b/sys-devel/llvm/files/llvm-3.2-nodoctargz.patch new file mode 100644 index 0000000..3a622b5 --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.2-nodoctargz.patch @@ -0,0 +1,45 @@ +--- docs/Makefile.orig 2012-04-30 17:00:01.000000000 +0200 ++++ docs/Makefile 2012-04-30 17:15:52.000000000 +0200 +@@ -52,11 +52,10 @@ + # 'make generated BUILD_FOR_WEBSITE=1' + generated:: $(generated_targets) + +-install-html: $(PROJ_OBJ_DIR)/html.tar.gz ++install-html: + $(Echo) Installing HTML documentation + $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html + $(Verb) $(DataInstall) $(HTML) $(DESTDIR)$(PROJ_docsdir)/html +- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/html.tar.gz $(DESTDIR)$(PROJ_docsdir) + + $(PROJ_OBJ_DIR)/html.tar.gz: $(HTML) + $(Echo) Packaging HTML documentation +@@ -68,12 +67,11 @@ + install-doxygen: doxygen + $(Echo) Installing doxygen documentation + $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/doxygen +- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(DESTDIR)$(PROJ_docsdir) + $(Verb) cd $(PROJ_OBJ_DIR)/doxygen && \ + $(FIND) . -type f -exec \ + $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/html/doxygen \; + +-doxygen: regendoc $(PROJ_OBJ_DIR)/doxygen.tar.gz ++doxygen: regendoc + + regendoc: + $(Echo) Building doxygen documentation +@@ -99,7 +97,6 @@ + install-ocamldoc: ocamldoc + $(Echo) Installing ocamldoc documentation + $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html +- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(DESTDIR)$(PROJ_docsdir) + $(Verb) cd $(PROJ_OBJ_DIR)/ocamldoc && \ + $(FIND) . -type f -exec \ + $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html \; +@@ -109,7 +106,6 @@ + $(Verb) $(RM) -rf $(PROJ_OBJ_DIR)/ocamldoc.tar* + $(Verb) $(TAR) cf $(PROJ_OBJ_DIR)/ocamldoc.tar ocamldoc + $(Verb) $(GZIPBIN) $(PROJ_OBJ_DIR)/ocamldoc.tar +- $(Verb) $(CP) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(PROJ_OBJ_DIR)/ocamldoc/html/ + + regen-ocamldoc: + $(Echo) Building ocamldoc documentation diff --git a/sys-devel/llvm/llvm-9999.ebuild b/sys-devel/llvm/llvm-9999.ebuild new file mode 100644 index 0000000..18e1a20 --- /dev/null +++ b/sys-devel/llvm/llvm-9999.ebuild @@ -0,0 +1,309 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header$ + +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 + +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 vim-syntax 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 ) + ocaml? ( dev-lang/ocaml ) + udis86? ( dev-libs/udis86[pic(+)] ) + ${PYTHON_DEPS}" +RDEPEND="dev-lang/perl + libffi? ( virtual/libffi ) + python? ( ${PYTHON_DEPS} ) + vim-syntax? ( || ( app-editors/vim app-editors/gvim ) ) + !<=sys-devel/clang-9999-r99" + +# pypy gives me around 1700 unresolved tests due to open file limit +# being exceeded. probably GC does not close them fast enough. +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 + 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() { + # 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" + if use gold; then + sed -e 's,\$(SharedLibDir),'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \ + -i tools/gold/Makefile || die "gold rpath sed failed" + fi + + # FileCheck is needed at least for dragonegg tests + sed -e "/NO_INSTALL = 1/s/^/#/" -i utils/FileCheck/Makefile \ + || 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 \ + || die "scan-view sed failed" + 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 + 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 + + epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch + + # User patches + epatch_user +} + +src_configure() { + local CONF_FLAGS="--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=../$(get_libdir)/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 use amd64; then + CONF_FLAGS="${CONF_FLAGS} --enable-pic" + fi + + if use gold; then + CONF_FLAGS="${CONF_FLAGS} --with-binutils-include=${EPREFIX}/usr/include/" + fi + if 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 ${CONF_FLAGS} +} + +src_compile() { + emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 + + emake -C docs -f Makefile.sphinx man + use doc && emake -C docs -f Makefile.sphinx html + + if use debug; then + pax-mark m Debug+Asserts+Checks/bin/lli + else + 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 +} + +src_test() { + default + + emake -C tools/clang test +} + +src_install() { + emake KEEP_SYMBOLS=1 DESTDIR="${D}" install + + doman docs/_build/man/*.1 + use doc && dohtml -r docs/_build/html/ + + if use vim-syntax; then + insinto /usr/share/vim/vimfiles/syntax + doins utils/vim/*.vim + fi + + 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 + + # 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 +} diff --git a/sys-devel/llvm/metadata.xml b/sys-devel/llvm/metadata.xml new file mode 100644 index 0000000..7d34900 --- /dev/null +++ b/sys-devel/llvm/metadata.xml @@ -0,0 +1,26 @@ + + + + + voyageur@gentoo.org + Bernard Cafarelli + + + mgorny@gentoo.org + Michał Górny + + Low Level Virtual Machine (LLVM) is: + 1. A compilation strategy designed to enable effective program optimization across the entire lifetime of a program. LLVM supports effective optimization at compile time, link-time (particularly interprocedural), run-time and offline (i.e., after software is installed), while remaining transparent to developers and maintaining compatibility with existing build scripts. + 2. A virtual instruction set - LLVM is a low-level object code representation that uses simple RISC-like instructions, but provides rich, language-independent, type information and dataflow (SSA) information about operands. This combination enables sophisticated transformations on object code, while remaining light-weight enough to be attached to the executable. This combination is key to allowing link-time, run-time, and offline transformations. + 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. + + Build the clang C/C++ compiler + Build and install the HTML documentation and regenerate the man pages + Build the gold linker plugin + Build LLVM with sys-devel/llvm-gcc + Build all host targets (default: host only) + Install the Clang static analyzer (requires USE=clang) + Enable support for dev-libs/udis86 disassembler library + +