git: 5a0ece282a4f - main - devel/rttr: Fix build on 14- / modern Clang
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 27 Nov 2021 21:38:03 UTC
The branch main has been updated by adridg: URL: https://cgit.FreeBSD.org/ports/commit/?id=5a0ece282a4f3e47cdb0647a7ec96a641a25b5a8 commit 5a0ece282a4f3e47cdb0647a7ec96a641a25b5a8 Author: Adriaan de Groot <adridg@FreeBSD.org> AuthorDate: 2021-11-27 14:30:20 +0000 Commit: Adriaan de Groot <adridg@FreeBSD.org> CommitDate: 2021-11-27 21:38:00 +0000 devel/rttr: Fix build on 14- / modern Clang - the bundled rapidjson doesn't build on 14- because of changes in the STL; use the version from ports instead which has the changes needed already. - the chaiscript examples don't build with modern Clang on 14-, and the examples are explicitly C++14 -- but still don't work Replace the bundled rapidjson and chaiscripts with the regular ports versions. There has been some work in git on both rttr and chaiscript, but neither has a newer release that might be pulled in, so we'll stick to messy patching of rttr instead. --- devel/rttr/Makefile | 15 ++++++-- ...3rd__party_rapidjson-1.1.0_rapidjson_document.h | 40 ---------------------- .../rttr/files/patch-CMake_3rd__party__libs.cmake | 23 +++++++++++++ .../patch-src_examples_scripting_CMakeLists.txt | 17 +++++++++ 4 files changed, 52 insertions(+), 43 deletions(-) diff --git a/devel/rttr/Makefile b/devel/rttr/Makefile index 8d989894b1bd..90cc3b13cac3 100644 --- a/devel/rttr/Makefile +++ b/devel/rttr/Makefile @@ -1,7 +1,7 @@ PORTNAME= rttr DISTVERSIONPREFIX= v DISTVERSION= 0.9.6-16 -PORTREVISION= 1 +PORTREVISION= 2 DISTVERSIONSUFFIX= -gb3a131c CATEGORIES= devel @@ -13,13 +13,22 @@ COMMENT= Run Time Type Reflection LICENSE= MIT -USES= cmake compiler:c++11-lang +BUILD_DEPENDS= ${LOCALBASE}/include/rapidjson/rapidjson.h:devel/rapidjson \ + ${LOCALBASE}/include/chaiscript/chaiscript.hpp:lang/chaiscript + +USES= cmake compiler:c++17-lang USE_GITHUB= yes GH_ACCOUNT= rttrorg CMAKE_OFF= BUILD_DOCUMENTATION \ - BUILD_UNIT_TESTS + BUILD_UNIT_TESTS \ + BUILD_EXAMPLES PORTSCOUT= limit:^0\. +post-extract: + ${RM} -r ${WRKSRC}/3rd_party/rapidjson-1.1.0/ + ${RM} -r ${WRKSRC}/3rd_party/chaiscript-devel/ + ${RM} -r ${WRKSRC}/3rd_party/chaiscript-6.1.0/ + .include <bsd.port.mk> diff --git a/devel/rttr/files/patch-3rd__party_rapidjson-1.1.0_rapidjson_document.h b/devel/rttr/files/patch-3rd__party_rapidjson-1.1.0_rapidjson_document.h deleted file mode 100644 index 7cba05cb4bee..000000000000 --- a/devel/rttr/files/patch-3rd__party_rapidjson-1.1.0_rapidjson_document.h +++ /dev/null @@ -1,40 +0,0 @@ ---- 3rd_party/rapidjson-1.1.0/rapidjson/document.h.orig 2019-01-18 18:25:46 UTC -+++ 3rd_party/rapidjson-1.1.0/rapidjson/document.h -@@ -1439,7 +1439,7 @@ class GenericValue { (public) - MemberIterator pos = MemberBegin() + (first - MemberBegin()); - for (MemberIterator itr = pos; itr != last; ++itr) - itr->~Member(); -- std::memmove(&*pos, &*last, static_cast<size_t>(MemberEnd() - last) * sizeof(Member)); -+ std::memmove(static_cast<void*>(&*pos), &*last, static_cast<size_t>(MemberEnd() - last) * sizeof(Member)); - data_.o.size -= static_cast<SizeType>(last - first); - return pos; - } -@@ -1642,8 +1642,8 @@ class GenericValue { (public) - RAPIDJSON_ASSERT(last <= End()); - ValueIterator pos = Begin() + (first - Begin()); - for (ValueIterator itr = pos; itr != last; ++itr) -- itr->~GenericValue(); -- std::memmove(pos, last, static_cast<size_t>(End() - last) * sizeof(GenericValue)); -+ itr->~GenericValue(); -+ std::memmove(static_cast<void*>(pos), last, static_cast<size_t>(End() - last) * sizeof(GenericValue)); - data_.a.size -= static_cast<SizeType>(last - first); - return pos; - } -@@ -1950,7 +1950,7 @@ class GenericValue { (public) - if (count) { - GenericValue* e = static_cast<GenericValue*>(allocator.Malloc(count * sizeof(GenericValue))); - SetElementsPointer(e); -- std::memcpy(e, values, count * sizeof(GenericValue)); -+ std::memcpy(static_cast<void*>(e), values, count * sizeof(GenericValue)); - } - else - SetElementsPointer(0); -@@ -1963,7 +1963,7 @@ class GenericValue { (public) - if (count) { - Member* m = static_cast<Member*>(allocator.Malloc(count * sizeof(Member))); - SetMembersPointer(m); -- std::memcpy(m, members, count * sizeof(Member)); -+ std::memcpy(static_cast<void*>(m), members, count * sizeof(Member)); - } - else - SetMembersPointer(0); diff --git a/devel/rttr/files/patch-CMake_3rd__party__libs.cmake b/devel/rttr/files/patch-CMake_3rd__party__libs.cmake new file mode 100644 index 000000000000..93ae68c111b8 --- /dev/null +++ b/devel/rttr/files/patch-CMake_3rd__party__libs.cmake @@ -0,0 +1,23 @@ +--- CMake/3rd_party_libs.cmake.orig 2019-01-18 18:25:46 UTC ++++ CMake/3rd_party_libs.cmake +@@ -53,7 +53,8 @@ if (BUILD_BENCHMARKS OR BUILD_EXAMPLES) + find_package(Threads REQUIRED) + endif() + +-set(RAPID_JSON_DIR ${RTTR_3RD_PARTY_DIR}/rapidjson-1.1.0) ++find_package(RapidJSON REQUIRED) ++set(RAPID_JSON_DIR ${RapidJSON_INCLUDE_DIR}) + set(NONIUS_DIR ${RTTR_3RD_PARTY_DIR}/nonius-1.1.2) + + # Prepare "Catch" library for other executables +@@ -63,7 +64,9 @@ add_library(Catch2::Catch ALIAS Catch) + target_include_directories(Catch INTERFACE ${CATCH_INCLUDE_DIR}) + + # Find chai script +-set(CHAISCRIPT_INCLUDE_DIR ${RTTR_3RD_PARTY_DIR}/chaiscript-6.1.0) ++find_package(PkgConfig REQUIRED) ++pkg_check_modules(_chaiscript REQUIRED chaiscript) ++set(CHAISCRIPT_INCLUDE_DIR ${_chaiscript_INCLUDEDIR}) + add_library(ChaiScript INTERFACE) + add_library(ChaiScript::ChaiScript ALIAS ChaiScript) + target_include_directories(ChaiScript INTERFACE ${CHAISCRIPT_INCLUDE_DIR}) diff --git a/devel/rttr/files/patch-src_examples_scripting_CMakeLists.txt b/devel/rttr/files/patch-src_examples_scripting_CMakeLists.txt new file mode 100644 index 000000000000..d112a5b12a4b --- /dev/null +++ b/devel/rttr/files/patch-src_examples_scripting_CMakeLists.txt @@ -0,0 +1,17 @@ +--- src/examples/scripting/CMakeLists.txt.orig 2021-11-27 21:00:51 UTC ++++ src/examples/scripting/CMakeLists.txt +@@ -41,12 +41,12 @@ endif() + + add_executable(scripting_example ${SRC_FILES} ${HPP_FILES}) + target_link_libraries(scripting_example RTTR::Core ChaiScript::ChaiScript ${CMAKE_DL_LIBS} Threads::Threads) +-# chaiscript minimum C++ version is 14 ++# chaiscript minimum C++ version is 17 + set_target_properties(scripting_example + PROPERTIES DEBUG_POSTFIX ${RTTR_DEBUG_POSTFIX} + FOLDER "Examples" + INSTALL_RPATH "${RTTR_EXECUTABLE_INSTALL_RPATH}" +- CXX_STANDARD 14) ++ CXX_STANDARD 17) + if (MSVC) + target_compile_options(scripting_example PRIVATE /bigobj) + endif()