commit a3314167de949ce0b929447f4bc68358646d632c Author: EnumDev Date: Tue Sep 2 20:08:09 2025 +0300 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3e58e5f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Exclude bpm archives +*.bpm \ No newline at end of file diff --git a/check-version.sh b/check-version.sh new file mode 100644 index 0000000..11954cb --- /dev/null +++ b/check-version.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Github repository +REPO="SuperTux/supertux" + +# Get tag name using Github Rest API +TAG_NAME=$(curl -s -L -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/"$REPO"/releases/latest | jq -r '.tag_name') + +# Trim 'v' character in TAG_NAME variable +VERSION=$(echo "$TAG_NAME" | tr -d 'v') + +echo "$VERSION" diff --git a/pkg.info b/pkg.info new file mode 100644 index 0000000..c2cdefe --- /dev/null +++ b/pkg.info @@ -0,0 +1,9 @@ +name: supertux +description: Jump'n'run game with strong inspiration from classic 2D side-scroller games +version: 0.6.3 +url: https://www.supertux.org/ +license: GPL3-or-later,CC-BY-SA-3.0,CC-BY-SA-4.0,CC-BY-3.0 +architecture: any +depends: ["boost","curl",'freetype2',"glew","hicolor-icon-theme","libvorbis","openal","physfs","sdl2-image"] +make_depends: ["cmake","glm","mesa"] +type: source diff --git a/source-files/gcc-12.patch b/source-files/gcc-12.patch new file mode 100644 index 0000000..f5e7392 --- /dev/null +++ b/source-files/gcc-12.patch @@ -0,0 +1,11 @@ +diff -upr SuperTux-v0.6.3-Source.orig/external/partio_zip/zip_manager.cpp SuperTux-v0.6.3-Source/external/partio_zip/zip_manager.cpp +--- SuperTux-v0.6.3-Source.orig/external/partio_zip/zip_manager.cpp 2021-12-23 01:01:58.000000000 +0200 ++++ SuperTux-v0.6.3-Source/external/partio_zip/zip_manager.cpp 2022-06-13 15:20:45.305976668 +0300 +@@ -47,6 +47,7 @@ extern "C"{ + #include + #include + #include ++#include + + #include "zip_manager.hpp" + diff --git a/source-files/gcc-14.patch b/source-files/gcc-14.patch new file mode 100644 index 0000000..149e640 --- /dev/null +++ b/source-files/gcc-14.patch @@ -0,0 +1,12 @@ +diff -ru SuperTux-v0.6.3-Source.orig/external/discord-sdk/thirdparty/rapidjson-1.1.0/include/rapidjson/document.h SuperTux-v0.6.3-Source/external/discord-sdk/thirdparty/rapidjson-1.1.0/include/rapidjson/document.h +--- SuperTux-v0.6.3-Source.orig/external/discord-sdk/thirdparty/rapidjson-1.1.0/include/rapidjson/document.h 2024-08-31 15:37:22.681399878 +0200 ++++ SuperTux-v0.6.3-Source/external/discord-sdk/thirdparty/rapidjson-1.1.0/include/rapidjson/document.h 2024-08-31 15:37:53.831860837 +0200 +@@ -316,8 +316,6 @@ + + GenericStringRef(const GenericStringRef& rhs) : s(rhs.s), length(rhs.length) {} + +- GenericStringRef& operator=(const GenericStringRef& rhs) { s = rhs.s; length = rhs.length; } +- + //! implicit conversion to plain CharType pointer + operator const Ch *() const { return s; } + diff --git a/source-files/no-boost.patch b/source-files/no-boost.patch new file mode 100644 index 0000000..32425e3 --- /dev/null +++ b/source-files/no-boost.patch @@ -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 + #include +-#include ++#include + #include + #include + #include +@@ -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 ++#include + #include + #include + #include +@@ -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. diff --git a/source.sh b/source.sh new file mode 100644 index 0000000..b5d825c --- /dev/null +++ b/source.sh @@ -0,0 +1,42 @@ +# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package +# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE +# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT + +DOWNLOAD="https://github.com/SuperTux/supertux/releases/download/v${BPM_PKG_VERSION}/SuperTux-v${BPM_PKG_VERSION}-Source.tar.gz" +FILENAME="${DOWNLOAD##*/}" + +# The prepare function is executed in the root of the temp directory +# This function is used for downloading files and putting them into the correct location +prepare() { + wget "$DOWNLOAD" + tar -xvf "$FILENAME" --strip-components=1 -C "$BPM_SOURCE" + + cd "$BPM_SOURCE" + sed -i '/cmake_minimum_require/s/[(].*[)]/(VERSION 3.30)/' external/*/CMakeLists.txt + # Fix compiler errors + patch -Np1 -i "$BPM_WORKDIR"/gcc-12.patch + patch -Np1 -i "$BPM_WORKDIR"/gcc-14.patch + # Fix boost library not found errors + patch -Np1 -i "$BPM_WORKDIR"/no-boost.patch +} + +# The build function is executed in the source directory +# This function is used to compile the source code +build() { + mkdir build + cd build + + cmake -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_DISCORD=ON -DINSTALL_SUBDIR_BIN=bin -DCMAKE_POLICY_VERSION_MINIMUM=3.5 .. + cmake --build . +} + +# The package function is executed in the source directory +# This function is used to move the compiled files into the output directory +package() { + cd build + + DESTDIR="$BPM_OUTPUT" cmake --install . + + # Install package license + install -Dm644 "$BPM_SOURCE"/LICENSE.txt "$BPM_OUTPUT"/usr/share/licenses/supertux/LICENSE.txt +}