dev-python/pip: arm64 stable (bug #719946)
[gentoo.git] / app-eselect / eselect-opengl / eselect-opengl-1.3.1-r4.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5
6 inherit eutils multilib
7
8 DESCRIPTION="Utility to switch between OpenGL implementations"
9 HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage"
10
11 # Source:
12 # http://www.opengl.org/registry/api/glext.h
13 # http://www.opengl.org/registry/api/glxext.h
14 GLEXT="85"
15 GLXEXT="34"
16
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"
20
21 LICENSE="GPL-2"
22 SLOT="0"
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"
24 IUSE=""
25
26 DEPEND="app-arch/xz-utils"
27 RDEPEND=">=app-admin/eselect-1.2.4"
28
29 S=${WORKDIR}
30
31 pkg_preinst() {
32         # we may be moving the config file, so get it early
33         OLD_IMPL=$(eselect opengl show)
34 }
35
36 pkg_postinst() {
37         local shopt_save=$(shopt -p nullglob)
38         shopt -s nullglob
39         local opengl_dirs=( "${EROOT}"/usr/lib*/opengl )
40         ${shopt_save}
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 {} +
46         fi
47
48         if [[ -n "${OLD_IMPL}" && "${OLD_IMPL}" != '(none)' ]] ; then
49                 eselect opengl set "${OLD_IMPL}"
50         fi
51         if [[ -f ${EROOT}/etc/env.d/03opengl ]]; then
52                 # remove the old file, moved now
53                 rm -vf "${EROOT}"/etc/env.d/03opengl
54         fi
55 }
56
57 src_prepare() {
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
61         fi
62 }
63
64 src_install() {
65         insinto "/usr/share/eselect/modules"
66         newins opengl.eselect-${PV} opengl.eselect
67 #       doman opengl.eselect.5
68 }