Gentoo Archives: gentoo-commits

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/dbus/, sys-apps/dbus/files/
Date: Thu, 21 Feb 2019 23:54:10
Message-Id: 1550793213.504ec9e306b7226f0fb0c709b429ebf16632a6c2.asturm@gentoo
1 commit: 504ec9e306b7226f0fb0c709b429ebf16632a6c2
2 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
3 AuthorDate: Thu Feb 21 23:02:53 2019 +0000
4 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
5 CommitDate: Thu Feb 21 23:53:33 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=504ec9e3
7
8 sys-apps/dbus: Fix build w/o dev-libs/expat (non-native ABI)
9
10 Closes: https://bugs.gentoo.org/653136
11 Closes: https://github.com/gentoo/gentoo/pull/11134
12 Package-Manager: Portage-2.3.62, Repoman-2.3.12
13 Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
14
15 sys-apps/dbus/dbus-1.12.12-r1.ebuild | 281 +++++++++++++++++++++++++
16 sys-apps/dbus/files/dbus-daemon-optional.patch | 75 +++++++
17 2 files changed, 356 insertions(+)
18
19 diff --git a/sys-apps/dbus/dbus-1.12.12-r1.ebuild b/sys-apps/dbus/dbus-1.12.12-r1.ebuild
20 new file mode 100644
21 index 00000000000..59c8de33e33
22 --- /dev/null
23 +++ b/sys-apps/dbus/dbus-1.12.12-r1.ebuild
24 @@ -0,0 +1,281 @@
25 +# Copyright 1999-2019 Gentoo Authors
26 +# Distributed under the terms of the GNU General Public License v2
27 +
28 +EAPI=7
29 +
30 +PYTHON_COMPAT=( python{2_7,3_{4,5,6,7}} )
31 +inherit autotools flag-o-matic linux-info python-any-r1 readme.gentoo-r1 systemd virtualx user multilib-minimal
32 +
33 +DESCRIPTION="A message bus system, a simple way for applications to talk to each other"
34 +HOMEPAGE="https://dbus.freedesktop.org/"
35 +SRC_URI="https://dbus.freedesktop.org/releases/dbus/${P}.tar.gz"
36 +
37 +LICENSE="|| ( AFL-2.1 GPL-2 )"
38 +SLOT="0"
39 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
40 +IUSE="debug doc elogind selinux static-libs systemd test user-session X"
41 +
42 +REQUIRED_USE="?? ( elogind systemd )"
43 +
44 +# autoconf-archive-2019.01.06 blocker added for bug #674830
45 +# Please check on bumps if the blocker is still necessary.
46 +BDEPEND="
47 + app-text/xmlto
48 + app-text/docbook-xml-dtd:4.4
49 + <sys-devel/autoconf-archive-2019.01.06
50 + virtual/pkgconfig
51 + doc? ( app-doc/doxygen )
52 +"
53 +COMMON_DEPEND="
54 + >=dev-libs/expat-2.1.0
55 + elogind? ( sys-auth/elogind )
56 + selinux? ( sys-libs/libselinux )
57 + systemd? ( sys-apps/systemd:0= )
58 + X? (
59 + x11-libs/libX11
60 + x11-libs/libXt
61 + )
62 +"
63 +DEPEND="${COMMON_DEPEND}
64 + dev-libs/expat
65 + test? (
66 + ${PYTHON_DEPS}
67 + >=dev-libs/glib-2.40:2
68 + )
69 +"
70 +RDEPEND="${COMMON_DEPEND}
71 + selinux? ( sec-policy/selinux-dbus )
72 +"
73 +
74 +DOC_CONTENTS="
75 + Some applications require a session bus in addition to the system
76 + bus. Please see \`man dbus-launch\` for more information.
77 +"
78 +
79 +# out of sources build dir for make check
80 +TBD="${WORKDIR}/${P}-tests-build"
81 +
82 +PATCHES=(
83 + "${FILESDIR}/${PN}-enable-elogind.patch"
84 + "${FILESDIR}/${PN}-daemon-optional.patch"
85 +)
86 +
87 +pkg_setup() {
88 + enewgroup messagebus
89 + enewuser messagebus -1 -1 -1 messagebus
90 +
91 + use test && python-any-r1_pkg_setup
92 +
93 + if use kernel_linux; then
94 + CONFIG_CHECK="~EPOLL"
95 + linux-info_pkg_setup
96 + fi
97 +}
98 +
99 +src_prepare() {
100 + # Tests were restricted because of this
101 + sed -i \
102 + -e 's/.*bus_dispatch_test.*/printf ("Disabled due to excess noise\\n");/' \
103 + -e '/"dispatch"/d' \
104 + bus/test-main.c || die
105 +
106 + default
107 +
108 + if [[ ${CHOST} == *-solaris* ]]; then
109 + # fix standards conflict, due to gcc being c99 by default nowadays
110 + sed -i \
111 + -e 's/_XOPEN_SOURCE=500/_XOPEN_SOURCE=600/' \
112 + configure.ac || die
113 + fi
114 +
115 + # required for bug 263909, cross-compile so don't remove eautoreconf
116 + eautoreconf
117 +}
118 +
119 +multilib_src_configure() {
120 + local docconf myconf testconf
121 +
122 + # so we can get backtraces from apps
123 + case ${CHOST} in
124 + *-mingw*)
125 + # error: unrecognized command line option '-rdynamic' wrt #488036
126 + ;;
127 + *)
128 + append-flags -rdynamic
129 + ;;
130 + esac
131 +
132 + # libaudit is *only* used in DBus wrt SELinux support, so disable it, if
133 + # not on an SELinux profile.
134 + myconf=(
135 + --localstatedir="${EPREFIX}/var"
136 + --docdir="${EPREFIX}/usr/share/doc/${PF}"
137 + --htmldir="${EPREFIX}/usr/share/doc/${PF}/html"
138 + $(use_enable static-libs static)
139 + $(use_enable debug verbose-mode)
140 + --disable-asserts
141 + --disable-checks
142 + $(use_enable selinux)
143 + $(use_enable selinux libaudit)
144 + --disable-apparmor
145 + $(use_enable kernel_linux inotify)
146 + $(use_enable kernel_FreeBSD kqueue)
147 + $(use_enable elogind)
148 + $(use_enable systemd)
149 + $(use_enable user-session)
150 + --disable-embedded-tests
151 + --disable-modular-tests
152 + $(use_enable debug stats)
153 + --with-session-socket-dir="${EPREFIX}"/tmp
154 + --with-system-pid-file="${EPREFIX}"/var/run/dbus.pid
155 + --with-system-socket="${EPREFIX}"/var/run/dbus/system_bus_socket
156 + --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
157 + --with-dbus-user=messagebus
158 + $(use_with X x)
159 + )
160 +
161 + if [[ ${CHOST} == *-darwin* ]]; then
162 + myconf+=(
163 + --enable-launchd
164 + --with-launchd-agent-dir="${EPREFIX}"/Library/LaunchAgents
165 + )
166 + fi
167 +
168 + if multilib_is_native_abi; then
169 + docconf=(
170 + --enable-xml-docs
171 + $(use_enable doc doxygen-docs)
172 + )
173 + else
174 + docconf=(
175 + --disable-xml-docs
176 + --disable-doxygen-docs
177 + )
178 + myconf+=(
179 + --disable-daemon
180 + --disable-selinux
181 + --disable-libaudit
182 + --disable-elogind
183 + --disable-systemd
184 + --without-x
185 + )
186 + fi
187 +
188 + einfo "Running configure in ${BUILD_DIR}"
189 + ECONF_SOURCE="${S}" econf "${myconf[@]}" "${docconf[@]}"
190 +
191 + if multilib_is_native_abi && use test; then
192 + mkdir "${TBD}" || die
193 + cd "${TBD}" || die
194 + testconf=(
195 + $(use_enable test asserts)
196 + $(use_enable test checks)
197 + $(use_enable test embedded-tests)
198 + $(use_enable test stats)
199 + $(has_version dev-libs/dbus-glib && echo --enable-modular-tests)
200 + )
201 + einfo "Running configure in ${TBD}"
202 + ECONF_SOURCE="${S}" econf "${myconf[@]}" "${testconf[@]}"
203 + fi
204 +}
205 +
206 +multilib_src_compile() {
207 + if multilib_is_native_abi; then
208 + # after the compile, it uses a selinuxfs interface to
209 + # check if the SELinux policy has the right support
210 + use selinux && addwrite /selinux/access
211 +
212 + einfo "Running make in ${BUILD_DIR}"
213 + emake
214 +
215 + if use test; then
216 + einfo "Running make in ${TBD}"
217 + emake -C "${TBD}"
218 + fi
219 + else
220 + emake -C dbus libdbus-1.la
221 + fi
222 +}
223 +
224 +src_test() {
225 + DBUS_VERBOSE=1 virtx emake -j1 -C "${TBD}" check
226 +}
227 +
228 +multilib_src_install() {
229 + if multilib_is_native_abi; then
230 + emake DESTDIR="${D}" install
231 + else
232 + emake DESTDIR="${D}" install-pkgconfigDATA
233 + emake DESTDIR="${D}" -C dbus \
234 + install-libLTLIBRARIES install-dbusincludeHEADERS \
235 + install-nodist_dbusarchincludeHEADERS
236 + fi
237 +}
238 +
239 +multilib_src_install_all() {
240 + newinitd "${FILESDIR}"/dbus.initd-r1 dbus
241 +
242 + if use X; then
243 + # dbus X session script (#77504)
244 + # turns out to only work for GDM (and startx). has been merged into
245 + # other desktop (kdm and such scripts)
246 + exeinto /etc/X11/xinit/xinitrc.d
247 + doexe "${FILESDIR}"/80-dbus
248 + fi
249 +
250 + # needs to exist for dbus sessions to launch
251 + keepdir /usr/share/dbus-1/services
252 + keepdir /etc/dbus-1/{session,system}.d
253 + # machine-id symlink from pkg_postinst()
254 + keepdir /var/lib/dbus
255 + # let the init script create the /var/run/dbus directory
256 + rm -rf "${ED}"/var/run
257 +
258 + dodoc AUTHORS ChangeLog NEWS README doc/TODO
259 + readme.gentoo_create_doc
260 +
261 + find "${ED}" -name '*.la' -delete || die
262 +}
263 +
264 +pkg_postinst() {
265 + readme.gentoo_print_elog
266 +
267 + # Ensure unique id is generated and put it in /etc wrt #370451 but symlink
268 + # for DBUS_MACHINE_UUID_FILE (see tools/dbus-launch.c) and reverse
269 + # dependencies with hardcoded paths (although the known ones got fixed already)
270 + dbus-uuidgen --ensure="${EROOT}"/etc/machine-id
271 + ln -sf "${EPREFIX}"/etc/machine-id "${EROOT}"/var/lib/dbus/machine-id
272 +
273 + if [[ ${CHOST} == *-darwin* ]]; then
274 + local plist="org.freedesktop.dbus-session.plist"
275 + elog
276 + elog
277 + elog "For MacOS/Darwin we now ship launchd support for dbus."
278 + elog "This enables autolaunch of dbus at session login and makes"
279 + elog "dbus usable under MacOS/Darwin."
280 + elog
281 + elog "The launchd plist file ${plist} has been"
282 + elog "installed in ${EPREFIX}/Library/LaunchAgents."
283 + elog "For it to be used, you will have to do all of the following:"
284 + elog " + cd ~/Library/LaunchAgents"
285 + elog " + ln -s ${EPREFIX}/Library/LaunchAgents/${plist}"
286 + elog " + logout and log back in"
287 + elog
288 + elog "If your application needs a proper DBUS_SESSION_BUS_ADDRESS"
289 + elog "specified and refused to start otherwise, then export the"
290 + elog "the following to your environment:"
291 + elog " DBUS_SESSION_BUS_ADDRESS=\"launchd:env=DBUS_LAUNCHD_SESSION_BUS_SOCKET\""
292 + fi
293 +
294 + if use user-session; then
295 + ewarn "You have enabled user-session. Please note this can cause"
296 + ewarn "bogus behaviors in several dbus consumers that are not prepared"
297 + ewarn "for this dbus activation method yet."
298 + ewarn
299 + ewarn "See the following link for background on this change:"
300 + ewarn "https://lists.freedesktop.org/archives/systemd-devel/2015-January/027711.html"
301 + ewarn
302 + ewarn "Known issues are tracked here:"
303 + ewarn "https://bugs.gentoo.org/show_bug.cgi?id=576028"
304 + fi
305 +}
306
307 diff --git a/sys-apps/dbus/files/dbus-daemon-optional.patch b/sys-apps/dbus/files/dbus-daemon-optional.patch
308 new file mode 100644
309 index 00000000000..353dcb5761b
310 --- /dev/null
311 +++ b/sys-apps/dbus/files/dbus-daemon-optional.patch
312 @@ -0,0 +1,75 @@
313 +From 3c08d28fbae8b0ef3839ef26f8d2a713a9a684f9 Mon Sep 17 00:00:00 2001
314 +From: Andreas Sturmlechner <asturm@g.o>
315 +Date: Thu, 21 Feb 2019 23:53:19 +0100
316 +Subject: [PATCH] Make dbus daemon build optional
317 +
318 +---
319 + bus/Makefile.am | 2 ++
320 + configure.ac | 17 ++++++++++++++++-
321 + 2 files changed, 18 insertions(+), 1 deletion(-)
322 +
323 +diff --git a/bus/Makefile.am b/bus/Makefile.am
324 +index 9ae3071..26a770c 100644
325 +--- a/bus/Makefile.am
326 ++++ b/bus/Makefile.am
327 +@@ -70,6 +70,7 @@ agentdir=$(LAUNCHD_AGENT_DIR)
328 + agent_DATA=org.freedesktop.dbus-session.plist
329 + endif
330 +
331 ++if DBUS_DAEMON
332 + if DBUS_BUS_ENABLE_KQUEUE
333 + DIR_WATCH_SOURCE=dir-watch-kqueue.c
334 + else
335 +@@ -241,6 +242,7 @@ test_bus_LDADD = \
336 + $(top_builddir)/dbus/libdbus-internal.la \
337 + $(DBUS_BUS_LIBS) \
338 + $(NULL)
339 ++endif DBUS_DAEMON
340 +
341 + install-data-hook:
342 + $(mkinstalldirs) $(DESTDIR)$(dbusdatadir)/session.d
343 +diff --git a/configure.ac b/configure.ac
344 +index be6b065..854e846 100644
345 +--- a/configure.ac
346 ++++ b/configure.ac
347 +@@ -202,6 +202,7 @@ AC_ARG_ENABLE([apparmor],
348 + [enable_apparmor=$enableval],
349 + [enable_apparmor=auto])
350 + AC_ARG_ENABLE(libaudit,AS_HELP_STRING([--enable-libaudit],[build audit daemon support for SELinux]),enable_libaudit=$enableval,enable_libaudit=auto)
351 ++AC_ARG_ENABLE(daemon, AS_HELP_STRING([--enable-daemon],[build with the dbus daemon]),enable_daemon=$enableval,enable_daemon=yes)
352 + AC_ARG_ENABLE(inotify, AS_HELP_STRING([--enable-inotify],[build with inotify support (linux only)]),enable_inotify=$enableval,enable_inotify=auto)
353 + AC_ARG_ENABLE(kqueue, AS_HELP_STRING([--enable-kqueue],[build with kqueue support]),enable_kqueue=$enableval,enable_kqueue=auto)
354 + AC_ARG_ENABLE(console-owner-file, AS_HELP_STRING([--enable-console-owner-file],[enable console owner file]),enable_console_owner_file=$enableval,enable_console_owner_file=auto)
355 +@@ -830,7 +831,20 @@ AC_CHECK_FUNCS(getpeerucred getpeereid)
356 +
357 + AC_CHECK_FUNCS(pipe2 accept4)
358 +
359 +-PKG_CHECK_MODULES([EXPAT], [expat])
360 ++# dbusdaemon checks
361 ++if test x$enable_daemon = xno ; then
362 ++ have_daemon=no
363 ++else
364 ++ have_daemon=yes
365 ++fi
366 ++
367 ++dnl check if daemon shall be built
368 ++if test x$have_daemon = xyes; then
369 ++ AC_DEFINE(DBUS_DAEMON,1,[Use daemon])
370 ++ PKG_CHECK_MODULES([EXPAT], [expat])
371 ++fi
372 ++
373 ++AM_CONDITIONAL(DBUS_DAEMON, test x$have_daemon = xyes)
374 +
375 + save_cflags="$CFLAGS"
376 + save_libs="$LIBS"
377 +@@ -1824,6 +1838,7 @@ echo "
378 + Building bus stats API: ${enable_stats}
379 + Building SELinux support: ${have_selinux}
380 + Building AppArmor support: ${have_apparmor}
381 ++ Building daemon: ${have_daemon}
382 + Building inotify support: ${have_inotify}
383 + Building kqueue support: ${have_kqueue}
384 + Building systemd support: ${have_systemd}
385 +--
386 +2.20.1
387 +