nixpkgs/pkgs/games/openxray/default.nix

75 lines
2.1 KiB
Nix
Raw Normal View History

2019-10-03 21:19:00 +02:00
{ stdenv, fetchFromGitHub, cmake, glew, freeimage, liblockfile
, openal, libtheora, SDL2, lzo, libjpeg, libogg, tbb
2019-10-03 21:19:00 +02:00
, pcre, makeWrapper }:
let
2020-07-11 23:09:47 +02:00
version = "730-july-preview";
2019-10-03 21:19:00 +02:00
src = fetchFromGitHub {
owner = "OpenXRay";
repo = "xray-16";
rev = version;
2020-07-11 23:09:47 +02:00
sha256 = "1nish3sbpk0hsag7r4nyx8j6pl9mlgx58v8dhzg2vwj2q32isyb2";
2019-10-03 21:19:00 +02:00
fetchSubmodules = true;
};
# https://github.com/OpenXRay/xray-16/issues/518
cryptopp = stdenv.mkDerivation {
pname = "cryptopp";
version = "5.6.5";
inherit src;
postUnpack = "sourceRoot+=/Externals/cryptopp";
makeFlags = [ "PREFIX=${placeholder "out"}" ];
enableParallelBuilding = true;
doCheck = true;
meta = with stdenv.lib; {
description = "Crypto++, a free C++ class library of cryptographic schemes";
homepage = "https://cryptopp.com/";
license = with licenses; [ boost publicDomain ];
platforms = platforms.all;
};
};
in stdenv.mkDerivation rec {
pname = "OpenXRay";
inherit version src;
2019-10-03 21:19:00 +02:00
hardeningDisable = [ "format" ];
cmakeFlags = [ "-DCMAKE_INCLUDE_PATH=${cryptopp}/include/cryptopp" ];
buildInputs = [
glew freeimage liblockfile openal cryptopp libtheora SDL2 lzo
libjpeg libogg tbb pcre
];
nativeBuildInputs = [ cmake makeWrapper ];
preConfigure = ''
substituteInPlace src/xrCore/xrCore.cpp \
--replace /usr/share $out/share
2020-10-21 09:40:51 +02:00
# https://github.com/OpenXRay/xray-16/issues/667
echo "inline const char* xr_sys_errlist[100] = {};" >> src/Common/PlatformLinux.inl
echo "#define _sys_errlist xr_sys_errlist" >> src/Common/PlatformLinux.inl
2019-10-03 21:19:00 +02:00
'';
postInstall = ''
# needed because of SDL_LoadObject library loading code
wrapProgram $out/bin/xr_3da \
--prefix LD_LIBRARY_PATH : $out/lib
'';
meta = with stdenv.lib; {
description = "X-Ray Engine 1.6 expansion. Original version was used in S.T.A.L.K.E.R.: Call of Pripyat";
homepage = src.meta.homepage;
license = licenses.unfree // {
url = "https://github.com/OpenXRay/xray-16/blob/xd_dev/License.txt";
2019-10-03 21:19:00 +02:00
};
maintainers = [ maintainers.gnidorah ];
platforms = [ "x86_64-linux" "i686-linux" ];
2019-10-03 21:19:00 +02:00
};
}