1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
{ lib
, stdenv
, fetchFromGitHub
, cmake
, glew
, freeimage
, liblockfile
, openal
, libtheora
, SDL2
, lzo
, libjpeg
, libogg
, pcre
, makeWrapper
, enableMultiplayer ? false # Requires old, insecure Crypto++ version
}:
let
version = "1144-december-2021-rc1";
src = fetchFromGitHub {
owner = "OpenXRay";
repo = "xray-16";
rev = version;
fetchSubmodules = true;
sha256 = "07qj1lpp21g4p583gvz5h66y2q71ymbsz4g5nr6dcys0vm7ph88v";
};
# https://github.com/OpenXRay/xray-16/issues/518
ancientCryptopp = stdenv.mkDerivation {
pname = "cryptopp";
version = "5.6.5";
inherit src;
sourceRoot = "source/Externals/cryptopp";
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 {
pname = "openxray";
inherit version src;
nativeBuildInputs = [
cmake
makeWrapper
];
buildInputs = [
glew
freeimage
liblockfile
openal
libtheora
SDL2
lzo
libjpeg
libogg
pcre
] ++ lib.optionals enableMultiplayer [
ancientCryptopp
];
# Crashes can happen, we'd like them to be reasonably debuggable
cmakeBuildType = "RelWithDebInfo";
dontStrip = true;
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
wrapProgram $out/bin/xr_3da \
--prefix LD_LIBRARY_PATH : $out/lib
'';
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 = "https://github.com/OpenXRay/xray-16/";
license = licenses.unfree // {
url = "https://github.com/OpenXRay/xray-16/blob/xd_dev/License.txt";
};
maintainers = with maintainers; [ OPNA2608 ];
platforms = [ "x86_64-linux" "i686-linux" ];
};
}
|