Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 332605 - Pleasre review Prefix changes for sys-devel/clang
Summary: Pleasre review Prefix changes for sys-devel/clang
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Bernard Cafarelli
URL:
Whiteboard:
Keywords:
Depends on: 333387
Blocks: prefix-gx86
  Show dependency tree
 
Reported: 2010-08-13 12:45 UTC by Matthias Maier
Modified: 2010-08-26 07:07 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
clang-2.7-r2-prefix.patch (clang-2.7-r2-prefix.patch,2.21 KB, patch)
2010-08-22 15:05 UTC, Fabian Groffen
Details | Diff
Proposed clang-9999.ebuild for prefix (clang-9999-prefix.patch,1.76 KB, patch)
2010-08-23 08:46 UTC, Matthias Maier
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Maier gentoo-dev 2010-08-13 12:45:54 UTC
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
Comment 1 Fabian Groffen gentoo-dev 2010-08-22 14:02:13 UTC
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() {
Comment 2 Matthias Maier gentoo-dev 2010-08-22 15:00:20 UTC
Please upload the patch as an attachment, due to the line-wrapping in Bugzilla this patch is malformed.
Comment 3 Fabian Groffen gentoo-dev 2010-08-22 15:05:35 UTC
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
Comment 4 Matthias Maier gentoo-dev 2010-08-23 08:46:39 UTC
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?
Comment 5 Bernard Cafarelli gentoo-dev 2010-08-25 16:07:55 UTC
Close to llvm changes, these are also good for me!
Comment 6 Fabian Groffen gentoo-dev 2010-08-26 07:07:31 UTC
committed, thanks!