From beed35c41747f033f64cc1d7def4220837140271 Mon Sep 17 00:00:00 2001 From: Aaron Andersen Date: Wed, 3 Nov 2021 22:01:03 -0400 Subject: [PATCH 1/4] StormLib: init at 9.22 --- .../libraries/StormLib/default.nix | 29 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 31 insertions(+) create mode 100644 pkgs/development/libraries/StormLib/default.nix diff --git a/pkgs/development/libraries/StormLib/default.nix b/pkgs/development/libraries/StormLib/default.nix new file mode 100644 index 000000000000..0bf9ba63dc48 --- /dev/null +++ b/pkgs/development/libraries/StormLib/default.nix @@ -0,0 +1,29 @@ +{ lib, stdenv, fetchFromGitHub, cmake, bzip2, libtomcrypt, zlib }: + +stdenv.mkDerivation rec { + pname = "StormLib"; + version = "9.22"; + + src = fetchFromGitHub { + owner = "ladislav-zezula"; + repo = "StormLib"; + rev = "v${version}"; + sha256 = "1rcdl6ryrr8fss5z5qlpl4prrw8xpbcdgajg2hpp0i7fpk21ymcc"; + }; + + cmakeFlags = [ + "-DBUILD_SHARED_LIBS=ON" + "-DWITH_LIBTOMCRYPT=ON" + ]; + + nativeBuildInputs = [ cmake ]; + buildInputs = [ bzip2 libtomcrypt zlib ]; + + meta = with lib; { + homepage = "https://github.com/ladislav-zezula/StormLib"; + license = licenses.mit; + description = "An open-source project that can work with Blizzard MPQ archives"; + platforms = platforms.all; + maintainers = with maintainers; [ aanderse karolchmist ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 68c4ff7a9c35..2f56913716b1 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -19541,6 +19541,8 @@ with pkgs; stb = callPackage ../development/libraries/stb { }; + StormLib = callPackage ../development/libraries/StormLib { }; + stxxl = callPackage ../development/libraries/stxxl { parallel = true; }; sqlite = lowPrio (callPackage ../development/libraries/sqlite { }); From 573849ce89f5fc5b18a8979d4496f09ac031880c Mon Sep 17 00:00:00 2001 From: Aaron Andersen Date: Wed, 3 Nov 2021 22:04:01 -0400 Subject: [PATCH 2/4] smpq: init at 1.6 --- pkgs/applications/misc/smpq/default.nix | 26 +++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 28 insertions(+) create mode 100644 pkgs/applications/misc/smpq/default.nix diff --git a/pkgs/applications/misc/smpq/default.nix b/pkgs/applications/misc/smpq/default.nix new file mode 100644 index 000000000000..02275055c406 --- /dev/null +++ b/pkgs/applications/misc/smpq/default.nix @@ -0,0 +1,26 @@ +{ lib, stdenv, fetchurl, cmake, StormLib }: + +stdenv.mkDerivation { + pname = "smpq"; + version = "1.6"; + + src = fetchurl { + url = "https://launchpad.net/smpq/trunk/1.6/+download/smpq_1.6.orig.tar.gz"; + sha256 = "1jqq5x3b17jy66x3kkf5hs5l322dx2v14djxxrqrnqp8bn5drlmm"; + }; + + cmakeFlags = [ + "-DWITH_KDE=OFF" + ]; + + nativeBuildInputs = [ cmake ]; + buildInputs = [ StormLib ]; + + meta = with lib; { + description = "StormLib MPQ archiving utility"; + homepage = "https://launchpad.net/smpq"; + license = licenses.gpl3Only; + platforms = platforms.all; + maintainers = with maintainers; [ aanderse karolchmist ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2f56913716b1..d59f7399bf8c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9434,6 +9434,8 @@ with pkgs; smu = callPackage ../tools/text/smu { }; + smpq = callPackage ../applications/misc/smpq { }; + sn0int = callPackage ../tools/security/sn0int { }; snabb = callPackage ../tools/networking/snabb { }; From 565d63295200f44948f384e0523336c511b60fb6 Mon Sep 17 00:00:00 2001 From: Aaron Andersen Date: Wed, 3 Nov 2021 22:05:53 -0400 Subject: [PATCH 3/4] devilutionx: 1.2.1 -> 1.3.0 --- pkgs/games/devilutionx/default.nix | 76 ++++++++++++++++++++++++------ 1 file changed, 61 insertions(+), 15 deletions(-) diff --git a/pkgs/games/devilutionx/default.nix b/pkgs/games/devilutionx/default.nix index fa457b1f1bcc..c1ba16bea1d7 100644 --- a/pkgs/games/devilutionx/default.nix +++ b/pkgs/games/devilutionx/default.nix @@ -1,32 +1,78 @@ -{ lib, stdenv, fetchFromGitHub, cmake, SDL2, SDL2_mixer, SDL2_ttf, libsodium, pkg-config }: +{ lib +, stdenv +, fetchFromGitHub +, fetchurl +, fetchzip +, cmake +, gettext +, SDL2 +, fmt +, libpng +, smpq +}: + +let + # TODO: submit a PR upstream to allow system copies of these libraries + 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"; + }; + + SDL_image = fetchurl { + url = "https://github.com/libsdl-org/SDL_image/archive/refs/tags/release-2.0.5.tar.gz"; + sha256 = "1zw3k40kbmwc2w9l8fkzrk8maidapmciw3lgcml86pqs9izzddvn"; + }; + + simpleini = fetchzip { + url = "https://github.com/brofield/simpleini/archive/7bca74f6535a37846162383e52071f380c99a43a.zip"; + sha256 = "07kf1jjbc9v04hsysa6v2wh1m9csf5qz0b1wmlkf9sj00kf47zj7"; + }; +in stdenv.mkDerivation rec { pname = "devilutionx"; - version = "1.2.1"; + version = "1.3.0"; src = fetchFromGitHub { owner = "diasurgical"; repo = "devilutionX"; rev = version; - sha256 = "sha256-PgYlNO1p78d0uiL474bDJOL++SxJfeBLK65czdaylHU="; + sha256 = "0acrkqi0pr3cbr5i1a1vfrnxv1n3xmql5d86bm2gywvpdb94xads"; }; postPatch = '' substituteInPlace Source/init.cpp --replace "/usr/share/diasurgical/devilutionx/" "${placeholder "out"}/share/diasurgical/devilutionx/" - ''; - NIX_CFLAGS_COMPILE = [ - "-I${SDL2_ttf}/include/SDL2" - ''-DTTF_FONT_PATH="${placeholder "out"}/share/fonts/truetype/CharisSILB.ttf"'' - ]; + # 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/SDL_image/CMakeLists.txt --replace "https://github.com/libsdl-org/SDL_image/archive/refs/tags/release-2.0.5.tar.gz" "${SDL_image}" + substituteInPlace 3rdParty/simpleini/CMakeLists.txt --replace "https://github.com/brofield/simpleini/archive/7bca74f6535a37846162383e52071f380c99a43a.zip" "${simpleini}" + ''; cmakeFlags = [ "-DBINARY_RELEASE=ON" "-DVERSION_NUM=${version}" + "-DPACKET_ENCRYPTION=OFF" # FIXME: build with libsodium + "-DDISABLE_ZERO_TIER=ON" # FIXME: build with libzt ]; - nativeBuildInputs = [ pkg-config cmake ]; - buildInputs = [ libsodium SDL2 SDL2_mixer SDL2_ttf ]; + nativeBuildInputs = [ + cmake + gettext + smpq # used to build devilutionx.mpq + ]; + + buildInputs = [ + fmt + libpng + (SDL2.override { withStatic = true; }) + ]; installPhase = '' runHook preInstall @@ -36,10 +82,10 @@ stdenv.mkDerivation rec { mv devilutionx.app $out/Applications '' else '' install -Dm755 -t $out/bin devilutionx - install -Dt $out/share/fonts/truetype ../Packaging/resources/CharisSILB.ttf - install -Dt $out/share/diasurgical/devilutionx ../Packaging/resources/devilutionx.mpq - - # TODO: icons and .desktop (see Packages/{debian,fedora}/*) + 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/devilution.png + install -Dm755 ../Packaging/resources/hellfire.png $out/share/icons/hicolor/512x512/apps/devilution-hellfire.png '') + '' runHook postInstall @@ -50,7 +96,7 @@ stdenv.mkDerivation rec { description = "Diablo build for modern operating systems"; 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; - maintainers = [ maintainers.karolchmist ]; + maintainers = with maintainers; [ karolchmist aanderse ]; platforms = platforms.linux ++ platforms.windows; }; } From 102fe107456266547063657deb02c11550454cf2 Mon Sep 17 00:00:00 2001 From: Aaron Andersen Date: Fri, 5 Nov 2021 16:48:28 -0400 Subject: [PATCH 4/4] devilutionx: include patch to compile with system SDL2_image --- pkgs/games/devilutionx/default.nix | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/pkgs/games/devilutionx/default.nix b/pkgs/games/devilutionx/default.nix index c1ba16bea1d7..04559d656281 100644 --- a/pkgs/games/devilutionx/default.nix +++ b/pkgs/games/devilutionx/default.nix @@ -1,18 +1,21 @@ { lib , stdenv , fetchFromGitHub +, fetchpatch , fetchurl , fetchzip , cmake +, pkg-config , gettext , SDL2 +, SDL2_image , fmt , libpng , smpq }: let - # TODO: submit a PR upstream to allow system copies of these libraries + # TODO: submit a PR upstream to allow system copies of these libraries where possible asio = fetchurl { url = "https://github.com/diasurgical/asio/archive/ebeff99f539da23d27c2e8d4bdbc1ee011968644.tar.gz"; sha256 = "0vhb4cig40mm0a98i74grpmfkcmby8zxg6vqa38dpryxpgvp5fw8"; @@ -23,11 +26,6 @@ let sha256 = "0z4rizncp6gqsy72b3709zc9fr915wgcwnlx1fhhy7mrczsly630"; }; - SDL_image = fetchurl { - url = "https://github.com/libsdl-org/SDL_image/archive/refs/tags/release-2.0.5.tar.gz"; - sha256 = "1zw3k40kbmwc2w9l8fkzrk8maidapmciw3lgcml86pqs9izzddvn"; - }; - simpleini = fetchzip { url = "https://github.com/brofield/simpleini/archive/7bca74f6535a37846162383e52071f380c99a43a.zip"; sha256 = "07kf1jjbc9v04hsysa6v2wh1m9csf5qz0b1wmlkf9sj00kf47zj7"; @@ -45,13 +43,22 @@ stdenv.mkDerivation rec { sha256 = "0acrkqi0pr3cbr5i1a1vfrnxv1n3xmql5d86bm2gywvpdb94xads"; }; + 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"; + }) + ]; + postPatch = '' substituteInPlace Source/init.cpp --replace "/usr/share/diasurgical/devilutionx/" "${placeholder "out"}/share/diasurgical/devilutionx/" # 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/SDL_image/CMakeLists.txt --replace "https://github.com/libsdl-org/SDL_image/archive/refs/tags/release-2.0.5.tar.gz" "${SDL_image}" substituteInPlace 3rdParty/simpleini/CMakeLists.txt --replace "https://github.com/brofield/simpleini/archive/7bca74f6535a37846162383e52071f380c99a43a.zip" "${simpleini}" ''; @@ -64,6 +71,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake + pkg-config gettext smpq # used to build devilutionx.mpq ]; @@ -72,6 +80,7 @@ stdenv.mkDerivation rec { fmt libpng (SDL2.override { withStatic = true; }) + SDL2_image ]; installPhase = ''