package.nix 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. {
  2. pkgs,
  3. src,
  4. libsquish ? (pkgs.callPackage ./libsquish.nix {}),
  5. minizip ? pkgs.minizip,
  6. generator ? pkgs.gnumake,
  7. docs ? true,
  8. launcher ? true,
  9. client ? true,
  10. video ? true,
  11. scripting ? true,
  12. }: let
  13. rev = builtins.substring 0 7 (src.rev or src.dirtyRev or "HEAD");
  14. in {
  15. pname = "vcmi";
  16. inherit src;
  17. version = "${rev}-dev"; #TODO: Update from git?
  18. meta = {
  19. description = "Open-source engine for Heroes of Might and Magic III";
  20. longDescription = ''
  21. VCMI is an open-source engine for Heroes of Might and Magic III, offering
  22. new and extended possibilities. To use VCMI, you need to own the original
  23. data files.
  24. '';
  25. homepage = "https://vcmi.eu";
  26. changelog = "https://github.com/vcmi/vcmi/blob/${rev}/ChangeLog.md";
  27. license = with pkgs.lib.licenses; [
  28. gpl2Plus
  29. cc-by-sa-40
  30. ];
  31. mainProgram = "vcmilauncher";
  32. };
  33. buildInputs = with pkgs;
  34. with qt6; let
  35. qtEnv = env "qt-custom-${qtbase.version}" [
  36. qtdeclarative
  37. qtsvg
  38. qttools
  39. ];
  40. in
  41. (
  42. if launcher
  43. then [qtEnv qtbase]
  44. else []
  45. )
  46. ++ [
  47. SDL2
  48. SDL2.dev
  49. SDL2_ttf
  50. SDL2_net
  51. SDL2_image
  52. SDL2_sound
  53. SDL2_mixer
  54. SDL2_gfx
  55. boost
  56. git
  57. libsquish
  58. cmake
  59. pkg-config
  60. generator
  61. ]
  62. ++ (
  63. if docs
  64. then [doxygen]
  65. else []
  66. )
  67. ++ (
  68. if launcher
  69. then [qt6.wrapQtAppsHook]
  70. else []
  71. );
  72. configureFlags = ["--with-sdl2"];
  73. postFixup = with pkgs; ''
  74. wrapProgram $out/bin/vcmibuilder \
  75. --prefix PATH : "${
  76. lib.makeBinPath [
  77. innoextract
  78. ffmpeg
  79. unshield
  80. ]
  81. }"
  82. '';
  83. cmakeFlags = with pkgs;
  84. [
  85. (lib.cmakeFeature "CMAKE_INSTALL_RPATH" "$out/lib/vcmi")
  86. (lib.cmakeFeature "CMAKE_INSTALL_BINDIR" "bin")
  87. (lib.cmakeFeature "CMAKE_INSTALL_LIBDIR" "lib")
  88. (lib.cmakeFeature "CMAKE_INSTALL_DATAROOTDIR" "share")
  89. ]
  90. ++ (
  91. if !client
  92. then ["-DENABLE_CLIENT=OFF"]
  93. else []
  94. )
  95. ++ (
  96. if scripting
  97. then ["-DENABLE_ERM=ON" "-DENABLE_LUA=ON"]
  98. else []
  99. )
  100. ++ (
  101. if !video
  102. then ["-DENABLE_VIDEO=OFF"]
  103. else []
  104. )
  105. ++ (
  106. if !launcher
  107. then ["-DENABLE_LAUNCHER=OFF"]
  108. else []
  109. );
  110. nativeBuildInputs = with pkgs.buildPackages;
  111. [
  112. boost
  113. zlib
  114. xz
  115. tbb
  116. vulkan-headers
  117. libxkbcommon
  118. onnxruntime
  119. python3
  120. pkg-config
  121. libsquish
  122. minizip
  123. ]
  124. ++ [
  125. (
  126. if ninja != null
  127. then ninja
  128. else gnumake
  129. )
  130. ]
  131. ++ (
  132. if (client && video)
  133. then [ffmpeg]
  134. else []
  135. )
  136. ++ (
  137. if launcher
  138. then [qt6.wrapQtAppsHook]
  139. else []
  140. )
  141. ++ (
  142. if scripting
  143. then [luajit]
  144. else []
  145. );
  146. }