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
|
2022-04-17 04:29:52 +01:00
|
|
|
, bzip2
|
2021-11-04 02:05:53 +00:00
|
|
|
, cmake
|
2021-11-05 20:48:28 +00:00
|
|
|
, pkg-config
|
2021-11-04 02:05:53 +00:00
|
|
|
, gettext
|
2022-04-17 04:29:52 +01:00
|
|
|
, libsodium
|
2021-11-04 02:05:53 +00:00
|
|
|
, SDL2
|
2022-04-17 04:29:52 +01:00
|
|
|
, SDL_audiolib
|
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
|
2022-04-17 04:29:52 +01:00
|
|
|
|
|
|
|
# fork with patches, far behind upstream
|
2021-11-04 02:05:53 +00:00
|
|
|
asio = fetchurl {
|
|
|
|
url = "https://github.com/diasurgical/asio/archive/ebeff99f539da23d27c2e8d4bdbc1ee011968644.tar.gz";
|
|
|
|
sha256 = "0vhb4cig40mm0a98i74grpmfkcmby8zxg6vqa38dpryxpgvp5fw8";
|
|
|
|
};
|
|
|
|
|
2022-04-17 04:29:52 +01:00
|
|
|
# fork with patches, upstream seems to be dead
|
|
|
|
libmpq = fetchurl {
|
|
|
|
url = "https://github.com/diasurgical/libmpq/archive/0f10bd1600f406b13932bf5351ba713361262184.tar.gz";
|
|
|
|
sha256 = "sha256-7hc/Xtsg8WJIJljLydS7hLZA9lEEHWhsCteyrxK68qE=";
|
|
|
|
};
|
|
|
|
|
|
|
|
# not "real" package with pkg-config or cmake file, just collection of source files
|
|
|
|
libsmackerdec = fetchurl {
|
|
|
|
url = "https://github.com/diasurgical/libsmackerdec/archive/2997ee0e41e91bb723003bc09234be553b190e38.tar.gz";
|
|
|
|
sha256 = "sha256-QMDcIZQ94i4VPVanmSxiGkKgxWx82DP4uE+Q5I2nU+o=";
|
|
|
|
};
|
|
|
|
|
|
|
|
# fork with patches, far behind upstream
|
|
|
|
libzt = fetchFromGitHub {
|
|
|
|
owner = "diasurgical";
|
|
|
|
repo = "libzt";
|
|
|
|
fetchSubmodules = true;
|
|
|
|
rev = "a34ba7f1cc2e41b05badd25d1b01fdc5fd2f4e02";
|
|
|
|
sha256 = "sha256-tyIPt+7OTi5W+5X/ixQP1puOKdhrqRZtpwXlWFBFpc8=";
|
2021-11-04 02:05:53 +00:00
|
|
|
};
|
|
|
|
|
2022-04-17 04:29:52 +01:00
|
|
|
# missing pkg-config and/or cmake file
|
|
|
|
simpleini = fetchurl {
|
|
|
|
url = "https://github.com/brofield/simpleini/archive/9b3ed7ec815997bc8c5b9edf140d6bde653e1458.tar.gz";
|
|
|
|
sha256 = "sha256-93kuyp8/ew7okW/6ThJMtLMZsR1YSeFcXu9Y65ELBFE==";
|
2021-11-04 02:05:53 +00:00
|
|
|
};
|
|
|
|
in
|
2021-04-08 23:18:46 +01:00
|
|
|
|
2019-10-21 01:10:52 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2021-04-04 23:45:02 +01:00
|
|
|
pname = "devilutionx";
|
2022-04-17 04:29:52 +01:00
|
|
|
version = "1.4.0";
|
2019-07-19 20:50:45 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "diasurgical";
|
|
|
|
repo = "devilutionX";
|
2021-04-08 09:44:45 +01:00
|
|
|
rev = version;
|
2022-04-17 04:29:52 +01:00
|
|
|
sha256 = "sha256-uuIPTdgGpHA8j1M8b+kfnBuiJ5mdS9rckvEfn2h7lmo=";
|
2019-07-19 20:50:45 +01:00
|
|
|
};
|
|
|
|
|
2021-11-05 20:48:28 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
2022-04-17 04:29:52 +01:00
|
|
|
url = "https://github.com/diasurgical/devilutionX/commit/03b22352fc9e1ecb88b20a053c90c04a50717267.patch";
|
|
|
|
sha256 = "sha256-5aAwi1NV8P+nLLbEEnlwLGNQCQBb0nQkIVe5tR5Shsw=";
|
2021-11-05 20:48:28 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2021-04-08 23:18:46 +01: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
|
2022-04-17 04:29:52 +01:00
|
|
|
substituteInPlace 3rdParty/asio/CMakeLists.txt --replace "${asio.url}" "${asio}"
|
|
|
|
substituteInPlace 3rdParty/libmpq/CMakeLists.txt --replace "${libmpq.url}" "${libmpq}"
|
|
|
|
substituteInPlace 3rdParty/libsmackerdec/CMakeLists.txt --replace "${libsmackerdec.url}" "${libsmackerdec}"
|
|
|
|
substituteInPlace 3rdParty/libzt/CMakeLists.txt \
|
|
|
|
--replace "GIT_REPOSITORY https://github.com/diasurgical/libzt.git" "" \
|
|
|
|
--replace "GIT_TAG ${libzt.rev}" "SOURCE_DIR ${libzt}"
|
|
|
|
substituteInPlace 3rdParty/simpleini/CMakeLists.txt --replace "${simpleini.url}" "${simpleini}"
|
2021-11-04 02:05:53 +00:00
|
|
|
'';
|
2019-07-19 20:50:45 +01:00
|
|
|
|
2020-10-25 08:18:42 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DBINARY_RELEASE=ON"
|
2021-04-08 23:18:46 +01:00
|
|
|
"-DVERSION_NUM=${version}"
|
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 = [
|
2022-04-17 04:29:52 +01:00
|
|
|
bzip2
|
2021-11-04 02:05:53 +00:00
|
|
|
fmt
|
|
|
|
libpng
|
2022-04-17 04:29:52 +01:00
|
|
|
libsodium
|
2021-11-07 18:15:24 +00:00
|
|
|
SDL2
|
2022-04-17 04:29:52 +01:00
|
|
|
SDL_audiolib
|
2021-11-05 20:48:28 +00:00
|
|
|
SDL2_image
|
2021-11-04 02:05:53 +00:00
|
|
|
];
|
2019-07-19 20:50:45 +01:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
2019-10-21 01:10:52 +01: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 01:10:52 +01:00
|
|
|
'') + ''
|
2019-07-19 20:50:45 +01:00
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2019-07-19 20:50:45 +01:00
|
|
|
homepage = "https://github.com/diasurgical/devilutionX";
|
|
|
|
description = "Diablo build for modern operating systems";
|
2019-10-21 01:10:52 +01: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 20:50:45 +01: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 20:50:45 +01:00
|
|
|
};
|
|
|
|
}
|