From dc0c6a92603f64768b765888236d5ca7d88b263d Mon Sep 17 00:00:00 2001 From: John Date: Sun, 3 Feb 2019 16:32:26 +0100 Subject: [PATCH] pioneer: update to 20190203. --- srcpkgs/pioneer-modelcompiler | 1 + srcpkgs/pioneer/files/pioneer.desktop | 10 - srcpkgs/pioneer/patches/4503.patch | 258 -------------------------- srcpkgs/pioneer/patches/cross.patch | 22 +++ srcpkgs/pioneer/patches/musl.patch | 26 +-- srcpkgs/pioneer/template | 33 ++-- 6 files changed, 50 insertions(+), 300 deletions(-) create mode 120000 srcpkgs/pioneer-modelcompiler delete mode 100644 srcpkgs/pioneer/files/pioneer.desktop delete mode 100644 srcpkgs/pioneer/patches/4503.patch create mode 100644 srcpkgs/pioneer/patches/cross.patch diff --git a/srcpkgs/pioneer-modelcompiler b/srcpkgs/pioneer-modelcompiler new file mode 120000 index 00000000000..bdbd34bab03 --- /dev/null +++ b/srcpkgs/pioneer-modelcompiler @@ -0,0 +1 @@ +pioneer \ No newline at end of file diff --git a/srcpkgs/pioneer/files/pioneer.desktop b/srcpkgs/pioneer/files/pioneer.desktop deleted file mode 100644 index 5f3f9f50d9e..00000000000 --- a/srcpkgs/pioneer/files/pioneer.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Name=Pioneer -Comment=Space adventure game set in our galaxy at the turn of the 31st century. -Path=/usr/share/pioneer/ -Exec=pioneer -Icon=pioneer -Terminal=false -Type=Application -Categories=Game;StrategyGame; - diff --git a/srcpkgs/pioneer/patches/4503.patch b/srcpkgs/pioneer/patches/4503.patch deleted file mode 100644 index 7b6d8cd1990..00000000000 --- a/srcpkgs/pioneer/patches/4503.patch +++ /dev/null @@ -1,258 +0,0 @@ -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 src/LuaEngine.cpp src/LuaEngine.cpp -index ebfe2b5eb1..858dcbf75f 100644 ---- src/LuaEngine.cpp -+++ 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 src/Pi.cpp src/Pi.cpp -index db4b6721b4..4066e44e7b 100644 ---- src/Pi.cpp -+++ 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 src/Pi.h src/Pi.h -index e7dfa78877..8924536e4e 100644 ---- src/Pi.h -+++ 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 src/galaxy/Galaxy.cpp src/galaxy/Galaxy.cpp -index d19d615f3b..312fec6ded 100644 ---- src/galaxy/Galaxy.cpp -+++ 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 src/main.cpp src/main.cpp -index 864ae2a737..f59ca02336 100644 ---- src/main.cpp -+++ 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/srcpkgs/pioneer/patches/cross.patch b/srcpkgs/pioneer/patches/cross.patch new file mode 100644 index 00000000000..ec716da96d9 --- /dev/null +++ b/srcpkgs/pioneer/patches/cross.patch @@ -0,0 +1,22 @@ +--- CMakeLists.txt 2019-02-03 11:56:16.000000000 +0100 ++++ - 2019-02-03 19:12:47.221852468 +0100 +@@ -241,11 +241,19 @@ + + # Optimize the models after the modelcompiler is built. + # This really shouldn't be done inside the source tree... ++if(CMAKE_CROSSCOMPILING) ++add_custom_command(TARGET modelcompiler POST_BUILD ++ COMMAND ${CMAKE_COMMAND} -E env SDL_VIDEODRIVER=dummy modelcompiler -b inplace ++ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ++ COMMENT "Optimizing models" VERBATIM ++) ++else() + add_custom_command(TARGET modelcompiler POST_BUILD + COMMAND ${CMAKE_COMMAND} -E env SDL_VIDEODRIVER=dummy $ -b inplace + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + COMMENT "Optimizing models" VERBATIM + ) ++endif() + + install(TARGETS ${PROJECT_NAME} modelcompiler savegamedump + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} diff --git a/srcpkgs/pioneer/patches/musl.patch b/srcpkgs/pioneer/patches/musl.patch index 41c63784223..2341d9cf9fa 100644 --- a/srcpkgs/pioneer/patches/musl.patch +++ b/srcpkgs/pioneer/patches/musl.patch @@ -1,20 +1,20 @@ ---- src/posix/OSPosix.cpp.orig 2017-08-19 20:00:23.645790781 +0200 -+++ src/posix/OSPosix.cpp 2017-08-19 20:00:44.153855997 +0200 +--- src/posix/OSPosix.cpp 2019-02-03 11:56:16.000000000 +0100 ++++ - 2019-02-03 17:32:45.957535773 +0100 @@ -48,7 +48,7 @@ - - void EnableFPE() - { + + void EnableFPE() + { -#if defined(_GNU_SOURCE) && !defined(__APPLE__) +#if defined(_GNU_SOURCE) && !defined(__APPLE__) && defined(__GLIBC__) - // clear any outstanding exceptions before enabling, otherwise they'll - // trip immediately - feclearexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); + // clear any outstanding exceptions before enabling, otherwise they'll + // trip immediately + feclearexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); @@ -58,7 +58,7 @@ - - void DisableFPE() - { + + void DisableFPE() + { -#if defined(_GNU_SOURCE) && !defined(__APPLE__) +#if defined(_GNU_SOURCE) && !defined(__APPLE__) && defined(__GLIBC__) - fedisableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); + fedisableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); #endif - } + } diff --git a/srcpkgs/pioneer/template b/srcpkgs/pioneer/template index c32700b9837..1551eb7d5d3 100644 --- a/srcpkgs/pioneer/template +++ b/srcpkgs/pioneer/template @@ -1,35 +1,30 @@ # Template file for 'pioneer' pkgname=pioneer -version=20181223 +version=20190203 revision=1 -build_style=gnu-configure +build_style=cmake +configure_args="-DPIONEER_DATA_DIR=/usr/share/pioneer + -DUSE_SYSTEM_LIBLUA=ON -DUSE_SYSTEM_LIBGLEW=ON" hostmakedepends="automake pkg-config" makedepends="freetype-devel libassimp-devel libsigc++-devel - libvorbis-devel SDL2_image-devel" + libvorbis-devel SDL2_image-devel glew-devel lua52-devel" depends="pioneer-data>=${version}_${revision}" short_desc="Space adventure game set in our galaxy at the turn of the 31st century" maintainer="John " license="GPL-3.0-or-later" homepage="https://pioneerspacesim.net" distfiles="https://github.com/pioneerspacesim/pioneer/archive/${version}.tar.gz" -checksum=e40cb6a33e519c78c0747638e0503ba7b5a4aadf73a04e33ee5246210b549540 +checksum=e526f1659ae321f45b997c0245acecbf9c4cf2122b025ab8db1090f1b9804f5e -pre_configure() { - export PIONEER_DATA_DIR=/usr/share/pioneer - ./bootstrap -} +if [ "$CROSS_BUILD" ]; then + hostmakedepends+=" pioneer-modelcompiler" +fi -post_install() { - vinstall ${FILESDIR}/pioneer.desktop 644 usr/share/applications - - for icon in application-icon/pngs/* - do - if [[ $icon =~ pioneer-([0-9]+x[0-9]+).png ]]; then - vinstall $icon 644 usr/share/icons/hicolor/${BASH_REMATCH[1]}/apps pioneer.png - fi - done - - vinstall application-icon/badge-enlarged-text.svg 644 usr/share/icons/hicolor/scalable/apps pioneer.svg +pioneer-modelcompiler_package() { + short_desc+=" -modelcompiler" + pkg_install() { + vmove usr/bin/modelcompiler + } } pioneer-data_package() {