nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at flake-libs 100 lines 2.5 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 gitUpdater, 6 cmake, 7 glew, 8 liblockfile, 9 openal, 10 libtheora, 11 SDL2, 12 lzo, 13 libjpeg, 14 libogg, 15 pcre, 16 makeWrapper, 17}: 18 19stdenv.mkDerivation (finalAttrs: { 20 pname = "openxray"; 21 version = "2921-january-2025-rc1"; 22 23 src = fetchFromGitHub { 24 owner = "OpenXRay"; 25 repo = "xray-16"; 26 tag = finalAttrs.version; 27 fetchSubmodules = true; 28 hash = "sha256-PYRC1t4gjT2d41ZZOZJF4u3vc0Pq7DpivEnnfbcSQYk="; 29 }; 30 31 # Don't force-override these please 32 postPatch = '' 33 substituteInPlace Externals/LuaJIT-proj/CMakeLists.txt \ 34 --replace-fail 'set(CMAKE_OSX_SYSROOT' '#set(CMAKE_OSX_SYSROOT' \ 35 --replace-fail 'set(ENV{SDKROOT}' '#set(ENV{SDKROOT}' 36 ''; 37 38 strictDeps = true; 39 40 nativeBuildInputs = [ 41 cmake 42 makeWrapper 43 ]; 44 45 buildInputs = [ 46 glew 47 liblockfile 48 openal 49 libtheora 50 SDL2 51 lzo 52 libjpeg 53 libogg 54 pcre 55 ]; 56 57 cmakeFlags = 58 [ 59 # Breaks on Darwin 60 (lib.cmakeBool "USE_LTO" (!stdenv.hostPlatform.isDarwin)) 61 ] 62 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 63 # This seemingly only gets set properly by CMake when using the XCode generator 64 (lib.cmakeFeature "CMAKE_OSX_DEPLOYMENT_TARGET" "${stdenv.hostPlatform.darwinMinVersion}") 65 ]; 66 67 # Crashes can happen, we'd like them to be reasonably debuggable 68 cmakeBuildType = "RelWithDebInfo"; 69 dontStrip = true; 70 71 # Because we work around https://github.com/OpenXRay/xray-16/issues/1224 by using GCC, 72 # we need a followup workaround for Darwin locale stuff when using GCC: 73 # runtime error: locale::facet::_S_create_c_locale name not valid 74 postInstall = lib.optionalString stdenv.hostPlatform.isDarwin '' 75 wrapProgram $out/bin/xr_3da \ 76 --run 'export LC_ALL=C' 77 ''; 78 79 # dlopens its own libraries, relies on rpath not having its prefix stripped 80 dontPatchELF = true; 81 82 passthru.updateScript = gitUpdater { }; 83 84 meta = with lib; { 85 mainProgram = "xr_3da"; 86 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"; 87 homepage = "https://github.com/OpenXRay/xray-16/"; 88 license = licenses.unfree // { 89 url = "https://github.com/OpenXRay/xray-16/blob/${finalAttrs.version}/License.txt"; 90 }; 91 maintainers = with maintainers; [ OPNA2608 ]; 92 platforms = [ 93 "x86_64-linux" 94 "i686-linux" 95 "aarch64-linux" 96 "x86_64-darwin" 97 "aarch64-darwin" 98 ]; 99 }; 100})