Gentoo Archives: gentoo-commits

From: Johannes Huber <johu@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-irc/quassel/files/, net-irc/quassel/
Date: Tue, 07 Jan 2020 22:28:09
Message-Id: 1578436071.17e237e072a6205547e2c43e99cc2bbc5914ff00.johu@gentoo
1 commit: 17e237e072a6205547e2c43e99cc2bbc5914ff00
2 Author: Johannes Huber <johu <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jan 7 22:27:34 2020 +0000
4 Commit: Johannes Huber <johu <AT> gentoo <DOT> org>
5 CommitDate: Tue Jan 7 22:27:51 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=17e237e0
7
8 net-irc/quassel: Fix build w/ Qt 5.14
9
10 Adds upstream patch by Manuel Nickschas <sputnick <AT> quassel-irc.org>.
11
12 Closes: https://bugs.gentoo.org/703904
13 Package-Manager: Portage-2.3.84, Repoman-2.3.20
14 Signed-off-by: Johannes Huber <johu <AT> gentoo.org>
15
16 net-irc/quassel/files/quassel-0.13.1-qt5.14.patch | 118 +++++++++++++
17 net-irc/quassel/quassel-0.13.1-r1.ebuild | 192 ++++++++++++++++++++++
18 2 files changed, 310 insertions(+)
19
20 diff --git a/net-irc/quassel/files/quassel-0.13.1-qt5.14.patch b/net-irc/quassel/files/quassel-0.13.1-qt5.14.patch
21 new file mode 100644
22 index 00000000000..f0305ea53ce
23 --- /dev/null
24 +++ b/net-irc/quassel/files/quassel-0.13.1-qt5.14.patch
25 @@ -0,0 +1,118 @@
26 +commit c90702bdbc43fc542d7df6d5ec4b321912ca0035
27 +Author: Manuel Nickschas <sputnick@×××××××××××.org>
28 +Date: Tue Jan 7 18:34:54 2020 +0100
29 +
30 + common: Disable enum type stream operators for Qt >= 5.14
31 +
32 + Starting from version 5.14, Qt provides stream operators for enum
33 + types, which collide with the ones we ship in types.h. Disable
34 + Quassel's stream operators when compiling against Qt 5.14 or later.
35 +
36 + Add a unit test that ensures that enum serialization honors the width
37 + of the underlying type.
38 +
39 +diff --git a/src/common/types.h b/src/common/types.h
40 +index 467d9fb2..c4b9f364 100644
41 +--- a/src/common/types.h
42 ++++ b/src/common/types.h
43 +@@ -140,6 +140,7 @@ Q_DECLARE_METATYPE(QHostAddress)
44 + typedef QList<MsgId> MsgIdList;
45 + typedef QList<BufferId> BufferIdList;
46 +
47 ++#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
48 + /**
49 + * Catch-all stream serialization operator for enum types.
50 + *
51 +@@ -169,6 +170,7 @@ QDataStream &operator>>(QDataStream &in, T &value) {
52 + value = static_cast<T>(v);
53 + return in;
54 + }
55 ++#endif
56 +
57 + // Exceptions
58 +
59 +diff --git a/src/common/typestest.cpp b/src/common/typestest.cpp
60 +new file mode 100644
61 +index 00000000..04031c29
62 +--- /dev/null
63 ++++ b/src/common/typestest.cpp
64 +@@ -0,0 +1,79 @@
65 ++/***************************************************************************
66 ++ * Copyright (C) 2005-2020 by the Quassel Project *
67 ++ * devel@×××××××××××.org *
68 ++ * *
69 ++ * This program is free software; you can redistribute it and/or modify *
70 ++ * it under the terms of the GNU General Public License as published by *
71 ++ * the Free Software Foundation; either version 2 of the License, or *
72 ++ * (at your option) version 3. *
73 ++ * *
74 ++ * This program is distributed in the hope that it will be useful, *
75 ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
76 ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
77 ++ * GNU General Public License for more details. *
78 ++ * *
79 ++ * You should have received a copy of the GNU General Public License *
80 ++ * along with this program; if not, write to the *
81 ++ * Free Software Foundation, Inc., *
82 ++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
83 ++ ***************************************************************************/
84 ++
85 ++#include <cstdint>
86 ++
87 ++#include <QByteArray>
88 ++#include <QDataStream>
89 ++#include <QObject>
90 ++
91 ++#include "testglobal.h"
92 ++#include "types.h"
93 ++
94 ++using namespace ::testing;
95 ++
96 ++class EnumHolder
97 ++{
98 ++ Q_GADGET
99 ++
100 ++public:
101 ++ enum class Enum16 : uint16_t {};
102 ++ enum class Enum32 : uint32_t {};
103 ++
104 ++ enum class EnumQt16 : uint16_t {};
105 ++ Q_ENUM(EnumQt16)
106 ++ enum class EnumQt32 : uint32_t {};
107 ++ Q_ENUM(EnumQt32)
108 ++};
109 ++
110 ++// Verify that enums are (de)serialized as their underlying type
111 ++TEST(TypesTest, enumSerialization)
112 ++{
113 ++ QByteArray data;
114 ++ QDataStream out(&data, QIODevice::WriteOnly);
115 ++
116 ++ // Serialize
117 ++ out << EnumHolder::Enum16(0xabcd);
118 ++ ASSERT_THAT(data.size(), Eq(2));
119 ++ out << EnumHolder::Enum32(0x123456);
120 ++ ASSERT_THAT(data.size(), Eq(6));
121 ++ out << EnumHolder::EnumQt16(0x4321);
122 ++ ASSERT_THAT(data.size(), Eq(8));
123 ++ out << EnumHolder::Enum32(0xfedcba);
124 ++ ASSERT_THAT(data.size(), Eq(12));
125 ++ ASSERT_THAT(out.status(), Eq(QDataStream::Status::Ok));
126 ++
127 ++ // Deserialize
128 ++ QDataStream in(data);
129 ++ EnumHolder::Enum16 enum16;
130 ++ EnumHolder::Enum32 enum32;
131 ++ EnumHolder::EnumQt16 enumQt16;
132 ++ EnumHolder::EnumQt32 enumQt32;
133 ++ in >> enum16 >> enum32 >> enumQt16 >> enumQt32;
134 ++ ASSERT_THAT(in.status(), Eq(QDataStream::Status::Ok));
135 ++ EXPECT_TRUE(in.atEnd());
136 ++
137 ++ EXPECT_THAT((int)enum16, Eq(0xabcd));
138 ++ EXPECT_THAT((int)enum32, Eq(0x123456));
139 ++ EXPECT_THAT((int)enumQt16, Eq(0x4321));
140 ++ EXPECT_THAT((int)enumQt32, Eq(0xfedcba));
141 ++}
142 ++
143 ++#include "typestest.moc"
144
145 diff --git a/net-irc/quassel/quassel-0.13.1-r1.ebuild b/net-irc/quassel/quassel-0.13.1-r1.ebuild
146 new file mode 100644
147 index 00000000000..67c973cdf7d
148 --- /dev/null
149 +++ b/net-irc/quassel/quassel-0.13.1-r1.ebuild
150 @@ -0,0 +1,192 @@
151 +# Copyright 1999-2020 Gentoo Authors
152 +# Distributed under the terms of the GNU General Public License v2
153 +
154 +EAPI=7
155 +
156 +inherit cmake xdg-utils pax-utils systemd user
157 +
158 +if [[ ${PV} != *9999* ]]; then
159 + MY_P=${PN}-${PV/_/-}
160 + SRC_URI="https://quassel-irc.org/pub/${MY_P}.tar.bz2"
161 + KEYWORDS="~amd64 ~arm ~x86 ~amd64-linux ~sparc-solaris"
162 + S="${WORKDIR}/${MY_P}"
163 +else
164 + EGIT_REPO_URI=( "https://github.com/${PN}/${PN}" )
165 + inherit git-r3
166 +fi
167 +
168 +DESCRIPTION="Qt/KDE IRC client supporting a remote daemon for 24/7 connectivity"
169 +HOMEPAGE="https://quassel-irc.org/"
170 +LICENSE="GPL-3"
171 +SLOT="0"
172 +IUSE="bundled-icons crypt +dbus debug kde ldap monolithic oxygen postgres +server
173 +snorenotify +ssl syslog urlpreview X"
174 +
175 +SERVER_DEPEND="
176 + dev-qt/qtscript:5
177 + crypt? ( app-crypt/qca:2[ssl] )
178 + ldap? ( net-nds/openldap )
179 + postgres? ( dev-qt/qtsql:5[postgres] )
180 + !postgres? ( dev-qt/qtsql:5[sqlite] dev-db/sqlite:3[threadsafe(+),-secure-delete] )
181 + syslog? ( virtual/logger )
182 +"
183 +
184 +GUI_DEPEND="
185 + dev-qt/qtgui:5
186 + dev-qt/qtmultimedia:5
187 + dev-qt/qtwidgets:5
188 + !bundled-icons? (
189 + kde-frameworks/breeze-icons:5
190 + oxygen? ( kde-frameworks/oxygen-icons:5 )
191 + )
192 + dbus? (
193 + >=dev-libs/libdbusmenu-qt-0.9.3_pre20140619
194 + dev-qt/qtdbus:5
195 + )
196 + kde? (
197 + kde-frameworks/kconfigwidgets:5
198 + kde-frameworks/kcoreaddons:5
199 + kde-frameworks/knotifications:5
200 + kde-frameworks/knotifyconfig:5
201 + kde-frameworks/ktextwidgets:5
202 + kde-frameworks/kwidgetsaddons:5
203 + kde-frameworks/kxmlgui:5
204 + kde-frameworks/sonnet:5
205 + )
206 + snorenotify? ( >=x11-libs/snorenotify-0.7.0 )
207 + urlpreview? ( dev-qt/qtwebengine:5[widgets] )
208 +"
209 +
210 +DEPEND="
211 + dev-qt/qtcore:5
212 + dev-qt/qtnetwork:5[ssl?]
213 + sys-libs/zlib
214 + monolithic? (
215 + ${SERVER_DEPEND}
216 + ${GUI_DEPEND}
217 + )
218 + !monolithic? (
219 + server? ( ${SERVER_DEPEND} )
220 + X? ( ${GUI_DEPEND} )
221 + )
222 +"
223 +RDEPEND="${DEPEND}"
224 +BDEPEND="
225 + dev-qt/linguist-tools:5
226 + kde-frameworks/extra-cmake-modules
227 +"
228 +
229 +DOCS=( AUTHORS ChangeLog README.md )
230 +
231 +REQUIRED_USE="
232 + || ( X server monolithic )
233 + crypt? ( || ( server monolithic ) )
234 + kde? ( || ( X monolithic ) dbus )
235 + ldap? ( || ( server monolithic ) )
236 + postgres? ( || ( server monolithic ) )
237 + snorenotify? ( || ( X monolithic ) )
238 + syslog? ( || ( server monolithic ) )
239 +"
240 +
241 +PATCHES=( "${FILESDIR}/${P}-qt5.14.patch" )
242 +
243 +pkg_setup() {
244 + if use server; then
245 + QUASSEL_DIR=/var/lib/${PN}
246 + QUASSEL_USER=${PN}
247 + # create quassel:quassel user
248 + enewgroup "${QUASSEL_USER}"
249 + enewuser "${QUASSEL_USER}" -1 -1 "${QUASSEL_DIR}" "${QUASSEL_USER}"
250 + fi
251 +}
252 +
253 +src_configure() {
254 + local mycmakeargs=(
255 + -DUSE_QT4=OFF
256 + -DUSE_QT5=ON
257 + -DUSE_CCACHE=OFF
258 + -DCMAKE_SKIP_RPATH=ON
259 + -DEMBED_DATA=OFF
260 + -DWITH_WEBKIT=OFF
261 + -DWITH_BUNDLED_ICONS=$(usex bundled-icons)
262 + $(cmake_use_find_package dbus dbusmenu-qt5)
263 + $(cmake_use_find_package dbus Qt5DBus)
264 + -DWITH_KDE=$(usex kde)
265 + -DWITH_LDAP=$(usex ldap)
266 + -DWANT_MONO=$(usex monolithic)
267 + -DWITH_OXYGEN_ICONS=$(usex oxygen)
268 + -DWANT_CORE=$(usex server)
269 + $(cmake_use_find_package snorenotify LibsnoreQt5)
270 + -DWITH_WEBENGINE=$(usex urlpreview)
271 + -DWANT_QTCLIENT=$(usex X)
272 + )
273 +
274 + if use server || use monolithic; then
275 + mycmakeargs+=( $(cmake_use_find_package crypt QCA2-QT5) )
276 + fi
277 +
278 + cmake_src_configure
279 +}
280 +
281 +src_install() {
282 + cmake_src_install
283 +
284 + if use server ; then
285 + # needs PAX marking wrt bug#346255
286 + pax-mark m "${ED}/usr/bin/quasselcore"
287 +
288 + # prepare folders in /var/
289 + keepdir "${QUASSEL_DIR}"
290 + fowners "${QUASSEL_USER}":"${QUASSEL_USER}" "${QUASSEL_DIR}"
291 +
292 + # init scripts & systemd unit
293 + newinitd "${FILESDIR}"/quasselcore.init-r1 quasselcore
294 + newconfd "${FILESDIR}"/quasselcore.conf-r1 quasselcore
295 + systemd_dounit "${FILESDIR}"/quasselcore.service
296 +
297 + # logrotate
298 + insinto /etc/logrotate.d
299 + newins "${FILESDIR}/quassel.logrotate" quassel
300 + fi
301 +}
302 +
303 +pkg_postinst() {
304 + if use monolithic && use ssl ; then
305 + elog "Information on how to enable SSL support for client/core connections"
306 + elog "is available at http://bugs.quassel-irc.org/projects/quassel-irc/wiki/Client-Core_SSL_support."
307 + fi
308 +
309 + if use server; then
310 + einfo "If you want to generate SSL certificate remember to run:"
311 + einfo " emerge --config =${CATEGORY}/${PF}"
312 + fi
313 +
314 + if use server || use monolithic ; then
315 + einfo "Quassel can use net-misc/oidentd package if installed on your system."
316 + einfo "Consider installing it if you want to run quassel within identd daemon."
317 + fi
318 +
319 + xdg_icon_cache_update
320 +}
321 +
322 +pkg_postrm() {
323 + xdg_icon_cache_update
324 +}
325 +
326 +pkg_config() {
327 + if use server && use ssl; then
328 + # generate the pem file only when it does not already exist
329 + if [ ! -f "${QUASSEL_DIR}/quasselCert.pem" ]; then
330 + einfo "Generating QUASSEL SSL certificate to: \"${QUASSEL_DIR}/quasselCert.pem\""
331 + openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
332 + -keyout "${QUASSEL_DIR}/quasselCert.pem" \
333 + -out "${QUASSEL_DIR}/quasselCert.pem"
334 + # permissions for the key
335 + chown ${QUASSEL_USER}:${QUASSEL_USER} "${QUASSEL_DIR}/quasselCert.pem"
336 + chmod 400 "${QUASSEL_DIR}/quasselCert.pem"
337 + else
338 + einfo "Certificate \"${QUASSEL_DIR}/quasselCert.pem\" already exists."
339 + einfo "Remove it if you want to create new one."
340 + fi
341 + fi
342 +}