supertux2: for boost-1.89

This commit is contained in:
Đoàn Trần Công Danh 2025-08-30 16:16:36 +07:00
parent 6b00be11e3
commit 2f21d5e3d1
2 changed files with 139 additions and 3 deletions

View file

@ -0,0 +1,136 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,7 +46,7 @@ if(COMMAND cmake_policy)
cmake_policy(SET CMP0023 NEW)
endif(COMMAND cmake_policy)
-set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
@@ -171,7 +171,7 @@ if(ENABLE_BOOST_STATIC_LIBS)
else(ENABLE_BOOST_STATIC_LIBS)
set(Boost_USE_STATIC_LIBS FALSE)
endif(ENABLE_BOOST_STATIC_LIBS)
-find_package(Boost REQUIRED COMPONENTS filesystem system date_time locale)
+find_package(Boost REQUIRED)
include_directories(SYSTEM ${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIRS})
@@ -927,7 +927,7 @@ if(WIN32)
else()
add_executable(supertux2 src/main.cpp)
endif(WIN32)
-target_link_libraries(supertux2 supertux2_lib Boost::filesystem Boost::locale)
+target_link_libraries(supertux2 supertux2_lib)
set_target_properties(supertux2_lib PROPERTIES OUTPUT_NAME supertux2_lib)
set_target_properties(supertux2_lib PROPERTIES COMPILE_FLAGS "${SUPERTUX2_EXTRA_WARNING_FLAGS}")
--- a/src/supertux/main.cpp
+++ b/src/supertux/main.cpp
@@ -22,7 +22,7 @@
#include <SDL_image.h>
#include <SDL_ttf.h>
-#include <boost/filesystem.hpp>
+#include <filesystem>
#include <boost/locale.hpp>
#include <physfs.h>
#include <tinygettext/log.hpp>
@@ -208,7 +208,7 @@ void PhysfsSubsystem::find_datadir() con
{
datadir = BUILD_DATA_DIR;
// Add config dir for supplemental files
- PHYSFS_mount(boost::filesystem::canonical(BUILD_CONFIG_DATA_DIR).string().c_str(), nullptr, 1);
+ PHYSFS_mount(std::filesystem::canonical(BUILD_CONFIG_DATA_DIR).string().c_str(), nullptr, 1);
}
else
{
@@ -219,7 +219,7 @@ void PhysfsSubsystem::find_datadir() con
}
}
- if (!PHYSFS_mount(boost::filesystem::canonical(datadir).string().c_str(), nullptr, 1))
+ if (!PHYSFS_mount(std::filesystem::canonical(datadir).string().c_str(), nullptr, 1))
{
log_warning << "Couldn't add '" << datadir << "' to physfs searchpath: " << PHYSFS_getLastErrorCode() << std::endl;
}
@@ -263,20 +263,20 @@ std::string olduserdir = FileSystem::joi
std::string olduserdir = FileSystem::join(physfs_userdir, "." PACKAGE_NAME);
#endif
if (FileSystem::is_directory(olduserdir)) {
- boost::filesystem::path olduserpath(olduserdir);
- boost::filesystem::path userpath(userdir);
+ std::filesystem::path olduserpath(olduserdir);
+ std::filesystem::path userpath(userdir);
- boost::filesystem::directory_iterator end_itr;
+ std::filesystem::directory_iterator end_itr;
bool success = true;
// cycle through the directory
- for (boost::filesystem::directory_iterator itr(olduserpath); itr != end_itr; ++itr) {
+ for (std::filesystem::directory_iterator itr(olduserpath); itr != end_itr; ++itr) {
try
{
- boost::filesystem::rename(itr->path().string().c_str(), userpath / itr->path().filename());
+ std::filesystem::rename(itr->path().string().c_str(), userpath / itr->path().filename());
}
- catch (const boost::filesystem::filesystem_error& err)
+ catch (const std::filesystem::filesystem_error& err)
{
success = false;
log_warning << "Failed to move contents of config directory: " << err.what() << std::endl;
@@ -285,9 +285,9 @@ if (FileSystem::is_directory(olduserdir)
if (success) {
try
{
- boost::filesystem::remove_all(olduserpath);
+ std::filesystem::remove_all(olduserpath);
}
- catch (const boost::filesystem::filesystem_error& err)
+ catch (const std::filesystem::filesystem_error& err)
{
success = false;
log_warning << "Failed to remove old config directory: " << err.what();
@@ -610,8 +610,8 @@ Main::run(int argc, char** argv)
try
{
std::locale::global(boost::locale::generator().generate(""));
- // Make boost.filesystem use it
- boost::filesystem::path::imbue(std::locale());
+ // Make std.filesystem use it
+ std::filesystem::path::imbue(std::locale());
}
catch(const std::runtime_error& err)
{
--- a/src/util/file_system.cpp
+++ b/src/util/file_system.cpp
@@ -16,7 +16,7 @@
#include "util/file_system.hpp"
-#include <boost/filesystem.hpp>
+#include <filesystem>
#include <boost/version.hpp>
#include <sstream>
#include <stdexcept>
@@ -38,14 +38,14 @@
#include "util/log.hpp"
#include "util/string_util.hpp"
-namespace fs = boost::filesystem;
+namespace fs = std::filesystem;
namespace FileSystem {
bool exists(const std::string& path)
{
fs::path location(path);
- boost::system::error_code ec;
+ std::error_code ec;
// If we get an error (such as "Permission denied"), then ignore it
// and pretend that the path doesn't exist.

View file

@ -1,7 +1,7 @@
# Template file for 'supertux2'
pkgname=supertux2
version=0.6.3
revision=6
revision=7
build_style=cmake
configure_args="
-DAPPDATADIR=/usr/share/supertux2
@ -10,8 +10,8 @@ configure_args="
-DWERROR=OFF"
make_cmd=make
hostmakedepends="pkg-config"
makedepends="SDL2_image-devel boost-devel-minimal libboost_filesystem
libboost_locale libboost_date_time glew-devel libcurl-devel
makedepends="SDL2_image-devel boost-devel-minimal
glew-devel libcurl-devel
libopenal-devel libraqm-devel physfs-devel glm"
short_desc="Side-scrolling platform game, milestone 2"
maintainer="beefcurtains <beefcurtains@voidlinux.org>"