commit:     f2af202efb0844fb1dd3b5a00d2865d51ffdeff3
Author:     Conrad Kostecki <conikost <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 28 20:45:43 2023 +0000
Commit:     Conrad Kostecki <conikost <AT> gentoo <DOT> org>
CommitDate: Tue Feb 28 20:46:32 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f2af202e

net-im/spectrum2: add log4cxx-1.0.0 support

Signed-off-by: Conrad Kostecki <conikost <AT> gentoo.org>

 .../files/spectrum2-2.1.3-log4cxx-1.0.0.patch      |  63 ++++++++++++
 net-im/spectrum2/spectrum2-2.1.3-r2.ebuild         | 111 +++++++++++++++++++++
 2 files changed, 174 insertions(+)

diff --git a/net-im/spectrum2/files/spectrum2-2.1.3-log4cxx-1.0.0.patch 
b/net-im/spectrum2/files/spectrum2-2.1.3-log4cxx-1.0.0.patch
new file mode 100644
index 000000000000..852f4ad78027
--- /dev/null
+++ b/net-im/spectrum2/files/spectrum2-2.1.3-log4cxx-1.0.0.patch
@@ -0,0 +1,63 @@
+Description: (newer) Debian log4cxx needs C++17 and used smart pointers.
+  This patch just enables C++17 for the build and using smart pointers
+  where needed.
+Author: Tobias Frost <t...@debian.org>
+Forwarded: not yet. log4cxx 0.14 will come with some preprocessor macros that 
will enable properly gating the new code.
+Last-Update: 2022-11-21 <YYYY-MM-DD, last update of the meta-information, 
optional>
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -2,7 +2,7 @@
+ 
+ project(libtransport)
+ 
+-set(CMAKE_CXX_STANDARD 11)
++set(CMAKE_CXX_STANDARD 17)
+ if(WIN32)
+       set(CMAKE_CXX_STANDARD 17)
+ endif(WIN32)
+--- a/plugin/cpp/Logging.cpp
++++ b/plugin/cpp/Logging.cpp
+@@ -26,6 +26,7 @@
+ #include <iterator>
+ #include <algorithm>
+ 
++#include <memory>
+ 
+ #include <boost/filesystem.hpp>
+ #include <boost/algorithm/string.hpp>
+@@ -100,15 +101,17 @@
+ #ifdef _MSC_VER
+               root->addAppender(new ConsoleAppender(new PatternLayout(L"%d 
%-5p %c: %m%n")));
+ #else
+-              root->addAppender(new ConsoleAppender(new PatternLayout("%d 
%-5p %c: %m%n")));
++              auto patternlayout = std::make_shared<PatternLayout>("%d %-5p 
%c: %m%n");
++              auto consoleappender = 
std::make_shared<ConsoleAppender>(patternlayout);
++              root->addAppender(consoleappender);
+ #endif
+       }
+       else {
+               log4cxx::helpers::Properties p;
+ 
+-              log4cxx::helpers::FileInputStream *istream = NULL;
++              log4cxx::helpers::InputStreamPtr istream;
+               try {
+-                      istream = new 
log4cxx::helpers::FileInputStream(CONFIG_STRING(config, key));
++                      istream.reset(new 
log4cxx::helpers::FileInputStream(CONFIG_STRING(config, key)));
+               }
+               catch(log4cxx::helpers::IOException &ex) {
+                       std::cerr << "Can't create FileInputStream logger 
instance: " << ex.what() << "\n";
+--- a/tests/libtransport/main.cpp
++++ b/tests/libtransport/main.cpp
+@@ -23,7 +23,9 @@
+ #ifdef WITH_LOG4CXX
+       LoggerPtr root = Logger::getRootLogger();
+ #ifndef _MSC_VER
+-      root->addAppender(new FileAppender(new PatternLayout("%d %-5p %c: 
%m%n"), "libtransport_test.log", false));
++      auto patternlayout = std::make_shared<PatternLayout>("%d %-5p %c: 
%m%n");
++      auto fileappender = std::make_shared<FileAppender>(patternlayout, 
"libtransport_test.log", false);
++      root->addAppender(fileappender);
+ #else
+       root->addAppender(new FileAppender(new PatternLayout(L"%d %-5p %c: 
%m%n"), L"libtransport_test.log", false));
+ #endif

diff --git a/net-im/spectrum2/spectrum2-2.1.3-r2.ebuild 
b/net-im/spectrum2/spectrum2-2.1.3-r2.ebuild
new file mode 100644
index 000000000000..6913f31eba94
--- /dev/null
+++ b/net-im/spectrum2/spectrum2-2.1.3-r2.ebuild
@@ -0,0 +1,111 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake systemd tmpfiles
+
+DESCRIPTION="An open source instant messaging transport"
+HOMEPAGE="https://www.spectrum.im";
+SRC_URI="https://github.com/SpectrumIM/spectrum2/archive/${PV}.tar.gz -> 
${P}.tar.gz"
+
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="doc frotz irc mysql postgres purple sms +sqlite test twitter whatsapp 
xmpp"
+REQUIRED_USE="
+       || ( mysql postgres sqlite )
+       test? ( irc )
+"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+       acct-group/spectrum
+       acct-user/spectrum
+       dev-libs/boost:=[nls]
+       dev-libs/expat
+       dev-libs/libev:=
+       >=dev-libs/log4cxx-1.0.0:=
+       dev-libs/jsoncpp:=
+       dev-libs/openssl:=
+       dev-libs/popt
+       dev-libs/protobuf:=
+       net-dns/libidn:=
+       >=net-im/swift-4.0.2-r2:=
+       net-misc/curl
+       sys-libs/zlib:=
+       frotz? ( !games-engines/frotz )
+       irc? ( net-im/libcommuni )
+       mysql? (
+               || (
+                       dev-db/mariadb-connector-c
+                       dev-db/mysql-connector-c
+               )
+       )
+       postgres? ( dev-libs/libpqxx:= )
+       purple? (
+               dev-libs/glib
+               net-im/pidgin:=
+       )
+       sms? ( app-mobilephone/smstools )
+       sqlite? ( dev-db/sqlite:3 )
+       twitter? ( net-misc/curl )
+       whatsapp? ( net-im/transwhat )"
+
+DEPEND="
+       ${RDEPEND}
+       doc? ( app-doc/doxygen )
+       test? ( dev-util/cppunit )
+"
+
+PATCHES=( "${FILESDIR}/${PN}-2.1.3-log4cxx-1.0.0.patch" )
+
+src_prepare() {
+       # Respect users LDFLAGS
+       sed -i -e "s/-Wl,-export-dynamic/& ${LDFLAGS}/" 
spectrum/src/CMakeLists.txt || die
+
+       cmake_src_prepare
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DENABLE_DOCS="$(usex doc)"
+               -DENABLE_FROTZ="$(usex frotz)"
+               -DENABLE_IRC="$(usex irc)"
+               -DENABLE_MYSQL="$(usex mysql)"
+               -DENABLE_PQXX="$(usex postgres)"
+               -DENABLE_PURPLE="$(usex purple)"
+               $(usex irc '-DENABLE_QT4=OFF' '')
+               -DENABLE_SMSTOOLS3="$(usex sms)"
+               -DENABLE_SQLITE3="$(usex sqlite)"
+               -DENABLE_TESTS="$(usex test)"
+               -DENABLE_TWITTER="$(usex twitter)"
+               -DENABLE_XMPP="$(usex xmpp)"
+               -DLIB_INSTALL_DIR="$(get_libdir)"
+       )
+
+       cmake_src_configure
+}
+
+src_test() {
+       cd "${BUILD_DIR}/tests/libtransport" || die
+       ./libtransport_test || die
+}
+
+src_install() {
+       cmake_src_install
+
+       diropts -o spectrum -g spectrum
+       keepdir /var/log/spectrum2 /var/lib/spectrum2
+       diropts
+
+       newinitd "${FILESDIR}"/spectrum2.initd spectrum2
+       systemd_newunit "${FILESDIR}"/spectrum2.service spectrum2.service
+       newtmpfiles "${FILESDIR}"/spectrum2.tmpfiles-r1 spectrum2.conf
+
+       einstalldocs
+}
+
+pkg_postinst() {
+       tmpfiles_process spectrum2.conf
+}

Reply via email to