Provided with the eselect opengl patch an implementation and the mesa
changes. If they are ok for everybody I'd change the ati and nvidia
drivers as well. (a better name for the amd-graphics driver would be
welcome btw)

lu

-- 

Luca Barbato
Gentoo/linux
http://dev.gentoo.org/~lu_zero

>From 17add6bb04836ee49f4babad51ed9f15b3fd9abe Mon Sep 17 00:00:00 2001
From: Luca Barbato <lu_z...@gentoo.org>
Date: Sat, 24 Mar 2012 18:07:06 -0700
Subject: [PATCH] opengl: support gles only implementation

Additionally make switching headers and libraries work for GLES OpenVG
and EGL.
---
 modules/opengl.eselect |   30 ++++++++++++++++++------------
 1 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/modules/opengl.eselect b/modules/opengl.eselect
index 2e8dd23..3f55ed5 100644
--- a/modules/opengl.eselect
+++ b/modules/opengl.eselect
@@ -140,14 +140,14 @@ setup_extensions_symlinks() {
 
 setup_includes_symlinks() {
 	local target=$1
+	local files=$2
 	local file
 	local sdir
 
-	shift
-
+	shift 2
 	mkdir -p "${target}" || die "Failed to create ${target}"
 	pushd "${target}" &> /dev/null
-		for file in gl.h glx.h glxtokens.h glext.h glxext.h glxmd.h glxproto.h; do
+		for file in ${files}; do
 			for sdir in "$@"; do
 				if [[ -e ${sdir}/${file} ]]; then
 					upgrade_file "${sdir}/${file}" "${target}"
@@ -165,6 +165,7 @@ set_new_implementation() {
 	local moduledir
 	local gl_dir
 	local gl_local
+	local -A gl_header
 
 	# Set a sane umask... bug #83115
 	umask 022
@@ -178,7 +179,7 @@ set_new_implementation() {
 		for libdir in $(list_libdirs); do
 			[[ ${ROOT} != / ]] && libdir=${libdir#${EROOT}}
 			[[ -d ${PREFIX}/${libdir}/opengl && ! -h ${PREFIX}/${libdir} ]] || continue
-			[[ -f "${PREFIX}/${libdir}/opengl/${gl_implem}/lib/libGL.so" ]] && found_libgl=yes
+			[[ -f "${PREFIX}/${libdir}/opengl/${gl_implem}/lib/libGL.so" || -f "${PREFIX}/${libdir}/opengl/${gl_implem}/.gles-only" ]] && found_libgl=yes
 		done
 
 		if [[ -z ${found_libgl} ]]; then
@@ -242,14 +243,19 @@ set_new_implementation() {
 			"${PREFIX}/${libdir}/opengl/${gl_local}/extensions" \
 			"${DST_PREFIX}/${libdir}/${moduledir}/extensions"
 
-		setup_includes_symlinks \
-			"${DST_PREFIX}/include/GL" \
-			"${PREFIX}/${libdir}/opengl/${gl_implem}/include/GL/" \
-			"${PREFIX}/${libdir}/opengl/${gl_implem}/include/" \
-			"${PREFIX}/${libdir}/opengl/global/include/" \
-			"${PREFIX}/${libdir}/opengl/xorg-x11/include/GL/" \
-			"${PREFIX}/${libdir}/opengl/xorg-x11/include/"
-
+		gl_header[GL]="gl.h glx.h glxtokens.h glext.h glxext.h glxmd.h glxproto.h"
+		gl_header[GLES]="egl.h gl_extensions.h glext.h gl.h glplatform.h"
+		gl_header[GLES2]="gl2ext.h gl2.h gl2platform.h"
+		gl_header[KHR]="khrplatform.h"
+		gl_header[VG]="openvg.h vgext.h vgplatform.h vgu.h"
+		for gl_dir in {GL,GLES,GLES2,KHR,VG}; do
+	                setup_includes_symlinks \
+	                "${DST_PREFIX}/include/${gl_dir}" \
+				"${gl_header[${gl_dir}]}" \
+	                "${PREFIX}/${libdir}/opengl/${gl_implem}/include/${gl_dir}/" \
+	                "${PREFIX}/${libdir}/opengl/global/include/${gl_dir}" \
+	                "${PREFIX}/${libdir}/opengl/xorg-x11/include/${gl_dir}/"
+		done
 		# Setup the $LDPATH
 		if [[ "x${REMOVE_ONLY}" == "xfalse" ]]; then
 			# we need this relative to ROOT
-- 
1.7.8.rc1

# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=3

inherit multilib

DESCRIPTION="Closed source imx5 OpenGL/OpenVG driver"
HOMEPAGE="http://freescale.com";
SRC_URI="http://localhost/${P}.tar.xz";

LICENSE="EULA"
SLOT="0"
KEYWORDS="~arm"
IUSE=""

DEPEND=">=app-admin/eselect-opengl-1.2.6"
RDEPEND="${DEPEND}
                x11-libs/libX11
                x11-libs/libXrender
                x11-libs/libXext
"

RESTRICT="test"


src_install() {
        local opengl_imp="amd-graphics"
        local opengl_dir="/usr/$(get_libdir)/opengl/${opengl_imp}"
        dodir "$opengl_dir"/lib  "$opengl_dir"/include
        local x
        for x in usr/lib/lib{EGL,GL*,OpenVG}.{la,a,so*}; do
                if [ -f ${x} -o -L ${x} ]; then
                        mv "${x}" "${ED}"/${opengl_dir}/lib \
                                || die "Failed to move ${x}"
                fi
        done
        mv usr/include/{EGL,GLES*,VG,KHR}/  \
                "${ED}"/${opengl_dir}/include || die "Failed to move headers"
        insinto /usr
        doins -r usr/include
        dolib usr/lib/*
}

pkg_postinst() {
        eselect opengl set --use-old ${opengl_imp}
}
--- /usr/portage/media-libs/mesa/mesa-8.0.1-r2.ebuild	2012-02-24 18:01:18.000000000 +0000
+++ /usr/portage/media-libs/mesa/mesa-8.0.1-r3.ebuild	2012-03-24 22:40:44.000000000 +0000
@@ -285,6 +287,9 @@
 					|| die "Failed to move ${x}"
 			fi
 		done
+		mv "${ED}"/usr/include/{EGL,GLES*,VG,KHR}/ \
+			"${ED}"/usr/$(get_libdir)/opengl/${OPENGL_DIR}/include \
+			|| die "Failed to move headers"
 	eend $?
 
 	if use classic || use gallium; then

Reply via email to