commit:     cc43a8e0b6cdf35dec9a0e992d68eed8e4c71c54
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 27 15:08:24 2025 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Thu Aug 28 19:50:22 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cc43a8e0

net-dns/avahi: Use patch to port to Qt6 (IUSE qt5 -> qt6)

Bug: https://bugs.gentoo.org/961804
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 net-dns/avahi/avahi-0.9_rc2-r3.ebuild       | 207 ++++++++++++++++++
 net-dns/avahi/files/avahi-0.9_rc2-qt6.patch | 318 ++++++++++++++++++++++++++++
 2 files changed, 525 insertions(+)

diff --git a/net-dns/avahi/avahi-0.9_rc2-r3.ebuild 
b/net-dns/avahi/avahi-0.9_rc2-r3.ebuild
new file mode 100644
index 000000000000..cfd149d8d131
--- /dev/null
+++ b/net-dns/avahi/avahi-0.9_rc2-r3.ebuild
@@ -0,0 +1,207 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{11..13} )
+PYTHON_REQ_USE="gdbm"
+inherit autotools multilib-minimal python-single-r1 systemd
+
+DESCRIPTION="System which facilitates service discovery on a local network"
+HOMEPAGE="https://avahi.org/";
+SRC_URI="https://github.com/lathiat/avahi/archive/v${PV/_/-}.tar.gz -> 
${P}.tar.gz"
+S="${WORKDIR}/${PN}-${PV/_/-}"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv 
~s390 ~sparc ~x86"
+IUSE="autoipd bookmarks +dbus doc gdbm gtk howl-compat +introspection ipv6 
mdnsresponder-compat nls python qt6 selinux systemd test"
+
+REQUIRED_USE="
+       python? ( dbus gdbm ${PYTHON_REQUIRED_USE} )
+       bookmarks? ( python )
+       howl-compat? ( dbus )
+       mdnsresponder-compat? ( dbus )
+       systemd? ( dbus )
+"
+
+RESTRICT="!test? ( test )"
+
+DEPEND="
+       dev-libs/libdaemon
+       dev-libs/libevent:=[${MULTILIB_USEDEP}]
+       dev-libs/expat
+       dev-libs/glib:2[${MULTILIB_USEDEP}]
+       gdbm? ( sys-libs/gdbm:=[${MULTILIB_USEDEP}] )
+       qt6? ( dev-qt/qtbase:6 )
+       gtk?  ( x11-libs/gtk+:3[${MULTILIB_USEDEP}] )
+       dbus? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+       kernel_linux? ( sys-libs/libcap )
+       introspection? ( dev-libs/gobject-introspection:= )
+       systemd? ( sys-apps/systemd:=[${MULTILIB_USEDEP}] )
+       python? (
+               ${PYTHON_DEPS}
+               $(python_gen_cond_dep '
+                       bookmarks? ( 
>=dev-python/twisted-16.0.0[${PYTHON_USEDEP}] )
+                       dbus? ( dev-python/dbus-python[${PYTHON_USEDEP}] )
+                       introspection? ( 
dev-python/pygobject:3[${PYTHON_USEDEP}] )
+               ')
+       )
+"
+RDEPEND="
+       acct-user/avahi
+       acct-group/avahi
+       acct-group/netdev
+       autoipd? (
+               acct-user/avahi-autoipd
+               acct-group/avahi-autoipd
+       )
+       ${DEPEND}
+       selinux? ( sec-policy/selinux-avahi )
+"
+BDEPEND="
+       dev-util/glib-utils
+       doc? ( app-text/doxygen )
+       app-text/xmltoman
+       sys-devel/gettext
+       virtual/pkgconfig
+"
+
+MULTILIB_WRAPPED_HEADERS=( /usr/include/avahi-qt6/qt-watch.h )
+
+PATCHES=(
+       "${FILESDIR}/${PN}-0.9_rc1-disable-avahi-ui-sharp.patch" # bug 769062
+       "${FILESDIR}/${P}-CVE-2024-52615.patch"
+       "${FILESDIR}/${P}-glibc-2.42.patch"
+       "${FILESDIR}/${P}-qt6.patch" # bug 961804
+)
+
+pkg_setup() {
+       use python && python-single-r1_pkg_setup
+}
+
+src_prepare() {
+       default
+
+       if ! use ipv6; then
+               sed -i \
+                       -e "s/use-ipv6=yes/use-ipv6=no/" \
+                       avahi-daemon/avahi-daemon.conf || die
+       fi
+
+       sed -i \
+               -e 
"s:\\.\\./\\.\\./\\.\\./doc/avahi-docs/html/:../../../doc/${PF}/html/:" \
+               doxygen_to_devhelp.xsl || die
+
+       eautoreconf
+
+       # bundled manpages
+       multilib_copy_sources
+}
+
+multilib_src_configure() {
+       local myconf=(
+               --disable-gtk
+               --disable-mono
+               --disable-monodoc
+               --disable-python-dbus
+               --disable-qt3
+               --disable-qt4
+               --disable-qt5
+               --disable-static
+               --enable-manpages
+               --enable-glib
+               --enable-gobject
+               --enable-xmltoman
+               --localstatedir="${EPREFIX}/var"
+               --runstatedir="${EPREFIX}/run"
+               --with-distro=gentoo
+               --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
+               $(use_enable dbus)
+               $(use_enable gdbm)
+               $(use_enable gtk gtk3)
+               $(use_enable howl-compat compat-howl)
+               $(use_enable mdnsresponder-compat compat-libdns_sd)
+               $(use_enable nls)
+               $(use_enable systemd libsystemd)
+               $(multilib_native_use_enable autoipd)
+               $(multilib_native_use_enable doc doxygen-doc)
+               $(multilib_native_use_enable introspection)
+               $(multilib_native_use_enable python)
+               $(multilib_native_use_enable test tests)
+       )
+
+       if use python; then
+               myconf+=(
+                       $(multilib_native_use_enable dbus python-dbus)
+                       $(multilib_native_use_enable introspection pygobject)
+               )
+       fi
+
+       if ! multilib_is_native_abi; then
+               myconf+=(
+                       # used by daemons only
+                       --disable-libdaemon
+                       --with-xml=none
+               )
+       fi
+
+       myconf+=( $(multilib_native_use_enable qt6) )
+
+       econf "${myconf[@]}"
+}
+
+multilib_src_compile() {
+       emake
+
+       multilib_is_native_abi && use doc && emake avahi.devhelp
+}
+
+multilib_src_install() {
+       emake install DESTDIR="${D}"
+
+       if ! use bookmarks || ! use python || ! use dbus; then
+               rm -f "${ED}"/usr/bin/avahi-bookmarks || die
+       fi
+
+       # https://github.com/lathiat/avahi/issues/28
+       use howl-compat && dosym avahi-compat-howl.pc 
/usr/$(get_libdir)/pkgconfig/howl.pc
+       use mdnsresponder-compat && dosym avahi-compat-libdns_sd/dns_sd.h 
/usr/include/dns_sd.h
+
+       if multilib_is_native_abi && use doc; then
+               docinto html
+               dodoc -r doxygen/html/.
+               insinto /usr/share/devhelp/books/avahi
+               doins avahi.devhelp
+       fi
+
+       # The build system creates an empty "/run" directory, so we clean it up 
here
+       rmdir "${ED}"/run || die
+}
+
+multilib_src_install_all() {
+       use python && python_optimize
+
+       if use autoipd; then
+               insinto /lib/rcscripts/net
+               doins "${FILESDIR}"/autoipd.sh
+
+               insinto /lib/netifrc/net
+               newins "${FILESDIR}"/autoipd-openrc.sh autoipd.sh
+       fi
+
+       dodoc docs/{AUTHORS,NEWS,README,TODO}
+
+       find "${ED}" -name '*.la' -type f -delete || die
+}
+
+pkg_postinst() {
+       if use autoipd; then
+               elog
+               elog "To use avahi-autoipd to configure your interfaces with 
IPv4LL (RFC3927)"
+               elog "addresses, just set config_<interface>=( autoipd ) in 
/etc/conf.d/net!"
+               elog
+       fi
+
+       systemd_reenable avahi-daemon.service
+}

diff --git a/net-dns/avahi/files/avahi-0.9_rc2-qt6.patch 
b/net-dns/avahi/files/avahi-0.9_rc2-qt6.patch
new file mode 100644
index 000000000000..fdff594fd3d3
--- /dev/null
+++ b/net-dns/avahi/files/avahi-0.9_rc2-qt6.patch
@@ -0,0 +1,318 @@
+From: https://github.com/avahi/avahi/pull/704
+
+From fdc30aff1e72ba22aff11e2d9c0ab486ba63d1a6 Mon Sep 17 00:00:00 2001
+From: Antonio Larrosa <[email protected]>
+Date: Fri, 30 May 2025 11:42:02 +0200
+Subject: [PATCH] Enable building with Qt6
+
+---
+ Makefile.am           | 10 ++++++++
+ acinclude.m4          |  2 +-
+ avahi-qt/Makefile.am  | 22 +++++++++++++++++
+ avahi-qt/qt-watch.cpp | 10 ++++----
+ avahi-qt6.pc.in       | 11 +++++++++
+ common/qt-pie.m4      | 55 +++++++++++++++++++++++++++++++++++++++++++
+ common/qt5-pie.m4     | 27 ---------------------
+ configure.ac          | 31 +++++++++++++++++++++++-
+ 8 files changed, 135 insertions(+), 33 deletions(-)
+ create mode 100644 avahi-qt6.pc.in
+ create mode 100644 common/qt-pie.m4
+ delete mode 100644 common/qt5-pie.m4
+
+diff --git a/Makefile.am b/Makefile.am
+index 352cdcf25..3df371ad3 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -45,6 +45,7 @@ EXTRA_DIST = \
+       avahi-qt3.pc.in \
+       avahi-qt4.pc.in \
+       avahi-qt5.pc.in \
++      avahi-qt6.pc.in \
+       avahi-sharp.pc.in \
+       avahi-ui-sharp.pc.in \
+       avahi-compat-libdns_sd.pc.in \
+@@ -108,6 +109,10 @@ if HAVE_QT5
+ DX_INPUT += \
+       $(srcdir)/avahi-qt/qt-watch.h
+ endif
++if HAVE_QT6
++DX_INPUT += \
++      $(srcdir)/avahi-qt/qt-watch.h
++endif
+ endif
+ 
+ if HAVE_GLIB
+@@ -236,6 +241,11 @@ pkgconfig_DATA += avahi-qt5.pc
+ CLEANFILES += avahi-qt5.pc
+ endif
+ 
++if HAVE_QT6
++pkgconfig_DATA += avahi-qt6.pc
++CLEANFILES += avahi-qt6.pc
++endif
++
+ if HAVE_LIBEVENT
+ pkgconfig_DATA += avahi-libevent.pc
+ CLEANFILES += avahi-libevent.pc
+diff --git a/acinclude.m4 b/acinclude.m4
+index ccf2ac616..ac922456e 100644
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -1,2 +1,2 @@
+ sinclude(common/doxygen.m4)
+-sincldue(common/qt5-pie.m4)
++sincldue(common/qt-pie.m4)
+diff --git a/avahi-qt/Makefile.am b/avahi-qt/Makefile.am
+index b404810f7..78069b56c 100644
+--- a/avahi-qt/Makefile.am
++++ b/avahi-qt/Makefile.am
+@@ -87,4 +87,26 @@ libavahi_qt5_la_LIBADD = $(AM_LDADD) 
../avahi-common/libavahi-common.la $(QT5_LI
+ libavahi_qt5_la_LDFLAGS = $(AM_LDFLAGS) -version-info 
$(LIBAVAHI_QT5_VERSION_INFO)
+ endif
+ 
++if HAVE_QT6
++
++avahiqt6includedir=$(includedir)/avahi-qt6
++avahiqt6include_HEADERS = \
++      qt-watch.h
++
++lib_LTLIBRARIES += \
++      libavahi-qt6.la
++
++BUILT_SOURCES += qt-watch.moc6
++
++libavahi_qt6_la_SOURCES = \
++      qt-watch.cpp
++
++qt-watch.moc6: qt-watch.cpp
++      $(AM_V_GEN)$(MOC_QT6) $^ > $@
++
++libavahi_qt6_la_CPPFLAGS = $(AM_CFLAGS) --std=gnu++17 $(QT6_CFLAGS) -DQT6 
$(VISIBILITY_HIDDEN_CFLAGS)
++libavahi_qt6_la_LIBADD = $(AM_LDADD) ../avahi-common/libavahi-common.la 
$(QT6_LIBS)
++libavahi_qt6_la_LDFLAGS = $(AM_LDFLAGS) -version-info 
$(LIBAVAHI_QT6_VERSION_INFO)
++endif
++
+ CLEANFILES = $(BUILT_SOURCES)
+diff --git a/avahi-qt/qt-watch.cpp b/avahi-qt/qt-watch.cpp
+index 14e0c6e6a..cd18bee3d 100644
+--- a/avahi-qt/qt-watch.cpp
++++ b/avahi-qt/qt-watch.cpp
+@@ -18,7 +18,7 @@
+ ***/
+ 
+ #include <sys/time.h>
+-#if defined(QT5) || defined(QT4)
++#if defined(QT6) || defined(QT5) || defined(QT4)
+ #include <QSocketNotifier>
+ #include <QObject>
+ #include <QTimer>
+@@ -114,7 +114,7 @@ AvahiTimeout::AvahiTimeout(const struct timeval* tv, 
AvahiTimeoutCallback callba
+     m_callback(callback), m_userdata(userdata)
+ {
+     connect(&m_timer, SIGNAL(timeout()), this, SLOT(timeout()));
+-#if defined(QT5) || defined(QT4)
++#if defined(QT6) || defined(QT5) || defined(QT4)
+     m_timer.setSingleShot(true);
+ #endif
+     update(tv);
+@@ -125,7 +125,7 @@ void AvahiTimeout::update(const struct timeval *tv)
+     m_timer.stop();
+     if (tv) {
+     AvahiUsec u = avahi_age(tv)/1000;
+-#if defined(QT5) || defined(QT4)
++#if defined(QT6) || defined(QT5) || defined(QT4)
+     m_timer.start( (u>0) ? 0 : -u);
+ #else
+     m_timer.start( (u>0) ? 0 : -u,true);
+@@ -191,7 +191,9 @@ const AvahiPoll* avahi_qt_poll_get(void)
+     return &qt_poll;
+ }
+ 
+-#if defined(QT5)
++#if defined(QT6)
++#include "qt-watch.moc6"
++#elif defined(QT5)
+ #include "qt-watch.moc5"
+ #elif defined(QT4)
+ #include "qt-watch.moc4"
+diff --git a/avahi-qt6.pc.in b/avahi-qt6.pc.in
+new file mode 100644
+index 000000000..ce9f13758
+--- /dev/null
++++ b/avahi-qt6.pc.in
+@@ -0,0 +1,11 @@
++prefix=@prefix@
++exec_prefix=${prefix}
++libdir=@libdir@
++includedir=${prefix}/include
++
++Name: avahi-qt6
++Description: Avahi Multicast DNS Responder (QT6 Support)
++Version: @PACKAGE_VERSION@
++Requires: Qt6Core >= 6.0.0
++Libs: -L${libdir} -lavahi-qt6
++Cflags: -D_REENTRANT -I${includedir}
+diff --git a/common/qt-pie.m4 b/common/qt-pie.m4
+new file mode 100644
+index 000000000..8f35e548b
+--- /dev/null
++++ b/common/qt-pie.m4
+@@ -0,0 +1,55 @@
++AC_DEFUN([AC_AVAHI_QT5_ADD_PIC_IF_NEEDED],
++[
++    AC_LANG_PUSH([C++])
++      save_CPPFLAGS="$CPPFLAGS"
++      CPPFLAGS="$CPPFLAGS $QT5_CFLAGS"
++      AC_MSG_CHECKING([whether Qt works without -fPIC])
++      AC_PREPROC_IFELSE(
++              [AC_LANG_SOURCE([[#include <QtCore>]])],
++              [AC_MSG_RESULT(yes)],
++              [
++                      AC_MSG_RESULT(no)
++                      AC_MSG_CHECKING([whether Qt works with -fPIC])
++                      CPPFLAGS="$CPPFLAGS -fPIC"
++                      AC_PREPROC_IFELSE(
++                              [AC_LANG_SOURCE([[#include <QtCore>]])],
++                              [
++                                      AC_MSG_RESULT(yes)
++                                      QT5_CFLAGS="$QT5_CFLAGS -fPIC"
++                              ],
++                              [
++                                      AC_MSG_RESULT(no)
++                                      AC_MSG_ERROR(Couldn't compile Qt 
without -fPIC nor with -fPIC)
++                              ])
++              ])
++      CPPFLAGS="$save_CPPFLAGS"
++    AC_LANG_POP([C++])
++])
++
++AC_DEFUN([AC_AVAHI_QT6_ADD_PIC_IF_NEEDED],
++[
++    AC_LANG_PUSH([C++])
++      save_CPPFLAGS="$CPPFLAGS"
++      CPPFLAGS="$CPPFLAGS $QT6_CFLAGS"
++      AC_MSG_CHECKING([whether Qt works without -fPIC])
++      AC_PREPROC_IFELSE(
++              [AC_LANG_SOURCE([[#include <QtCore>]])],
++              [AC_MSG_RESULT(yes)],
++              [
++                      AC_MSG_RESULT(no)
++                      AC_MSG_CHECKING([whether Qt works with -fPIC])
++                      CPPFLAGS="$CPPFLAGS -fPIC"
++                      AC_PREPROC_IFELSE(
++                              [AC_LANG_SOURCE([[#include <QtCore>]])],
++                              [
++                                      AC_MSG_RESULT(yes)
++                                      QT6_CFLAGS="$QT6_CFLAGS -fPIC"
++                              ],
++                              [
++                                      AC_MSG_RESULT(no)
++                                      AC_MSG_ERROR(Couldn't compile Qt 
without -fPIC nor with -fPIC)
++                              ])
++              ])
++      CPPFLAGS="$save_CPPFLAGS"
++    AC_LANG_POP([C++])
++])
+diff --git a/common/qt5-pie.m4 b/common/qt5-pie.m4
+deleted file mode 100644
+index 10d564c8f..000000000
+--- a/common/qt5-pie.m4
++++ /dev/null
+@@ -1,27 +0,0 @@
+-AC_DEFUN([AC_AVAHI_QT_ADD_PIC_IF_NEEDED],
+-[
+-    AC_LANG_PUSH([C++])
+-      save_CPPFLAGS="$CPPFLAGS"
+-      CPPFLAGS="$CPPFLAGS $QT5_CFLAGS"
+-      AC_MSG_CHECKING([whether Qt works without -fPIC])
+-      AC_PREPROC_IFELSE(
+-              [AC_LANG_SOURCE([[#include <QtCore>]])],
+-              [AC_MSG_RESULT(yes)],
+-              [
+-                      AC_MSG_RESULT(no)
+-                      AC_MSG_CHECKING([whether Qt works with -fPIC])
+-                      CPPFLAGS="$CPPFLAGS -fPIC"
+-                      AC_PREPROC_IFELSE(
+-                              [AC_LANG_SOURCE([[#include <QtCore>]])],
+-                              [
+-                                      AC_MSG_RESULT(yes)
+-                                      QT5_CFLAGS="$QT5_CFLAGS -fPIC"
+-                              ],
+-                              [
+-                                      AC_MSG_RESULT(no)
+-                                      AC_MSG_ERROR(Couldn't compile Qt 
without -fPIC nor with -fPIC)
+-                              ])
+-              ])
+-      CPPFLAGS="$save_CPPFLAGS"
+-    AC_LANG_POP([C++])
+-])
+diff --git a/configure.ac b/configure.ac
+index 31bce3d76..5959df14e 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -36,6 +36,7 @@ AC_SUBST(LIBAVAHI_GOBJECT_VERSION_INFO, [0:5:0])
+ AC_SUBST(LIBAVAHI_QT3_VERSION_INFO, [1:2:0])
+ AC_SUBST(LIBAVAHI_QT4_VERSION_INFO, [1:2:0])
+ AC_SUBST(LIBAVAHI_QT5_VERSION_INFO, [1:2:0])
++AC_SUBST(LIBAVAHI_QT6_VERSION_INFO, [1:2:0])
+ AC_SUBST(LIBAVAHI_UI_VERSION_INFO, [1:4:1])
+ 
+ # Do not touch these, since they we took this version-info from upstream 
HOWL/Bonjour
+@@ -557,7 +558,7 @@ AC_ARG_ENABLE(qt5,
+ 
+ if test "x$HAVE_QT5" = "xyes" ; then
+         PKG_CHECK_MODULES( QT5, [ Qt5Core >= 5.0.0 ])
+-        AC_AVAHI_QT_ADD_PIC_IF_NEEDED
++        AC_AVAHI_QT5_ADD_PIC_IF_NEEDED
+         AC_SUBST(QT5_CFLAGS)
+         AC_SUBST(QT5_LIBS)
+         QT5_PREFIX="`$PKG_CONFIG --variable=host_bins Qt5Core`"
+@@ -569,6 +570,32 @@ if test "x$HAVE_QT5" = "xyes" ; then
+ fi
+ AM_CONDITIONAL(HAVE_QT5, test "x$HAVE_QT5" = "xyes")
+ 
++#
++# Check for Qt 6
++#
++AC_ARG_ENABLE(qt6,
++        AS_HELP_STRING([--disable-qt6],[Disable building of Qt6Core mainloop 
integration]),
++        [case "${enableval}" in
++                yes) HAVE_QT6=yes ;;
++                no)  HAVE_QT6=no ;;
++                *) AC_MSG_ERROR(bad value ${enableval} for --enable-qt6) ;;
++        esac],
++        [HAVE_QT6=yes])
++
++if test "x$HAVE_QT6" = "xyes" ; then
++        PKG_CHECK_MODULES( QT6, [ Qt6Core >= 6.0.0 ])
++        AC_AVAHI_QT6_ADD_PIC_IF_NEEDED
++        AC_SUBST(QT6_CFLAGS)
++        AC_SUBST(QT6_LIBS)
++        QT6_PREFIX="`$PKG_CONFIG --variable=libexecdir Qt6Core`"
++        AC_PATH_PROGS(MOC_QT6, [moc-qt6 moc], no, [$QT6_PREFIX])
++        if test "$MOC_QT6" = no; then
++            AC_MSG_ERROR([Could not find QT6 moc])
++        fi
++        AC_SUBST(MOC_QT6)
++fi
++AM_CONDITIONAL(HAVE_QT6, test "x$HAVE_QT6" = "xyes")
++
+ #
+ # Check for GTK+ 2.0
+ #
+@@ -1222,6 +1249,7 @@ echo "
+     Enable QT3:                                ${HAVE_QT3}
+     Enable QT4:                                ${HAVE_QT4}
+     Enable QT5:                                ${HAVE_QT5}
++    Enable QT6:                                ${HAVE_QT6}
+     Enable Mono:                               ${HAVE_MONO}
+     Enable Monodoc:                            ${HAVE_MONODOC}
+     Distribution/OS:                           ${with_distro}
+@@ -1292,6 +1320,7 @@ echo "\
+     Building libavahi-qt3:              ${HAVE_QT3}
+     Building libavahi-qt4:              ${HAVE_QT4}
+     Building libavahi-qt5:              ${HAVE_QT5}
++    Building libavahi-qt6:              ${HAVE_QT6}
+     Building avahi-sharp:               ${HAVE_MONO}
+     Building avahi-compat-libdns_sd:    ${ENABLE_COMPAT_LIBDNS_SD}
+     Building avahi-compat-howl:         ${ENABLE_COMPAT_HOWL}

Reply via email to