1 |
commit: 7dd0463d8d7d3a9b80c6a702e8ad561de31db674 |
2 |
Author: Louis Sautier <sbraz <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Aug 7 15:51:33 2022 +0000 |
4 |
Commit: Louis Sautier <sbraz <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Aug 7 16:00:12 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7dd0463d |
7 |
|
8 |
net-irc/znc: fix build with -Werror=odr, add py3.11, EAPI 8 |
9 |
|
10 |
Closes: https://bugs.gentoo.org/861470 |
11 |
Signed-off-by: Louis Sautier <sbraz <AT> gentoo.org> |
12 |
|
13 |
.../znc/files/znc-1.8.2-fix-odr-violation.patch | 56 ++++++ |
14 |
net-irc/znc/znc-1.8.2-r2.ebuild | 195 +++++++++++++++++++++ |
15 |
2 files changed, 251 insertions(+) |
16 |
|
17 |
diff --git a/net-irc/znc/files/znc-1.8.2-fix-odr-violation.patch b/net-irc/znc/files/znc-1.8.2-fix-odr-violation.patch |
18 |
new file mode 100644 |
19 |
index 000000000000..967d6e35c2ea |
20 |
--- /dev/null |
21 |
+++ b/net-irc/znc/files/znc-1.8.2-fix-odr-violation.patch |
22 |
@@ -0,0 +1,56 @@ |
23 |
+From 3e45b2f35f194100ec3293c7f3e36f95f48b0cb8 Mon Sep 17 00:00:00 2001 |
24 |
+From: Uli Schlachter <psychon@×××.in> |
25 |
+Date: Fri, 5 Aug 2022 16:12:40 +0200 |
26 |
+Subject: [PATCH] Fix an ODR violation |
27 |
+ |
28 |
+Building with CFLAGS="-flto -Werror=odr -Werror=lto-type-mismatch |
29 |
+-Werror=strict-aliasing" CXXFLAGS="-flto -Werror=odr |
30 |
+-Werror=lto-type-mismatch -Werror=strict-aliasing" LDFLAGS=-flto fails |
31 |
+due to a violation of the one definition rule. There are two different |
32 |
+definitions of TOption that are both linked into the znc binary. |
33 |
+ |
34 |
+Fix this by putting them into anonymous namespaces. |
35 |
+ |
36 |
+Fixes: https://github.com/znc/znc/issues/1834 |
37 |
+Signed-off-by: Uli Schlachter <psychon@×××.in> |
38 |
+--- |
39 |
+ src/IRCNetwork.cpp | 2 ++ |
40 |
+ src/User.cpp | 2 ++ |
41 |
+ 2 files changed, 4 insertions(+) |
42 |
+ |
43 |
+diff --git a/src/IRCNetwork.cpp b/src/IRCNetwork.cpp |
44 |
+index 46a2481a49..99f9242907 100644 |
45 |
+--- a/src/IRCNetwork.cpp |
46 |
++++ b/src/IRCNetwork.cpp |
47 |
+@@ -363,11 +363,13 @@ CString CIRCNetwork::GetNetworkPath() const { |
48 |
+ return sNetworkPath; |
49 |
+ } |
50 |
+ |
51 |
++namespace { |
52 |
+ template <class T> |
53 |
+ struct TOption { |
54 |
+ const char* name; |
55 |
+ void (CIRCNetwork::*pSetter)(T); |
56 |
+ }; |
57 |
++} |
58 |
+ |
59 |
+ bool CIRCNetwork::ParseConfig(CConfig* pConfig, CString& sError, |
60 |
+ bool bUpgrade) { |
61 |
+diff --git a/src/User.cpp b/src/User.cpp |
62 |
+index 2ab5fac66f..16624adbbe 100644 |
63 |
+--- a/src/User.cpp |
64 |
++++ b/src/User.cpp |
65 |
+@@ -135,11 +135,13 @@ CUser::~CUser() { |
66 |
+ CZNC::Get().AddBytesWritten(m_uBytesWritten); |
67 |
+ } |
68 |
+ |
69 |
++namespace { |
70 |
+ template <class T> |
71 |
+ struct TOption { |
72 |
+ const char* name; |
73 |
+ void (CUser::*pSetter)(T); |
74 |
+ }; |
75 |
++} |
76 |
+ |
77 |
+ bool CUser::ParseConfig(CConfig* pConfig, CString& sError) { |
78 |
+ TOption<const CString&> StringOptions[] = { |
79 |
|
80 |
diff --git a/net-irc/znc/znc-1.8.2-r2.ebuild b/net-irc/znc/znc-1.8.2-r2.ebuild |
81 |
new file mode 100644 |
82 |
index 000000000000..fab250986d5e |
83 |
--- /dev/null |
84 |
+++ b/net-irc/znc/znc-1.8.2-r2.ebuild |
85 |
@@ -0,0 +1,195 @@ |
86 |
+# Copyright 1999-2022 Gentoo Authors |
87 |
+# Distributed under the terms of the GNU General Public License v2 |
88 |
+ |
89 |
+EAPI=8 |
90 |
+ |
91 |
+PYTHON_COMPAT=( python3_{8..11} ) |
92 |
+ |
93 |
+inherit cmake python-single-r1 readme.gentoo-r1 systemd |
94 |
+ |
95 |
+GTEST_VER="1.8.1" |
96 |
+GTEST_URL="https://github.com/google/googletest/archive/${GTEST_VER}.tar.gz -> gtest-${GTEST_VER}.tar.gz" |
97 |
+DESCRIPTION="An advanced IRC Bouncer" |
98 |
+ |
99 |
+if [[ ${PV} == *9999* ]]; then |
100 |
+ inherit git-r3 |
101 |
+ EGIT_REPO_URI="https://github.com/znc/znc.git" |
102 |
+else |
103 |
+ MY_PV=${PV/_/-} |
104 |
+ MY_P=${PN}-${MY_PV} |
105 |
+ SRC_URI=" |
106 |
+ https://znc.in/releases/archive/${MY_P}.tar.gz |
107 |
+ test? ( ${GTEST_URL} ) |
108 |
+ " |
109 |
+ KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~x86" |
110 |
+ S=${WORKDIR}/${MY_P} |
111 |
+fi |
112 |
+ |
113 |
+HOMEPAGE="https://znc.in" |
114 |
+LICENSE="Apache-2.0" |
115 |
+# "If you upgrade your ZNC version, you must recompile all your modules." |
116 |
+# - https://wiki.znc.in/Compiling_modules |
117 |
+SLOT="0/${PV}" |
118 |
+IUSE="+ipv6 +icu nls perl python +ssl sasl tcl test +zlib" |
119 |
+RESTRICT="!test? ( test )" |
120 |
+ |
121 |
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} icu )" |
122 |
+ |
123 |
+# perl is a build-time dependency of modpython |
124 |
+BDEPEND=" |
125 |
+ virtual/pkgconfig |
126 |
+ nls? ( sys-devel/gettext ) |
127 |
+ perl? ( |
128 |
+ >=dev-lang/swig-3.0.0 |
129 |
+ >=dev-lang/perl-5.10 |
130 |
+ ) |
131 |
+ python? ( |
132 |
+ >=dev-lang/swig-3.0.0 |
133 |
+ >=dev-lang/perl-5.10 |
134 |
+ ) |
135 |
+ test? ( |
136 |
+ ${PYTHON_DEPS} |
137 |
+ dev-qt/qtnetwork:5 |
138 |
+ ) |
139 |
+" |
140 |
+DEPEND=" |
141 |
+ icu? ( dev-libs/icu:= ) |
142 |
+ nls? ( dev-libs/boost:=[nls] ) |
143 |
+ perl? ( >=dev-lang/perl-5.10:= ) |
144 |
+ python? ( ${PYTHON_DEPS} ) |
145 |
+ sasl? ( >=dev-libs/cyrus-sasl-2 ) |
146 |
+ ssl? ( dev-libs/openssl:0= ) |
147 |
+ tcl? ( dev-lang/tcl:0= ) |
148 |
+ zlib? ( sys-libs/zlib:0= ) |
149 |
+" |
150 |
+RDEPEND=" |
151 |
+ ${DEPEND} |
152 |
+ acct-user/znc |
153 |
+ acct-group/znc |
154 |
+" |
155 |
+ |
156 |
+PATCHES=( |
157 |
+ "${FILESDIR}"/${PN}-1.7.1-inttest-dir.patch |
158 |
+ # All these are backports |
159 |
+ "${FILESDIR}"/${P}-fix-systemd-datadir.patch |
160 |
+ "${FILESDIR}"/${P}-add-libera.patch |
161 |
+ "${FILESDIR}"/${P}-fix-python-3.10.patch |
162 |
+ "${FILESDIR}"/${P}-fix-odr-violation.patch |
163 |
+) |
164 |
+ |
165 |
+pkg_setup() { |
166 |
+ if use python; then |
167 |
+ python-single-r1_pkg_setup |
168 |
+ fi |
169 |
+} |
170 |
+ |
171 |
+src_prepare() { |
172 |
+ # Let SWIG rebuild modperl/modpython to make user patching easier. |
173 |
+ if [[ ${PV} != *9999* ]]; then |
174 |
+ rm modules/modperl/generated.tar.gz || die |
175 |
+ rm modules/modpython/generated.tar.gz || die |
176 |
+ fi |
177 |
+ |
178 |
+ sed -i -e "s|DZNC_BIN_DIR:path=|DZNC_BIN_DIR:path=${T}/inttest|" \ |
179 |
+ test/CMakeLists.txt || die |
180 |
+ |
181 |
+ sed -i "s|--datadir=|&${EPREFIX}|" znc.service.in || die |
182 |
+ |
183 |
+ cmake_src_prepare |
184 |
+} |
185 |
+ |
186 |
+src_configure() { |
187 |
+ local mycmakeargs=( |
188 |
+ -DWANT_SYSTEMD=yes # Causes -DSYSTEMD_DIR to be used. |
189 |
+ -DSYSTEMD_DIR="$(systemd_get_systemunitdir)" |
190 |
+ -DWANT_ICU="$(usex icu)" |
191 |
+ -DWANT_IPV6="$(usex ipv6)" |
192 |
+ -DWANT_I18N="$(usex nls)" |
193 |
+ -DWANT_PERL="$(usex perl)" |
194 |
+ -DWANT_PYTHON="$(usex python)" |
195 |
+ -DWANT_PYTHON_VERSION="${EPYTHON#python}" |
196 |
+ -DWANT_CYRUS="$(usex sasl)" |
197 |
+ -DWANT_OPENSSL="$(usex ssl)" |
198 |
+ -DWANT_TCL="$(usex tcl)" |
199 |
+ -DWANT_ZLIB="$(usex zlib)" |
200 |
+ ) |
201 |
+ |
202 |
+ if [[ ${PV} != *9999* ]] && use test; then |
203 |
+ export GTEST_ROOT="${WORKDIR}/googletest-release-${GTEST_VER}/googletest" |
204 |
+ export GMOCK_ROOT="${WORKDIR}/googletest-release-${GTEST_VER}/googlemock" |
205 |
+ fi |
206 |
+ |
207 |
+ cmake_src_configure |
208 |
+} |
209 |
+ |
210 |
+src_test() { |
211 |
+ cmake_build unittest |
212 |
+ DESTDIR="${T}/inttest" cmake_build install |
213 |
+ local filter='-' |
214 |
+ if ! use perl; then |
215 |
+ filter="${filter}:ZNCTest.Modperl*" |
216 |
+ fi |
217 |
+ if ! use python; then |
218 |
+ filter="${filter}:ZNCTest.Modpython*" |
219 |
+ fi |
220 |
+ # CMAKE_PREFIX_PATH and CXXFLAGS are needed for znc-buildmod |
221 |
+ # invocations from inside the test |
222 |
+ GTEST_FILTER="${filter}" ZNC_UNUSUAL_ROOT="${T}/inttest" \ |
223 |
+ CMAKE_PREFIX_PATH="${T}/inttest/usr/share/znc/cmake" \ |
224 |
+ CXXFLAGS="${CXXFLAGS} -isystem ${T}/inttest/usr/include" \ |
225 |
+ cmake_build inttest |
226 |
+} |
227 |
+ |
228 |
+src_install() { |
229 |
+ cmake_src_install |
230 |
+ |
231 |
+ dodoc NOTICE |
232 |
+ newinitd "${FILESDIR}"/znc.initd-r2 znc |
233 |
+ newconfd "${FILESDIR}"/znc.confd-r1 znc |
234 |
+ |
235 |
+ local DOC_CONTENTS |
236 |
+ # "local" has its own return value which is not what we want to catch |
237 |
+ DOC_CONTENTS=$(<"${FILESDIR}/README.gentoo-r1") || die |
238 |
+ local DISABLE_AUTOFORMATTING=1 |
239 |
+ readme.gentoo_create_doc |
240 |
+} |
241 |
+ |
242 |
+pkg_postinst() { |
243 |
+ if [[ -d "${EROOT}/var/lib/znc/.znc/" ]]; then |
244 |
+ eerror "${EROOT}/var/lib/znc/.znc/ exists, please move your data to ${EROOT}/var/lib/znc/" |
245 |
+ eerror "" |
246 |
+ eerror "The systemd unit has changed and now expects data to be located" |
247 |
+ eerror "at the root of ${EROOT}/var/lib/znc instead of its '.znc' subfolder." |
248 |
+ eerror "The recommended procedure to move the data is the following:" |
249 |
+ eerror "1. stop the service: systemctl stop znc.service" |
250 |
+ eerror "2. move the data: cp -a '${EROOT}/var/lib/znc/.znc/.' '${EROOT}/var/lib/znc/'" |
251 |
+ eerror "3. fix the config file: sed -i 's|${EROOT}/var/lib/znc/.znc|${EROOT}/var/lib/znc|g' '${EROOT}/var/lib/znc/configs/znc.conf'" |
252 |
+ eerror "4. restart znc: systemctl start znc.service" |
253 |
+ eerror "5. once everything works, remove the old data directory: rm -r '${EROOT}/var/lib/znc/.znc/'" |
254 |
+ eerror "See https://bugs.gentoo.org/743856 for details." |
255 |
+ fi |
256 |
+ |
257 |
+ if [[ -z "${REPLACING_VERSIONS}" ]]; then |
258 |
+ # This is a new installation |
259 |
+ readme.gentoo_print_elog |
260 |
+ fi |
261 |
+} |
262 |
+ |
263 |
+pkg_config() { |
264 |
+ if [[ -d "${EROOT}/var/lib/znc/configs" ]]; then |
265 |
+ ewarn "${EROOT}/var/lib/znc/configs/ already exists," |
266 |
+ ewarn "aborting to avoid damaging any existing configuration." |
267 |
+ ewarn "If you are sure you want to generate a new configuration," |
268 |
+ ewarn "remove the folder and try again." |
269 |
+ else |
270 |
+ einfo "Press enter to interactively create a new configuration file for znc." |
271 |
+ einfo "To abort, press Control-C" |
272 |
+ read |
273 |
+ su ${PN} -p -s /bin/sh -c 'ZNC_NO_LAUNCH_AFTER_MAKECONF=1 \ |
274 |
+ "${EROOT}"/usr/bin/znc --makeconf \ |
275 |
+ --datadir "${EROOT}/var/lib/znc"' || die "Config failed" |
276 |
+ einfo |
277 |
+ einfo "You can now start the znc service using the init system of your choice." |
278 |
+ einfo "Don't forget to enable it if you want to use znc at boot." |
279 |
+ fi |
280 |
+} |