about summary refs log tree commit diff
path: root/pkgs/games/endless-sky
diff options
context:
space:
mode:
authorrian <19516527+360ied@users.noreply.github.com>2023-12-15 12:57:35 +0000
committerGitHub <noreply@github.com>2023-12-15 13:57:35 +0100
commit2960f5366bba81a9a00e3b5892c1956639c9207d (patch)
tree8db4ebcc4efd18c23319bf98e7e723e141e54a0d /pkgs/games/endless-sky
parent9bcc22403c9dba56405e4f524dfcbb285b172f79 (diff)
endless-sky: 0.9.16.1 -> 0.10.4 (#273995)
Diffstat (limited to 'pkgs/games/endless-sky')
-rw-r--r--pkgs/games/endless-sky/default.nix41
-rw-r--r--pkgs/games/endless-sky/fixes.patch39
2 files changed, 62 insertions, 18 deletions
diff --git a/pkgs/games/endless-sky/default.nix b/pkgs/games/endless-sky/default.nix
index ac44390faf564..9a3e86117cef4 100644
--- a/pkgs/games/endless-sky/default.nix
+++ b/pkgs/games/endless-sky/default.nix
@@ -1,22 +1,39 @@
-{ lib, stdenv, fetchFromGitHub
-, SDL2, libpng, libjpeg, glew, openal, scons, libmad, libuuid
+{ lib
+, stdenv
+, fetchFromGitHub
+, SDL2
+, libpng
+, libjpeg
+, glew
+, openal
+, scons
+, libmad
+, libuuid
 }:
 
 stdenv.mkDerivation rec {
   pname = "endless-sky";
-  version = "0.9.16.1";
+  version = "0.10.4";
 
   src = fetchFromGitHub {
     owner = "endless-sky";
     repo = "endless-sky";
     rev = "v${version}";
-    sha256 = "sha256-bohljxAtSVqsfnge6t4LF3pC1s1r99v3hNLKTBquC20=";
+    sha256 = "sha256-VTg8H6umq9yMMP274StIJfEZZvUFDILiMKhioam58QE=";
   };
 
   patches = [
     ./fixes.patch
   ];
 
+  postPatch = ''
+    # the trailing slash is important!!
+    # endless sky naively joins the paths with string concatenation
+    # so it's essential that there be a trailing slash on the resources path
+    substituteInPlace source/Files.cpp \
+      --replace '%NIXPKGS_RESOURCES_PATH%' "$out/share/games/endless-sky/"
+  '';
+
   preBuild = ''
     export AR="${stdenv.cc.targetPrefix}gcc-ar"
   '';
@@ -24,7 +41,14 @@ stdenv.mkDerivation rec {
   enableParallelBuilding = true;
 
   buildInputs = [
-    SDL2 libpng libjpeg glew openal scons libmad libuuid
+    SDL2
+    libpng
+    libjpeg
+    glew
+    openal
+    scons
+    libmad
+    libuuid
   ];
 
   prefixKey = "PREFIX=";
@@ -33,9 +57,12 @@ stdenv.mkDerivation rec {
     description = "A sandbox-style space exploration game similar to Elite, Escape Velocity, or Star Control";
     homepage = "https://endless-sky.github.io/";
     license = with licenses; [
-      gpl3Plus cc-by-sa-30 cc-by-sa-40 publicDomain
+      gpl3Plus
+      cc-by-sa-30
+      cc-by-sa-40
+      publicDomain
     ];
-    maintainers = with maintainers; [ lheckemann ];
+    maintainers = with maintainers; [ lheckemann _360ied ];
     platforms = platforms.linux; # Maybe other non-darwin Unix
   };
 }
diff --git a/pkgs/games/endless-sky/fixes.patch b/pkgs/games/endless-sky/fixes.patch
index 359e2ee4af3b2..b6f330eca4426 100644
--- a/pkgs/games/endless-sky/fixes.patch
+++ b/pkgs/games/endless-sky/fixes.patch
@@ -12,13 +12,19 @@ index 48fd080..419b40d 100644
  # Install the desktop file:
  env.Install("$DESTDIR$PREFIX/share/applications", "endless-sky.desktop")
 diff --git a/source/Files.cpp b/source/Files.cpp
-index c8c8957..d196459 100644
+index de27023e..4225051f 100644
 --- a/source/Files.cpp
 +++ b/source/Files.cpp
-@@ -114,15 +114,9 @@ void Files::Init(const char * const *argv)
- 	if(resources.back() != '/')
- 		resources += '/';
- #if defined __linux__ || defined __FreeBSD__ || defined __DragonFly__
+@@ -108,32 +108,9 @@ void Files::Init(const char * const *argv)
+ 		resources = str;
+ 		SDL_free(str);
+ 	}
+-#if defined _WIN32
+-	FixWindowsSlashes(resources);
+-#endif
+-	if(resources.back() != '/')
+-		resources += '/';
+-#if defined __linux__ || defined __FreeBSD__ || defined __DragonFly__
 -	// Special case, for Linux: the resource files are not in the same place as
 -	// the executable, but are under the same prefix (/usr or /usr/local).
 -	static const string LOCAL_PATH = "/usr/local/";
@@ -28,9 +34,20 @@ index c8c8957..d196459 100644
 -		resources = LOCAL_PATH + RESOURCE_PATH;
 -	else if(!resources.compare(0, STANDARD_PATH.length(), STANDARD_PATH))
 -		resources = STANDARD_PATH + RESOURCE_PATH;
-+	// Workaround for NixOS. Not sure how to proceed with other OSes, feedback
-+	// is welcome.
-+	resources += "../share/games/endless-sky/";
- #elif defined __APPLE__
- 	// Special case for Mac OS X: the resources are in ../Resources relative to
- 	// the folder the binary is in.
+-#endif
+-	// If the resources are not here, search in the directories containing this
+-	// one. This allows, for example, a Mac app that does not actually have the
+-	// resources embedded within it.
+-	while(!Exists(resources + "credits.txt"))
+-	{
+-		size_t pos = resources.rfind('/', resources.length() - 2);
+-		if(pos == string::npos || pos == 0)
+-			throw runtime_error("Unable to find the resource directories!");
+-		resources.erase(pos + 1);
+-	}
++
++	resources = "%NIXPKGS_RESOURCES_PATH%";
++
+ 	dataPath = resources + "data/";
+ 	imagePath = resources + "images/";
+ 	soundPath = resources + "sounds/";