commit:     32682621b27ce3c478a5c984c18f2176d11f9026
Author:     Eli Schwartz <eschwartz93 <AT> gmail <DOT> com>
AuthorDate: Tue May 21 20:24:50 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed May 22 01:06:15 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=32682621

net-misc/openntpd: fix broken c89 configure check

Closes: https://bugs.gentoo.org/900296
Signed-off-by: Eli Schwartz <eschwartz93 <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...01-fix-incompatible-check-for-libc-compat.patch | 30 ++++++++++++++++++++++
 ...-6.8_p1-r1.ebuild => openntpd-6.2_p3-r3.ebuild} | 23 +++++++++++------
 ...-6.8_p1-r1.ebuild => openntpd-6.8_p1-r2.ebuild} |  8 +++++-
 3 files changed, 52 insertions(+), 9 deletions(-)

diff --git 
a/net-misc/openntpd/files/0001-fix-incompatible-check-for-libc-compat.patch 
b/net-misc/openntpd/files/0001-fix-incompatible-check-for-libc-compat.patch
new file mode 100644
index 000000000000..ee676d6f9935
--- /dev/null
+++ b/net-misc/openntpd/files/0001-fix-incompatible-check-for-libc-compat.patch
@@ -0,0 +1,30 @@
+From 8e4fdc1c2794e861cd026864607fa6b04c5237cb Mon Sep 17 00:00:00 2001
+From: Eli Schwartz <[email protected]>
+Date: Tue, 21 May 2024 16:10:45 -0400
+Subject: [PATCH] fix incompatible check for libc compat
+
+It relied on implicit function declarations, which are banned starting
+in c99. Result: the check always failed.
+
+See: 
https://wiki.gentoo.org/wiki/Modern_C_porting#How_do_I_reproduce_these_bugs.3F
+Bug: https://bugs.gentoo.org/900296
+Signed-off-by: Eli Schwartz <[email protected]>
+---
+ m4/check-libc-compat.m4 | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/m4/check-libc-compat.m4 b/m4/check-libc-compat.m4
+index a806cbe..3bb859a 100644
+--- a/m4/check-libc-compat.m4
++++ b/m4/check-libc-compat.m4
+@@ -1,6 +1,6 @@
+ AC_DEFUN([CHECK_PROGNAME], [
+ AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
+-       AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
++       AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]],
+                 [[ extern char *__progname; printf("%s", __progname); ]])],
+         [ ac_cv_libc_defines___progname="yes" ],
+         [ ac_cv_libc_defines___progname="no"
+-- 
+2.44.1
+

diff --git a/net-misc/openntpd/openntpd-6.8_p1-r1.ebuild 
b/net-misc/openntpd/openntpd-6.2_p3-r3.ebuild
similarity index 69%
copy from net-misc/openntpd/openntpd-6.8_p1-r1.ebuild
copy to net-misc/openntpd/openntpd-6.2_p3-r3.ebuild
index aaceb1670299..aef0f71353d6 100644
--- a/net-misc/openntpd/openntpd-6.8_p1-r1.ebuild
+++ b/net-misc/openntpd/openntpd-6.2_p3-r3.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-inherit systemd
+inherit autotools systemd
 
 MY_P="${P/_p/p}"
 
@@ -13,12 +13,11 @@ SRC_URI="mirror://openbsd/OpenNTPD/${MY_P}.tar.gz"
 
 LICENSE="BSD GPL-2"
 SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 
~sparc ~x86"
-IUSE="constraints selinux"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 
~riscv ~s390 ~sparc ~x86"
+IUSE="selinux"
 
 DEPEND="
-       !net-misc/ntp[-openntpd]
-       constraints? ( dev-libs/libretls:= )"
+       !net-misc/ntp[-openntpd]"
 
 RDEPEND="
        ${DEPEND}
@@ -28,8 +27,15 @@ RDEPEND="
 
 S="${WORKDIR}/${MY_P}"
 
+PATCHES=(
+       "${FILESDIR}/openntpd-6.2p3-fno-common.patch"
+       # https://github.com/openntpd-portable/openntpd-portable/pull/75
+       "${FILESDIR}"/0001-fix-incompatible-check-for-libc-compat.patch
+)
+
 src_prepare() {
        default
+       eautoreconf
 
        # fix /run path
        sed -i 's:/var/run/ntpd:/run/ntpd:g' src/ntpctl.8 src/ntpd.8 || die
@@ -40,16 +46,17 @@ src_prepare() {
        sed -i 's:"/db/ntpd.drift":"/openntpd/ntpd.drift":' src/ntpd.h || die
 
        # fix default config to use gentoo pool
-       sed -i 's:^server:#server:g' ntpd.conf || die
+       sed -i 's:servers pool.ntp.org:#servers pool.ntp.org:' ntpd.conf || die
        printf "\n# Choose servers announced from Gentoo NTP Pool\nservers 
0.gentoo.pool.ntp.org\nservers 1.gentoo.pool.ntp.org\nservers 
2.gentoo.pool.ntp.org\nservers 3.gentoo.pool.ntp.org\n" >> ntpd.conf || die
 
-       use constraints || sed -ie 's/^constraints/#constraints/g' ntpd.conf || 
die
+       sed -ie 's/^constraints/#constraints/g' ntpd.conf || die
 }
 
 src_configure() {
        econf \
                --with-privsep-user=openntpd \
-               $(use_enable constraints https-constraint)
+               --with-privsep-path=/var/lib/openntpd/chroot \
+               --disable-https-constraint
 }
 
 src_install() {

diff --git a/net-misc/openntpd/openntpd-6.8_p1-r1.ebuild 
b/net-misc/openntpd/openntpd-6.8_p1-r2.ebuild
similarity index 90%
rename from net-misc/openntpd/openntpd-6.8_p1-r1.ebuild
rename to net-misc/openntpd/openntpd-6.8_p1-r2.ebuild
index aaceb1670299..c5b8250e115b 100644
--- a/net-misc/openntpd/openntpd-6.8_p1-r1.ebuild
+++ b/net-misc/openntpd/openntpd-6.8_p1-r2.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-inherit systemd
+inherit autotools systemd
 
 MY_P="${P/_p/p}"
 
@@ -28,8 +28,14 @@ RDEPEND="
 
 S="${WORKDIR}/${MY_P}"
 
+PATCHES=(
+       # https://github.com/openntpd-portable/openntpd-portable/pull/75
+       "${FILESDIR}"/0001-fix-incompatible-check-for-libc-compat.patch
+)
+
 src_prepare() {
        default
+       eautoreconf
 
        # fix /run path
        sed -i 's:/var/run/ntpd:/run/ntpd:g' src/ntpctl.8 src/ntpd.8 || die

Reply via email to