Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / games / forge-mtg / default.nix
blobcc5c56977bb98043744488fc3ecae1e36cf3a581
1 { coreutils
2 , fetchFromGitHub
3 , gnused
4 , lib
5 , maven
6 , makeWrapper
7 , openjdk
8 }:
10 let
11   version = "1.6.57";
13   src = fetchFromGitHub {
14     owner = "Card-Forge";
15     repo = "forge";
16     rev = "forge-${version}";
17     hash = "sha256-pxnnqLfyblbIgIRZZrx8Y8K43zUv9mu7PzZ7zltpEUQ=";
18   };
20   # launch4j downloads and runs a native binary during the package phase.
21   patches = [ ./no-launch4j.patch ];
24 maven.buildMavenPackage {
25   pname = "forge-mtg";
26   inherit version src patches;
28   # Tests need a running Xorg.
29   mvnParameters = "-DskipTests";
30   mvnHash = "sha256-QK9g0tG75lIhEtf4jW03N32YbD9Fe5iI0JTuqmCTtnE=";
32   nativeBuildInputs = [ makeWrapper ];
34   installPhase = ''
35     runHook preInstall
36     mkdir -p $out/bin $out/share/forge
37     cp -a \
38       forge-gui-desktop/target/forge.sh \
39       forge-gui-desktop/target/forge-gui-desktop-${version}-jar-with-dependencies.jar \
40       forge-gui-mobile-dev/target/forge-adventure.sh \
41       forge-gui-mobile-dev/target/forge-gui-mobile-dev-${version}-jar-with-dependencies.jar \
42       forge-adventure/target/forge-adventure-editor.sh \
43       forge-adventure/target/forge-adventure-${version}-jar-with-dependencies.jar \
44       forge-gui/res \
45       $out/share/forge
46     runHook postInstall
47   '';
49   preFixup = ''
50     for commandToInstall in forge forge-adventure forge-adventure-editor; do
51       chmod 555 $out/share/forge/$commandToInstall.sh
52       makeWrapper $out/share/forge/$commandToInstall.sh $out/bin/$commandToInstall \
53         --prefix PATH : ${lib.makeBinPath [ coreutils openjdk gnused ]} \
54         --set JAVA_HOME ${openjdk}/lib/openjdk \
55         --set SENTRY_DSN ""
56     done
57   '';
59   meta = with lib; {
60     description = "Magic: the Gathering card game with rules enforcement";
61     homepage = "https://www.slightlymagic.net/forum/viewforum.php?f=26";
62     license = licenses.gpl3Plus;
63     maintainers = with maintainers; [ eigengrau ];
64   };