depot/third_party/nixpkgs/pkgs/games/forge-mtg/default.nix
Default email 5e9e1146e1 Project import generated by Copybara.
GitOrigin-RevId: 18036c0be90f4e308ae3ebcab0e14aae0336fe42
2023-08-05 00:07:22 +02:00

65 lines
1.9 KiB
Nix

{ coreutils
, fetchFromGitHub
, gnused
, lib
, maven
, makeWrapper
, openjdk
}:
let
version = "1.6.56";
src = fetchFromGitHub {
owner = "Card-Forge";
repo = "forge";
rev = "forge-${version}";
hash = "sha256-VB/ToTq1XwHPEUNmbocwUoCP4DfyAFdlRAwxrx4tNJU=";
};
# launch4j downloads and runs a native binary during the package phase.
patches = [ ./no-launch4j.patch ];
in
maven.buildMavenPackage {
pname = "forge-mtg";
inherit version src patches;
# Tests need a running Xorg.
mvnParameters = "-DskipTests";
mvnHash = "sha256-ajrHnaiJS7ZnR9BjLaXK2bnAKCp5UWQqYpjWbz3z6bw=";
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
runHook preInstall
mkdir -p $out/bin $out/share/forge
cp -a \
forge-gui-desktop/target/forge.sh \
forge-gui-desktop/target/forge-gui-desktop-${version}-jar-with-dependencies.jar \
forge-gui-mobile-dev/target/forge-adventure.sh \
forge-gui-mobile-dev/target/forge-gui-mobile-dev-${version}-jar-with-dependencies.jar \
forge-adventure/target/forge-adventure-editor.sh \
forge-adventure/target/forge-adventure-${version}-jar-with-dependencies.jar \
forge-gui/res \
$out/share/forge
runHook postInstall
'';
preFixup = ''
for commandToInstall in forge forge-adventure forge-adventure-editor; do
chmod 555 $out/share/forge/$commandToInstall.sh
makeWrapper $out/share/forge/$commandToInstall.sh $out/bin/$commandToInstall \
--prefix PATH : ${lib.makeBinPath [ coreutils openjdk gnused ]} \
--set JAVA_HOME ${openjdk}/lib/openjdk \
--set SENTRY_DSN ""
done
'';
meta = with lib; {
description = "Magic: the Gathering card game with rules enforcement";
homepage = "https://www.slightlymagic.net/forum/viewforum.php?f=26";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ eigengrau ];
};
}