From cbf3e1acdd3262da4af52236d7bb9ab4847d776a Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Mon, 4 Apr 2016 21:46:46 +0200 Subject: [PATCH] TSC: fix build (boost-1.61/Mageia patch) --- srcpkgs/TSC/patches/boost-1.60.patch | 468 +++++++++++++++++++++++++++ 1 file changed, 468 insertions(+) create mode 100644 srcpkgs/TSC/patches/boost-1.60.patch diff --git a/srcpkgs/TSC/patches/boost-1.60.patch b/srcpkgs/TSC/patches/boost-1.60.patch new file mode 100644 index 00000000000..f2c685c12e9 --- /dev/null +++ b/srcpkgs/TSC/patches/boost-1.60.patch @@ -0,0 +1,468 @@ +diff -Naur TSC-2.0.0/tsc/src/core/filesystem/boost_relative.cpp TSC-2.0.0-patch/tsc/src/core/filesystem/boost_relative.cpp +--- tsc/src/core/filesystem/boost_relative.cpp 2015-03-31 14:36:44.000000000 +0200 ++++ tsc/src/core/filesystem/boost_relative.cpp 1970-01-01 01:00:00.000000000 +0100 +@@ -1,81 +0,0 @@ +-/*************************************************************************** +- * boost_relative.cpp - Implementation of boost::filesystem::relvative() +- * +- * Copyright © 2013 - 2014 The TSC Contributors +- ***************************************************************************/ +-/* +- This program is free software; you can redistribute it and/or modify +- it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 3 of the License, or +- (at your option) any later version. +- +- You should have received a copy of the GNU General Public License +- along with this program. If not, see . +-*/ +- +-#include "boost_relative.hpp" +- +-namespace boost { +-namespace filesystem { +- +-/** +- * Returns the path you need to walk in order to go from `start_path' to +- * `target_path'. Examples: +- * +- * /foo/bar/baz to /foo/blubb/zubb/xx => ../../blubb/zubb/xx +- * /foo/bar to /foo => .. +- * /foo to /foo/bar => bar +- * /foo/bar to /foo/bar => . +- * +- * Only works with absolute pathes. If relative ones are passed, boost::filesystem::absolute() +- * is called on them previously. +- */ +-boost::filesystem::path relative(boost::filesystem::path start_path, boost::filesystem::path target_path) +-{ +- start_path = boost::filesystem::absolute(start_path); +- target_path = boost::filesystem::absolute(target_path); +- +- if (start_path == target_path) +- return boost::filesystem::path("."); +- +- boost::filesystem::path result; +- boost::filesystem::path::iterator startpath_iter = start_path.begin(); +- boost::filesystem::path::iterator targetpath_iter = target_path.begin(); +- +- while(true) { +- if (targetpath_iter == target_path.end()) { +- /* /foo/bar +- * /foo +- */ +- for(; startpath_iter != start_path.end(); startpath_iter++) { +- result /= ".."; +- } +- break; +- } +- else if (startpath_iter == start_path.end()) { +- /* /foo +- * /foo/bar +- */ +- for(; targetpath_iter != target_path.end(); targetpath_iter++) { +- result /= (*targetpath_iter); +- } +- break; +- } +- else if (*startpath_iter != *targetpath_iter) { +- // Both are inequal at this part, but not terminal +- result /= ".."; +- } +- else { +- // Both are equal at this part of the path (part of common root), skip to next one +- // (ignore) +- } +- +- startpath_iter++; +- targetpath_iter++; +- } +- +- return result; +-} +- +-} +-} +diff -Naur TSC-2.0.0/tsc/src/core/filesystem/boost_relative.hpp TSC-2.0.0-patch/tsc/src/core/filesystem/boost_relative.hpp +--- tsc/src/core/filesystem/boost_relative.hpp 2015-03-31 14:36:44.000000000 +0200 ++++ tsc/src/core/filesystem/boost_relative.hpp 1970-01-01 01:00:00.000000000 +0100 +@@ -1,33 +0,0 @@ +-/*************************************************************************** +- * boost_relative.hpp - Implementation of boost::filesystem::relvative() +- * +- * Copyright © 2013 - 2014 The TSC Contributors +- ***************************************************************************/ +-/* +- This program is free software; you can redistribute it and/or modify +- it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 3 of the License, or +- (at your option) any later version. +- +- You should have received a copy of the GNU General Public License +- along with this program. If not, see . +-*/ +- +-/* +- * This file adds a function make_relative() to boost::filesystem that +- * allows us to create a relative path from a given “root”, i.e. the +- * common parts of both paths are missing in the returned path object. +- */ +- +-#ifndef TSC_BOOST_RELATIVE_HPP +-#define TSC_BOOST_RELATIVE_HPP +-#include +- +-namespace boost { +- +- namespace filesystem { +- /// Find the relative path from start_path to target_path. +- boost::filesystem::path relative(boost::filesystem::path start_path, boost::filesystem::path target_path); +- } +-} +-#endif +diff -Naur TSC-2.0.0/tsc/src/core/filesystem/relative.cpp TSC-2.0.0-patch/tsc/src/core/filesystem/relative.cpp +--- tsc/src/core/filesystem/relative.cpp 1970-01-01 01:00:00.000000000 +0100 ++++ tsc/src/core/filesystem/relative.cpp 2016-01-12 08:31:43.537609273 +0100 +@@ -0,0 +1,89 @@ ++/*************************************************************************** ++ * boost_relative.cpp - Implementation of boost::filesystem::relvative() ++ * ++ * Copyright © 2013 - 2014 The TSC Contributors ++ ***************************************************************************/ ++/* ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . ++*/ ++ ++#include ++#include ++#include "relative.hpp" ++ ++/** ++ * Returns the path you need to walk in order to go from `start_path' to ++ * `target_path'. Examples: ++ * ++ * /foo/bar/baz to /foo/blubb/zubb/xx => ../../blubb/zubb/xx ++ * /foo/bar to /foo => .. ++ * /foo to /foo/bar => bar ++ * /foo/bar to /foo/bar => . ++ * ++ * Only works with absolute pathes. If relative ones are passed, boost::filesystem::absolute() ++ * is called on them previously. ++ * ++ * With boost >= 1.60.0 this function is implemented on top of ++ * boost::filesystem::relative(). With boost versions below that ++ * we provide our own implementation. ++ * ++ * TODO: If boost 1.60.0 becomes common enough among distros, remove ++ * our custom implementation. ++ */ ++boost::filesystem::path TSC::fs_relative(boost::filesystem::path start_path, boost::filesystem::path target_path) ++{ ++#if BOOST_VERSION >= 106000 ++ // Boost 1.60.0 has fs::relative(). Beware inverted argument order. ++ return boost::filesystem::relative(target_path, start_path); ++#else ++ start_path = boost::filesystem::absolute(start_path); ++ target_path = boost::filesystem::absolute(target_path); ++ ++ if (start_path == target_path) ++ return boost::filesystem::path("."); ++ ++ boost::filesystem::path result; ++ boost::filesystem::path::iterator startpath_iter = start_path.begin(); ++ boost::filesystem::path::iterator targetpath_iter = target_path.begin(); ++ ++ while(true) { ++ if (targetpath_iter == target_path.end()) { ++ /* /foo/bar ++ * /foo ++ */ ++ for(; startpath_iter != start_path.end(); startpath_iter++) { ++ result /= ".."; ++ } ++ break; ++ } ++ else if (startpath_iter == start_path.end()) { ++ /* /foo ++ * /foo/bar ++ */ ++ for(; targetpath_iter != target_path.end(); targetpath_iter++) { ++ result /= (*targetpath_iter); ++ } ++ break; ++ } ++ else if (*startpath_iter != *targetpath_iter) { ++ // Both are inequal at this part, but not terminal ++ result /= ".."; ++ } ++ else { ++ // Both are equal at this part of the path (part of common root), skip to next one ++ // (ignore) ++ } ++ ++ startpath_iter++; ++ targetpath_iter++; ++ } ++ ++ return result; ++#endif ++} +diff -Naur TSC-2.0.0/tsc/src/core/filesystem/relative.hpp TSC-2.0.0-patch/tsc/src/core/filesystem/relative.hpp +--- tsc/src/core/filesystem/relative.hpp 1970-01-01 01:00:00.000000000 +0100 ++++ tsc/src/core/filesystem/relative.hpp 2016-01-12 08:31:45.176534981 +0100 +@@ -0,0 +1,34 @@ ++/*************************************************************************** ++ * relative.hpp - Implementation of relative path detector ++ * ++ * Copyright © 2013 - 2014 The TSC Contributors ++ ***************************************************************************/ ++/* ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . ++*/ ++ ++/* ++ * This file adds a function fs_relative() to boost::filesystem that ++ * allows us to create a relative path from a given “root”, i.e. the ++ * common parts of both paths are missing in the returned path object. ++ * ++ * Boost >= 1.60.0 includes such a function, but for the sake of ++ * supporting older versions as well we provide our own version ++ * here. ++ */ ++ ++#ifndef TSC_RELATIVE_HPP ++#define TSC_RELATIVE_HPP ++ ++namespace TSC { ++ ++ /// Find the relative path from start_path to target_path. ++ boost::filesystem::path fs_relative(boost::filesystem::path start_path, boost::filesystem::path target_path); ++} ++#endif +diff -Naur TSC-2.0.0/tsc/src/core/global_basic.hpp TSC-2.0.0-patch/tsc/src/core/global_basic.hpp +--- tsc/src/core/global_basic.hpp 2015-07-16 19:18:42.000000000 +0200 ++++ tsc/src/core/global_basic.hpp 2016-01-12 08:32:15.508164917 +0100 +@@ -75,7 +75,6 @@ + #include + #include + #include +-#include "filesystem/boost_relative.hpp" + + // libxml++ (with its prerequisite glibmm) + #include +diff -Naur TSC-2.0.0/tsc/src/enemies/static.cpp TSC-2.0.0-patch/tsc/src/enemies/static.cpp +--- tsc/src/enemies/static.cpp 2015-07-16 19:18:42.000000000 +0200 ++++ tsc/src/enemies/static.cpp 2016-01-12 08:32:15.512164737 +0100 +@@ -25,11 +25,9 @@ + #include "../objects/path.hpp" + #include "../core/filesystem/filesystem.hpp" + #include "../core/filesystem/resource_manager.hpp" +-#include "../core/filesystem/boost_relative.hpp" ++#include "../core/filesystem/relative.hpp" + #include "../core/xml_attributes.hpp" + +-namespace fs = boost::filesystem; +- + namespace TSC { + + /* *** *** *** *** *** *** cStaticEnemy *** *** *** *** *** *** *** *** *** *** *** */ +@@ -292,7 +290,7 @@ + CEGUI::Editbox* editbox = static_cast(wmgr.createWindow("TaharezLook/Editbox", "editor_static_enemy_image")); + Editor_Add(UTF8_("Image"), UTF8_("Image filename"), editbox, 200); + +- editbox->setText(path_to_utf8(fs::relative(pResource_Manager->Get_Game_Pixmaps_Directory(), m_image->Get_Path())).c_str()); ++ editbox->setText(path_to_utf8(fs_relative(pResource_Manager->Get_Game_Pixmaps_Directory(), m_image->Get_Path())).c_str()); + editbox->subscribeEvent(CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber(&cStaticEnemy::Editor_Image_Text_Changed, this)); + + // rotation speed +diff -Naur TSC-2.0.0/tsc/src/level/level_background.cpp TSC-2.0.0-patch/tsc/src/level/level_background.cpp +--- tsc/src/level/level_background.cpp 2015-07-16 19:18:42.000000000 +0200 ++++ tsc/src/level/level_background.cpp 2016-01-12 08:32:15.509164872 +0100 +@@ -20,7 +20,7 @@ + #include "../video/gl_surface.hpp" + #include "../core/framerate.hpp" + #include "../core/filesystem/resource_manager.hpp" +-#include "../core/filesystem/boost_relative.hpp" ++#include "../core/filesystem/relative.hpp" + #include "../core/xml_attributes.hpp" + + namespace fs = boost::filesystem; +@@ -195,7 +195,7 @@ + + // Make the path relative to pixmaps/ if it isn’t yet + if (m_image_1_filename.is_absolute()) +- m_image_1_filename = fs::relative(pResource_Manager->Get_Game_Pixmaps_Directory(), m_image_1_filename); ++ m_image_1_filename = fs_relative(pResource_Manager->Get_Game_Pixmaps_Directory(), m_image_1_filename); + + m_image_1 = pVideo->Get_Surface(m_image_1_filename); + } +diff -Naur TSC-2.0.0/tsc/src/level/level.cpp TSC-2.0.0-patch/tsc/src/level/level.cpp +--- tsc/src/level/level.cpp 2015-07-16 19:18:42.000000000 +0200 ++++ tsc/src/level/level.cpp 2016-01-12 08:32:15.509164872 +0100 +@@ -56,7 +56,7 @@ + #include "../objects/path.hpp" + #include "../core/filesystem/filesystem.hpp" + #include "../core/filesystem/resource_manager.hpp" +-#include "../core/filesystem/boost_relative.hpp" ++#include "../core/filesystem/relative.hpp" + #include "../overworld/world_editor.hpp" + #include "../scripting/events/key_down_event.hpp" + +@@ -930,7 +930,7 @@ + + fs::path cLevel::Get_Music_Filename() const + { +- return fs::relative(pResource_Manager->Get_Game_Music_Directory(), m_musicfile); ++ return fs_relative(pResource_Manager->Get_Game_Music_Directory(), m_musicfile); + } + + void cLevel::Set_Music(fs::path filename) +diff -Naur TSC-2.0.0/tsc/src/objects/moving_platform.cpp TSC-2.0.0-patch/tsc/src/objects/moving_platform.cpp +--- tsc/src/objects/moving_platform.cpp 2015-07-16 19:18:42.000000000 +0200 ++++ tsc/src/objects/moving_platform.cpp 2016-01-12 08:32:15.510164827 +0100 +@@ -29,7 +29,7 @@ + #include "../objects/path.hpp" + #include "../input/mouse.hpp" + #include "../core/filesystem/resource_manager.hpp" +-#include "../core/filesystem/boost_relative.hpp" ++#include "../core/filesystem/relative.hpp" + #include "../core/xml_attributes.hpp" + + namespace fs = boost::filesystem; +@@ -209,15 +209,15 @@ + + fs::path rel; + // image top left +- rel = fs::relative(pResource_Manager->Get_Game_Pixmaps_Directory(), m_images[0].m_image->Get_Path()); ++ rel = fs_relative(pResource_Manager->Get_Game_Pixmaps_Directory(), m_images[0].m_image->Get_Path()); + Convert_Path_Separators(rel); + Add_Property(p_node, "image_top_left", path_to_utf8(rel)); + // image top middle +- rel = fs::relative(pResource_Manager->Get_Game_Pixmaps_Directory(), m_images[1].m_image->Get_Path()); ++ rel = fs_relative(pResource_Manager->Get_Game_Pixmaps_Directory(), m_images[1].m_image->Get_Path()); + Convert_Path_Separators(rel); + Add_Property(p_node, "image_top_middle", path_to_utf8(rel)); + // image top right +- rel = fs::relative(pResource_Manager->Get_Game_Pixmaps_Directory(), m_images[2].m_image->Get_Path()); ++ rel = fs_relative(pResource_Manager->Get_Game_Pixmaps_Directory(), m_images[2].m_image->Get_Path()); + Convert_Path_Separators(rel); + Add_Property(p_node, "image_top_right", path_to_utf8(rel)); + +@@ -1043,7 +1043,7 @@ + editbox = static_cast(wmgr.createWindow("TaharezLook/Editbox", "editor_moving_platform_image_top_left")); + Editor_Add(UTF8_("Image top left"), UTF8_("Image top left"), editbox, 200); + +- rel = fs::relative(pResource_Manager->Get_Game_Pixmaps_Directory(), m_images[0].m_image->Get_Path()); ++ rel = fs_relative(pResource_Manager->Get_Game_Pixmaps_Directory(), m_images[0].m_image->Get_Path()); + editbox->setText(path_to_utf8(rel)); + editbox->subscribeEvent(CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber(&cMoving_Platform::Editor_Image_Top_Left_Text_Changed, this)); + +@@ -1051,7 +1051,7 @@ + editbox = static_cast(wmgr.createWindow("TaharezLook/Editbox", "editor_moving_platform_image_top_middle")); + Editor_Add(UTF8_("Image top middle"), UTF8_("Image top middle"), editbox, 200); + +- rel = fs::relative(pResource_Manager->Get_Game_Pixmaps_Directory(), m_images[1].m_image->Get_Path()); ++ rel = fs_relative(pResource_Manager->Get_Game_Pixmaps_Directory(), m_images[1].m_image->Get_Path()); + editbox->setText(path_to_utf8(rel)); + editbox->subscribeEvent(CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber(&cMoving_Platform::Editor_Image_Top_Middle_Text_Changed, this)); + +@@ -1059,7 +1059,7 @@ + editbox = static_cast(wmgr.createWindow("TaharezLook/Editbox", "editor_moving_platform_image_top_right")); + Editor_Add(UTF8_("Image top right"), UTF8_("Image top right"), editbox, 200); + +- rel = fs::relative(pResource_Manager->Get_Game_Pixmaps_Directory(), m_images[2].m_image->Get_Path()); ++ rel = fs_relative(pResource_Manager->Get_Game_Pixmaps_Directory(), m_images[2].m_image->Get_Path()); + editbox->setText(path_to_utf8(rel)); + editbox->subscribeEvent(CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber(&cMoving_Platform::Editor_Image_Top_Right_Text_Changed, this)); + +diff -Naur TSC-2.0.0/tsc/src/objects/sprite.cpp TSC-2.0.0-patch/tsc/src/objects/sprite.cpp +--- tsc/src/objects/sprite.cpp 2015-07-16 19:18:42.000000000 +0200 ++++ tsc/src/objects/sprite.cpp 2016-01-12 08:32:15.510164827 +0100 +@@ -28,6 +28,7 @@ + #include "../core/i18n.hpp" + #include "../scripting/events/touch_event.hpp" + #include "../level/level_editor.hpp" ++#include "../core/filesystem/relative.hpp" + #include "../core/filesystem/resource_manager.hpp" + #include "../core/xml_attributes.hpp" + +@@ -462,7 +463,7 @@ + // Only save the relative part of the filename -- otherwise the + // generated levels wouldn’t be portable. + if (img_filename.is_absolute()) +- img_filename = boost::filesystem::relative(pResource_Manager->Get_Game_Pixmaps_Directory(), img_filename); ++ img_filename = fs_relative(pResource_Manager->Get_Game_Pixmaps_Directory(), img_filename); + + Add_Property(p_node, "image", img_filename.generic_string()); + +@@ -1400,7 +1401,7 @@ + CEGUI::Editbox* editbox = static_cast(wmgr.createWindow("TaharezLook/Editbox", "editor_sprite_image")); + Editor_Add(UTF8_("Image"), UTF8_("Image filename"), editbox, 200); + +- fs::path rel = fs::relative(pResource_Manager->Get_Game_Pixmaps_Directory(), m_start_image->Get_Path()); ++ fs::path rel = fs_relative(pResource_Manager->Get_Game_Pixmaps_Directory(), m_start_image->Get_Path()); + editbox->setText(path_to_utf8(rel)); + editbox->subscribeEvent(CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber(&cSprite::Editor_Image_Text_Changed, this)); + +diff -Naur TSC-2.0.0/tsc/src/video/animation.cpp TSC-2.0.0-patch/tsc/src/video/animation.cpp +--- tsc/src/video/animation.cpp 2015-07-16 19:18:42.000000000 +0200 ++++ tsc/src/video/animation.cpp 2016-01-12 08:32:15.511164782 +0100 +@@ -23,7 +23,7 @@ + #include "../core/i18n.hpp" + #include "../core/filesystem/filesystem.hpp" + #include "../core/filesystem/resource_manager.hpp" +-#include "../core/filesystem/boost_relative.hpp" ++#include "../core/filesystem/relative.hpp" + #include "../core/xml_attributes.hpp" + #include "../input/mouse.hpp" + +@@ -1149,7 +1149,7 @@ + // remember the filename for saving + m_image_filename = filename; + if (filename.is_absolute()) +- m_image_filename = boost::filesystem::relative(pResource_Manager->Get_Game_Pixmaps_Directory(), filename); ++ m_image_filename = fs_relative(pResource_Manager->Get_Game_Pixmaps_Directory(), filename); + + // set new image + Set_Image(pVideo->Get_Surface(m_image_filename, 0)); +diff -Naur TSC-2.0.0/tsc/src/video/video.cpp TSC-2.0.0-patch/tsc/src/video/video.cpp +--- tsc/src/video/video.cpp 2015-07-16 19:18:42.000000000 +0200 ++++ tsc/src/video/video.cpp 2016-01-12 08:32:15.511164782 +0100 +@@ -29,6 +29,7 @@ + #include "../core/math/size.hpp" + #include "../core/filesystem/filesystem.hpp" + #include "../core/filesystem/resource_manager.hpp" ++#include "../core/filesystem/relative.hpp" + #include "../gui/spinner.hpp" + + namespace fs = boost::filesystem; +@@ -663,7 +664,7 @@ + for (vector::iterator itr = image_files.begin(); itr != image_files.end(); ++itr) { + // get filenames + fs::path filename = (*itr); +- fs::path cache_filename = imgcache_dir_active / fs::relative(pResource_Manager->Get_Game_Data_Directory(), filename); ++ fs::path cache_filename = imgcache_dir_active / fs_relative(pResource_Manager->Get_Game_Data_Directory(), filename); + + // if directory + if (fs::is_directory(filename)) { +@@ -1011,7 +1012,7 @@ + if (fs::exists(settings_file) && fs::is_regular_file(settings_file)) { + settings = pSettingsParser->Get(settings_file); + +- fs::path img_filename_cache = m_imgcache_dir / fs::relative(pResource_Manager->Get_Game_Data_Directory(), settings_file); // Why add .png here? Should be in the return value of fs::relative() anyway. ++ fs::path img_filename_cache = m_imgcache_dir / fs_relative(pResource_Manager->Get_Game_Data_Directory(), settings_file); // Why add .png here? Should be in the return value of fs_relative() anyway. + // check if image cache file exists + if (fs::exists(img_filename_cache) && fs::is_regular_file(img_filename_cache)) + sdl_surface = IMG_Load(path_to_utf8(img_filename_cache).c_str());