package hase (game)

This commit is contained in:
Colin 2023-03-10 22:37:32 +00:00
parent 3ec01ba971
commit f714235717
3 changed files with 181 additions and 0 deletions

View File

@ -203,6 +203,7 @@ let
gimp # broken on phosh
"gnome.gnome-disk-utility"
handbrake
hase
inkscape
kdenlive
kid3 # audio tagging

View File

@ -0,0 +1,178 @@
diff --git a/pkgs/development/libraries/sparrow3d/default.nix b/pkgs/development/libraries/sparrow3d/default.nix
new file mode 100644
index 00000000000..331a02efc5f
--- /dev/null
+++ b/pkgs/development/libraries/sparrow3d/default.nix
@@ -0,0 +1,53 @@
+{ lib
+, fetchFromGitHub
+, pkg-config
+, SDL
+, SDL_image
+, SDL_mixer
+, SDL_net
+, SDL_ttf
+, stdenv
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+ pname = "sparrow3d";
+ version = "2020-10-06";
+
+ src = fetchFromGitHub {
+ owner = "theZiz";
+ repo = "sparrow3d";
+ rev = "2033349d7adeba34bda2c442e1fec22377471134";
+ hash = "sha256-28j5nbTYBrMN8BQ6XrTlO1D8Viw+RiT3MAl99BAbhR4=";
+ };
+
+ nativeBuildInputs = [
+ pkg-config
+ ];
+
+ propagatedBuildInputs = [
+ SDL.dev
+ SDL_image
+ SDL_ttf
+ SDL_mixer
+ SDL_net
+ ];
+
+ postConfigure = ''
+ NIX_CFLAGS_COMPILE=$(pkg-config --cflags SDL_image SDL_ttf SDL_mixer SDL_net)
+ '';
+
+ installPhase = ''
+ mkdir -p $out/{include,lib/pkgconfig}
+ cp sparrow*.h $out/include
+ cp libsparrow{3d,Net,Sound}.so $out/lib
+ substituteAll ${./sparrow3d.pc.in} $out/lib/pkgconfig/sparrow3d.pc
+ '';
+
+ meta = with lib; {
+ description = "a software renderer for different open handhelds like the gp2x, wiz, caanoo and pandora";
+ homepage = "https://github.com/theZiz/sparrow3d";
+ license = licenses.lgpl21;
+ maintainers = with maintainers; [ colinsane ];
+ platforms = [ "x86_64-linux" ];
+ };
+})
diff --git a/pkgs/development/libraries/sparrow3d/sparrow3d.pc.in b/pkgs/development/libraries/sparrow3d/sparrow3d.pc.in
new file mode 100644
index 00000000000..046e174ea97
--- /dev/null
+++ b/pkgs/development/libraries/sparrow3d/sparrow3d.pc.in
@@ -0,0 +1,17 @@
+prefix=@out@
+includedir=${prefix}/include
+libdir=${prefix}/lib
+
+Name: sparrow3d
+Description: a software renderer for different open handhelds like the gp2x, wiz, caanoo and pandora
+URL: https://github.com/theZiz/sparrow3d
+Version: @version@
+Requires: \
+ sdl \
+ SDL_image \
+ SDL_ttf \
+ SDL_mixer \
+ SDL_net
+Cflags: -isystem${includedir}
+Libs: -L${libdir} -lsparrow3d -lsparrowNet -lsparrowSound
+
diff --git a/pkgs/games/hase/default.nix b/pkgs/games/hase/default.nix
new file mode 100644
index 00000000000..794b6d017ae
--- /dev/null
+++ b/pkgs/games/hase/default.nix
@@ -0,0 +1,49 @@
+{ lib
+, fetchFromGitHub
+, pkg-config
+, stdenv
+, sparrow3d
+, zlib
+}:
+
+stdenv.mkDerivation {
+ pname = "hase";
+ version = "2020-10-06";
+
+ src = fetchFromGitHub {
+ owner = "theZiz";
+ repo = "hase";
+ rev = "31d6840cdf0c72fc459f10402dae7726096b2974";
+ hash = "sha256-d9So3E8nCQJ1/BdlwMkGbaFPT9mkX1VzlDGKp71ptEE=";
+ };
+ patches = [ ./prefer-dynamic.patch ];
+
+ nativeBuildInputs = [
+ pkg-config
+ ];
+
+ buildInputs = [
+ sparrow3d
+ zlib
+ ];
+
+ buildPhase = ''
+ NIX_CFLAGS_COMPILE=$(pkg-config --cflags sparrow3d zlib)
+ mkdir -p $out/{bin,share/applications,share/pixmaps}
+ # build and install are one step, and inseparable without patching
+ ./install.sh $out
+ '';
+
+ postFixup = ''
+ substituteInPlace "$out/share/applications/hase.desktop" \
+ --replace "Exec=hase" "Exec=$out/bin/hase"
+ '';
+
+ meta = with lib; {
+ description = "Hase is an open source gravity based artillery shooter. It is similar to Worms, Hedgewars or artillery, but the gravity force and direction depends on the mass nearby. It is optimized for mobile game consoles like the GP2X, Open Pandora or GCW Zero";
+ homepage = "http://ziz.gp2x.de/hase/";
+ license = licenses.gpl3;
+ maintainers = with maintainers; [ colinsane ];
+ platforms = [ "x86_64-linux" ];
+ };
+}
diff --git a/pkgs/games/hase/prefer-dynamic.patch b/pkgs/games/hase/prefer-dynamic.patch
new file mode 100644
index 00000000000..ab36e6b2b3d
--- /dev/null
+++ b/pkgs/games/hase/prefer-dynamic.patch
@@ -0,0 +1,13 @@
+diff --git a/Makefile b/Makefile
+index 95d894e..3c561c1 100644
+--- a/Makefile
++++ b/Makefile
+@@ -35,7 +35,7 @@ endif
+ LIB += -L$(SPARROW_LIB)
+ INCLUDE += -I$(SPARROW_FOLDER)
+
+-HASE_STATIC = $(SPARROW_LIB)/$(SPARROW3D_STATIC_LIB) $(SPARROW_LIB)/$(SPARROWSOUND_STATIC_LIB) $(SPARROW_LIB)/$(SPARROWNET_STATIC_LIB) $(STATIC)
++DYNAMIC += -lsparrow3d -lsparrowSound -lsparrowNet
+
+ ifneq ($(TARGET),win32)
+ DYNAMIC += -lz
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 521b00eb5f5..31052251314 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -23550,6 +23550,8 @@ with pkgs;
spaceship-prompt = callPackage ../shells/zsh/spaceship-prompt {};
+ sparrow3d = callPackage ../development/libraries/sparrow3d {};
+
spdk = callPackage ../development/libraries/spdk { };
speechd = callPackage ../development/libraries/speechd { };
@@ -35570,6 +35572,8 @@ with pkgs;
harmonist = callPackage ../games/harmonist { };
+ hase = callPackage ../games/hase { };
+
hedgewars = libsForQt5.callPackage ../games/hedgewars {
inherit (haskellPackages) ghcWithPackages;
};

View File

@ -43,6 +43,8 @@
hash = "sha256-hx2keVWuokla2Oi92zoXsnjVuwakxL2cB55ctzlO8OQ=";
})
./2023-03-10-hase.patch
# # kaiteki: init at 2022-09-03
# vendorHash changes too frequently (might not be reproducible).
# using local package defn until stabilized