1919 libdecor ,
2020 ffmpeg ,
2121 wayland-scanner ,
22- makeWrapper ,
22+ makeBinaryWrapper ,
2323 versionCheckHook ,
24+ copyDesktopItems ,
25+ makeDesktopItem ,
26+ desktopToDarwinBundle ,
2427 x11Support ? stdenv . hostPlatform . isLinux ,
2528 waylandSupport ? stdenv . hostPlatform . isLinux ,
2629} :
2730
2831stdenv . mkDerivation ( finalAttrs : rec {
2932 pname = "q2pro" ;
30- version = "3510 " ;
33+ version = "0-unstable-2025-01-02 " ;
3134
3235 src = fetchFromGitHub {
3336 owner = "skullernet" ;
3437 repo = "q2pro" ;
35- tag = "r ${ version } " ;
36- hash = "sha256-LNOrGJarXnf4QqFXDkUfUgLGrjSqbjncpIN2yttbMuk =" ;
38+ rev = "5b2d9f29aa9fb07cfe2b4ba9ee628a0153e759c2 " ;
39+ hash = "sha256-vz7f6isv3pcMtr3hO96sV1G2F94/w431FxtB6DcpCVU =" ;
3740 } ;
3841
42+ # build date and rev number is displayed in the game's console
43+ revCount = "3660" ; # git rev-list --count ${src.rev}
44+ SOURCE_DATE_EPOCH = "1735838714" ; # git show -s --format=%ct ${src.rev}
45+
3946 nativeBuildInputs =
4047 [
4148 meson
4249 pkg-config
4350 ninja
44- makeWrapper
51+ makeBinaryWrapper
52+ copyDesktopItems
4553 ]
46- ++ lib . optionals waylandSupport [
47- wayland-scanner
48- ] ;
54+ ++ lib . optional waylandSupport wayland-scanner
55+ ++ lib . optional stdenv . hostPlatform . isDarwin desktopToDarwinBundle ;
4956
5057 buildInputs =
5158 [
@@ -64,7 +71,7 @@ stdenv.mkDerivation (finalAttrs: rec {
6471 wayland-protocols
6572 libdecor
6673 ]
67- ++ lib . optionals x11Support [ libXi ] ;
74+ ++ lib . optional x11Support libXi ;
6875
6976 mesonBuildType = "release" ;
7077
@@ -79,8 +86,9 @@ stdenv.mkDerivation (finalAttrs: rec {
7986 ( lib . mesonEnable "windows-crash-dumps" false )
8087 ] ;
8188
89+ internalVersion = "r${ revCount } ~${ builtins . substring 0 8 src . rev } " ;
8290 postPatch = ''
83- echo 'r ${ version } ' > VERSION
91+ echo '${ internalVersion } ' > VERSION
8492 '' ;
8593
8694 postInstall =
@@ -92,12 +100,37 @@ stdenv.mkDerivation (finalAttrs: rec {
92100 mv -v $out/bin/q2pro $out/bin/q2pro-unwrapped
93101 makeWrapper $out/bin/q2pro-unwrapped $out/bin/q2pro \
94102 --prefix ${ ldLibraryPathEnvName } : "${ lib . makeLibraryPath finalAttrs . buildInputs } "
103+
104+ install -D ${ src } /src/unix/res/q2pro.xpm $out/share/icons/hicolor/32x32/apps/q2pro.xpm
95105 '' ;
96106
97107 nativeInstallCheckInputs = [ versionCheckHook ] ;
98108 versionCheckProgramArg = "--version" ;
109+ preVersionCheck = ''
110+ export version='${ internalVersion } '
111+ '' ;
99112 doInstallCheck = true ;
100113
114+ desktopItems = [
115+ ( makeDesktopItem {
116+ name = "q2pro" ;
117+ desktopName = "Q2PRO" ;
118+ exec = if stdenv . hostPlatform . isDarwin then "q2pro" else "q2pro +connect %u" ;
119+ icon = "q2pro" ;
120+ terminal = false ;
121+ mimeTypes = [
122+ "x-scheme-handler/quake2"
123+ ] ;
124+ type = "Application" ;
125+ categories = [
126+ "Game"
127+ "ActionGame"
128+ ] ;
129+ } )
130+ ] ;
131+
132+ passthru . updateScript = ./update.sh ;
133+
101134 meta = {
102135 description = "Enhanced Quake 2 client and server focused on multiplayer" ;
103136 homepage = "https://github.com/skullernet/q2pro" ;
0 commit comments