--- /usr/portage/local/layman/x11/media-libs/mesa/mesa-9999.ebuild 2008-05-24 16:25:55.670625010 +0100 +++ mesa-9999.ebuild 2008-05-29 13:31:06.599491992 +0100 @@ -4,7 +4,7 @@ EGIT_REPO_URI="git://anongit.freedesktop.org/mesa/mesa" -inherit autotools multilib flag-o-matic git portability +inherit autotools multilib flag-o-matic git portability toolchain-funcs OPENGL_DIR="xorg-x11" @@ -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,8 +114,40 @@ eautoreconf } -src_compile() { +mesa_src_compile() { local myconf + local OCFLAGS="" + local OCXXFLAGS="" + local OCHOST="" + CC="$(tc-getCC)" + CXX="$(tc-getCXX)" + + if has_multilib_profile ; then + OCFLAGS=${CFLAGS} + OCHOST=${CHOST} + if use amd64 || use ppc64 ; then + case ${ABI} in + x86) CHOST="i686-${OCHOST#*-}" + CFLAGS="${OCFLAGS} -m32" + CXXFLAGS="${OCXXFLAGS} -m32" + ;; + amd64) CHOST="x86_64-${OCHOST#*-}" + CFLAGS="${OCFLAGS} -m64" + CXXFLAGS="${CXXFLAGS} -m64" + ;; + ppc) CHOST="powerpc-${OCHOST#*-}" + CFLAGS="${OCFLAGS} -m32" + CXXFLAGS="${OCXXFLAGS} -m32" + ;; + ppc64) CHOST="powerpc64-${OCHOST#*-}" + CFLAGS="${OCFLAGS} -m64" + CXXFLAGS="${OCXXFLAGS} -m64" + ;; + *) die "Unknown ABI" + ;; + esac + fi + fi # This is where we might later change to build xlib/osmesa myconf="${myconf} --with-driver=dri" @@ -148,37 +183,69 @@ 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)" + # Create seperate build dir for each ABI since the Mesa build system + # doesn't handle building both ABIs in the same tree + cp -al ${S} ${WORKDIR}/builddir.${ABI} + cd ${WORKDIR}/builddir.${ABI} + econf ${myconf} || die + emake || die + if has_multilib_profile; then + CFLAGS="${OCFLAGS}" + CXXFLAGS="${OCXXFLAGS}" + CHOST="${OCHOST}" + fi } -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} ..." + cd ${WORKDIR}/builddir.${ABI} + 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 # Install libtool archives - insinto /usr/$(get_libdir) - # (#67729) Needs to be lib, not $(get_libdir) - doins "${FILESDIR}"/lib/libGLU.la + sed -e "s:\/usr\/lib:/usr/$(get_libdir):g" "${FILESDIR}"/lib/libGLU.la \ + > "${D}"/usr/$(get_libdir)/libGLU.la sed -e "s:\${libdir}:$(get_libdir):g" "${FILESDIR}"/lib/libGL.la \ > "${D}"/usr/$(get_libdir)/opengl/xorg-x11/lib/libGL.la @@ -190,13 +257,46 @@ "${D}"/usr/$(get_libdir)/libGLU.la \ "${D}"/usr/$(get_libdir)/opengl/xorg-x11/lib/libGL.la + is_final_abi || return 0 + # libGLU doesn't get the plain .so symlink either #dosym libGLU.so.1 /usr/$(get_libdir)/libGLU.so + 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 + # 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