It would be nice to have clang/llvm in Gentoo Prefix. I have tested the following ebuilds from the main repository with the help of the eapify-script on an ~amd64-linux - target: sys-devel/llvm-2.7 and sys-devel/llvm-9999 with the use-flags +libffi +alltargets +debug +ocaml. I'm not interested in llvm-gcc, so i have not tested +llvm-gcc. +udis86 is not possible because dev-libs/udis86 is missing in the prefix. (I have not tried to add udis86 to the prefix.) sys-devel/clang-2.7 (+-system-cxx-headers) and sys-devel/clang-9999 with +debug +static-analyzer. Everything compiles just fine. I only tested some minor parts for functionality: clang and clang++ is able to produce executable (and functional) code for some simple and two bigger projects I tried to compile. I only stumbled over non prefix - specific issues, e.g. the need to compile clang-2.7 with +system-cxx-headers so that clang++ finds the STL-Headers. (This issue should be addressed in the latest svn-version, so -9999 is just fine.) Reproducible: Always
Please review and comment on the changes to clang-2.7-r2, necessary for Prefix support. The install_name_tool bit is to accomodate Darwin installs only. Index: clang-2.7-r2.ebuild =================================================================== RCS file: /var/cvsroot/gentoo-x86/sys-devel/clang/clang-2.7-r2.ebuild,v retrieving revision 1.1 diff -u -r1.1 clang-2.7-r2.ebuild --- clang-2.7-r2.ebuild 27 Jul 2010 13:06:47 -0000 1.1 +++ clang-2.7-r2.ebuild 22 Aug 2010 13:57:46 -0000 @@ -2,7 +2,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/sys-devel/clang/clang-2.7-r2.ebuild,v 1.1 2010/07/27 13:06:47 voyageur Exp $ -EAPI=2 +EAPI=3 RESTRICT_PYTHON_ABIS="3.*" SUPPORT_PYTHON_ABIS="1" @@ -17,7 +17,7 @@ LICENSE="UoI-NCSA" SLOT="0" -KEYWORDS="~amd64 ~x86" +KEYWORDS="~amd64 ~x86 ~ppc-macos" IUSE="debug +static-analyzer system-cxx-headers test" # Note: for LTO support, clang will depend on binutils with gold plugins, and LLVM built after that - http://llvm.org/docs/GoldPlugin.html @@ -50,7 +50,7 @@ # From llvm src_prepare einfo "Fixing install dirs" sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \ - -e 's,^PROJ_etcdir.*,PROJ_etcdir := /etc/llvm,' \ + -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \ -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir), \ -i Makefile.config.in || die "Makefile.config sed failed" @@ -73,6 +73,12 @@ --disable-expensive-checks" fi + # Setup the search path to include the Prefix includes + if use prefix ; then + CONF_FLAGS="${CONF_FLAGS} \ + --with-c-include-dirs=${EPREFIX}/usr/include:/usr/include" + fi + if use amd64; then CONF_FLAGS="${CONF_FLAGS} --enable-pic" fi @@ -127,10 +133,19 @@ install-scan-view() { insinto "$(python_get_sitedir)"/clang doins Reporter.py Resources ScanView.py startfile.py - touch "${D}"/"$(python_get_sitedir)"/clang/__init__.py + touch "${ED}"/"$(python_get_sitedir)"/clang/__init__.py } python_execute_function install-scan-view fi + + # Fix install_names on Darwin. The build system is too complicated + # to just fix this, so we correct it post-install + if [[ ${CHOST} == *-darwin* ]] ; then + for lib in libCIndex.dylib ; do + install_name_tool -id "${EPREFIX}"/usr/lib/${lib} \ + "${ED}"/usr/lib/${lib} + done + fi } pkg_postinst() {
Please upload the patch as an attachment, due to the line-wrapping in Bugzilla this patch is malformed.
Created attachment 244047 [details, diff] clang-2.7-r2-prefix.patch it was meant for review only, I can just commit it when ok, but here you go
Created attachment 244167 [details, diff] Proposed clang-9999.ebuild for prefix This is Fabian's patch applied to the 9999-ebuild. (It would be very nice to have the svn-version in the prefix too :) ) Compiles and runs fine on a ~amd64-linux - host. Can someone with a Darwin - target please review whether the changes work as intended?
Close to llvm changes, these are also good for me!
committed, thanks!