2021-11-09 15:09:14 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchpatch
|
|
|
|
, libX11
|
|
|
|
, libGL
|
|
|
|
, mesa
|
2015-12-04 21:31:10 +00:00
|
|
|
, nvidia_x11 ? null
|
2017-01-29 21:29:39 +00:00
|
|
|
, libglvnd
|
2014-05-03 15:28:21 +01:00
|
|
|
}:
|
2015-12-04 21:31:10 +00:00
|
|
|
|
2017-01-29 21:29:39 +00:00
|
|
|
let
|
|
|
|
aPackage =
|
2018-03-05 13:53:38 +00:00
|
|
|
if nvidia_x11 == null then libGL
|
2017-01-29 21:29:39 +00:00
|
|
|
else if nvidia_x11.useGLVND then libglvnd
|
|
|
|
else nvidia_x11;
|
|
|
|
|
2021-11-09 15:09:14 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
pname = "primus-lib";
|
|
|
|
version = "unstable-2015-04-28";
|
2015-12-04 21:31:10 +00:00
|
|
|
|
2016-05-20 11:04:38 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "amonakov";
|
|
|
|
repo = "primus";
|
2015-12-04 21:31:10 +00:00
|
|
|
rev = "d1afbf6fce2778c0751eddf19db9882e04f18bfd";
|
2016-05-20 11:04:38 +01:00
|
|
|
sha256 = "118jm57ccawskb8vjq3a9dpa2gh72nxzvx2zk7zknpy0arrdznj1";
|
2014-05-03 15:28:21 +01:00
|
|
|
};
|
|
|
|
|
2017-01-30 16:21:28 +00:00
|
|
|
patches = [
|
|
|
|
# Bump buffer size for long library paths.
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/abbradar/primus/commit/2f429e232581c556df4f4bf210aee8a0c99c60b7.patch";
|
|
|
|
sha256 = "1da6ynz7r7x98495i329sf821308j1rpy8prcdraqahz7p4c89nc";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2018-03-05 13:53:38 +00:00
|
|
|
buildInputs = [ libX11 libGL ];
|
2015-12-04 21:31:10 +00:00
|
|
|
|
2021-11-09 15:09:14 +00:00
|
|
|
makeFlags = [
|
|
|
|
"LIBDIR=$(out)/lib"
|
|
|
|
"PRIMUS_libGLa=${aPackage}/lib/libGL.so"
|
|
|
|
"PRIMUS_libGLd=${libGL}/lib/libGL.so"
|
|
|
|
"PRIMUS_LOAD_GLOBAL=${mesa}/lib/libglapi.so"
|
|
|
|
];
|
2014-05-03 15:28:21 +01:00
|
|
|
|
2015-12-04 21:31:10 +00:00
|
|
|
installPhase = ''
|
|
|
|
ln -s $out/lib/libGL.so.1 $out/lib/libGL.so
|
|
|
|
'';
|
|
|
|
|
2017-01-29 21:29:39 +00:00
|
|
|
passthru.glvnd = if nvidia_x11 != null && nvidia_x11.useGLVND then nvidia_x11 else null;
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2015-12-04 21:31:10 +00:00
|
|
|
description = "Low-overhead client-side GPU offloading";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/amonakov/primus";
|
2018-03-07 10:34:24 +00:00
|
|
|
platforms = [ "i686-linux" "x86_64-linux" ];
|
2015-12-04 21:31:10 +00:00
|
|
|
license = licenses.bsd2;
|
|
|
|
maintainers = with maintainers; [ abbradar ];
|
|
|
|
};
|
2014-05-03 15:28:21 +01:00
|
|
|
}
|