forgejo-lts: 7.0.10 -> 7.0.11
[NixPkgs.git] / pkgs / by-name / q2 / q2pro / package.nix
blobde838ef82fef6f791a8b6cb7cec7d6e3301caafa
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   meson,
6   pkg-config,
7   ninja,
8   zlib,
9   libpng,
10   libjpeg,
11   curl,
12   SDL2,
13   openalSoft,
14   libogg,
15   libvorbis,
16   libXi,
17   wayland,
18   wayland-protocols,
19   libdecor,
20   ffmpeg,
21   wayland-scanner,
22   makeWrapper,
23   versionCheckHook,
24   x11Support ? stdenv.isLinux,
25   waylandSupport ? stdenv.isLinux,
28 stdenv.mkDerivation (finalAttrs: rec {
29   pname = "q2pro";
30   version = "3510";
32   src = fetchFromGitHub {
33     owner = "skullernet";
34     repo = "q2pro";
35     rev = "refs/tags/r${version}";
36     hash = "sha256-LNOrGJarXnf4QqFXDkUfUgLGrjSqbjncpIN2yttbMuk=";
37   };
39   nativeBuildInputs =
40     [
41       meson
42       pkg-config
43       ninja
44       makeWrapper
45     ]
46     ++ lib.optionals waylandSupport [
47       wayland-scanner
48     ];
50   buildInputs =
51     [
52       zlib
53       libpng
54       libjpeg
55       curl
56       SDL2
57       libogg
58       libvorbis
59       ffmpeg
60       openalSoft
61     ]
62     ++ lib.optionals waylandSupport [
63       wayland
64       wayland-protocols
65       libdecor
66     ]
67     ++ lib.optionals x11Support [ libXi ];
69   mesonBuildType = "release";
71   mesonFlags = [
72     (lib.mesonBool "anticheat-server" true)
73     (lib.mesonBool "client-gtv" true)
74     (lib.mesonBool "packetdup-hack" true)
75     (lib.mesonBool "variable-fps" true)
76     (lib.mesonEnable "wayland" waylandSupport)
77     (lib.mesonEnable "x11" x11Support)
78     (lib.mesonEnable "icmp-errors" stdenv.isLinux)
79     (lib.mesonEnable "windows-crash-dumps" false)
80   ];
82   postPatch = ''
83     echo 'r${version}' > VERSION
84   '';
86   postInstall =
87     let
88       ldLibraryPathEnvName =
89         if stdenv.hostPlatform.isDarwin then "DYLD_LIBRARY_PATH" else "LD_LIBRARY_PATH";
90     in
91     ''
92       mv -v $out/bin/q2pro $out/bin/q2pro-unwrapped
93       makeWrapper $out/bin/q2pro-unwrapped $out/bin/q2pro \
94         --prefix ${ldLibraryPathEnvName} : "${lib.makeLibraryPath finalAttrs.buildInputs}"
95     '';
97   nativeInstallCheckInputs = [ versionCheckHook ];
98   versionCheckProgramArg = "--version";
99   doInstallCheck = true;
101   meta = {
102     description = "Enhanced Quake 2 client and server focused on multiplayer";
103     homepage = "https://github.com/skullernet/q2pro";
104     license = lib.licenses.gpl2;
105     maintainers = with lib.maintainers; [ carlossless ];
106     platforms = lib.platforms.unix;
107     mainProgram = "q2pro";
108   };