From 9aca55e79d62468ef230350026b41947d0472309 Mon Sep 17 00:00:00 2001 From: Linus Heckemann Date: Fri, 9 Dec 2016 00:02:44 +0000 Subject: [PATCH] endless sky: init at 0.9.4 --- lib/maintainers.nix | 1 + pkgs/games/endless-sky/default.nix | 46 ++++++++++++++++++++++++++++++ pkgs/games/endless-sky/fixes.patch | 45 +++++++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 3 +- 4 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 pkgs/games/endless-sky/default.nix create mode 100644 pkgs/games/endless-sky/fixes.patch diff --git a/lib/maintainers.nix b/lib/maintainers.nix index b56dce798201..8a3584b0b8d0 100644 --- a/lib/maintainers.nix +++ b/lib/maintainers.nix @@ -242,6 +242,7 @@ leonardoce = "Leonardo Cecchi "; lethalman = "Luca Bruno "; lewo = "Antoine Eiche "; + lheckemann = "Linus Heckemann "; lhvwb = "Nathaniel Baxter "; lihop = "Leroy Hopson "; linquize = "Linquize "; diff --git a/pkgs/games/endless-sky/default.nix b/pkgs/games/endless-sky/default.nix new file mode 100644 index 000000000000..f993ad1b8e09 --- /dev/null +++ b/pkgs/games/endless-sky/default.nix @@ -0,0 +1,46 @@ +{ stdenv, fetchFromGitHub +, SDL2, libpng, libjpeg, glew, openal, scons +}: + +let + version = "0.9.4"; + +in +stdenv.mkDerivation rec { + name = "endless-sky-${version}"; + + src = fetchFromGitHub { + owner = "endless-sky"; + repo = "endless-sky"; + rev = "v${version}"; + sha256 = "1mirdcpap0a280j472lhmhqg605b7glvdr4l93qcapk8an8d46m7"; + }; + + enableParallelBuilding = true; + + buildInputs = [ + SDL2 libpng libjpeg glew openal scons + ]; + + patches = [ + ./fixes.patch + ]; + + buildPhase = '' + scons -j$NIX_BUILD_CORES PREFIX="$out" + ''; + + installPhase = '' + scons -j$NIX_BUILD_CORES install PREFIX="$out" + ''; + + meta = with stdenv.lib; { + 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 + ]; + maintainers = with maintainers; [ lheckemann ]; + platforms = with platforms; allBut darwin; + }; +} diff --git a/pkgs/games/endless-sky/fixes.patch b/pkgs/games/endless-sky/fixes.patch new file mode 100644 index 000000000000..cad7a6acaed0 --- /dev/null +++ b/pkgs/games/endless-sky/fixes.patch @@ -0,0 +1,45 @@ +diff --git a/SConstruct b/SConstruct +index 48fd080..419b40d 100644 +--- a/SConstruct ++++ b/SConstruct +@@ -1,7 +1,7 @@ + import os + + # Load any environment variables that alter the build. +-env = Environment() ++env = Environment(ENV = os.environ) + if 'CCFLAGS' in os.environ: + env.Append(CCFLAGS = os.environ['CCFLAGS']) + if 'CXXFLAGS' in os.environ: +@@ -55,7 +55,7 @@ sky = env.Program("endless-sky", Glob("build/" + env["mode"] + "/*.cpp")) + + + # Install the binary: +-env.Install("$DESTDIR$PREFIX/games", sky) ++env.Install("$DESTDIR$PREFIX/bin", sky) + + # 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 +--- 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__ +- // 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/"; +- static const string STANDARD_PATH = "/usr/"; +- static const string RESOURCE_PATH = "share/games/endless-sky/"; +- if(!resources.compare(0, LOCAL_PATH.length(), LOCAL_PATH)) +- 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. diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 910df7d74af7..1aab12d22887 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1550,7 +1550,6 @@ in emscriptenStdenv = stdenv // { mkDerivation = buildEmscriptenPackage; }; - efibootmgr = callPackage ../tools/system/efibootmgr { }; efivar = callPackage ../tools/system/efivar { }; @@ -15662,6 +15661,8 @@ in egoboo = callPackage ../games/egoboo { }; + endless-sky = callPackage ../games/endless-sky { }; + eternity = callPackage ../games/eternity-engine { }; extremetuxracer = callPackage ../games/extremetuxracer {