endless-sky: 0.9.16.1 -> 0.10.4 (#273995)

This commit is contained in:
rian 2023-12-15 12:57:35 +00:00 committed by GitHub
parent 9bcc22403c
commit 2960f5366b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 62 additions and 18 deletions

View File

@ -1,22 +1,39 @@
{ lib, stdenv, fetchFromGitHub { lib
, SDL2, libpng, libjpeg, glew, openal, scons, libmad, libuuid , stdenv
, fetchFromGitHub
, SDL2
, libpng
, libjpeg
, glew
, openal
, scons
, libmad
, libuuid
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "endless-sky"; pname = "endless-sky";
version = "0.9.16.1"; version = "0.10.4";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "endless-sky"; owner = "endless-sky";
repo = "endless-sky"; repo = "endless-sky";
rev = "v${version}"; rev = "v${version}";
sha256 = "sha256-bohljxAtSVqsfnge6t4LF3pC1s1r99v3hNLKTBquC20="; sha256 = "sha256-VTg8H6umq9yMMP274StIJfEZZvUFDILiMKhioam58QE=";
}; };
patches = [ patches = [
./fixes.patch ./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 = '' preBuild = ''
export AR="${stdenv.cc.targetPrefix}gcc-ar" export AR="${stdenv.cc.targetPrefix}gcc-ar"
''; '';
@ -24,7 +41,14 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true; enableParallelBuilding = true;
buildInputs = [ buildInputs = [
SDL2 libpng libjpeg glew openal scons libmad libuuid SDL2
libpng
libjpeg
glew
openal
scons
libmad
libuuid
]; ];
prefixKey = "PREFIX="; prefixKey = "PREFIX=";
@ -33,9 +57,12 @@ stdenv.mkDerivation rec {
description = "A sandbox-style space exploration game similar to Elite, Escape Velocity, or Star Control"; description = "A sandbox-style space exploration game similar to Elite, Escape Velocity, or Star Control";
homepage = "https://endless-sky.github.io/"; homepage = "https://endless-sky.github.io/";
license = with licenses; [ 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 platforms = platforms.linux; # Maybe other non-darwin Unix
}; };
} }

View File

@ -12,13 +12,19 @@ index 48fd080..419b40d 100644
# Install the desktop file: # Install the desktop file:
env.Install("$DESTDIR$PREFIX/share/applications", "endless-sky.desktop") env.Install("$DESTDIR$PREFIX/share/applications", "endless-sky.desktop")
diff --git a/source/Files.cpp b/source/Files.cpp diff --git a/source/Files.cpp b/source/Files.cpp
index c8c8957..d196459 100644 index de27023e..4225051f 100644
--- a/source/Files.cpp --- a/source/Files.cpp
+++ b/source/Files.cpp +++ b/source/Files.cpp
@@ -114,15 +114,9 @@ void Files::Init(const char * const *argv) @@ -108,32 +108,9 @@ void Files::Init(const char * const *argv)
if(resources.back() != '/') resources = str;
resources += '/'; SDL_free(str);
#if defined __linux__ || defined __FreeBSD__ || defined __DragonFly__ }
-#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 - // 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). - // the executable, but are under the same prefix (/usr or /usr/local).
- static const string LOCAL_PATH = "/usr/local/"; - static const string LOCAL_PATH = "/usr/local/";
@ -28,9 +34,20 @@ index c8c8957..d196459 100644
- resources = LOCAL_PATH + RESOURCE_PATH; - resources = LOCAL_PATH + RESOURCE_PATH;
- else if(!resources.compare(0, STANDARD_PATH.length(), STANDARD_PATH)) - else if(!resources.compare(0, STANDARD_PATH.length(), STANDARD_PATH))
- resources = STANDARD_PATH + RESOURCE_PATH; - resources = STANDARD_PATH + RESOURCE_PATH;
+ // Workaround for NixOS. Not sure how to proceed with other OSes, feedback -#endif
+ // is welcome. - // If the resources are not here, search in the directories containing this
+ resources += "../share/games/endless-sky/"; - // one. This allows, for example, a Mac app that does not actually have the
#elif defined __APPLE__ - // resources embedded within it.
// Special case for Mac OS X: the resources are in ../Resources relative to - while(!Exists(resources + "credits.txt"))
// the folder the binary is in. - {
- 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/";