diff --git a/.gitignore b/.gitignore index 0ca16ba..0992595 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ /pioneer-20170827.tar.gz /pioneer-20171001.tar.gz /pioneer-20180203.tar.gz +/pioneer-20181223.tar.gz diff --git a/pioneer-bug4503.patch b/pioneer-bug4503.patch new file mode 100644 index 0000000..6068082 --- /dev/null +++ b/pioneer-bug4503.patch @@ -0,0 +1,258 @@ +From 1fdea8fe6fd1caf7b37de3e0ad423121b73672e4 Mon Sep 17 00:00:00 2001 +From: Andrew Copland +Date: Wed, 26 Dec 2018 21:58:54 +0000 +Subject: [PATCH] Queue requests in response to UI events, never process them + immediately. + +--- + src/LuaEngine.cpp | 4 +-- + src/Pi.cpp | 57 +++++++++++++++++++++++++++++-------------- + src/Pi.h | 15 +++++++++--- + src/galaxy/Galaxy.cpp | 6 ++--- + src/main.cpp | 1 - + 5 files changed, 54 insertions(+), 29 deletions(-) + +diff --git a/src/LuaEngine.cpp b/src/LuaEngine.cpp +index ebfe2b5eb1..858dcbf75f 100644 +--- a/src/LuaEngine.cpp ++++ b/src/LuaEngine.cpp +@@ -152,9 +152,7 @@ static int l_engine_attr_version(lua_State *l) + */ + static int l_engine_quit(lua_State *l) + { +- if (Pi::game) +- Pi::EndGame(); +- Pi::Quit(); ++ Pi::RequestQuit(); + return 0; + } + +diff --git a/src/Pi.cpp b/src/Pi.cpp +index db4b6721b4..4066e44e7b 100644 +--- a/src/Pi.cpp ++++ b/src/Pi.cpp +@@ -152,7 +152,7 @@ Graphics::RenderTarget *Pi::renderTarget; + RefCountedPtr Pi::renderTexture; + std::unique_ptr Pi::renderQuad; + Graphics::RenderState *Pi::quadRenderState = nullptr; +-bool Pi::bRequestEndGame = false; ++std::vector Pi::internalRequests; + bool Pi::isRecordingVideo = false; + FILE *Pi::ffmpegFile = nullptr; + +@@ -774,6 +774,9 @@ bool Pi::IsConsoleActive() + + void Pi::Quit() + { ++ if (Pi::game) { // always end the game if there is one before quitting ++ Pi::EndGame(); ++ } + if (Pi::ffmpegFile != nullptr) { + _pclose(Pi::ffmpegFile); + } +@@ -837,9 +840,7 @@ void Pi::HandleKeyDown(SDL_Keysym *key) + if (CTRL) { + switch (key->sym) { + case SDLK_q: // Quit +- if (Pi::game) +- Pi::EndGame(); +- Pi::Quit(); ++ Pi::RequestQuit(); + break; + case SDLK_PRINTSCREEN: // print + case SDLK_KP_MULTIPLY: // screen +@@ -1039,9 +1040,7 @@ void Pi::HandleEvents() + Pi::input.mouseMotion[0] = Pi::input.mouseMotion[1] = 0; + while (SDL_PollEvent(&event)) { + if (event.type == SDL_QUIT) { +- if (Pi::game) +- Pi::EndGame(); +- Pi::Quit(); ++ Pi::RequestQuit(); + } + + Pi::pigui->ProcessEvent(&event); +@@ -1095,6 +1094,26 @@ void Pi::HandleEvents() + } + } + ++void Pi::HandleRequests() ++{ ++ for (auto request : internalRequests) ++ { ++ switch (request) ++ { ++ case END_GAME: ++ EndGame(); ++ break; ++ case QUIT_GAME: ++ Quit(); ++ break; ++ default: ++ Output("Pi::HandleRequests, unhandled request type processed.\n"); ++ break; ++ } ++ } ++ internalRequests.clear(); ++} ++ + void Pi::TombStoneLoop() + { + std::unique_ptr tombstone(new Tombstone(Pi::renderer, Graphics::GetScreenWidth(), Graphics::GetScreenHeight())); +@@ -1115,6 +1134,8 @@ void Pi::TombStoneLoop() + Pi::DrawRenderTarget(); + Pi::renderer->SwapBuffers(); + ++ Pi::HandleRequests(); ++ + Pi::frameTime = 0.001f * (SDL_GetTicks() - last_time); + _time += Pi::frameTime; + last_time = SDL_GetTicks(); +@@ -1162,8 +1183,6 @@ void Pi::StartGame() + + void Pi::Start(const SystemPath &startPath) + { +- Pi::bRequestEndGame = false; +- + Pi::intro = new Intro(Pi::renderer, Graphics::GetScreenWidth(), Graphics::GetScreenHeight()); + if (startPath != SystemPath(0, 0, 0, 0, 0)) { + Pi::game = new Game(startPath, 0.0); +@@ -1179,7 +1198,7 @@ void Pi::Start(const SystemPath &startPath) + SDL_Event event; + while (SDL_PollEvent(&event)) { + if (event.type == SDL_QUIT) +- Pi::Quit(); ++ Pi::RequestQuit(); + else { + Pi::pigui->ProcessEvent(&event); + +@@ -1260,6 +1279,8 @@ void Pi::Start(const SystemPath &startPath) + _time += Pi::frameTime; + last_time = SDL_GetTicks(); + ++ Pi::HandleRequests(); ++ + #ifdef ENABLE_SERVER_AGENT + Pi::serverAgent->ProcessResponses(); + #endif +@@ -1276,14 +1297,16 @@ void Pi::Start(const SystemPath &startPath) + // request that the game is ended as soon as safely possible + void Pi::RequestEndGame() + { +- Pi::bRequestEndGame = true; ++ internalRequests.push_back(END_GAME); + } + +-void Pi::EndGame() ++void Pi::RequestQuit() + { +- // always reset this, otherwise we can never play again +- Pi::bRequestEndGame = false; ++ internalRequests.push_back(QUIT_GAME); ++} + ++void Pi::EndGame() ++{ + Pi::SetMouseGrab(false); + + Pi::musicPlayer.Stop(); +@@ -1423,10 +1446,6 @@ void Pi::MainLoop() + Pi::luaConsole->HandleTCPDebugConnections(); + #endif + +- if (Pi::bRequestEndGame) { +- Pi::EndGame(); +- } +- + Pi::renderer->EndFrame(); + + Pi::renderer->ClearDepthBuffer(); +@@ -1510,6 +1529,8 @@ void Pi::MainLoop() + asyncJobQueue->FinishJobs(); + syncJobQueue->FinishJobs(); + ++ HandleRequests(); ++ + #if WITH_DEVKEYS + if (Pi::showDebugInfo && SDL_GetTicks() - last_stats > 1000) { + size_t lua_mem = Lua::manager->GetMemoryUsage(); +diff --git a/src/Pi.h b/src/Pi.h +index e7dfa78877..8924536e4e 100644 +--- a/src/Pi.h ++++ b/src/Pi.h +@@ -65,10 +65,10 @@ class Pi { + static void RequestEndGame(); // request that the game is ended as soon as safely possible + static void EndGame(); + static void Start(const SystemPath &startPath); ++ static void RequestQuit(); + static void MainLoop(); + static void TombStoneLoop(); + static void OnChangeDetailLevel(); +- static void Quit() __attribute((noreturn)); + static float GetFrameTime() { return frameTime; } + static float GetGameTickAlpha() { return gameTickAlpha; } + +@@ -160,10 +160,20 @@ class Pi { + static bool DrawGUI; + + private: ++ // msgs/requests that can be posted which the game processes at the end of a game loop in HandleRequests ++ enum InternalRequests ++ { ++ END_GAME = 0, ++ QUIT_GAME, ++ }; ++ static void Quit() __attribute((noreturn)); + static void HandleKeyDown(SDL_Keysym *key); + static void HandleEvents(); +- // Handler for ESC key press ++ static void HandleRequests(); + static void HandleEscKey(); ++ ++ // private members ++ static std::vector internalRequests; + static const Uint32 SYNC_JOBS_PER_LOOP = 1; + static std::unique_ptr asyncJobQueue; + static std::unique_ptr syncJobQueue; +@@ -193,7 +203,6 @@ class Pi { + static Graphics::RenderState *quadRenderState; + + static bool doingMouseGrab; +- static bool bRequestEndGame; + + static bool isRecordingVideo; + static FILE *ffmpegFile; +diff --git a/src/galaxy/Galaxy.cpp b/src/galaxy/Galaxy.cpp +index d19d615f3b..312fec6ded 100644 +--- a/src/galaxy/Galaxy.cpp ++++ b/src/galaxy/Galaxy.cpp +@@ -113,15 +113,13 @@ DensityMapGalaxy::DensityMapGalaxy(RefCountedPtr galaxyGenerato + { + RefCountedPtr filedata = FileSystem::gameDataFiles.ReadFile(mapfile); + if (!filedata) { +- Output("Galaxy: couldn't load '%s'\n", mapfile.c_str()); +- Pi::Quit(); ++ Error("Galaxy: couldn't load '%s'\n", mapfile.c_str()); + } + + SDL_RWops *datastream = SDL_RWFromConstMem(filedata->GetData(), filedata->GetSize()); + SDL_Surface *galaxyImg = SDL_LoadBMP_RW(datastream, 1); + if (!galaxyImg) { +- Output("Galaxy: couldn't load: %s (%s)\n", mapfile.c_str(), SDL_GetError()); +- Pi::Quit(); ++ Error("Galaxy: couldn't load: %s (%s)\n", mapfile.c_str(), SDL_GetError()); + } + + // now that we have our raw image loaded +diff --git a/src/main.cpp b/src/main.cpp +index 864ae2a737..f59ca02336 100644 +--- a/src/main.cpp ++++ b/src/main.cpp +@@ -197,7 +197,6 @@ int main(int argc, char** argv) + if (filename != "-" && fclose(file) != 0) { + Output("pioneer: writing to \"%s\" failed: %s\n", filename.c_str(), strerror(errno)); + } +- Pi::Quit(); + } + break; + } diff --git a/pioneer-bug4505.patch b/pioneer-bug4505.patch new file mode 100644 index 0000000..f6e8639 --- /dev/null +++ b/pioneer-bug4505.patch @@ -0,0 +1,27 @@ +From d8a0d783b32b066c9d246e009791eddbf2aedbf3 Mon Sep 17 00:00:00 2001 +From: orbea +Date: Fri, 28 Dec 2018 08:21:42 -0800 +Subject: [PATCH] cmake: Test for a .git directory. + +This prevents the following error when git is found and the source +directory is not a git repo. + + fatal: not a git repository (or any parent up to mount point /) + Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set). +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2b91161386..2d00fd1924 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -39,7 +39,7 @@ endif() + + # Get the GIT hash of the latest commit + include(FindGit OPTIONAL) +-if (GIT_FOUND) ++if (GIT_FOUND AND EXISTS ${PROJECT_SOURCE_DIR}/.git) + execute_process( + COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/pioneer-bug4509.patch b/pioneer-bug4509.patch new file mode 100644 index 0000000..7f14662 --- /dev/null +++ b/pioneer-bug4509.patch @@ -0,0 +1,22 @@ +From 882a9bb23c83f0260050f06b2c77626caf449e5a Mon Sep 17 00:00:00 2001 +From: Webster Sheets +Date: Thu, 3 Jan 2019 13:05:49 -0500 +Subject: [PATCH] Use dummy videodriver for modelcompiler. + +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2d00fd1924..1512307f95 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -241,7 +241,7 @@ set_target_properties(${PROJECT_NAME} modelcompiler savegamedump pioneerLib PROP + # Optimize the models after the modelcompiler is built. + # This really shouldn't be done inside the source tree... + add_custom_command(TARGET modelcompiler POST_BUILD +- COMMAND modelcompiler -b inplace ++ COMMAND ${CMAKE_COMMAND} -E env SDL_VIDEODRIVER=dummy $ -b inplace + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + COMMENT "Optimizing models" VERBATIM + ) diff --git a/pioneer-bug4510.patch b/pioneer-bug4510.patch new file mode 100644 index 0000000..8a96cf0 --- /dev/null +++ b/pioneer-bug4510.patch @@ -0,0 +1,62 @@ +From e83b0c04eaafb8314639380b8cf8a85141ca65e8 Mon Sep 17 00:00:00 2001 +From: orbea +Date: Thu, 3 Jan 2019 16:51:05 -0800 +Subject: [PATCH 1/2] Fix modelcompiler crash when opengl.txt doesn't exist. + +This crash is reproduced during the build when ran with sandbox. + +Further fixes https://github.com/pioneerspacesim/pioneer/issues/4506 +--- + src/graphics/Graphics.cpp | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/src/graphics/Graphics.cpp b/src/graphics/Graphics.cpp +index f5d0c345ec..e4958b0f3f 100644 +--- a/src/graphics/Graphics.cpp ++++ b/src/graphics/Graphics.cpp +@@ -102,11 +102,16 @@ Renderer* Init(Settings vs) + renderer->WriteRendererInfo(buf); + + FILE *f = FileSystem::userFiles.OpenWriteStream("opengl.txt", FileSystem::FileSourceFS::WRITE_TEXT); +- if (!f) ++ if (f) ++ { ++ const std::string &s = buf.str(); ++ fwrite(s.c_str(), 1, s.size(), f); ++ fclose(f); ++ } ++ else ++ { + Output("Could not open 'opengl.txt'\n"); +- const std::string &s = buf.str(); +- fwrite(s.c_str(), 1, s.size(), f); +- fclose(f); ++ } + } + + initted = true; + +From b97fe61476f6fd7eb0621dbd660f0020fd32a9fc Mon Sep 17 00:00:00 2001 +From: orbea +Date: Thu, 3 Jan 2019 16:59:50 -0800 +Subject: [PATCH 2/2] cmake: Add missing DESTDIR. + +This will be installed directly to the file system even when DESTDIR +is used. +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1512307f95..0b6b504611 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -250,7 +250,7 @@ install(TARGETS ${PROJECT_NAME} modelcompiler savegamedump + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) + install(DIRECTORY data/ +- DESTINATION ${PIONEER_DATA_DIR} ++ DESTINATION ${DESTDIR}${PIONEER_DATA_DIR} + PATTERN "listdata.*" EXCLUDE + PATTERN "Makefile.am" EXCLUDE + ) diff --git a/pioneer.spec b/pioneer.spec index 288f9a1..8decb9c 100644 --- a/pioneer.spec +++ b/pioneer.spec @@ -1,6 +1,8 @@ # https://github.com/pioneerspacesim/pioneer/issues/3846 ExclusiveArch: %{ix86} x86_64 +%global use_autotools 0 + ## This package uses an own miniz.h file. ## Upstream: taken from http://miniz.googlecode.com/svn/trunk/miniz.c. I've cut this into ## header and implementation files and disabled (via define) some interfaces that @@ -10,20 +12,30 @@ ExclusiveArch: %{ix86} x86_64 Name: pioneer Summary: A game of lonely space adventure -Version: 20180203 -Release: 5%{?dist} +Version: 20181223 +Release: 1%{?dist} ## Main license: GPLv3 ## Dejavu font license: Bitstream Vera and Public Domain ## Pioneer's art, music and other assets (including Lua model scripts): CC-BY-SA License: GPLv3 and CC-BY-SA and Bitstream Vera and Public Domain URL: http://pioneerspacesim.net/ -Source0: https://github.com/pioneerspacesim/pioneer/archive/%{version}.zip#/%{name}-%{version}.tar.gz +Source0: https://github.com/pioneerspacesim/%{name}/archive/%{version}/%{name}-%{version}.tar.gz Source1: %{name}.desktop Source2: %{name}.appdata.xml +# Set of patches from January 2019 changes +Patch0: %{name}-bug4503.patch +Patch1: %{name}-bug4505.patch +Patch2: %{name}-bug4509.patch +Patch3: %{name}-bug4510.patch + +%if 0%{?use_autotools} BuildRequires: autoconf BuildRequires: automake +%else +BuildRequires: cmake +%endif BuildRequires: chrpath BuildRequires: desktop-file-utils BuildRequires: doxygen @@ -36,11 +48,10 @@ BuildRequires: pkgconfig(vorbis) BuildRequires: pkgconfig(sigc++-2.0) BuildRequires: pkgconfig(libcurl) BuildRequires: pkgconfig(SDL2_image) +BuildRequires: pkgconfig(glew) BuildRequires: pkgconfig(freetype2) BuildRequires: pkgconfig(libpng) -#BuildRequires: pkgconfig(lua) BuildRequires: assimp-devel >= 3.2 -#BuildRequires: pkgconfig(gl) BuildRequires: mesa-libGLU-devel BuildRequires: miniz-devel BuildRequires: NaturalDocs @@ -113,11 +124,12 @@ Requires: fontpackages-filesystem PionilliumText22L Medium font file based on Titillium. %prep -%setup -q -n %{name}-%{version} +%autosetup -p1 -n %{name}-%{version} -## Pioneer does not work with Lua 5.3.2 +## Pioneer does not work with Lua 5.3.* ## We cannot unbundle internal Lua yet ## See https://github.com/pioneerspacesim/pioneer/issues/3712 +## https://github.com/mpv-player/mpv/issues/5205 #rm -f contrib/lua/lua.h #rm -f contrib/lua/lauxlib.h #rm -f contrib/lua/lua.hpp @@ -128,22 +140,33 @@ PionilliumText22L Medium font file based on Titillium. sed -e 's|naturaldocs|NaturalDocs|g' -i Makefile.am %build +%if 0%{?use_autotools} ./bootstrap - %configure --disable-silent-rules --with-ccache --without-strip \ --with-version --with-extra-version --without-extra-warnings \ --without-thirdparty --without-external-liblua --with-no-optimise \ PIONEER_DATA_DIR=%{_datadir}/%{name} - %make_build V=1 OPTIMISE="" +%else +mkdir -p build && pushd build +%cmake -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE \ + -DUSE_SYSTEM_LIBLUA:BOOL=OFF -DUSE_SYSTEM_LIBGLEW:BOOL=ON \ + -DPIONEER_DATA_DIR:PATH=%{_datadir}/%{name} .. +%make_build V=1 +popd +%endif ## Build documentation -make codedoc +#make codedoc pushd doxygen doxygen %install +%if 0%{?use_autotools} %make_install +%else +%make_install -C build +%endif ## Remove rpaths chrpath -d %{buildroot}%{_bindir}/%{name} @@ -176,11 +199,13 @@ install -Dpm 644 application-icon/pngs/%{name}-256x256.png %{buildroot}%{_datadi ## Install desktop file mkdir -p %{buildroot}%{_datadir}/applications -desktop-file-install %{SOURCE1} --dir=%{buildroot}%{_datadir}/applications +#desktop-file-install %%{SOURCE1} --dir=%{buildroot}%{_datadir}/applications/ +desktop-file-install metadata/net.pioneerspacesim.Pioneer.desktop --dir=%{buildroot}%{_datadir}/applications/pioneer.desktop ## Install appdata file mkdir -p %{buildroot}%{_datadir}/metainfo -install -pm 644 %{SOURCE2} %{buildroot}%{_metainfodir}/ +#install -pm 644 %%{SOURCE2} %{buildroot}%{_metainfodir}/ +install -pm 644 metadata/net.pioneerspacesim.Pioneer.xml %{buildroot}%{_metainfodir}/pioneer.appdata.xml appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/*.appdata.xml ## Remove empty directories @@ -222,13 +247,15 @@ ln -sf %{_fontbasedir}/dejavu/DejaVuSans.ttf %{buildroot}%{_datadir}/%{name}/fon %{_metainfodir}/*.appdata.xml %files data -%license licenses/GPL-3.txt licenses/*.html licenses/CC-BY-SA-3.0.txt licenses/DejaVu-license.txt +%license licenses/GPL-3.txt licenses/CC-BY-SA-3.0.txt licenses/DejaVu-license.txt +# Image Use Policy - NASA Spitzer Space Telescope +%license licenses/*.html %doc AUTHORS.txt Changelog.txt Quickstart.txt README.md %{_datadir}/%{name}/ %files doc %license licenses/GPL-3.txt -%doc doxygen/html AUTHORS.txt README.md codedoc +%doc doxygen/html AUTHORS.txt README.md %_font_pkg -n inpionata Inpionata.ttf %license licenses/SIL-1.1.txt @@ -243,6 +270,14 @@ ln -sf %{_fontbasedir}/dejavu/DejaVuSans.ttf %{buildroot}%{_datadir}/%{name}/fon %dir %{_fontdir} %changelog +* Fri Jan 04 2019 Antonio Trande - 20181223-1 +- Release 20181223 +- Note about Image Use Policy from NASA Spitzer Space Telescope +- Use Upstream's metadata files + +* Thu Oct 04 2018 Antonio Trande - 20181127-0.1.gitb8e2b81 +- Pre-release 20181127 + * Wed Sep 05 2018 Antonio Trande - 20180203-5 - Use %%_metainfodir - Remove Group tag diff --git a/sources b/sources index f3ea186..8894454 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (pioneer-20180203.tar.gz) = cd339809712ac35d5e3bcaa60126590c3c6ece4339f7ac08de7deea9d88bc79c89e43fcec58ee9e57f172049ef7b74f92fb90c91f0a74979e6cb43003e88ab2c +SHA512 (pioneer-20181223.tar.gz) = 421f80076c4ee9a334c6e856e6c0ac1ef2e8c3c67d62d3c28492a5b9d977116c746aa2d196eea3b4be921c4bef5f9c489b036dac8755c6c1a24c1ef4c05bc7c3