1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit eutils multilib
8 DESCRIPTION="Utility to switch between OpenGL implementations"
9 HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage"
12 # http://www.opengl.org/registry/api/glext.h
13 # http://www.opengl.org/registry/api/glxext.h
17 MIRROR="https://dev.gentoo.org/~mattst88/distfiles"
18 SRC_URI="https://dev.gentoo.org/~mgorny/dist/opengl.eselect-${PV}.xz"
19 # ${MIRROR}/${P}.tar.xz"
23 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
26 DEPEND="app-arch/xz-utils"
27 RDEPEND=">=app-admin/eselect-1.2.4"
32 # we may be moving the config file, so get it early
33 OLD_IMPL=$(eselect opengl show)
37 local shopt_save=$(shopt -p nullglob)
39 local opengl_dirs=( "${EROOT}"/usr/lib*/opengl )
41 if [[ -n ${opengl_dirs[@]} ]]; then
42 # delete broken symlinks
43 find "${opengl_dirs[@]}" -xtype l -delete
44 # delete empty leftover directories (they confuse eselect)
45 find "${opengl_dirs[@]}" -depth -type d -empty -exec rmdir -v {} +
48 if [[ -n "${OLD_IMPL}" && "${OLD_IMPL}" != '(none)' ]] ; then
49 eselect opengl set "${OLD_IMPL}"
51 if [[ -f ${EROOT}/etc/env.d/03opengl ]]; then
52 # remove the old file, moved now
53 rm -vf "${EROOT}"/etc/env.d/03opengl
58 # don't die on Darwin users
59 if [[ ${CHOST} == *-darwin* ]] ; then
60 sed -i -e 's/libGL\.so/libGL.dylib/' opengl.eselect-${PV} || die
65 insinto "/usr/share/eselect/modules"
66 newins opengl.eselect-${PV} opengl.eselect
67 # doman opengl.eselect.5