Merge remote-tracking branch 'remotes/github/pr/979'
[gentoo.git] / app-eselect / eselect-opengl / eselect-opengl-1.2.7.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=4
6
7 inherit multilib
8
9 DESCRIPTION="Utility to change the OpenGL interface being used"
10 HOMEPAGE="https://www.gentoo.org/"
11
12 # Source:
13 # http://www.opengl.org/registry/api/glext.h
14 # http://www.opengl.org/registry/api/glxext.h
15 GLEXT="85"
16 GLXEXT="34"
17
18 MIRROR="https://dev.gentoo.org/~mattst88/distfiles"
19 SRC_URI="${MIRROR}/glext.h.${GLEXT}.xz
20         ${MIRROR}/glxext.h.${GLXEXT}.xz
21         ${MIRROR}/${P}.tar.xz"
22
23 LICENSE="GPL-2"
24 SLOT="0"
25 KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
26 IUSE=""
27
28 DEPEND="app-arch/xz-utils"
29 RDEPEND=">=app-admin/eselect-1.2.4
30                  !<media-libs/mesa-8.0.3-r1
31                  !<x11-proto/glproto-1.4.15-r1
32                  !=media-libs/mesa-10.3.4-r1
33                  !=media-libs/mesa-10.3.5-r1
34                  !>=media-libs/mesa-10.3.7-r2
35                  !>=x11-proto/glproto-1.4.17-r1
36                  !=x11-base/xorg-server-1.12.4-r6
37                  !=x11-base/xorg-server-1.15.2-r3
38                  !=x11-base/xorg-server-1.16.4-r1
39                  !>=x11-base/xorg-server-1.16.4-r4"
40
41 pkg_postinst() {
42         local impl="$(eselect opengl show)"
43         if [[ -n "${impl}"  && "${impl}" != '(none)' ]] ; then
44                 eselect opengl set "${impl}"
45         fi
46 }
47
48 src_prepare() {
49         # don't die on Darwin users
50         if [[ ${CHOST} == *-darwin* ]] ; then
51                 sed -i -e 's/libGL\.so/libGL.dylib/' opengl.eselect || die
52         fi
53 }
54
55 src_install() {
56         insinto "/usr/share/eselect/modules"
57         doins opengl.eselect
58         doman opengl.eselect.5
59
60         # Install global glext.h and glxext.h
61         insinto "/usr/$(get_libdir)/opengl/global/include/GL/"
62         cd "${WORKDIR}"
63         newins glext.h.${GLEXT} glext.h
64         newins glxext.h.${GLXEXT} glxext.h
65 }