From 1031d6d2f7f6ceda8646b3fc58e7f1c062c53810 Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Mon, 27 Mar 2023 11:50:41 +0200 Subject: [PATCH] vcmi: update to 1.1.1, switch to boost 1.70 workaround Haiku bug with SO_SNDBUF and SO_RCVBUF sockopts --- .../vcmi/patches/vcmi-1.1.0.patchset | 166 ------------------ .../vcmi/patches/vcmi-1.1.1.patchset | 125 +++++++++++++ .../{vcmi-1.1.0.recipe => vcmi-1.1.1.recipe} | 38 ++-- 3 files changed, 144 insertions(+), 185 deletions(-) delete mode 100644 games-strategy/vcmi/patches/vcmi-1.1.0.patchset create mode 100644 games-strategy/vcmi/patches/vcmi-1.1.1.patchset rename games-strategy/vcmi/{vcmi-1.1.0.recipe => vcmi-1.1.1.recipe} (76%) diff --git a/games-strategy/vcmi/patches/vcmi-1.1.0.patchset b/games-strategy/vcmi/patches/vcmi-1.1.0.patchset deleted file mode 100644 index 9bbb73c31..000000000 --- a/games-strategy/vcmi/patches/vcmi-1.1.0.patchset +++ /dev/null @@ -1,166 +0,0 @@ -From dcbeefe5844a008645e202c316b2c35613257521 Mon Sep 17 00:00:00 2001 -From: PulkoMandy -Date: Fri, 13 Jan 2023 20:18:05 +0100 -Subject: Import patches from vcmi 0.99 - - -diff --git a/Global.h b/Global.h -index 0270d69..8d6a802 100644 ---- a/Global.h -+++ b/Global.h -@@ -50,7 +50,7 @@ static_assert(sizeof(bool) == 1, "Bool needs to be 1 byte in size."); - # define VCMI_WINDOWS_32 - #elif defined(_WIN32_WCE) - # error "Windows CE isn't supported" --#elif defined(__linux__) || defined(__gnu_linux__) || defined(linux) || defined(__linux) -+#elif defined(__linux__) || defined(__gnu_linux__) || defined(linux) || defined(__linux) || defined(__HAIKU__) - # define VCMI_UNIX - # define VCMI_XDG - # ifdef __ANDROID__ -diff --git a/lib/CThreadHelper.cpp b/lib/CThreadHelper.cpp -index 94ab6d5..01602b6 100644 ---- a/lib/CThreadHelper.cpp -+++ b/lib/CThreadHelper.cpp -@@ -14,6 +14,8 @@ - #include - #elif !defined(VCMI_APPLE) && !defined(VCMI_FREEBSD) && !defined(VCMI_HURD) - #include -+#elif defined(__HAIKU__) -+ #include - #endif - - VCMI_LIB_NAMESPACE_BEGIN -@@ -88,6 +90,8 @@ void setThreadName(const std::string &name) - prctl(PR_SET_NAME, name.c_str(), 0, 0, 0); - #elif defined(VCMI_APPLE) - pthread_setname_np(name.c_str()); -+#elif defined(__HAIKU__) -+ rename_thread(find_thread(NULL), name.c_str()); - #endif - } - -diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt -index 0f03131..82aebe3 100644 ---- a/server/CMakeLists.txt -+++ b/server/CMakeLists.txt -@@ -47,6 +47,10 @@ if(WIN32) - ) - endif() - -+if(HAIKU) -+ target_link_libraries(vcmiserver network) -+endif() -+ - vcmi_set_output_dir(vcmiserver "") - enable_pch(vcmiserver) - -diff --git a/server/CVCMIServer.cpp b/server/CVCMIServer.cpp -index 63bd636..5ab20c9 100644 ---- a/server/CVCMIServer.cpp -+++ b/server/CVCMIServer.cpp -@@ -958,7 +958,7 @@ ui8 CVCMIServer::getIdOfFirstUnallocatedPlayer() const - return 0; - } - --#if defined(__GNUC__) && !defined(__MINGW32__) && !defined(VCMI_ANDROID) && !defined(VCMI_IOS) -+#if defined(__GNUC__) && !defined(__MINGW32__) && !defined(VCMI_ANDROID) && !defined(VCMI_IOS) && !defined(__HAIKU__) - void handleLinuxSignal(int sig) - { - const int STACKTRACE_SIZE = 100; -@@ -1053,7 +1053,7 @@ int main(int argc, char * argv[]) - #endif - // Installs a sig sev segmentation violation handler - // to log stacktrace --#if defined(__GNUC__) && !defined(__MINGW32__) && !defined(VCMI_ANDROID) && !defined(VCMI_IOS) -+#if defined(__GNUC__) && !defined(__MINGW32__) && !defined(VCMI_ANDROID) && !defined(VCMI_IOS) && !defined(__HAIKU__) - signal(SIGSEGV, handleLinuxSignal); - #endif - -diff --git a/vcmibuilder b/vcmibuilder -index 08b78ab..b29dadd 100755 ---- a/vcmibuilder -+++ b/vcmibuilder -@@ -52,7 +52,7 @@ then - echo " --convertMP3 " "Convert all mp3 files into ogg/vorbis" - echo " " "Requires ffmpeg or avconv" - echo -- echo " --dest DIRECTORY " "Path where resulting data will be placed. Default is ~/.local/share/vcmi" -+ echo " --dest DIRECTORY " "Path where resulting data will be placed. Default is `finddir B_USER_NONPACKAGED_DATA_DIRECTORY`/vcmi" - echo - echo " --validate " "Run basic validness checks" - exit 0 -@@ -153,7 +153,7 @@ if [[ -z "$dest_dir" ]] - then - if [[ -z "$XDG_DATA_HOME" ]] - then -- dest_dir="$HOME/.local/share/vcmi" -+ dest_dir="`finddir B_USER_NONPACKAGED_DATA_DIRECTORY`/vcmi" - else - dest_dir="$XDG_DATA_HOME/vcmi" - fi --- -2.37.3 - - -From e174985316cc1d3fbe7ce7d71c17d2832106f1b0 Mon Sep 17 00:00:00 2001 -From: PulkoMandy -Date: Fri, 13 Jan 2023 20:58:08 +0100 -Subject: Fix linking of libnetwork in server - - -diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt -index 82aebe3..b5770cb 100644 ---- a/server/CMakeLists.txt -+++ b/server/CMakeLists.txt -@@ -33,6 +33,10 @@ endif() - if(CMAKE_SYSTEM_NAME MATCHES FreeBSD) - set(server_LIBS execinfo ${server_LIBS}) - endif() -+if(HAIKU) -+ set(server_LIBS network ${server_LIBS}) -+endif() -+ - target_link_libraries(vcmiserver PRIVATE ${server_LIBS} minizip::minizip) - - target_include_directories(vcmiserver -@@ -47,10 +51,6 @@ if(WIN32) - ) - endif() - --if(HAIKU) -- target_link_libraries(vcmiserver network) --endif() -- - vcmi_set_output_dir(vcmiserver "") - enable_pch(vcmiserver) - --- -2.37.3 - - -From 5ed623f4a0ccde176688a5799d4cf09f210d24b2 Mon Sep 17 00:00:00 2001 -From: PulkoMandy -Date: Fri, 13 Jan 2023 22:44:50 +0100 -Subject: Fix Haiku patch - - -diff --git a/lib/CThreadHelper.cpp b/lib/CThreadHelper.cpp -index 01602b6..e96220b 100644 ---- a/lib/CThreadHelper.cpp -+++ b/lib/CThreadHelper.cpp -@@ -12,10 +12,10 @@ - - #ifdef VCMI_WINDOWS - #include --#elif !defined(VCMI_APPLE) && !defined(VCMI_FREEBSD) && !defined(VCMI_HURD) -- #include - #elif defined(__HAIKU__) - #include -+#elif !defined(VCMI_APPLE) && !defined(VCMI_FREEBSD) && !defined(VCMI_HURD) -+ #include - #endif - - VCMI_LIB_NAMESPACE_BEGIN --- -2.37.3 - diff --git a/games-strategy/vcmi/patches/vcmi-1.1.1.patchset b/games-strategy/vcmi/patches/vcmi-1.1.1.patchset new file mode 100644 index 000000000..3717cff87 --- /dev/null +++ b/games-strategy/vcmi/patches/vcmi-1.1.1.patchset @@ -0,0 +1,125 @@ +From b4de628a7f050a0ef59883729c54d4fb604acbd7 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Sun, 26 Mar 2023 18:42:08 +0200 +Subject: Haiku patch + + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f736ce6..48e476a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -267,6 +267,9 @@ if(NOT WIN32 AND NOT APPLE_IOS) + if(HAVE_RT_LIB) + set(SYSTEM_LIBS ${SYSTEM_LIBS} rt) + endif() ++ if(HAIKU) ++ set(SYSTEM_LIBS ${SYSTEM_LIBS} network) ++ endif() + endif() + + if(ENABLE_LUA) +diff --git a/Global.h b/Global.h +index 0270d69..6f02b05 100644 +--- a/Global.h ++++ b/Global.h +@@ -60,6 +60,10 @@ static_assert(sizeof(bool) == 1, "Bool needs to be 1 byte in size."); + # define VCMI_UNIX + # define VCMI_XDG + # define VCMI_FREEBSD ++#elif defined(__HAIKU__) ++# define VCMI_UNIX ++# define VCMI_XDG ++# define VCMI_HAIKU + #elif defined(__GNU__) || defined(__gnu_hurd__) || (defined(__MACH__) && !defined(__APPLE__)) + # define VCMI_UNIX + # define VCMI_XDG +diff --git a/lib/CThreadHelper.cpp b/lib/CThreadHelper.cpp +index 94ab6d5..7b01ad7 100644 +--- a/lib/CThreadHelper.cpp ++++ b/lib/CThreadHelper.cpp +@@ -12,6 +12,8 @@ + + #ifdef VCMI_WINDOWS + #include ++#elif defined(VCMI_HAIKU) ++ #include + #elif !defined(VCMI_APPLE) && !defined(VCMI_FREEBSD) && !defined(VCMI_HURD) + #include + #endif +@@ -88,6 +90,8 @@ void setThreadName(const std::string &name) + prctl(PR_SET_NAME, name.c_str(), 0, 0, 0); + #elif defined(VCMI_APPLE) + pthread_setname_np(name.c_str()); ++#elif defined(VCMI_HAIKU) ++ rename_thread(find_thread(NULL), name.c_str()); + #endif + } + +diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt +index 0f03131..21c3692 100644 +--- a/server/CMakeLists.txt ++++ b/server/CMakeLists.txt +@@ -30,7 +30,7 @@ else() + set(server_LIBS vcmi) + endif() + +-if(CMAKE_SYSTEM_NAME MATCHES FreeBSD) ++if(CMAKE_SYSTEM_NAME MATCHES FreeBSD OR HAIKU) + set(server_LIBS execinfo ${server_LIBS}) + endif() + target_link_libraries(vcmiserver PRIVATE ${server_LIBS} minizip::minizip) +diff --git a/vcmibuilder b/vcmibuilder +index 6d3555e..f2c1b7d 100755 +--- a/vcmibuilder ++++ b/vcmibuilder +@@ -52,7 +52,7 @@ then + echo " --convertMP3 " "Convert all mp3 files into ogg/vorbis" + echo " " "Requires ffmpeg or avconv" + echo +- echo " --dest DIRECTORY " "Path where resulting data will be placed. Default is ~/.local/share/vcmi" ++ echo " --dest DIRECTORY " "Path where resulting data will be placed. Default is `finddir B_USER_NONPACKAGED_DATA_DIRECTORY`/vcmi" + echo + echo " --validate " "Run basic validness checks" + exit 0 +@@ -158,7 +158,7 @@ if [[ -z "$dest_dir" ]] + then + if [[ -z "$XDG_DATA_HOME" ]] + then +- dest_dir="$HOME/.local/share/vcmi" ++ dest_dir="`finddir B_USER_NONPACKAGED_DATA_DIRECTORY`/vcmi" + else + dest_dir="$XDG_DATA_HOME/vcmi" + fi +-- +2.37.3 + + +From 795e59f238f72759c658ceaca27348918c2557d3 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Sun, 26 Mar 2023 18:42:08 +0200 +Subject: Haiku: setting send/receive buffer size is buggy + + +diff --git a/lib/serializer/Connection.cpp b/lib/serializer/Connection.cpp +index f84b0c9..a01902d 100644 +--- a/lib/serializer/Connection.cpp ++++ b/lib/serializer/Connection.cpp +@@ -44,6 +44,7 @@ void CConnection::init() + connectionBuffers = std::make_unique(); + + socket->set_option(boost::asio::ip::tcp::no_delay(true)); ++#ifndef __HAIKU__ + try + { + socket->set_option(boost::asio::socket_base::send_buffer_size(4194304)); +@@ -53,6 +54,7 @@ void CConnection::init() + { + logNetwork->error("error setting socket option: %s", e.what()); + } ++#endif + + enableSmartPointerSerialization(); + disableStackSendingByID(); +-- +2.37.3 + diff --git a/games-strategy/vcmi/vcmi-1.1.0.recipe b/games-strategy/vcmi/vcmi-1.1.1.recipe similarity index 76% rename from games-strategy/vcmi/vcmi-1.1.0.recipe rename to games-strategy/vcmi/vcmi-1.1.1.recipe index 5ccdb47ac..4f4a9afeb 100644 --- a/games-strategy/vcmi/vcmi-1.1.0.recipe +++ b/games-strategy/vcmi/vcmi-1.1.1.recipe @@ -8,12 +8,12 @@ You'll require the original game files to use this port." HOMEPAGE="https://vcmi.eu" COPYRIGHT="2005-2017 VCMI Team" LICENSE="GNU GPL v2" -REVISION="6" +REVISION="1" SOURCE_URI="https://github.com/vcmi/vcmi/archive/$portVersion.tar.gz" -CHECKSUM_SHA256="39db3ac7a2d1e386be1982957c0746e4e47f0d6a57268a57e65df9c95c967474" +CHECKSUM_SHA256="41cf343e45a3c1f4ddf95e97697c25e68e40b93f681c0b9d631b3c9d1608a49b" PATCHES="vcmi-$portVersion.patchset" -ARCHITECTURES="all !x86_gcc2 ?x86" +ARCHITECTURES="all !x86_gcc2" SECONDARY_ARCHITECTURES="?x86" PROVIDES=" @@ -23,20 +23,20 @@ PROVIDES=" cmd:vcmieditor cmd:vcmilauncher cmd:vcmiserver - devel:libfuzzylite_static$secondaryArchSuffix - lib:libminizip$secondaryArchSuffix lib:libvcmi$secondaryArchSuffix " REQUIRES=" haiku$secondaryArchSuffix cmd:innoextract lib:libavcodec$secondaryArchSuffix - lib:libboost_date_time$secondaryArchSuffix >= 1.69.0 - lib:libboost_filesystem$secondaryArchSuffix >= 1.69.0 + lib:libboost_date_time$secondaryArchSuffix + lib:libboost_filesystem$secondaryArchSuffix lib:libboost_program_options$secondaryArchSuffix lib:libboost_system$secondaryArchSuffix lib:libboost_thread$secondaryArchSuffix + lib:libexecinfo$secondaryArchSuffix lib:libfuzzylite$secondaryArchSuffix + lib:libminizip$secondaryArchSuffix lib:libQt5Core$secondaryArchSuffix lib:libQt5Gui$secondaryArchSuffix lib:libQt5Network$secondaryArchSuffix @@ -53,14 +53,15 @@ BUILD_REQUIRES=" haiku${secondaryArchSuffix}_devel # dependency of devel:libQt5Gui devel:libavcodec$secondaryArchSuffix - devel:libboost_filesystem$secondaryArchSuffix - devel:libboost_program_options$secondaryArchSuffix - devel:libboost_system$secondaryArchSuffix - devel:libboost_thread$secondaryArchSuffix - devel:libboost_unit_test_framework$secondaryArchSuffix + devel:libboost_filesystem$secondaryArchSuffix >= 1.70.0 + devel:libboost_program_options$secondaryArchSuffix >= 1.70.0 + devel:libboost_system$secondaryArchSuffix >= 1.70.0 + devel:libboost_thread$secondaryArchSuffix >= 1.70.0 + devel:libboost_unit_test_framework$secondaryArchSuffix >= 1.70.0 devel:libexecinfo$secondaryArchSuffix devel:libfuzzylite$secondaryArchSuffix devel:libGL$secondaryArchSuffix + devel:libminizip$secondaryArchSuffix devel:libQt5Core$secondaryArchSuffix devel:libQt5Gui$secondaryArchSuffix devel:libQt5Network$secondaryArchSuffix @@ -82,21 +83,20 @@ BUILD_PREREQUIRES=" BUILD() { - mkdir -p build - cd build export CFLAGS=-DUSE_FILE32API export CXXFLAGS="$CFLAGS -DBOOST_NO_CXX11_CONSTEXPR" - cmake .. -DDATA_DIR=$relativeDataDir/vcmi \ + cmake -Bbuild -S. -DCMAKE_BUILD_TYPE=Release \ + -DDATA_DIR=$relativeDataDir/vcmi \ -DCMAKE_INSTALL_PREFIX=$prefix \ -DLIB_DIR=$relativeLibDir \ - -DCMAKE_BUILD_TYPE='Release' -DFORCE_BUNDLED_FL=0 - make $jobArgs + -DFORCE_BUNDLED_FL=0 + + make -C build $jobArgs } INSTALL() { - cd build - make install + make -C build install rm -r $prefix/share # desktop file and png icons we don't care about }