1 |
commit: f2af202efb0844fb1dd3b5a00d2865d51ffdeff3 |
2 |
Author: Conrad Kostecki <conikost <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Feb 28 20:45:43 2023 +0000 |
4 |
Commit: Conrad Kostecki <conikost <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Feb 28 20:46:32 2023 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f2af202e |
7 |
|
8 |
net-im/spectrum2: add log4cxx-1.0.0 support |
9 |
|
10 |
Signed-off-by: Conrad Kostecki <conikost <AT> gentoo.org> |
11 |
|
12 |
.../files/spectrum2-2.1.3-log4cxx-1.0.0.patch | 63 ++++++++++++ |
13 |
net-im/spectrum2/spectrum2-2.1.3-r2.ebuild | 111 +++++++++++++++++++++ |
14 |
2 files changed, 174 insertions(+) |
15 |
|
16 |
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 |
17 |
new file mode 100644 |
18 |
index 000000000000..852f4ad78027 |
19 |
--- /dev/null |
20 |
+++ b/net-im/spectrum2/files/spectrum2-2.1.3-log4cxx-1.0.0.patch |
21 |
@@ -0,0 +1,63 @@ |
22 |
+Description: (newer) Debian log4cxx needs C++17 and used smart pointers. |
23 |
+ This patch just enables C++17 for the build and using smart pointers |
24 |
+ where needed. |
25 |
+Author: Tobias Frost <tobi@××××××.org> |
26 |
+Forwarded: not yet. log4cxx 0.14 will come with some preprocessor macros that will enable properly gating the new code. |
27 |
+Last-Update: 2022-11-21 <YYYY-MM-DD, last update of the meta-information, optional> |
28 |
+--- |
29 |
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ |
30 |
+--- a/CMakeLists.txt |
31 |
++++ b/CMakeLists.txt |
32 |
+@@ -2,7 +2,7 @@ |
33 |
+ |
34 |
+ project(libtransport) |
35 |
+ |
36 |
+-set(CMAKE_CXX_STANDARD 11) |
37 |
++set(CMAKE_CXX_STANDARD 17) |
38 |
+ if(WIN32) |
39 |
+ set(CMAKE_CXX_STANDARD 17) |
40 |
+ endif(WIN32) |
41 |
+--- a/plugin/cpp/Logging.cpp |
42 |
++++ b/plugin/cpp/Logging.cpp |
43 |
+@@ -26,6 +26,7 @@ |
44 |
+ #include <iterator> |
45 |
+ #include <algorithm> |
46 |
+ |
47 |
++#include <memory> |
48 |
+ |
49 |
+ #include <boost/filesystem.hpp> |
50 |
+ #include <boost/algorithm/string.hpp> |
51 |
+@@ -100,15 +101,17 @@ |
52 |
+ #ifdef _MSC_VER |
53 |
+ root->addAppender(new ConsoleAppender(new PatternLayout(L"%d %-5p %c: %m%n"))); |
54 |
+ #else |
55 |
+- root->addAppender(new ConsoleAppender(new PatternLayout("%d %-5p %c: %m%n"))); |
56 |
++ auto patternlayout = std::make_shared<PatternLayout>("%d %-5p %c: %m%n"); |
57 |
++ auto consoleappender = std::make_shared<ConsoleAppender>(patternlayout); |
58 |
++ root->addAppender(consoleappender); |
59 |
+ #endif |
60 |
+ } |
61 |
+ else { |
62 |
+ log4cxx::helpers::Properties p; |
63 |
+ |
64 |
+- log4cxx::helpers::FileInputStream *istream = NULL; |
65 |
++ log4cxx::helpers::InputStreamPtr istream; |
66 |
+ try { |
67 |
+- istream = new log4cxx::helpers::FileInputStream(CONFIG_STRING(config, key)); |
68 |
++ istream.reset(new log4cxx::helpers::FileInputStream(CONFIG_STRING(config, key))); |
69 |
+ } |
70 |
+ catch(log4cxx::helpers::IOException &ex) { |
71 |
+ std::cerr << "Can't create FileInputStream logger instance: " << ex.what() << "\n"; |
72 |
+--- a/tests/libtransport/main.cpp |
73 |
++++ b/tests/libtransport/main.cpp |
74 |
+@@ -23,7 +23,9 @@ |
75 |
+ #ifdef WITH_LOG4CXX |
76 |
+ LoggerPtr root = Logger::getRootLogger(); |
77 |
+ #ifndef _MSC_VER |
78 |
+- root->addAppender(new FileAppender(new PatternLayout("%d %-5p %c: %m%n"), "libtransport_test.log", false)); |
79 |
++ auto patternlayout = std::make_shared<PatternLayout>("%d %-5p %c: %m%n"); |
80 |
++ auto fileappender = std::make_shared<FileAppender>(patternlayout, "libtransport_test.log", false); |
81 |
++ root->addAppender(fileappender); |
82 |
+ #else |
83 |
+ root->addAppender(new FileAppender(new PatternLayout(L"%d %-5p %c: %m%n"), L"libtransport_test.log", false)); |
84 |
+ #endif |
85 |
|
86 |
diff --git a/net-im/spectrum2/spectrum2-2.1.3-r2.ebuild b/net-im/spectrum2/spectrum2-2.1.3-r2.ebuild |
87 |
new file mode 100644 |
88 |
index 000000000000..6913f31eba94 |
89 |
--- /dev/null |
90 |
+++ b/net-im/spectrum2/spectrum2-2.1.3-r2.ebuild |
91 |
@@ -0,0 +1,111 @@ |
92 |
+# Copyright 1999-2023 Gentoo Authors |
93 |
+# Distributed under the terms of the GNU General Public License v2 |
94 |
+ |
95 |
+EAPI=8 |
96 |
+ |
97 |
+inherit cmake systemd tmpfiles |
98 |
+ |
99 |
+DESCRIPTION="An open source instant messaging transport" |
100 |
+HOMEPAGE="https://www.spectrum.im" |
101 |
+SRC_URI="https://github.com/SpectrumIM/spectrum2/archive/${PV}.tar.gz -> ${P}.tar.gz" |
102 |
+ |
103 |
+LICENSE="GPL-2+" |
104 |
+SLOT="0" |
105 |
+KEYWORDS="~amd64" |
106 |
+IUSE="doc frotz irc mysql postgres purple sms +sqlite test twitter whatsapp xmpp" |
107 |
+REQUIRED_USE=" |
108 |
+ || ( mysql postgres sqlite ) |
109 |
+ test? ( irc ) |
110 |
+" |
111 |
+RESTRICT="!test? ( test )" |
112 |
+ |
113 |
+RDEPEND=" |
114 |
+ acct-group/spectrum |
115 |
+ acct-user/spectrum |
116 |
+ dev-libs/boost:=[nls] |
117 |
+ dev-libs/expat |
118 |
+ dev-libs/libev:= |
119 |
+ >=dev-libs/log4cxx-1.0.0:= |
120 |
+ dev-libs/jsoncpp:= |
121 |
+ dev-libs/openssl:= |
122 |
+ dev-libs/popt |
123 |
+ dev-libs/protobuf:= |
124 |
+ net-dns/libidn:= |
125 |
+ >=net-im/swift-4.0.2-r2:= |
126 |
+ net-misc/curl |
127 |
+ sys-libs/zlib:= |
128 |
+ frotz? ( !games-engines/frotz ) |
129 |
+ irc? ( net-im/libcommuni ) |
130 |
+ mysql? ( |
131 |
+ || ( |
132 |
+ dev-db/mariadb-connector-c |
133 |
+ dev-db/mysql-connector-c |
134 |
+ ) |
135 |
+ ) |
136 |
+ postgres? ( dev-libs/libpqxx:= ) |
137 |
+ purple? ( |
138 |
+ dev-libs/glib |
139 |
+ net-im/pidgin:= |
140 |
+ ) |
141 |
+ sms? ( app-mobilephone/smstools ) |
142 |
+ sqlite? ( dev-db/sqlite:3 ) |
143 |
+ twitter? ( net-misc/curl ) |
144 |
+ whatsapp? ( net-im/transwhat )" |
145 |
+ |
146 |
+DEPEND=" |
147 |
+ ${RDEPEND} |
148 |
+ doc? ( app-doc/doxygen ) |
149 |
+ test? ( dev-util/cppunit ) |
150 |
+" |
151 |
+ |
152 |
+PATCHES=( "${FILESDIR}/${PN}-2.1.3-log4cxx-1.0.0.patch" ) |
153 |
+ |
154 |
+src_prepare() { |
155 |
+ # Respect users LDFLAGS |
156 |
+ sed -i -e "s/-Wl,-export-dynamic/& ${LDFLAGS}/" spectrum/src/CMakeLists.txt || die |
157 |
+ |
158 |
+ cmake_src_prepare |
159 |
+} |
160 |
+ |
161 |
+src_configure() { |
162 |
+ local mycmakeargs=( |
163 |
+ -DENABLE_DOCS="$(usex doc)" |
164 |
+ -DENABLE_FROTZ="$(usex frotz)" |
165 |
+ -DENABLE_IRC="$(usex irc)" |
166 |
+ -DENABLE_MYSQL="$(usex mysql)" |
167 |
+ -DENABLE_PQXX="$(usex postgres)" |
168 |
+ -DENABLE_PURPLE="$(usex purple)" |
169 |
+ $(usex irc '-DENABLE_QT4=OFF' '') |
170 |
+ -DENABLE_SMSTOOLS3="$(usex sms)" |
171 |
+ -DENABLE_SQLITE3="$(usex sqlite)" |
172 |
+ -DENABLE_TESTS="$(usex test)" |
173 |
+ -DENABLE_TWITTER="$(usex twitter)" |
174 |
+ -DENABLE_XMPP="$(usex xmpp)" |
175 |
+ -DLIB_INSTALL_DIR="$(get_libdir)" |
176 |
+ ) |
177 |
+ |
178 |
+ cmake_src_configure |
179 |
+} |
180 |
+ |
181 |
+src_test() { |
182 |
+ cd "${BUILD_DIR}/tests/libtransport" || die |
183 |
+ ./libtransport_test || die |
184 |
+} |
185 |
+ |
186 |
+src_install() { |
187 |
+ cmake_src_install |
188 |
+ |
189 |
+ diropts -o spectrum -g spectrum |
190 |
+ keepdir /var/log/spectrum2 /var/lib/spectrum2 |
191 |
+ diropts |
192 |
+ |
193 |
+ newinitd "${FILESDIR}"/spectrum2.initd spectrum2 |
194 |
+ systemd_newunit "${FILESDIR}"/spectrum2.service spectrum2.service |
195 |
+ newtmpfiles "${FILESDIR}"/spectrum2.tmpfiles-r1 spectrum2.conf |
196 |
+ |
197 |
+ einstalldocs |
198 |
+} |
199 |
+ |
200 |
+pkg_postinst() { |
201 |
+ tmpfiles_process spectrum2.conf |
202 |
+} |