commit:     71e0258b5309c64c42807d099af04f0c578f8cfb
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Dec  6 11:46:25 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Dec  6 16:00:57 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=71e0258b

net-misc/radvd: fix modern c issue in configure

Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../radvd/files/radvd-2.19-configure-c99.patch     | 46 +++++++++++++
 net-misc/radvd/radvd-2.19-r6.ebuild                | 76 ++++++++++++++++++++++
 2 files changed, 122 insertions(+)

diff --git a/net-misc/radvd/files/radvd-2.19-configure-c99.patch 
b/net-misc/radvd/files/radvd-2.19-configure-c99.patch
new file mode 100644
index 000000000000..38a6d070657f
--- /dev/null
+++ b/net-misc/radvd/files/radvd-2.19-configure-c99.patch
@@ -0,0 +1,46 @@
+https://github.com/radvd-project/radvd/commit/5acb1c64766dfaf37c9745632f99feecf11d1403
+
+From 5acb1c64766dfaf37c9745632f99feecf11d1403 Mon Sep 17 00:00:00 2001
+From: Sam James <[email protected]>
+Date: Fri, 3 Feb 2023 02:33:13 +0000
+Subject: [PATCH] configure.ac: Fix -Wint-conversion warnings
+
+These become fatal with Clang 15 and may lead to incorrect configure
+test results.
+
+```
+-ignoreme: warning: incompatible pointer to integer conversion initializing 
'int' with an expression of type 'uint16_t[8]' (aka 'unsigned short[8]') 
[-Wint-conversion]
++ignoreme: error: incompatible pointer to integer conversion initializing 
'int' with an expression of type 'uint16_t[8]' (aka 'unsigned short[8]') 
[-Wint-conversion]
+ int u =  in6_u.s6_addr16;
+     ^    ~~~~~~~~~~~~~~~
+```
+
+Signed-off-by: Sam James <[email protected]>
+--- a/configure.ac
++++ b/configure.ac
+@@ -178,15 +178,19 @@ AC_HEADER_TIME
+ 
+ dnl Checks for typedefs, structures, and compiler characteristics.
+ AC_MSG_CHECKING(whether struct sockaddr_in6 has sin6_scope_id)
+-AC_TRY_COMPILE([#include <sys/types.h>
+-#include <netinet/in.h>], [static struct sockaddr_in6 ac_sin6; int ac_size = 
+-sizeof (ac_sin6.sin6_scope_id);], [AC_MSG_RESULT(yes); 
AC_DEFINE([HAVE_SIN6_SCOPE_ID],
++AC_TRY_COMPILE([#include <stdint.h>
++#include <sys/types.h>
++#include <netinet/in.h>], [
++static struct sockaddr_in6 ac_sin6;
++uint32_t ac_size = sizeof (ac_sin6.sin6_scope_id);
++], [AC_MSG_RESULT(yes); AC_DEFINE([HAVE_SIN6_SCOPE_ID],
+ 1, [whether struct sockaddr_in6 has sin6_scope_id])],
+ AC_MSG_RESULT(no))
+ 
+ AC_MSG_CHECKING(whether struct in6_addr has u6_addrXX and defines s6_addrXX)
+-AC_TRY_COMPILE([#include <netinet/in.h>], [static struct in6_addr in6_u; 
+-int u =  in6_u.s6_addr16;], [AC_MSG_RESULT(yes); 
AC_DEFINE([HAVE_IN6_ADDR_S6_ADDR],
++AC_TRY_COMPILE([#include <stdint.h>
++#include <netinet/in.h>], [static struct in6_addr in6_u;
++uint16_t u =  in6_u.s6_addr16[0];], [AC_MSG_RESULT(yes); 
AC_DEFINE([HAVE_IN6_ADDR_S6_ADDR],
+ 1, [whether struct in6_addr has u6_addrXX and defines s6_addrXX])],
+ AC_MSG_RESULT(no))
+ 
+

diff --git a/net-misc/radvd/radvd-2.19-r6.ebuild 
b/net-misc/radvd/radvd-2.19-r6.ebuild
new file mode 100644
index 000000000000..1d81dd69fda5
--- /dev/null
+++ b/net-misc/radvd/radvd-2.19-r6.ebuild
@@ -0,0 +1,76 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools readme.gentoo-r1 systemd toolchain-funcs
+
+DESCRIPTION="Linux IPv6 Router Advertisement Daemon"
+HOMEPAGE="https://radvd.litech.org/";
+SRC_URI="https://v6web.litech.org/radvd/dist/${P}.tar.xz";
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~riscv ~sparc ~x86"
+IUSE="selinux test"
+RESTRICT="!test? ( test )"
+
+BDEPEND="
+       sys-devel/bison
+       sys-devel/flex
+       virtual/pkgconfig"
+DEPEND="test? ( dev-libs/check )"
+RDEPEND="
+       acct-group/radvd
+       acct-user/radvd
+       selinux? ( sec-policy/selinux-radvd )"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-musl-include.patch
+       "${FILESDIR}"/${P}-clang16.patch
+       "${FILESDIR}"/${P}-configure-c99.patch
+)
+
+src_prepare() {
+       default
+
+       # Drop once clang16 patch is in a release
+       eautoreconf
+}
+
+src_configure() {
+       # Needs reentrant functions (yyset_in), bug #884375
+       export LEX=flex
+
+       econf --with-pidfile=/run/radvd/radvd.pid \
+               --with-systemdsystemunitdir=no \
+               $(use_with test check)
+}
+
+src_compile() {
+       emake AR="$(tc-getAR)"
+}
+
+src_install() {
+       HTML_DOCS=( INTRO.html )
+       default
+       dodoc radvd.conf.example
+
+       newinitd "${FILESDIR}"/${PN}-2.15.init ${PN}
+       newconfd "${FILESDIR}"/${PN}.conf ${PN}
+
+       systemd_dounit "${FILESDIR}"/${PN}.service
+
+       DISABLE_AUTOFORMATTING=1
+       local DOC_CONTENTS="Please create a configuration file 
${EPREFIX}/etc/radvd.conf.
+See ${EPREFIX}/usr/share/doc/${PF} for an example.
+
+grsecurity users should allow a specific group to read /proc
+and add the radvd user to that group, otherwise radvd may
+segfault on startup."
+       readme.gentoo_create_doc
+}
+
+pkg_postinst() {
+       readme.gentoo_print_elog
+}

Reply via email to