--- /usr/portage/local/layman/x11/media-libs/mesa/mesa-9999.ebuild 2008-05-24 16:25:55.670625010 +0100 +++ mesa-9999.ebuild 2008-05-28 01:17:25.066311126 +0100 @@ -23,6 +23,8 @@ LICENSE="LGPL-2" SLOT="0" KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd" +EMULTILIB_PKG="true" + IUSE_VIDEO_CARDS=" video_cards_i810 video_cards_mach64 @@ -44,7 +46,8 @@ motif nptl xcb - kernel_FreeBSD" + kernel_FreeBSD + multilib" RDEPEND="app-admin/eselect-opengl dev-libs/expat @@ -111,9 +114,20 @@ eautoreconf } -src_compile() { +mesa_src_compile() { local myconf + if use amd64; then + case ${ABI} in + x86) myconf="${myconf} --enable-32-bit" + ;; + amd64) myconf="${myconf} --enable-64-bit" + ;; + *) die "Unknown ABI" + ;; + esac + fi + # This is where we might later change to build xlib/osmesa myconf="${myconf} --with-driver=dri" @@ -148,33 +162,74 @@ myconf="${myconf} --without-demos" - myconf="${myconf} $(use_enable xcb)" - + # xcb is not yet used for the binary 32bit compatibility libs + if is_final_abi ; then + myconf="${myconf} $(use_enable xcb)" + fi + # Get rid of glut includes rm -f "${S}"/include/GL/glut*h myconf="${myconf} $(use_enable motif glw)" econf ${myconf} || die + + # store the config for the install stage + cp configs/current configs/gentoo-${ABI} + + # force recompile after the config change + find -name '*.o' | xargs rm -f + emake || die } -src_install() { +src_compile() { + if [[ -z ${OABI} ]] ; then + local abilist="" + if has_multilib_profile ; then + abilist=$(get_install_abis) + einfo "Building multilib Mesa for ABIs: ${abilist}" + elif is_crosscompile || tc-is-cross-compiler ; then + abilist=${DEFAULT_ABI} + fi + if [[ -n ${abilist} ]] ; then + OABI=${ABI} + for ABI in ${abilist} ; do + export ABI + src_compile + done + ABI=${OABI} + unset OABI + return 0 + fi + fi + mesa_src_compile +} + +mesa_src_install() { + einfo "Installing Mesa ${ABI} ..." + + pushd configs + ln -sf gentoo-${ABI} current + popd + + # Ensure the binaries are not re-linked on install + for FILE in `find $(get_libdir)`; do touch $FILE; done + dodir /usr + emake \ DESTDIR="${D}" \ install || die "Installation failed" - if ! use motif; then - rm "${D}"/usr/include/GL/GLwMDrawA.h - fi - - # Don't install private headers - rm -f "${D}"/usr/include/GL/GLw*P.h - - fix_opengl_symlinks - dynamic_libgl_install - + # The dri drivers get installed from the src tree but with multilib + # this contains the final ABI build. Copy the dri drivers from the + # lib{32|64} object directories + insinto /usr/$(get_libdir)/dri + for FILE in `find $(get_libdir) -name '*_dri.so'`; do + doins "${FILE}" + done + # Install libtool archives insinto /usr/$(get_libdir) # (#67729) Needs to be lib, not $(get_libdir) @@ -193,10 +248,46 @@ # libGLU doesn't get the plain .so symlink either #dosym libGLU.so.1 /usr/$(get_libdir)/libGLU.so + is_final_abi || return 0 + + if ! use motif; then + rm "${D}"/usr/include/GL/GLwMDrawA.h + fi + + # Don't install private headers + rm -f "${D}"/usr/include/GL/GLw*P.h + + fix_opengl_symlinks + dynamic_libgl_install + # Figure out why libGL.so.1.5 is built (directfb), and why it's linked to # as the default libGL.so.1 } +src_install() { + if [[ -z ${OABI} ]] ; then + local abilist="" + if has_multilib_profile ; then + abilist=$(get_install_abis) + einfo "Installing multilib Mesa for ABIs: ${abilist}" + elif is_crosscompile || tc-is-cross-compiler ; then + abilist=${DEFAULT_ABI} + fi + if [[ -n ${abilist} ]] ; then + OABI=${ABI} + for ABI in ${abilist} ; do + export ABI + src_install + done + ABI=${OABI} + unset OABI + return 0 + fi + fi + + mesa_src_install +} + pkg_postinst() { switch_opengl_implem