summary refs log tree commit diff
path: root/pkgs/games/openxray
diff options
context:
space:
mode:
authorOPNA2608 <christoph.neidahl@gmail.com>2022-05-12 19:34:54 +0200
committerOPNA2608 <christoph.neidahl@gmail.com>2022-05-12 19:34:54 +0200
commit51b24b0bf08f3b7d99de00140229294cac8429fb (patch)
tree7f33f0ad17a5ef2407a6610da025e861eced546c /pkgs/games/openxray
parent7ab6a92aa8d43d1bb7331906272adf1218270588 (diff)
downloadnixpkgs-51b24b0bf08f3b7d99de00140229294cac8429fb.tar
nixpkgs-51b24b0bf08f3b7d99de00140229294cac8429fb.tar.gz
nixpkgs-51b24b0bf08f3b7d99de00140229294cac8429fb.tar.bz2
nixpkgs-51b24b0bf08f3b7d99de00140229294cac8429fb.tar.lz
nixpkgs-51b24b0bf08f3b7d99de00140229294cac8429fb.tar.xz
nixpkgs-51b24b0bf08f3b7d99de00140229294cac8429fb.tar.zst
nixpkgs-51b24b0bf08f3b7d99de00140229294cac8429fb.zip
openxray: 822-december-preview -> 1144-december-2021-rc1
Diffstat (limited to 'pkgs/games/openxray')
-rw-r--r--pkgs/games/openxray/default.nix83
1 files changed, 55 insertions, 28 deletions
diff --git a/pkgs/games/openxray/default.nix b/pkgs/games/openxray/default.nix
index 58c82aec365..2340f14edc6 100644
--- a/pkgs/games/openxray/default.nix
+++ b/pkgs/games/openxray/default.nix
@@ -1,20 +1,34 @@
-{ lib, stdenv, fetchFromGitHub, cmake, glew, freeimage,  liblockfile
-, openal, libtheora, SDL2, lzo, libjpeg, libogg, tbb
-, pcre, makeWrapper, fetchpatch }:
+{ lib
+, stdenv
+, fetchFromGitHub
+, cmake
+, glew
+, freeimage
+, liblockfile
+, openal
+, libtheora
+, SDL2
+, lzo
+, libjpeg
+, libogg
+, pcre
+, makeWrapper
+, enableMultiplayer ? false # Requires old, insecure Crypto++ version
+}:
 
 let
-  version = "822-december-preview";
+  version = "1144-december-2021-rc1";
 
   src = fetchFromGitHub {
     owner = "OpenXRay";
     repo = "xray-16";
     rev = version;
     fetchSubmodules = true;
-    sha256 = "06f3zjnib7hipyl3hnc6mwcj9f50kbwn522wzdjydz8qgdg60h3m";
+    sha256 = "07qj1lpp21g4p583gvz5h66y2q71ymbsz4g5nr6dcys0vm7ph88v";
   };
 
   # https://github.com/OpenXRay/xray-16/issues/518
-  cryptopp = stdenv.mkDerivation {
+  ancientCryptopp = stdenv.mkDerivation {
     pname = "cryptopp";
     version = "5.6.5";
 
@@ -22,47 +36,59 @@ let
 
     sourceRoot = "source/Externals/cryptopp";
 
-    makeFlags = [ "PREFIX=${placeholder "out"}" ];
+    installFlags = [ "PREFIX=${placeholder "out"}" ];
+
     enableParallelBuilding = true;
 
     doCheck = true;
 
+    dontStrip = true;
+
     meta = with lib; {
       description = "Crypto++, a free C++ class library of cryptographic schemes";
       homepage = "https://cryptopp.com/";
       license = with licenses; [ boost publicDomain ];
       platforms = platforms.all;
+      knownVulnerabilities = [
+        "CVE-2019-14318"
+      ];
     };
   };
-in stdenv.mkDerivation rec {
+in
+stdenv.mkDerivation rec {
   pname = "openxray";
+
   inherit version src;
 
-  # TODO https://github.com/OpenXRay/GameSpy/pull/6, check if merged in version > 822
-  # Fixes format hardening
-  patches = [
-    (fetchpatch {
-      url = "https://github.com/OpenXRay/GameSpy/pull/6/commits/155af876281f5d94f0142886693314d97deb2d4c.patch";
-      sha256 = "1l0vcgvzzx8n56shpblpfdhvpr6c12fcqf35r0mflaiql8q7wn88";
-      stripLen = 1;
-      extraPrefix = "Externals/GameSpy/";
-    })
+  nativeBuildInputs = [
+    cmake
+    makeWrapper
   ];
 
-  cmakeFlags = [ "-DCMAKE_INCLUDE_PATH=${cryptopp}/include/cryptopp" ];
-
   buildInputs = [
-    glew freeimage liblockfile openal cryptopp libtheora SDL2 lzo
-    libjpeg libogg tbb pcre
+    glew
+    freeimage
+    liblockfile
+    openal
+    libtheora
+    SDL2
+    lzo
+    libjpeg
+    libogg
+    pcre
+  ] ++ lib.optionals enableMultiplayer [
+    ancientCryptopp
   ];
 
-  nativeBuildInputs = [ cmake makeWrapper ];
+  # Crashes can happen, we'd like them to be reasonably debuggable
+  cmakeBuildType = "RelWithDebInfo";
+  dontStrip = true;
 
-  # https://github.com/OpenXRay/xray-16/issues/786
-  preConfigure = ''
-    substituteInPlace src/xrCore/xrCore.cpp \
-      --replace /usr/share $out/share
-  '';
+  cmakeFlags = [
+    "-DUSE_CRYPTOPP=${if enableMultiplayer then "ON" else "OFF"}"
+  ] ++ lib.optionals enableMultiplayer [
+    "-DCMAKE_INCLUDE_PATH=${ancientCryptopp}/include/cryptopp"
+  ];
 
   postInstall = ''
     # needed because of SDL_LoadObject library loading code
@@ -71,8 +97,9 @@ in stdenv.mkDerivation rec {
   '';
 
   meta = with lib; {
+    mainProgram = "xray-16";
     description = "Improved version of the X-Ray Engine, the game engine used in the world-famous S.T.A.L.K.E.R. game series by GSC Game World";
-    homepage = src.meta.homepage;
+    homepage = "https://github.com/OpenXRay/xray-16/";
     license = licenses.unfree // {
       url = "https://github.com/OpenXRay/xray-16/blob/xd_dev/License.txt";
     };