summary refs log tree commit diff
path: root/pkgs/games/iortcw
diff options
context:
space:
mode:
authorgnidorah <gnidorah@users.noreply.github.com>2020-11-01 12:41:33 +0300
committerFrederik Rietdijk <freddyrietdijk@fridh.nl>2020-11-01 11:45:57 +0100
commit61040fa997191422631dc44dd0d5d6e5755efeaf (patch)
tree7af57194db9816902e7b6adc62577bc74ba6eb39 /pkgs/games/iortcw
parent790714af65bf03234efce4c6ec9237166697bf86 (diff)
iortcw: init at 1.51c
Diffstat (limited to 'pkgs/games/iortcw')
-rw-r--r--pkgs/games/iortcw/default.nix27
-rw-r--r--pkgs/games/iortcw/sp.nix52
2 files changed, 79 insertions, 0 deletions
diff --git a/pkgs/games/iortcw/default.nix b/pkgs/games/iortcw/default.nix
new file mode 100644
index 0000000000000..3aa459777ea7a
--- /dev/null
+++ b/pkgs/games/iortcw/default.nix
@@ -0,0 +1,27 @@
+{ buildEnv, callPackage, makeWrapper }:
+
+let
+  sp = callPackage ./sp.nix {};
+  mp = sp.overrideAttrs (oldAttrs: rec {
+    sourceRoot = "source/MP";
+  });
+in buildEnv {
+  name = "iortcw";
+
+  paths = [ sp mp ];
+
+  pathsToLink = [ "/opt" ];
+
+  buildInputs = [ makeWrapper ];
+
+  # so we can launch sp from mp game and vice versa
+  postBuild = ''
+    for i in `find -L $out/opt/iortcw -maxdepth 1 -type f -executable`; do
+      makeWrapper $i $out/bin/`basename $i` --run "cd $out/opt/iortcw"
+    done
+  '';
+
+  meta = sp.meta // {
+    description = "Game engine for Return to Castle Wolfenstein";
+  };
+}
diff --git a/pkgs/games/iortcw/sp.nix b/pkgs/games/iortcw/sp.nix
new file mode 100644
index 0000000000000..71144ad0eb851
--- /dev/null
+++ b/pkgs/games/iortcw/sp.nix
@@ -0,0 +1,52 @@
+{ stdenv, fetchFromGitHub, opusfile, libogg, SDL2, openal, freetype
+, libjpeg, curl, makeWrapper }:
+
+stdenv.mkDerivation rec {
+  pname = "iortcw-sp";
+  version = "1.51c";
+
+  src = fetchFromGitHub {
+    owner = "iortcw";
+    repo = "iortcw";
+    rev = version;
+    sha256 = "0g5wgqb1gm34pd05dj2i8nj3qhsz0831p3m7bsgxpjcg9c00jpyw";
+  };
+
+  enableParallelBuilding = true;
+
+  sourceRoot = "source/SP";
+
+  makeFlags = [
+    "USE_INTERNAL_LIBS=0"
+    "COPYDIR=${placeholder "out"}/opt/iortcw"
+    "USE_OPENAL_DLOPEN=0"
+    "USE_CURL_DLOPEN=0"
+  ];
+
+  installTargets = [ "copyfiles" ];
+
+  buildInputs = [
+    opusfile libogg SDL2 freetype libjpeg openal curl
+  ];
+  nativeBuildInputs = [ makeWrapper ];
+
+  NIX_CFLAGS_COMPILE = [
+    "-I${SDL2.dev}/include/SDL2"
+    "-I${opusfile}/include/opus"
+  ];
+  NIX_CFLAGS_LINK = [ "-lSDL2" ];
+
+  postInstall = ''
+    for i in `find $out/opt/iortcw -maxdepth 1 -type f -executable`; do
+      makeWrapper $i $out/bin/`basename $i` --run "cd $out/opt/iortcw"
+    done
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Single player version of game engine for Return to Castle Wolfenstein";
+    homepage = src.meta.homepage;
+    license = licenses.gpl3;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ gnidorah ];
+  };
+}