dev-python/agate: Bump to 1.13.0
[gentoo/gentoo.git] / x11-misc / primus / primus-0.2-r4.ebuild
blobacd44b6182fd7369ffeb6d11ce16e7a1c2dd8fe3
1 # Copyright 1999-2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 EAPI=8
6 inherit multilib-build
8 DESCRIPTION="Faster OpenGL offloading for Bumblebee"
9 HOMEPAGE="https://github.com/amonakov/primus"
10 SRC_URI="https://github.com/amonakov/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
11 EGIT_REPO_URI="https://github.com/amonakov/${PN}.git"
13 LICENSE="ISC"
14 SLOT="0"
15 KEYWORDS="~amd64"
16 IUSE="+libglvnd"
18 RDEPEND="
19         x11-misc/bumblebee
20         x11-drivers/nvidia-drivers[libglvnd(+)=]
22 DEPEND="virtual/opengl"
24 PATCHES=(
25         "${FILESDIR}/primus-0.2-libglvnd-workaround.patch"
26         "${FILESDIR}/primus-0.2-respect-ldflags.patch"
29 src_prepare() {
30         default
31         # Exported values don't always seem to be used.  Until source fixed,
32         # patch primusrun script
33         if use libglvnd; then
34                 sed -i "/libGLa/a export PRIMUS_libGLa='\/usr\/\$LIB\/libGLX_nvidia.so.0'" primusrun || die
35                 sed -i "/libGLd/a export PRIMUS_libGLd='\/usr\/\$LIB\/libGLX.so.0'" primusrun || die
36         else
37                 sed -i "/libGLa/a export PRIMUS_libGLa='\/usr\/$$LIB\/opengl\/nvidia\/lib/libGL.so.1'" primusrun || die
38         fi
41 src_compile() {
42         if use libglvnd; then
43                 export PRIMUS_libGLa='/usr/$$LIB/libGLX_nvidia.so.0'
44                 export PRIMUS_libGLd='/usr/$$LIB/libGLX.so.0'
45         else
46                 export PRIMUS_libGLa='/usr/$$LIB/opengl/nvidia/lib/libGL.so.1'
47         fi
48         mymake() {
49                 emake LIBDIR=$(get_libdir)
50         }
51         multilib_parallel_foreach_abi mymake
54 src_install() {
55         sed -i -e "s#^PRIMUS_libGL=.*#PRIMUS_libGL='/usr/\$LIB/primus'#" primusrun || die
56         dobin primusrun
57         myinst() {
58                 insinto /usr/$(get_libdir)/primus
59                 doins "${S}"/$(get_libdir)/libGL.so.1
60         }
61         multilib_foreach_abi myinst