nixpkgs/pkgs/games/devilutionx/default.nix

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

136 lines
4.4 KiB
Nix
Raw Normal View History

2021-11-04 02:05:53 +00:00
{ lib
, stdenv
, fetchFromGitHub
, fetchurl
2022-04-17 03:29:52 +00:00
, bzip2
2021-11-04 02:05:53 +00:00
, cmake
, pkg-config
2021-11-04 02:05:53 +00:00
, gettext
2022-04-17 03:29:52 +00:00
, libsodium
2021-11-04 02:05:53 +00:00
, SDL2
, SDL2_image
2024-04-11 08:17:14 +00:00
, SDL_audiolib
, flac
2021-11-04 02:05:53 +00:00
, fmt
, libpng
, smpq
}:
let
# TODO: submit a PR upstream to allow system copies of these libraries where possible
2022-04-17 03:29:52 +00:00
# fork with patches, far behind upstream
2021-11-04 02:05:53 +00:00
asio = fetchurl {
2024-08-31 15:30:07 +00:00
url = "https://github.com/diasurgical/asio/archive/4bcf552fcea3e1ae555dde2ab33bc9fa6770da4d.tar.gz";
sha256 = "sha256-AFBy5OFsAzxZsiI4DirIHh+VjFkdalEhN9OGqhC0Cvc=";
2021-11-04 02:05:53 +00:00
};
2022-04-17 03:29:52 +00:00
# fork with patches, upstream seems to be dead
libmpq = fetchurl {
2024-04-11 08:17:14 +00:00
url = "https://github.com/diasurgical/libmpq/archive/b78d66c6fee6a501cc9b95d8556a129c68841b05.tar.gz";
sha256 = "sha256-NIzZwr6cBn38uKLWzW+Uet5QiOFUPB5dsf3FsS22ruo=";
2022-04-17 03:29:52 +00:00
};
# not "real" package with pkg-config or cmake file, just collection of source files
libsmackerdec = fetchurl {
2024-04-11 08:17:14 +00:00
url = "https://github.com/diasurgical/libsmackerdec/archive/91e732bb6953489077430572f43fc802bf2c75b2.tar.gz";
sha256 = "sha256-5WXjfvGuT4hG2cnCS4YbxW/c4tek7OR95EjgCqkEi4c=";
2022-04-17 03:29:52 +00:00
};
# fork with patches, far behind upstream
libzt = fetchFromGitHub {
owner = "diasurgical";
repo = "libzt";
fetchSubmodules = true;
2024-04-11 08:17:14 +00:00
rev = "d6c6a069a5041a3e89594c447ced3f15d77618b8";
sha256 = "sha256-ttRJLfaGHzhS4jd8db7BNPWROCti3ZxuRouqsL/M5ew=";
2021-11-04 02:05:53 +00:00
};
2024-04-11 08:17:14 +00:00
# breaks without this version
SDL_audiolib' = SDL_audiolib.overrideAttrs (oldAttrs: {
src = fetchFromGitHub {
owner = "realnc";
repo = "SDL_audiolib";
rev = "cc1bb6af8d4cf5e200259072bde1edd1c8c5137e";
sha256 = "sha256-xP7qlwwOkqVeTlCEZLinnvmx8LbU2co5+t//cf4n190=";
};
buildInputs = oldAttrs.buildInputs ++ [ flac ];
});
2022-04-17 03:29:52 +00:00
# missing pkg-config and/or cmake file
simpleini = fetchurl {
2024-04-11 08:17:14 +00:00
url = "https://github.com/brofield/simpleini/archive/56499b5af5d2195c6acfc58c4630b70e0c9c4c21.tar.gz";
sha256 = "sha256-29tQoz0+33kfwmIjCdnD1wGi+35+K0A9P6UE4E8K3g4=";
2021-11-04 02:05:53 +00:00
};
in
2021-04-08 22:18:46 +00:00
stdenv.mkDerivation rec {
pname = "devilutionx";
2024-08-31 15:30:07 +00:00
version = "1.5.3";
src = fetchFromGitHub {
owner = "diasurgical";
repo = "devilutionX";
rev = version;
2024-08-31 15:30:07 +00:00
sha256 = "sha256-4cA2OHTc51U8XIk3iS16En7JJExkcn4a4VdtjNkZfH8=";
};
2021-04-08 22:18:46 +00:00
postPatch = ''
2024-04-11 08:17:14 +00:00
substituteInPlace 3rdParty/asio/CMakeLists.txt --replace-fail "${asio.url}" "${asio}"
substituteInPlace 3rdParty/libmpq/CMakeLists.txt --replace-fail "${libmpq.url}" "${libmpq}"
substituteInPlace 3rdParty/libsmackerdec/CMakeLists.txt --replace-fail "${libsmackerdec.url}" "${libsmackerdec}"
2022-04-17 03:29:52 +00:00
substituteInPlace 3rdParty/libzt/CMakeLists.txt \
2024-04-11 08:17:14 +00:00
--replace-fail "GIT_REPOSITORY https://github.com/diasurgical/libzt.git" "" \
--replace-fail "GIT_TAG ${libzt.rev}" "SOURCE_DIR ${libzt}"
substituteInPlace 3rdParty/simpleini/CMakeLists.txt --replace-fail "${simpleini.url}" "${simpleini}"
2021-11-04 02:05:53 +00:00
'';
2021-11-04 02:05:53 +00:00
nativeBuildInputs = [
cmake
pkg-config
2021-11-04 02:05:53 +00:00
gettext
smpq # used to build devilutionx.mpq
];
buildInputs = [
2022-04-17 03:29:52 +00:00
bzip2
2021-11-04 02:05:53 +00:00
fmt
libpng
2022-04-17 03:29:52 +00:00
libsodium
SDL2
SDL2_image
2024-04-11 08:17:14 +00:00
SDL_audiolib'
2021-11-04 02:05:53 +00:00
];
installPhase = ''
runHook preInstall
'' + (if stdenv.hostPlatform.isDarwin then ''
mkdir -p $out/Applications
mv devilutionx.app $out/Applications
'' else ''
install -Dm755 -t $out/bin devilutionx
2024-04-11 08:17:14 +00:00
install -Dm755 -t $out/bin devilutionx.mpq
2021-11-04 02:05:53 +00:00
install -Dm755 -t $out/share/diasurgical/devilutionx devilutionx.mpq
install -Dm755 -t $out/share/applications ../Packaging/nix/devilutionx-hellfire.desktop ../Packaging/nix/devilutionx.desktop
install -Dm755 ../Packaging/resources/icon.png $out/share/icons/hicolor/512x512/apps/devilutionx.png
install -Dm755 ../Packaging/resources/hellfire.png $out/share/icons/hicolor/512x512/apps/devilutionx-hellfire.png
install -Dm755 ../Packaging/resources/icon_32.png $out/share/icons/hicolor/32x32/apps/devilutionx.png
install -Dm755 ../Packaging/resources/hellfire_32.png $out/share/icons/hicolor/32x32/apps/devilutionx-hellfire.png
'') + ''
runHook postInstall
'';
meta = with lib; {
homepage = "https://github.com/diasurgical/devilutionX";
description = "Diablo build for modern operating systems";
mainProgram = "devilutionx";
longDescription = "In order to play this game a copy of diabdat.mpq is required. Place a copy of diabdat.mpq in ~/.local/share/diasurgical/devilution before executing the game.";
license = licenses.unlicense;
2021-11-04 02:05:53 +00:00
maintainers = with maintainers; [ karolchmist aanderse ];
platforms = platforms.linux ++ platforms.windows;
};
}