From e80b22369dd029cfd4ad9891f245daccba8d1158 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Sat, 24 Sep 2016 12:49:34 +0300 Subject: [PATCH] quake3: refactor wrapper, fix pak collisions --- pkgs/games/quake3/wrapper/builder.sh | 18 ---------------- pkgs/games/quake3/wrapper/default.nix | 31 ++++++++++++++++++--------- 2 files changed, 21 insertions(+), 28 deletions(-) delete mode 100644 pkgs/games/quake3/wrapper/builder.sh diff --git a/pkgs/games/quake3/wrapper/builder.sh b/pkgs/games/quake3/wrapper/builder.sh deleted file mode 100644 index d5115baa7e6d..000000000000 --- a/pkgs/games/quake3/wrapper/builder.sh +++ /dev/null @@ -1,18 +0,0 @@ -source $stdenv/setup - -mkdir -p $out/baseq3 -for i in $paks; do - if test -d "$i/baseq3"; then - ln -s "$i/baseq3"/* $out/baseq3/ - fi -done - -# We add Mesa to the end of $LD_LIBRARY_PATH to provide fallback -# software rendering. GCC is needed so that libgcc_s.so can be found -# when Mesa is used. -makeWrapper $game/ioquake3.* $out/bin/quake3 \ - --suffix-each LD_LIBRARY_PATH ':' "$mesa/lib $gcc/lib" \ - --add-flags "+set fs_basepath $out +set r_allowSoftwareGL 1" - -makeWrapper $game/ioq3ded.* $out/bin/quake3-server \ - --add-flags "+set fs_basepath $out" diff --git a/pkgs/games/quake3/wrapper/default.nix b/pkgs/games/quake3/wrapper/default.nix index ae0387ad2900..5f65d26140c8 100644 --- a/pkgs/games/quake3/wrapper/default.nix +++ b/pkgs/games/quake3/wrapper/default.nix @@ -1,22 +1,33 @@ -{ stdenv, fetchurl, mesa, ioquake3, makeWrapper }: +{ stdenv, buildEnv, lib, fetchurl, mesa_noglu, ioquake3, makeWrapper }: { paks, name ? (stdenv.lib.head paks).name, description ? "" }: -stdenv.mkDerivation { +let + libPath = lib.makeLibraryPath [ mesa_noglu stdenv.cc.cc ]; + env = buildEnv { + name = "quake3-env"; + paths = [ ioquake3 ] ++ paks; + }; + +in stdenv.mkDerivation { name = "${name}-${ioquake3.name}"; - builder = ./builder.sh; - nativeBuildInputs = [ makeWrapper ]; - - inherit paks mesa; - game = ioquake3; + buildCommand = '' + mkdir -p $out/bin - gcc = stdenv.cc.cc; + # We add Mesa to the end of $LD_LIBRARY_PATH to provide fallback + # software rendering. GCC is needed so that libgcc_s.so can be found + # when Mesa is used. + makeWrapper ${env}/ioquake3.* $out/bin/quake3 \ + --suffix-each LD_LIBRARY_PATH ':' "${libPath}" \ + --add-flags "+set fs_basepath ${env} +set r_allowSoftwareGL 1" + + makeWrapper ${env}/ioq3ded.* $out/bin/quake3-server \ + --add-flags "+set fs_basepath ${env}" + ''; - preferLocalBuild = true; - meta = { inherit description; };