summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Feldman <NP-Hardass@gentoo.org>2020-09-01 14:59:10 -0400
committerAdam Feldman <NP-Hardass@gentoo.org>2020-09-02 02:01:30 -0400
commitfc3e4618bc73e4b52b38c63afa80341affddf74a (patch)
treebebf1ccb5e5c33556803ca2cea1a640d5177bed5 /x11-misc/primus
parentdev-python/rq: add Python 3.6 to 1.5.0 too (diff)
downloadgentoo-fc3e4618bc73e4b52b38c63afa80341affddf74a.tar.gz
gentoo-fc3e4618bc73e4b52b38c63afa80341affddf74a.tar.bz2
gentoo-fc3e4618bc73e4b52b38c63afa80341affddf74a.zip
x11-misc/primus: Support libglvnd ootb
Package-Manager: Portage-2.3.103, Repoman-2.3.23 Signed-off-by: Adam Feldman <NP-Hardass@gentoo.org>
Diffstat (limited to 'x11-misc/primus')
-rw-r--r--x11-misc/primus/files/primus-0.2-libglvnd-workaround.patch23
-rw-r--r--x11-misc/primus/metadata.xml3
-rw-r--r--x11-misc/primus/primus-0.2-r1.ebuild59
3 files changed, 85 insertions, 0 deletions
diff --git a/x11-misc/primus/files/primus-0.2-libglvnd-workaround.patch b/x11-misc/primus/files/primus-0.2-libglvnd-workaround.patch
new file mode 100644
index 000000000000..f64757b7e340
--- /dev/null
+++ b/x11-misc/primus/files/primus-0.2-libglvnd-workaround.patch
@@ -0,0 +1,23 @@
+From 6ff7b3ee8c38830a72b5fc087d6f4f12cf421920 Mon Sep 17 00:00:00 2001
+From: Gary Gatling <gsgatlin@ncsu.edu>
+Date: Thu, 2 Mar 2017 14:50:47 -0500
+Subject: [PATCH] primus needs this variable workaround for libglvnd enabled
+ mesa
+
+---
+ primusrun | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/primusrun b/primusrun
+index 81e2dc0..33f0eef 100755
+--- a/primusrun
++++ b/primusrun
+@@ -1,5 +1,8 @@
+ #!/bin/bash
+
++# primus needs this variable workaround for libglvnd enabled mesa
++export __GLVND_DISALLOW_PATCHING=1
++
+ # Readback-display synchronization method
+ # 0: no sync, 1: D lags behind one frame, 2: fully synced
+ # export PRIMUS_SYNC=${PRIMUS_SYNC:-0}
diff --git a/x11-misc/primus/metadata.xml b/x11-misc/primus/metadata.xml
index 7eea5579ed48..91842eda4522 100644
--- a/x11-misc/primus/metadata.xml
+++ b/x11-misc/primus/metadata.xml
@@ -5,6 +5,9 @@
<email>zx2c4@gentoo.org</email>
<name>Jason A. Donenfeld</name>
</maintainer>
+ <use>
+ <flag name="libglvnd">Use <pkg>media-libs/libglvnd</pkg> for dispatch</flag>
+ </use>
<upstream>
<remote-id type="github">amonakov/primus</remote-id>
</upstream>
diff --git a/x11-misc/primus/primus-0.2-r1.ebuild b/x11-misc/primus/primus-0.2-r1.ebuild
new file mode 100644
index 000000000000..b17cd30fb649
--- /dev/null
+++ b/x11-misc/primus/primus-0.2-r1.ebuild
@@ -0,0 +1,59 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit multilib-build
+
+DESCRIPTION="Faster OpenGL offloading for Bumblebee"
+HOMEPAGE="https://github.com/amonakov/primus"
+SRC_URI="https://github.com/amonakov/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+EGIT_REPO_URI="https://github.com/amonakov/${PN}.git"
+
+LICENSE="ISC"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="+libglvnd"
+
+RDEPEND="
+ x11-misc/bumblebee
+ x11-drivers/nvidia-drivers[libglvnd(-)=]
+"
+DEPEND="virtual/opengl"
+
+PATCHES=( "${FILESDIR}/primus-0.2-libglvnd-workaround.patch" )
+
+src_prepare() {
+ default
+ # Exported values don't always seem to be used. Until source fixed,
+ # patch primusrun script
+ if use libglvnd; then
+ sed -i "/libGLa/a export PRIMUS_libGLa='\/usr\/\$LIB\/libGLX_nvidia.so.0'" primusrun || die
+ sed -i "/libGLd/a export PRIMUS_libGLd='\/usr\/\$LIB\/libGLX.so.0'" primusrun || die
+ else
+ sed -i "/libGLa/a export PRIMUS_libGLa='\/usr\/$$LIB\/opengl\/nvidia\/lib/libGL.so.1'" primusrun || die
+ fi
+}
+
+src_compile() {
+ if use libglvnd; then
+ export PRIMUS_libGLa='/usr/$$LIB/libGLX_nvidia.so.0'
+ export PRIMUS_libGLd='/usr/$$LIB/libGLX.so.0'
+ else
+ export PRIMUS_libGLa='/usr/$$LIB/opengl/nvidia/lib/libGL.so.1'
+ fi
+ mymake() {
+ emake LIBDIR=$(get_libdir)
+ }
+ multilib_parallel_foreach_abi mymake
+}
+
+src_install() {
+ sed -i -e "s#^PRIMUS_libGL=.*#PRIMUS_libGL='/usr/\$LIB/primus'#" primusrun
+ dobin primusrun
+ myinst() {
+ insinto /usr/$(get_libdir)/primus
+ doins "${S}"/$(get_libdir)/libGL.so.1
+ }
+ multilib_foreach_abi myinst
+}