From 99ceae71b0e64fe8db4b8b04fed0f93c0e18774b Mon Sep 17 00:00:00 2001 From: Krul Ceter Date: Sat, 21 Jan 2023 08:36:07 +0300 Subject: [PATCH] EternalTerminal: update to 6.2.4. * replace disable_testing.patch with upstream build_testing.patch in order to properly disable building tests with the "BUILD_TESTING" flag. * bundled cxxopts is broken; apply (not yet) upstream patch to use and link against the packaged library. * gcc complains at "string"/"vector" not having a type in src/base/TunnelUtils.(hpp|cpp); apply upstream patch. * clean up the mess made with build_wrksrc in the previous commit. --- .../patches/build_testing.patch | 89 +++++++++++++++++++ srcpkgs/EternalTerminal/patches/cxxopts.patch | 46 ++++++++++ .../patches/disable-tests.patch | 30 ------- .../EternalTerminal/patches/fix-cflags.patch | 4 +- .../EternalTerminal/patches/tunnelutils.patch | 45 ++++++++++ srcpkgs/EternalTerminal/template | 21 +++-- 6 files changed, 192 insertions(+), 43 deletions(-) create mode 100644 srcpkgs/EternalTerminal/patches/build_testing.patch create mode 100644 srcpkgs/EternalTerminal/patches/cxxopts.patch delete mode 100644 srcpkgs/EternalTerminal/patches/disable-tests.patch create mode 100644 srcpkgs/EternalTerminal/patches/tunnelutils.patch diff --git a/srcpkgs/EternalTerminal/patches/build_testing.patch b/srcpkgs/EternalTerminal/patches/build_testing.patch new file mode 100644 index 000000000000..3ba509d228df --- /dev/null +++ b/srcpkgs/EternalTerminal/patches/build_testing.patch @@ -0,0 +1,89 @@ +https://github.com/MisterTea/EternalTerminal/pull/562.patch + +From d39008320d401264770636abe9d77ba69e65c620 Mon Sep 17 00:00:00 2001 +From: Krul Ceter +Date: Sat, 21 Jan 2023 07:36:17 +0300 +Subject: [PATCH] Add BUILD_TESTING to make tests optional by choice + +The option is enabled by default, so it should not disrupt the default +behavior. +--- + CMakeLists.txt | 48 ++++++++++++++++++++++++++---------------------- + 1 file changed, 26 insertions(+), 22 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ef239d3e..2368dfc2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -165,6 +165,7 @@ endif() + + option(CODE_COVERAGE "Enable code coverage" OFF) + option(FUZZING "Enable builds for fuzz testing" OFF) ++option(BUILD_TESTING "Build tests" ON) + option(DISABLE_CRASH_LOG "Disable installing easylogging crash handler" OFF) + + add_definitions(-DET_VERSION="${PROJECT_VERSION}") +@@ -521,30 +522,33 @@ else(WIN32) + ${CORE_LIBRARIES}) + decorate_target(htmd) + +- enable_testing() ++ if(BUILD_TESTING) ++ enable_testing() + +- file(GLOB TEST_SRCS test/*Test.cpp) +- add_executable( +- et-test +- ${TEST_SRCS} +- test/Main.cpp +- ) +- add_dependencies(et-test TerminalCommon et-lib) +- target_link_libraries( ++ file(GLOB TEST_SRCS test/*Test.cpp) ++ add_executable( + et-test +- TerminalCommon +- et-lib +- ${CMAKE_THREAD_LIBS_INIT} +- ${PROTOBUF_LIBS} +- ${sodium_LIBRARY_RELEASE} +- ${SELINUX_LIBRARIES} +- ${UTEMPTER_LIBRARIES} +- ${Boost_LIBRARIES} +- ${CORE_LIBRARIES}) +- add_test(et-test et-test) +- decorate_target(et-test) ++ ${TEST_SRCS} ++ test/Main.cpp ++ ) + +- if(FUZZING) ++ add_dependencies(et-test TerminalCommon et-lib) ++ target_link_libraries( ++ et-test ++ TerminalCommon ++ et-lib ++ ${CMAKE_THREAD_LIBS_INIT} ++ ${PROTOBUF_LIBS} ++ ${sodium_LIBRARY_RELEASE} ++ ${SELINUX_LIBRARIES} ++ ${UTEMPTER_LIBRARIES} ++ ${Boost_LIBRARIES} ++ ${CORE_LIBRARIES}) ++ add_test(et-test et-test) ++ decorate_target(et-test) ++ endif() ++ ++ if(BUILD_TESTING AND FUZZING) + add_executable( + TerminalServerFuzzer + test/TerminalServerFuzzer.cpp +@@ -582,7 +586,7 @@ else(WIN32) + ${Boost_LIBRARIES} + ${CORE_LIBRARIES}) + decorate_fuzzer(TerminalServerRouterFuzzer) +- endif(FUZZING) ++ endif(BUILD_TESTING AND FUZZING) + + install( + TARGETS etserver etterminal et htm htmd diff --git a/srcpkgs/EternalTerminal/patches/cxxopts.patch b/srcpkgs/EternalTerminal/patches/cxxopts.patch new file mode 100644 index 000000000000..72834e95af0b --- /dev/null +++ b/srcpkgs/EternalTerminal/patches/cxxopts.patch @@ -0,0 +1,46 @@ +https://github.com/MisterTea/EternalTerminal/pull/565 + +From a3b18bebeeb1e6da13819a775d2b5a30c8c21638 Mon Sep 17 00:00:00 2001 +From: Krul Ceter +Date: Fri, 27 Jan 2023 13:26:08 +0300 +Subject: [PATCH] Make cxxopts an optional system dependency + +Fall back to the bundled library if cmake cannot find it on the running +system. +--- + CMakeLists.txt | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2368dfc2..3e3bf5d4 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -98,6 +98,7 @@ find_package(Threads REQUIRED) + find_package(sodium REQUIRED) + find_package(Protobuf REQUIRED) + find_package(ZLIB REQUIRED) ++find_package(cxxopts) + find_package(Unwind) + + # Optional packages +@@ -278,6 +279,12 @@ else() + stdc++fs) + endif() + ++if(cxxopts_FOUND) ++ list(INSERT CORE_LIBRARIES 0 cxxopts::cxxopts) ++else() ++ include_directories(${EXTERNAL_DIR}/cxxopts/include) ++endif() ++ + IF(Unwind_FOUND) + list(INSERT CORE_LIBRARIES 0 unwind::unwind) + ENDIF() +@@ -322,7 +329,6 @@ include_directories( + ${EXTERNAL_DIR}/ThreadPool + ${EXTERNAL_DIR}/PlatformFolders + ${EXTERNAL_DIR}/Catch2/single_include +- ${EXTERNAL_DIR}/cxxopts/include + ${EXTERNAL_DIR}/msgpack-c/include + ${EXTERNAL_DIR}/json/single_include/nlohmann + ${EXTERNAL_DIR}/sole diff --git a/srcpkgs/EternalTerminal/patches/disable-tests.patch b/srcpkgs/EternalTerminal/patches/disable-tests.patch deleted file mode 100644 index f7dcee020b9b..000000000000 --- a/srcpkgs/EternalTerminal/patches/disable-tests.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- a/EternalTerminal/CMakeLists.txt -+++ b/EternalTerminal/CMakeLists.txt -@@ -519,17 +519,8 @@ - ${CORE_LIBRARIES}) - decorate_target(htmd) - -- enable_testing() -- -- file(GLOB TEST_SRCS test/*Test.cpp) -- add_executable( -- et-test -- ${TEST_SRCS} -- test/Main.cpp -- ) -- add_dependencies(et-test TerminalCommon et-lib) -+ add_dependencies(TerminalCommon et-lib) - target_link_libraries( -- et-test - TerminalCommon - et-lib - ${CMAKE_THREAD_LIBS_INIT} -@@ -539,8 +530,6 @@ - ${UTEMPTER_LIBRARIES} - ${Boost_LIBRARIES} - ${CORE_LIBRARIES}) -- add_test(et-test et-test) -- decorate_target(et-test) - - if(FUZZING) - add_executable( diff --git a/srcpkgs/EternalTerminal/patches/fix-cflags.patch b/srcpkgs/EternalTerminal/patches/fix-cflags.patch index 952005b1bd48..ce7e998804ee 100644 --- a/srcpkgs/EternalTerminal/patches/fix-cflags.patch +++ b/srcpkgs/EternalTerminal/patches/fix-cflags.patch @@ -1,7 +1,7 @@ Index: EternalTerminal-et-v6.0.13/CMakeLists.txt =================================================================== ---- a/EternalTerminal/CMakeLists.txt -+++ b/EternalTerminal/CMakeLists.txt +--- a/CMakeLists.txt ++++ b/CMakeLists.txt @@ -187,12 +187,6 @@ "${CMAKE_CXX_FLAGS} -DELPP_DISABLE_DEFAULT_CRASH_HANDLING") endif(DISABLE_CRASH_LOG) diff --git a/srcpkgs/EternalTerminal/patches/tunnelutils.patch b/srcpkgs/EternalTerminal/patches/tunnelutils.patch new file mode 100644 index 000000000000..f5f6fe690091 --- /dev/null +++ b/srcpkgs/EternalTerminal/patches/tunnelutils.patch @@ -0,0 +1,45 @@ +https://github.com/MisterTea/EternalTerminal/commit/fde8a7cb084bb6bc005b8205f4257e7f65978521 + +Only the diff for src/base/TunnelUtils.hpp is used here, the rest is +retained as is. + +From fde8a7cb084bb6bc005b8205f4257e7f65978521 Mon Sep 17 00:00:00 2001 +From: kruceter +Date: Thu, 26 Jan 2023 20:38:12 +0300 +Subject: [PATCH] Fix cross build with GCC 12 (#564) + +* src/base/TunnelUtils.hpp: replace "ETerminal.pb.h" with "Headers.hpp" + +Fixes "strings" and "vectors" not having a type. + +Headers.hpp already includes ETerminal.pb.h. + +* external/cxxopts: update submodule + +Needed in order to fix cross build with GCC 12. + +Note that the submodule is updated to revision +c74846a891b3cc3bfa992d588b1295f528d43039 which is equal to the tagged +version 3.0.0. + +This decision was made due to the changes in master of cxxopts breaking +EternalTerminal (such as removing cxxopts::OptionException from the +code). +--- + external/cxxopts | 2 +- + src/base/TunnelUtils.hpp | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/base/TunnelUtils.hpp b/src/base/TunnelUtils.hpp +index 207969ee..42e96cc4 100644 +--- a/src/base/TunnelUtils.hpp ++++ b/src/base/TunnelUtils.hpp +@@ -1,7 +1,7 @@ + #ifndef __ET_TUNNEL_UTILS__ + #define __ET_TUNNEL_UTILS__ + +-#include "ETerminal.pb.h" ++#include "Headers.hpp" + + namespace et { + diff --git a/srcpkgs/EternalTerminal/template b/srcpkgs/EternalTerminal/template index 1017a1b4a1ec..c4a1776c2d1c 100644 --- a/srcpkgs/EternalTerminal/template +++ b/srcpkgs/EternalTerminal/template @@ -1,25 +1,25 @@ # Template file for 'EternalTerminal' pkgname=EternalTerminal -version=6.2.1 +version=6.2.4 revision=1 # revisions used for the specific versions of submodules. # they can be found in the external/ directory of the source code. _sanitizers_gitrev="99e159ec9bc8dd362b08d18436bd40ff0648417b" _threadpool_gitrev="9a42ec1329f259a5f4881a291db1dcb8f2ad9040" -build_wrksrc=${pkgname} build_style=cmake -configure_args="-DDISABLE_VCPKG=ON -DDISABLE_TELEMETRY=ON -DDISABLE_SENTRY=ON" -hostmakedepends="protobuf" +configure_args="-DDISABLE_VCPKG=ON -DDISABLE_TELEMETRY=ON -DDISABLE_SENTRY=ON + -DBUILD_TESTING=OFF" +hostmakedepends="protobuf pkg-config" makedepends="gflags-devel libsodium-devel protobuf-devel openssl-devel - zlib-devel" + zlib-devel cxxopts" short_desc="Re-Connectable secure remote shell" maintainer="Orphaned " license="Apache-2.0" homepage="https://eternalterminal.dev/" -distfiles="https://github.com/MisterTea/EternalTerminal/archive/et-v${version}.tar.gz +distfiles="https://github.com/MisterTea/EternalTerminal/archive/refs/tags/et-v${version}.tar.gz https://github.com/arsenm/sanitizers-cmake/archive/${_sanitizers_gitrev}.tar.gz https://github.com/progschj/ThreadPool/archive/${_threadpool_gitrev}.tar.gz" -checksum="fdf68a51cb8b62b3dbbacd1d2aeba5d5491e5142e65c97713c2f1ce61d4fdbed +checksum="95cfb79bc2f25d19eb84ca3c28dba860bb52b3750334d373adeb2cd061de6ba6 f9cf386638f455c5d2e7a835b95941201387d2531b8682942d59827663b58341 954e0ecdac1aa0da1e0fa78577ff0d352e53094df43762fbc1884f76a7e1dcd2" system_accounts="_eternal" @@ -38,10 +38,9 @@ if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then fi post_extract() { - mv EternalTerminal-et-v${version} ${build_wrksrc} - mv sanitizers-cmake-${_sanitizers_gitrev}/* \ - ${build_wrksrc}/external/sanitizers-cmake - mv ThreadPool-${_threadpool_gitrev}/* ${build_wrksrc}/external/ThreadPool + mv EternalTerminal-et-v${version}/* . + mv sanitizers-cmake-${_sanitizers_gitrev}/* external/sanitizers-cmake + mv ThreadPool-${_threadpool_gitrev}/* external/ThreadPool } post_patch() {