Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/dbus/files/, sys-apps/dbus/
Date: Mon, 12 Sep 2022 18:04:25
Message-Id: 1663005855.d1a79e781bbe17899a96df6137118e6a03076737.sam@gentoo
1 commit: d1a79e781bbe17899a96df6137118e6a03076737
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Mon Sep 12 17:39:27 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Mon Sep 12 18:04:15 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d1a79e78
7
8 sys-apps/dbus: fix configure tests with Clang 15
9
10 Signed-off-by: Sam James <sam <AT> gentoo.org>
11
12 sys-apps/dbus/dbus-1.14.0-r5.ebuild | 294 +++++++++++++++++++++
13 .../files/dbus-1.14.0-clang-15-configure.patch | 26 ++
14 2 files changed, 320 insertions(+)
15
16 diff --git a/sys-apps/dbus/dbus-1.14.0-r5.ebuild b/sys-apps/dbus/dbus-1.14.0-r5.ebuild
17 new file mode 100644
18 index 000000000000..64f28fbcc48f
19 --- /dev/null
20 +++ b/sys-apps/dbus/dbus-1.14.0-r5.ebuild
21 @@ -0,0 +1,294 @@
22 +# Copyright 1999-2022 Gentoo Authors
23 +# Distributed under the terms of the GNU General Public License v2
24 +
25 +EAPI=7
26 +
27 +PYTHON_COMPAT=( python3_{8..10} )
28 +TMPFILES_OPTIONAL=1
29 +
30 +# At least at the moment, while a CMake port exists, it's not recommended
31 +# for distributions.
32 +# https://gitlab.freedesktop.org/dbus/dbus/-/blob/master/CONTRIBUTING.md#L189
33 +inherit autotools flag-o-matic linux-info python-any-r1 readme.gentoo-r1 systemd tmpfiles virtualx multilib-minimal
34 +
35 +DESCRIPTION="A message bus system, a simple way for applications to talk to each other"
36 +HOMEPAGE="https://www.freedesktop.org/wiki/Software/dbus/"
37 +SRC_URI="https://dbus.freedesktop.org/releases/dbus/${P}.tar.xz"
38 +
39 +LICENSE="|| ( AFL-2.1 GPL-2 )"
40 +SLOT="0"
41 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
42 +IUSE="debug doc elogind selinux static-libs systemd test X"
43 +RESTRICT="!test? ( test )"
44 +
45 +REQUIRED_USE="?? ( elogind systemd )"
46 +
47 +BDEPEND="
48 + acct-user/messagebus
49 + app-text/xmlto
50 + app-text/docbook-xml-dtd:4.4
51 + sys-devel/autoconf-archive
52 + virtual/pkgconfig
53 + doc? ( app-doc/doxygen )
54 +"
55 +COMMON_DEPEND="
56 + >=dev-libs/expat-2.1.0
57 + elogind? ( sys-auth/elogind )
58 + selinux? ( sys-libs/libselinux )
59 + systemd? ( sys-apps/systemd:0= )
60 + X? (
61 + x11-libs/libX11
62 + x11-libs/libXt
63 + )
64 +"
65 +DEPEND="${COMMON_DEPEND}
66 + dev-libs/expat
67 + test? (
68 + ${PYTHON_DEPS}
69 + >=dev-libs/glib-2.40:2
70 + )
71 +"
72 +RDEPEND="${COMMON_DEPEND}
73 + acct-user/messagebus
74 + selinux? ( sec-policy/selinux-dbus )
75 + systemd? ( virtual/tmpfiles )
76 +"
77 +
78 +DOC_CONTENTS="
79 + Some applications require a session bus in addition to the system
80 + bus. Please see \`man dbus-launch\` for more information.
81 +"
82 +
83 +# out of sources build dir for make check
84 +TBD="${WORKDIR}/${P}-tests-build"
85 +
86 +PATCHES=(
87 + "${FILESDIR}/dbus-enable-elogind.patch"
88 + "${FILESDIR}/dbus-daemon-optional.patch" # bug #653136
89 +
90 + "${FILESDIR}/dbus-1.14.0-x-autoconf-fixes.patch"
91 + "${FILESDIR}/dbus-1.12.22-check-fd.patch"
92 +
93 + # https://bugs.gentoo.org/836560
94 + "${FILESDIR}/dbus-1.14.0-oom_score_adj.patch"
95 +
96 + "${FILESDIR}/dbus-1.14.0-clang-15-configure.patch"
97 +)
98 +
99 +pkg_setup() {
100 + use test && python-any-r1_pkg_setup
101 +
102 + if use kernel_linux; then
103 + CONFIG_CHECK="~EPOLL"
104 + linux-info_pkg_setup
105 + fi
106 +}
107 +
108 +src_prepare() {
109 + default
110 +
111 + if [[ ${CHOST} == *-solaris* ]]; then
112 + # fix standards conflict, due to gcc being c99 by default nowadays
113 + sed -i \
114 + -e 's/_XOPEN_SOURCE=500/_XOPEN_SOURCE=600/' \
115 + configure.ac || die
116 + fi
117 +
118 + # required for bug #263909, cross-compile so don't remove eautoreconf
119 + eautoreconf
120 +}
121 +
122 +src_configure() {
123 + local rundir=$(usex kernel_linux /run /var/run)
124 +
125 + sed -e "s;@rundir@;${EPREFIX}${rundir};g" "${FILESDIR}"/dbus.initd.in \
126 + > "${T}"/dbus.initd || die
127 +
128 + multilib-minimal_src_configure
129 +}
130 +
131 +multilib_src_configure() {
132 + local docconf myconf testconf
133 +
134 + # so we can get backtraces from apps
135 + case ${CHOST} in
136 + *-mingw*)
137 + # error: unrecognized command line option '-rdynamic', bug #488036
138 + ;;
139 + *)
140 + append-flags -rdynamic
141 + ;;
142 + esac
143 +
144 + # libaudit is *only* used in DBus wrt SELinux support, so disable it, if
145 + # not on an SELinux profile.
146 + myconf=(
147 + --localstatedir="${EPREFIX}/var"
148 + $(use_enable static-libs static)
149 + $(use_enable debug verbose-mode)
150 + --disable-asserts
151 + --disable-checks
152 + $(use_enable selinux)
153 + $(use_enable selinux libaudit)
154 + --disable-apparmor
155 + $(use_enable kernel_linux inotify)
156 + --disable-kqueue
157 + $(use_enable elogind)
158 + $(use_enable systemd)
159 + $(use_enable systemd user-session)
160 + --disable-embedded-tests
161 + --disable-modular-tests
162 + $(use_enable debug stats)
163 + --with-session-socket-dir="${EPREFIX}"/tmp
164 + --with-system-pid-file="${EPREFIX}${rundir}"/dbus.pid
165 + --with-system-socket="${EPREFIX}${rundir}"/dbus/system_bus_socket
166 + --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
167 + --with-systemduserunitdir="$(systemd_get_userunitdir)"
168 + --with-dbus-user=messagebus
169 + $(use_with X x)
170 + )
171 +
172 + if [[ ${CHOST} == *-darwin* ]]; then
173 + myconf+=(
174 + --enable-launchd
175 + --with-launchd-agent-dir="${EPREFIX}"/Library/LaunchAgents
176 + )
177 + fi
178 +
179 + if multilib_is_native_abi; then
180 + docconf=(
181 + --enable-xml-docs
182 + $(use_enable doc doxygen-docs)
183 + )
184 + else
185 + docconf=(
186 + --disable-xml-docs
187 + --disable-doxygen-docs
188 + )
189 + myconf+=(
190 + --disable-daemon
191 + --disable-selinux
192 + --disable-libaudit
193 + --disable-elogind
194 + --disable-systemd
195 + --without-x
196 + )
197 + fi
198 +
199 + einfo "Running configure in ${BUILD_DIR}"
200 + ECONF_SOURCE="${S}" econf "${myconf[@]}" "${docconf[@]}"
201 +
202 + if multilib_is_native_abi && use test; then
203 + mkdir "${TBD}" || die
204 + cd "${TBD}" || die
205 + testconf=(
206 + $(use_enable test asserts)
207 + $(use_enable test checks)
208 + $(use_enable test embedded-tests)
209 + $(use_enable test stats)
210 + $(has_version dev-libs/dbus-glib && echo --enable-modular-tests)
211 + )
212 + einfo "Running configure in ${TBD}"
213 + ECONF_SOURCE="${S}" econf "${myconf[@]}" "${testconf[@]}"
214 + fi
215 +}
216 +
217 +multilib_src_compile() {
218 + if multilib_is_native_abi; then
219 + # After the compile, it uses a selinuxfs interface to
220 + # check if the SELinux policy has the right support
221 + use selinux && addwrite /selinux/access
222 +
223 + einfo "Running make in ${BUILD_DIR}"
224 + emake
225 +
226 + if use test; then
227 + einfo "Running make in ${TBD}"
228 + emake -C "${TBD}"
229 + fi
230 + else
231 + emake -C dbus libdbus-1.la
232 + fi
233 +}
234 +
235 +src_test() {
236 + # DBUS_TEST_MALLOC_FAILURES=0 to avoid huge test logs
237 + # https://gitlab.freedesktop.org/dbus/dbus/-/blob/master/CONTRIBUTING.md#L231
238 + DBUS_TEST_MALLOC_FAILURES=0 DBUS_VERBOSE=1 virtx emake -j1 -C "${TBD}" check
239 +
240 +}
241 +
242 +multilib_src_install() {
243 + if multilib_is_native_abi; then
244 + emake DESTDIR="${D}" install
245 + else
246 + emake DESTDIR="${D}" install-pkgconfigDATA
247 + emake DESTDIR="${D}" -C dbus \
248 + install-libLTLIBRARIES install-dbusincludeHEADERS \
249 + install-nodist_dbusarchincludeHEADERS
250 + fi
251 +}
252 +
253 +multilib_src_install_all() {
254 + newinitd "${T}"/dbus.initd dbus
255 +
256 + if use X; then
257 + # dbus X session script (bug #77504)
258 + # turns out to only work for GDM (and startx). has been merged into
259 + # other desktop (kdm and such scripts)
260 + exeinto /etc/X11/xinit/xinitrc.d
261 + newexe "${FILESDIR}"/80-dbus-r1 80-dbus
262 + fi
263 +
264 + # Needs to exist for dbus sessions to launch
265 + keepdir /usr/share/dbus-1/services
266 + keepdir /etc/dbus-1/{session,system}.d
267 + # machine-id symlink from pkg_postinst()
268 + keepdir /var/lib/dbus
269 + # Let the init script create the /var/run/dbus directory
270 + rm -rf "${ED}"/var/run
271 +
272 + # bug #761763
273 + rm -rf "${ED}"/usr/lib/sysusers.d
274 +
275 + dodoc AUTHORS NEWS README doc/TODO
276 + readme.gentoo_create_doc
277 +
278 + find "${ED}" -name '*.la' -delete || die
279 +}
280 +
281 +pkg_postinst() {
282 + readme.gentoo_print_elog
283 +
284 + if use systemd; then
285 + tmpfiles_process dbus.conf
286 + fi
287 +
288 + # Ensure unique id is generated and put it in /etc wrt bug #370451 but symlink
289 + # for DBUS_MACHINE_UUID_FILE (see tools/dbus-launch.c) and reverse
290 + # dependencies with hardcoded paths (although the known ones got fixed already)
291 + # TODO: should be safe to remove at least the ln because of the above tmpfiles_process?
292 + dbus-uuidgen --ensure="${EROOT}"/etc/machine-id
293 + ln -sf "${EPREFIX}"/etc/machine-id "${EROOT}"/var/lib/dbus/machine-id
294 +
295 + if [[ ${CHOST} == *-darwin* ]]; then
296 + local plist="org.freedesktop.dbus-session.plist"
297 + elog
298 + elog
299 + elog "For MacOS/Darwin we now ship launchd support for dbus."
300 + elog "This enables autolaunch of dbus at session login and makes"
301 + elog "dbus usable under MacOS/Darwin."
302 + elog
303 + elog "The launchd plist file ${plist} has been"
304 + elog "installed in ${EPREFIX}/Library/LaunchAgents."
305 + elog "For it to be used, you will have to do all of the following:"
306 + elog " + cd ~/Library/LaunchAgents"
307 + elog " + ln -s ${EPREFIX}/Library/LaunchAgents/${plist}"
308 + elog " + logout and log back in"
309 + elog
310 + elog "If your application needs a proper DBUS_SESSION_BUS_ADDRESS"
311 + elog "specified and refused to start otherwise, then export the"
312 + elog "the following to your environment:"
313 + elog " DBUS_SESSION_BUS_ADDRESS=\"launchd:env=DBUS_LAUNCHD_SESSION_BUS_SOCKET\""
314 + fi
315 +}
316
317 diff --git a/sys-apps/dbus/files/dbus-1.14.0-clang-15-configure.patch b/sys-apps/dbus/files/dbus-1.14.0-clang-15-configure.patch
318 new file mode 100644
319 index 000000000000..821279c50ee9
320 --- /dev/null
321 +++ b/sys-apps/dbus/files/dbus-1.14.0-clang-15-configure.patch
322 @@ -0,0 +1,26 @@
323 +https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/339
324 +
325 +From 88c96ff6a351758cb7c69a25e3a8464b5164a19c Mon Sep 17 00:00:00 2001
326 +From: Sam James <sam@g.o>
327 +Date: Mon, 12 Sep 2022 18:37:35 +0100
328 +Subject: [PATCH] configure.ac: fix configure tests broken with Clang 15
329 + (implicit function declarations)
330 +
331 +Clang 15 makes implicit function declarations fatal by default which
332 +leads to some configure tests silently failing/returning
333 +the wrong result.
334 +
335 +Signed-off-by: Sam James <sam@g.o>
336 +--- a/configure.ac
337 ++++ b/configure.ac
338 +@@ -613,7 +613,8 @@ AS_IF([test -n "$dbus_va_copy_func"],
339 + AC_CACHE_CHECK([whether $CC knows __sync_sub_and_fetch()],
340 + dbus_cv_sync_sub_and_fetch,
341 + [AC_LINK_IFELSE([
342 +- AC_LANG_PROGRAM([[]], [[int a = 4; int b = __sync_sub_and_fetch(&a, 4); exit(b); ]])],
343 ++ AC_LANG_PROGRAM([[]], [[#include <stdlib.h>
344 ++ int a = 4; int b = __sync_sub_and_fetch(&a, 4); exit(b); ]])],
345 + [dbus_cv_sync_sub_and_fetch=yes],
346 + [dbus_cv_sync_sub_and_fetch=no])
347 + ])
348 +GitLab