nixpkgs/pkgs/games/wargus/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

64 lines
2.1 KiB
Nix
Raw Normal View History

2020-09-24 19:24:09 +02:00
{ stdenv, lib, callPackage, fetchFromGitHub
2022-08-05 18:52:54 +02:00
, fetchurl, runCommand, unzip, bchunk, p7zip
2020-09-24 19:24:09 +02:00
, cmake, pkg-config, makeWrapper
, zlib, bzip2, libpng
2022-08-05 18:52:54 +02:00
, dialog, python3, cdparanoia, ffmpeg
2020-09-24 19:24:09 +02:00
}:
let
stratagus = callPackage ./stratagus.nix {};
2022-08-05 18:52:54 +02:00
dataDownload = fetchurl {
url = "https://archive.org/download/warcraft-ii-tides-of-darkness_202105/Warcess.zip";
sha256 = "0yxgvf8xpv1w2bjmny4a38pa3xcdgqckk9abj21ilkc5zqzqmm9b";
};
data = runCommand "warcraft2" {
buildInputs = [ unzip bchunk p7zip ];
meta.license = lib.licenses.unfree;
} ''
unzip ${dataDownload} "Warcraft.II.Tides.of.Darkness/Warcraft II - Tides of Darkness (1995)/games/WarcrafD/cd/"{WC2BTDP.img,WC2BTDP.cue}
bchunk "Warcraft.II.Tides.of.Darkness/Warcraft II - Tides of Darkness (1995)/games/WarcrafD/cd/"{WC2BTDP.img,WC2BTDP.cue} WC2BTDP
rm -r Warcraft.II.Tides.of.Darkness
7z x WC2BTDP01.iso
rm WC2BTDP*.{iso,cdr}
cp -r DATA $out
'';
2020-09-24 19:24:09 +02:00
in
stdenv.mkDerivation rec {
pname = "wargus";
inherit (stratagus) version;
src = fetchFromGitHub {
owner = "wargus";
repo = "wargus";
rev = "v${version}";
2022-07-28 17:37:27 +02:00
sha256 = "sha256-yJeMFxCD0ikwVPQApf+IBuMQ6eOjn1fVKNmqh6r760c=";
2020-09-24 19:24:09 +02:00
};
2022-08-05 18:52:54 +02:00
nativeBuildInputs = [ cmake pkg-config makeWrapper ffmpeg ];
2020-09-24 19:24:09 +02:00
buildInputs = [ zlib bzip2 libpng ];
cmakeFlags = [
"-DSTRATAGUS=${stratagus}/games/stratagus"
"-DSTRATAGUS_INCLUDE_DIR=${stratagus.src}/gameheaders"
];
postInstall = ''
makeWrapper $out/games/wargus $out/bin/wargus \
2022-08-05 18:52:54 +02:00
--prefix PATH : ${lib.makeBinPath [ "$out" ]}
2022-08-06 01:31:19 +02:00
substituteInPlace $out/share/applications/wargus.desktop \
--replace $out/games/wargus $out/bin/wargus
2022-08-05 18:52:54 +02:00
$out/bin/wartool -v -r ${data} $out/share/games/stratagus/wargus
ln -s $out/share/games/stratagus/wargus/{contrib/black_title.png,graphics/ui/black_title.png}
2020-09-24 19:24:09 +02:00
'';
meta = with lib; {
description = "Importer and scripts for Warcraft II: Tides of Darkness, the expansion Beyond the Dark Portal, and Aleonas Tales";
homepage = "https://wargus.github.io/";
license = licenses.gpl2Only;
maintainers = [ maintainers.astro ];
platforms = platforms.linux;
};
}