mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
* In Quake 3, by default use Mesa as the OpenGL implementation. But
allow the OpenGL implementation to be overriden through the OPENGL_DRIVER environment variable. If it is not set, we use the implementation installed in the profile /nix/var/nix/profiles/opengl, allowing easy late binding by the user, e.g., $ nix-env -p /nix/var/nix/profiles/opengl -i nvidia-sys-opengl might install the NVidia OpenGL implementation. The code that does this is not specific to Quake 3: it has been factored out into build-support/opengl/mesa-switch.sh. Presumably any application that requires hardware-accelerated OpenGL needs it. * Add the Quake 3 demo to the cache. svn path=/nixpkgs/trunk/; revision=4612
This commit is contained in:
parent
3263d078dd
commit
7f74c406c4
41
pkgs/build-support/opengl/mesa-switch.sh
Normal file
41
pkgs/build-support/opengl/mesa-switch.sh
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
profileName=opengl
|
||||||
|
profileDir=/nix/var/nix/profiles
|
||||||
|
profile=$profileDir/$profileName
|
||||||
|
|
||||||
|
if test -z "$OPENGL_DRIVER"; then
|
||||||
|
if test -d "$profile/lib"; then
|
||||||
|
OPENGL_DRIVER=$profile
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -z "$OPENGL_DRIVER"; then
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
======================================================================
|
||||||
|
This program uses OpenGL for 3D graphics. For best performance, you
|
||||||
|
should use a hardware-accelerated implementation of OpenGL. Since you
|
||||||
|
have not enabled one, a software implementation (Mesa) will be used.
|
||||||
|
This will probably be quite slow.
|
||||||
|
|
||||||
|
This program will look for a hardware-accelerated implementation of
|
||||||
|
OpenGL in the "$profileName" profile of your Nix installation. For
|
||||||
|
instance, to enable NVidia's accelerated driver on non-NixOS systems,
|
||||||
|
try
|
||||||
|
|
||||||
|
$ nix-env -p $profile -i nvidia-sys-opengl
|
||||||
|
|
||||||
|
Alternatively, you can set the OPENGL_DRIVER environment variable to
|
||||||
|
point at the package containing the OpenGL implementation.
|
||||||
|
======================================================================
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
OPENGL_DRIVER=$mesa
|
||||||
|
fi
|
||||||
|
|
||||||
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH${LD_LIBRARY_PATH:+:}$OPENGL_DRIVER/lib
|
||||||
|
|
||||||
|
hook="$OPENGL_DRIVER/nix-support/opengl-hook"
|
||||||
|
if test -e "$hook"; then
|
||||||
|
source "$hook"
|
||||||
|
fi
|
@ -12,8 +12,13 @@ done
|
|||||||
ensureDir $out/bin
|
ensureDir $out/bin
|
||||||
|
|
||||||
cat >$out/bin/quake3 <<EOF
|
cat >$out/bin/quake3 <<EOF
|
||||||
|
mesa=$mesa
|
||||||
|
|
||||||
|
$(cat $mesaSwitch)
|
||||||
|
|
||||||
exec $game/ioquake3.i386 \
|
exec $game/ioquake3.i386 \
|
||||||
+set fs_basepath $out \
|
+set fs_basepath $out \
|
||||||
|
+set r_allowSoftwareGL 1 \
|
||||||
"\$@"
|
"\$@"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{stdenv, fetchurl, game, paks}:
|
{stdenv, fetchurl, game, paks, mesa, name}:
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "quake3";
|
|
||||||
builder = ./builder.sh;
|
builder = ./builder.sh;
|
||||||
inherit game paks;
|
inherit game paks mesa name;
|
||||||
|
mesaSwitch = ../../../build-support/opengl/mesa-switch.sh;
|
||||||
}
|
}
|
||||||
|
@ -2095,7 +2095,8 @@ rec {
|
|||||||
};
|
};
|
||||||
|
|
||||||
quake3demo = import ../games/quake3/wrapper {
|
quake3demo = import ../games/quake3/wrapper {
|
||||||
inherit fetchurl stdenv;
|
name = "quake3-demo";
|
||||||
|
inherit fetchurl stdenv mesa;
|
||||||
game = quake3game;
|
game = quake3game;
|
||||||
paks = [quake3demodata];
|
paks = [quake3demodata];
|
||||||
};
|
};
|
||||||
|
@ -128,6 +128,8 @@ let {
|
|||||||
ecj
|
ecj
|
||||||
jre
|
jre
|
||||||
jetty
|
jetty
|
||||||
|
|
||||||
|
quake3demo
|
||||||
;};
|
;};
|
||||||
|
|
||||||
i686FreeBSDPkgs = {inherit (allPackages {system = "i686-freebsd";})
|
i686FreeBSDPkgs = {inherit (allPackages {system = "i686-freebsd";})
|
||||||
|
Loading…
Reference in New Issue
Block a user