2021-11-04 02:05:53 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
2021-11-05 20:48:28 +00:00
|
|
|
, fetchpatch
|
2021-11-04 02:05:53 +00:00
|
|
|
, fetchurl
|
|
|
|
, fetchzip
|
|
|
|
, cmake
|
2021-11-05 20:48:28 +00:00
|
|
|
, pkg-config
|
2021-11-04 02:05:53 +00:00
|
|
|
, gettext
|
|
|
|
, SDL2
|
2021-11-05 20:48:28 +00:00
|
|
|
, SDL2_image
|
2021-11-04 02:05:53 +00:00
|
|
|
, fmt
|
|
|
|
, libpng
|
|
|
|
, smpq
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2021-11-05 20:48:28 +00:00
|
|
|
# TODO: submit a PR upstream to allow system copies of these libraries where possible
|
2021-11-04 02:05:53 +00:00
|
|
|
asio = fetchurl {
|
|
|
|
url = "https://github.com/diasurgical/asio/archive/ebeff99f539da23d27c2e8d4bdbc1ee011968644.tar.gz";
|
|
|
|
sha256 = "0vhb4cig40mm0a98i74grpmfkcmby8zxg6vqa38dpryxpgvp5fw8";
|
|
|
|
};
|
|
|
|
|
|
|
|
SDL_audiolib = fetchurl {
|
|
|
|
url = "https://github.com/realnc/SDL_audiolib/archive/aa79660eba4467a44f9dcaecf26b0f0a000abfd7.tar.gz";
|
|
|
|
sha256 = "0z4rizncp6gqsy72b3709zc9fr915wgcwnlx1fhhy7mrczsly630";
|
|
|
|
};
|
|
|
|
|
|
|
|
simpleini = fetchzip {
|
|
|
|
url = "https://github.com/brofield/simpleini/archive/7bca74f6535a37846162383e52071f380c99a43a.zip";
|
|
|
|
sha256 = "07kf1jjbc9v04hsysa6v2wh1m9csf5qz0b1wmlkf9sj00kf47zj7";
|
|
|
|
};
|
|
|
|
in
|
2021-04-08 22:18:46 +00:00
|
|
|
|
2019-10-21 00:10:52 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2021-04-04 22:45:02 +00:00
|
|
|
pname = "devilutionx";
|
2021-11-04 02:05:53 +00:00
|
|
|
version = "1.3.0";
|
2019-07-19 19:50:45 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "diasurgical";
|
|
|
|
repo = "devilutionX";
|
2021-04-08 08:44:45 +00:00
|
|
|
rev = version;
|
2021-11-04 02:05:53 +00:00
|
|
|
sha256 = "0acrkqi0pr3cbr5i1a1vfrnxv1n3xmql5d86bm2gywvpdb94xads";
|
2019-07-19 19:50:45 +00:00
|
|
|
};
|
|
|
|
|
2021-11-05 20:48:28 +00:00
|
|
|
patches = [
|
|
|
|
# allow building with system SDL2_image instead of vendored version
|
|
|
|
# this patch can be removed on the next release of devilutionx
|
|
|
|
# see https://github.com/diasurgical/devilutionX/pull/3386
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/diasurgical/devilutionX/commit/41ff03e94c02477bffb2d62764e8624c0e06854d.patch";
|
|
|
|
sha256 = "1lrnb9d0dcdyd78rix5rl4p8kkwbnl91llr9fgb86ysm3q58qkvj";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2021-04-08 22:18:46 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace Source/init.cpp --replace "/usr/share/diasurgical/devilutionx/" "${placeholder "out"}/share/diasurgical/devilutionx/"
|
|
|
|
|
2021-11-04 02:05:53 +00:00
|
|
|
# download dependencies ahead of time
|
|
|
|
substituteInPlace 3rdParty/asio/CMakeLists.txt --replace "https://github.com/diasurgical/asio/archive/ebeff99f539da23d27c2e8d4bdbc1ee011968644.tar.gz" "${asio}"
|
|
|
|
substituteInPlace 3rdParty/SDL_audiolib/CMakeLists.txt --replace "https://github.com/realnc/SDL_audiolib/archive/aa79660eba4467a44f9dcaecf26b0f0a000abfd7.tar.gz" "${SDL_audiolib}"
|
|
|
|
substituteInPlace 3rdParty/simpleini/CMakeLists.txt --replace "https://github.com/brofield/simpleini/archive/7bca74f6535a37846162383e52071f380c99a43a.zip" "${simpleini}"
|
|
|
|
'';
|
2019-07-19 19:50:45 +00:00
|
|
|
|
2020-10-25 08:18:42 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DBINARY_RELEASE=ON"
|
2021-04-08 22:18:46 +00:00
|
|
|
"-DVERSION_NUM=${version}"
|
2021-11-04 02:05:53 +00:00
|
|
|
"-DPACKET_ENCRYPTION=OFF" # FIXME: build with libsodium
|
|
|
|
"-DDISABLE_ZERO_TIER=ON" # FIXME: build with libzt
|
2020-10-25 08:18:42 +00:00
|
|
|
];
|
|
|
|
|
2021-11-04 02:05:53 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
2021-11-05 20:48:28 +00:00
|
|
|
pkg-config
|
2021-11-04 02:05:53 +00:00
|
|
|
gettext
|
|
|
|
smpq # used to build devilutionx.mpq
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
fmt
|
|
|
|
libpng
|
2021-11-07 18:15:24 +00:00
|
|
|
SDL2
|
2021-11-05 20:48:28 +00:00
|
|
|
SDL2_image
|
2021-11-04 02:05:53 +00:00
|
|
|
];
|
2019-07-19 19:50:45 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
2019-10-21 00:10:52 +00:00
|
|
|
'' + (if stdenv.isDarwin then ''
|
|
|
|
mkdir -p $out/Applications
|
|
|
|
mv devilutionx.app $out/Applications
|
|
|
|
'' else ''
|
2019-10-31 21:46:24 +00:00
|
|
|
install -Dm755 -t $out/bin devilutionx
|
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
|
2022-03-11 17:23:31 +00:00
|
|
|
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
|
2019-10-21 00:10:52 +00:00
|
|
|
'') + ''
|
2019-07-19 19:50:45 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2019-07-19 19:50:45 +00:00
|
|
|
homepage = "https://github.com/diasurgical/devilutionX";
|
|
|
|
description = "Diablo build for modern operating systems";
|
2019-10-21 00:10:52 +00:00
|
|
|
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.";
|
2019-07-19 19:50:45 +00:00
|
|
|
license = licenses.unlicense;
|
2021-11-04 02:05:53 +00:00
|
|
|
maintainers = with maintainers; [ karolchmist aanderse ];
|
2020-10-25 08:18:42 +00:00
|
|
|
platforms = platforms.linux ++ platforms.windows;
|
2019-07-19 19:50:45 +00:00
|
|
|
};
|
|
|
|
}
|