about summary refs log tree commit diff
path: root/pkgs/games/fishfight
diff options
context:
space:
mode:
authorfigsoda <figsoda@pm.me>2021-12-11 23:07:02 -0500
committerfigsoda <figsoda@pm.me>2021-12-12 00:03:13 -0500
commit036201a5198ae5a7d1d190ef1706b178294a62aa (patch)
treee4787d071ad0a7ee593b7917f5d749713738a8c1 /pkgs/games/fishfight
parente09a539ccbb089769644ca3449e6e3dec946fbca (diff)
fishfight: 0.1 -> 0.3
Diffstat (limited to 'pkgs/games/fishfight')
-rw-r--r--pkgs/games/fishfight/default.nix23
-rw-r--r--pkgs/games/fishfight/use-system-sdl2.patch39
2 files changed, 50 insertions, 12 deletions
diff --git a/pkgs/games/fishfight/default.nix b/pkgs/games/fishfight/default.nix
index 420d024d5f671..422901fd98648 100644
--- a/pkgs/games/fishfight/default.nix
+++ b/pkgs/games/fishfight/default.nix
@@ -2,6 +2,7 @@
 , rustPlatform
 , fetchFromGitHub
 , stdenv
+, SDL2
 , alsa-lib
 , libGL
 , libX11
@@ -9,25 +10,28 @@
 , AudioToolbox
 , Cocoa
 , CoreAudio
-, CoreFoundation
-, IOKit
 , OpenGL
 }:
 
 rustPlatform.buildRustPackage rec {
   pname = "fishfight";
-  version = "0.1";
+  version = "0.3";
 
   src = fetchFromGitHub {
     owner = "fishfight";
     repo = pname;
     rev = "v${version}";
-    sha256 = "0mbg9zshyg9hlbsk5npslbnwjf8fh6gxszi5hxks380z080cjxs2";
+    sha256 = "sha256-kLdk7zTICZ8iawNttTsWUVKGvh2zykXVsMqUyYoGrBs=";
   };
 
-  cargoSha256 = "sha256-fZXqJ6a2erAQSgAZRwmkor94eMryjiq3gbY102pJb9Q=";
+  # use system sdl2 instead of bundled sdl2
+  cargoPatches = [ ./use-system-sdl2.patch ];
 
-  buildInputs = lib.optionals stdenv.isLinux [
+  cargoSha256 = "sha256-KQiqUzdsVMIjDmmreihekrrFoXeyNzd6ZbqApwH8B4Q=";
+
+  buildInputs =  [
+    SDL2
+  ] ++ lib.optionals stdenv.isLinux [
     alsa-lib
     libGL
     libX11
@@ -36,15 +40,11 @@ rustPlatform.buildRustPackage rec {
     AudioToolbox
     Cocoa
     CoreAudio
-    CoreFoundation
-    IOKit
     OpenGL
   ];
 
   postPatch = ''
-    substituteInPlace assets/levels/levels.toml --replace assets $out/share/assets
-    substituteInPlace src/gui.rs --replace \"assets \"$out/share/assets
-    substituteInPlace src/main.rs --replace \"assets \"$out/share/assets
+    substituteInPlace src/main.rs --replace ./assets $out/share/assets
   '';
 
   postInstall = ''
@@ -57,6 +57,5 @@ rustPlatform.buildRustPackage rec {
     homepage = "https://fishfight.org/";
     license = with licenses; [ mit /* or */ asl20 ];
     maintainers = with maintainers; [ figsoda ];
-    mainProgram = "fishgame";
   };
 }
diff --git a/pkgs/games/fishfight/use-system-sdl2.patch b/pkgs/games/fishfight/use-system-sdl2.patch
new file mode 100644
index 0000000000000..fcae36ce68b0e
--- /dev/null
+++ b/pkgs/games/fishfight/use-system-sdl2.patch
@@ -0,0 +1,39 @@
+--- a/Cargo.lock
++++ b/Cargo.lock
+@@ -96,15 +96,6 @@ version = "1.0.0"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+ 
+-[[package]]
+-name = "cmake"
+-version = "0.1.46"
+-source = "registry+https://github.com/rust-lang/crates.io-index"
+-checksum = "b7b858541263efe664aead4a5209a4ae5c5d2811167d4ed4ee0944503f8d2089"
+-dependencies = [
+- "cc",
+-]
+-
+ [[package]]
+ name = "color_quant"
+ version = "1.1.0"
+@@ -605,7 +596,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
+ checksum = "94cb479353c0603785c834e2307440d83d196bf255f204f7f6741358de8d6a2f"
+ dependencies = [
+  "cfg-if",
+- "cmake",
+  "libc",
+  "version-compare",
+ ]
+diff --git a/Cargo.toml b/Cargo.toml
+index d2af29e..a813f30 100644
+--- a/Cargo.toml
++++ b/Cargo.toml
+@@ -14,7 +14,7 @@ macroquad-profiler = "0.1"
+ 
+ ff-particles = { version = "0.1", features = ["serde"] }
+ 
+-fishsticks = { version = "0.2.0", features = ["bundled-sdl2"] }
++fishsticks = "0.2.0"
+ 
+ stunclient = { git = "https://github.com/not-fl3/rust-stunclient", default-features = false }
+