primus: 1.0.0748176 -> 20151204, add useNvidia flag

This commit is contained in:
Nikolay Amiantov 2015-12-05 00:31:10 +03:00
parent ae7ff02081
commit 56ffc2ecd2
4 changed files with 41 additions and 52 deletions

View File

@ -1,12 +0,0 @@
source $stdenv/setup
cp -r $src src
cd src
export LIBDIR=$out/lib
export PRIMUS_libGLa=$nvidia/lib/libGL.so
export PRIMUS_libGLd=$mesa/lib/libGL.so
export PRIMUS_LOAD_GLOBAL=$mesa/lib/libglapi.so
make
ln -s $LIBDIR/libGL.so.1 $LIBDIR/libGL.so

View File

@ -5,31 +5,18 @@
# Other distributions do the same.
{ stdenv
, primusLib
, writeScript
, writeScriptBin
, primusLib_i686 ? null
, useNvidia ? true
}:
with stdenv.lib;
let
version = "1.0.0748176";
ldPath = makeLibraryPath ([primusLib] ++ optional (primusLib_i686 != null) primusLib_i686);
primusrun = writeScript "primusrun"
''
primus = if useNvidia then primusLib else primusLib.override { nvidia_x11 = null; };
primus_i686 = if useNvidia then primusLib_i686 else primusLib_i686.override { nvidia_x11 = null; };
ldPath = stdenv.lib.makeLibraryPath ([primus] ++ stdenv.lib.optional (primusLib_i686 != null) primus_i686);
in writeScriptBin "primusrun" ''
#!${stdenv.shell}
export LD_LIBRARY_PATH=${ldPath}:$LD_LIBRARY_PATH
exec "$@"
'';
in
stdenv.mkDerivation {
name = "primus-${version}";
builder = writeScript "builder"
''
source $stdenv/setup
mkdir -p $out/bin
cp ${primusrun} $out/bin/primusrun
'';
meta = {
homepage = https://github.com/amonakov/primus;
description = "Faster OpenGL offloading for Bumblebee";
maintainers = with maintainers; [ coconnor ];
};
}
''

View File

@ -1,20 +1,35 @@
{ stdenv, fetchgit
, xlibsWrapper, mesa
, nvidia
, nvidia_x11 ? null
, libX11
}:
let
version = "1.0.0748176";
in
stdenv.mkDerivation {
name = "primus-lib-${version}";
name = "primus-lib-20151204";
src = fetchgit {
url = git://github.com/amonakov/primus.git;
rev = "074817614c014e3a99259388cb18fd54648b659a";
sha256 = "0mrh432md6zrm16avxyk57mgszrqpgwdjahspchvlaccqxp3x82v";
rev = "d1afbf6fce2778c0751eddf19db9882e04f18bfd";
sha256 = "8f095b5e2030cdb155a42a49873832843c1e4dc3087a6fb94d198de982609923";
};
inherit nvidia mesa;
buildInputs = [ libX11 mesa ];
buildInputs = [ xlibsWrapper mesa ];
builder = ./builder.sh;
makeFlags = [ "LIBDIR=$(out)/lib"
"PRIMUS_libGLa=${if nvidia_x11 == null then mesa else nvidia_x11}/lib/libGL.so"
"PRIMUS_libGLd=${mesa}/lib/libGL.so"
"PRIMUS_LOAD_GLOBAL=${mesa}/lib/libglapi.so"
];
installPhase = ''
ln -s $out/lib/libGL.so.1 $out/lib/libGL.so
'';
meta = with stdenv.lib; {
description = "Low-overhead client-side GPU offloading";
homepage = https://github.com/amonakov/primus;
platforms = platforms.linux;
license = licenses.bsd2;
maintainers = with maintainers; [ abbradar ];
};
}

View File

@ -13387,15 +13387,14 @@ let
virtualgl = callPackage ../tools/X11/virtualgl { };
primus = callPackage ../tools/X11/primus {
primusLib = callPackage ../tools/X11/primus/lib.nix {
nvidia = linuxPackages.nvidia_x11;
nvidia_x11 = linuxPackages.nvidia_x11.override { libsOnly = true; };
};
primus = callPackage ../tools/X11/primus {
primusLib_i686 = if system == "x86_64-linux"
then callPackage_i686 ../tools/X11/primus/lib.nix {
nvidia = pkgsi686Linux.linuxPackages.nvidia_x11.override { libsOnly = true; };
}
then pkgsi686Linux.primusLib
else null;
};