about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorAaron Andersen <aaron@fosslib.net>2021-11-05 16:48:28 -0400
committerAaron Andersen <aaron@fosslib.net>2021-11-07 07:50:04 -0500
commit102fe107456266547063657deb02c11550454cf2 (patch)
tree6ef659ef1fe332728092162789853dfbcd185905 /pkgs
parent565d63295200f44948f384e0523336c511b60fb6 (diff)
devilutionx: include patch to compile with system SDL2_image
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/games/devilutionx/default.nix23
1 files changed, 16 insertions, 7 deletions
diff --git a/pkgs/games/devilutionx/default.nix b/pkgs/games/devilutionx/default.nix
index c1ba16bea1d70..04559d6562815 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 = ''