about summary refs log tree commit diff
path: root/pkgs/games/build-support
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2017-09-13 06:06:52 +0200
committeraszlig <aszlig@redmoonstudios.org>2017-09-13 15:26:36 +0200
commit217818dbb80b54ca9eac240c169e8c015a145dc7 (patch)
tree1e8b1ffef11b6b4721183aa2bf08e9391a092238 /pkgs/games/build-support
parente273773c4e66c2e553e1cbf0c453fc225fe808e3 (diff)
pkgs/build-unity: Switch to using buildGame
Now we no longer need to invoke patchelf by ourselves and all of the
dependencies are patched automatically.

I've added gtk2-x11, gdk_pixbuf and glib to buildUnity as well, because
after inspecting other Unity games they seem to require the same
libraries as well.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'pkgs/games/build-support')
-rw-r--r--pkgs/games/build-support/build-unity.nix42
1 files changed, 19 insertions, 23 deletions
diff --git a/pkgs/games/build-support/build-unity.nix b/pkgs/games/build-support/build-unity.nix
index dfd69bba..bdca83eb 100644
--- a/pkgs/games/build-support/build-unity.nix
+++ b/pkgs/games/build-support/build-unity.nix
@@ -1,35 +1,31 @@
-{ stdenv, makeWrapper, mesa, xorg, libpulseaudio, libudev }:
+{ stdenv, buildGame, makeWrapper, gtk2-x11, gdk_pixbuf, glib
+, mesa, xorg, libpulseaudio, libudev, zlib
+}:
 
-{ name, version, fullName, buildPhase ? "", rpath ? [], ... }@attrs:
+{ name, version, fullName
+, nativeBuildInputs ? []
+, buildInputs ? []
+, runtimeDependencies ? []
+, ...
+}@attrs:
 
 let
   arch = if stdenv.system == "x86_64-linux" then "x86_64" else "x86";
   executable = "${fullName}.${arch}";
   dataDir = "${fullName}_Data";
 
-in stdenv.mkDerivation ({
+in buildGame ({
   name = "${name}-${version}";
   inherit fullName version arch executable dataDir;
   slugName = name;
 
-  nativeBuildInputs = [ makeWrapper ];
+  nativeBuildInputs = [ makeWrapper ] ++ nativeBuildInputs;
 
-  buildPhase = let
-    mainRpath = stdenv.lib.makeLibraryPath ([
-      stdenv.cc.cc mesa xorg.libX11 xorg.libXcursor xorg.libXrandr
-      libpulseaudio libudev
-    ] ++ rpath);
-  in ''
-    runHook preBuild
+  buildInputs = [ gtk2-x11 gdk_pixbuf glib ];
 
-    patchelf \
-      --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
-      --set-rpath ${stdenv.lib.escapeShellArg mainRpath} "$executable"
-
-    ${buildPhase}
-
-    runHook postBuild
-  '';
+  runtimeDependencies = [
+    mesa xorg.libX11 xorg.libXcursor xorg.libXrandr libudev zlib
+  ];
 
   installPhase = ''
     runHook preInstall
@@ -62,7 +58,7 @@ in stdenv.mkDerivation ({
 
     runHook postInstall
   '';
-
-  dontStrip = true;
-  dontPatchELF = true;
-} // removeAttrs attrs [ "name" "version" "fullName" "buildPhase" "rpath" ])
+} // removeAttrs attrs [
+  "name" "version" "fullName" "nativeBuildInputs" "buildInputs"
+  "runtimeDependencies"
+])