public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: net-misc/rdate/, net-misc/rdate/files/
@ 2022-02-03  9:34 Sam James
  0 siblings, 0 replies; 2+ messages in thread
From: Sam James @ 2022-02-03  9:34 UTC (permalink / raw
  To: gentoo-commits

commit:     475fe45c89d774a7dbf72de27486b0fe8de84596
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Feb  3 09:33:36 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Feb  3 09:33:58 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=475fe45c

net-misc/rdate: convert respect AR sed into patch

Sent upstream.

Bug: https://bugs.gentoo.org/729998
Signed-off-by: Sam James <sam <AT> gentoo.org>

 net-misc/rdate/files/rdate-1.10.2-respect-AR.patch | 40 ++++++++++++++++++++++
 net-misc/rdate/rdate-1.10.2.ebuild                 |  3 +-
 2 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/net-misc/rdate/files/rdate-1.10.2-respect-AR.patch b/net-misc/rdate/files/rdate-1.10.2-respect-AR.patch
new file mode 100644
index 000000000000..05289f3453c9
--- /dev/null
+++ b/net-misc/rdate/files/rdate-1.10.2-respect-AR.patch
@@ -0,0 +1,40 @@
+https://github.com/resurrecting-open-source-projects/openrdate/pull/4
+
+From: Sam James <sam@gentoo.org>
+Date: Thu, 3 Feb 2022 09:30:53 +0000
+Subject: [PATCH] Respect AR from environment
+
+Detect `AR` from the environment (first the AR environment variable, but
+failing that, ${CHOST}-ar). This allows using different toolchains (e.g.
+Clang and LLVM's tooling) and also facilitates cross-compilation.
+
+Bug: https://bugs.gentoo.org/729998
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/configure.ac
++++ b/configure.ac
+@@ -11,6 +11,8 @@ AC_CONFIG_SRCDIR([src/rdate.c])
+ AC_CONFIG_HEADERS([config.h])
+ AC_ARG_VAR([kernel_version], [the version of the kernel to build against])
+ 
++AC_CANONICAL_HOST
++
+ # Checks for programs.
+ AC_PROG_CC
+ 
+@@ -22,6 +24,8 @@ AC_PROG_INSTALL
+ AC_PROG_RANLIB
+ AC_PROG_EGREP
+ 
++AM_PROG_AR
++
+ # Checks for libraries.
+ AC_CHECK_LIB([c], [fork])
+ AC_CHECK_LIB([util], [malloc])
+@@ -52,7 +56,6 @@ AC_CHECK_FUNCS([gettimeofday memset select socket])
+ AC_PATH_PROG([UNAME], [uname],
+                [:])
+ 
+-AC_CANONICAL_HOST
+ # Determine the particulars of the host
+ case "${host}" in
+ 	*-*-linux*)

diff --git a/net-misc/rdate/rdate-1.10.2.ebuild b/net-misc/rdate/rdate-1.10.2.ebuild
index 40191e638b49..b7d663d09747 100644
--- a/net-misc/rdate/rdate-1.10.2.ebuild
+++ b/net-misc/rdate/rdate-1.10.2.ebuild
@@ -21,13 +21,12 @@ RDEPEND="${DEPEND}"
 
 PATCHES=(
 	"${FILESDIR}"/${PN}-1.10.2-fix-musl-compat-stdint.patch
+	"${FILESDIR}"/${PN}-1.10.2-respect-AR.patch
 )
 
 src_prepare() {
 	default
 
-	# Don't use hardcoded 'ar' command
-	sed -s '/^AC_PROG_CC/a m4_ifdef([AM_PROG_AR], [AM_PROG_AR], [AC_SUBST([AR], [$(tc-getAR])])' -i configure.ac || die
 	eautoreconf
 }
 


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: net-misc/rdate/, net-misc/rdate/files/
@ 2022-02-03  9:34 Sam James
  0 siblings, 0 replies; 2+ messages in thread
From: Sam James @ 2022-02-03  9:34 UTC (permalink / raw
  To: gentoo-commits

commit:     1588352a15a53c38ce3b00b5a8a0f9c243abc6a5
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Feb  3 09:25:57 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Feb  3 09:33:57 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1588352a

net-misc/rdate: fix build on musl

Closes: https://bugs.gentoo.org/832554
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../rdate-1.10.2-fix-musl-compat-stdint.patch      | 180 +++++++++++++++++++++
 net-misc/rdate/rdate-1.10.2.ebuild                 |   8 +-
 2 files changed, 186 insertions(+), 2 deletions(-)

diff --git a/net-misc/rdate/files/rdate-1.10.2-fix-musl-compat-stdint.patch b/net-misc/rdate/files/rdate-1.10.2-fix-musl-compat-stdint.patch
new file mode 100644
index 000000000000..a6ff70b353d5
--- /dev/null
+++ b/net-misc/rdate/files/rdate-1.10.2-fix-musl-compat-stdint.patch
@@ -0,0 +1,180 @@
+https://github.com/resurrecting-open-source-projects/openrdate/pull/3
+
+From: Sam James <sam@gentoo.org>
+Date: Thu, 3 Feb 2022 09:23:35 +0000
+Subject: [PATCH] Use <stdint.h> to fix musl compatibility
+
+uint32_t and friends are provided by <stdint.h> and the types
+previously being relied on are non-standard, so let's swap.
+
+This fixes building rdate on e.g. musl rather than glibc.
+
+Bug: https://bugs.gentoo.org/832554
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/src/ntp.c
++++ b/src/ntp.c
+@@ -52,6 +52,7 @@
+ #include <netdb.h>
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <stdint.h>
+ #include <string.h>
+ #include <time.h>
+ #include <unistd.h>
+@@ -106,11 +107,11 @@ struct ntp_data {
+     double		receive;
+     double		transmit;
+     double		current;
+-    u_int64_t	recvck;
++    uint64_t	recvck;
+ 
+     /* Local State */
+     double		originate;
+-    u_int64_t	xmitck;
++    uint64_t	xmitck;
+ };
+ 
+ void	ntp_client(const char *, int, struct timeval *, struct timeval *, int, int, int);
+@@ -282,7 +283,7 @@ write_packet(int fd, struct ntp_data *data)
+ 
+     packet[0] = (NTP_VERSION << 3) | (NTP_MODE_CLIENT);
+ 
+-    data->xmitck = (u_int64_t)arc4random() << 32 | arc4random();
++    data->xmitck = (uint64_t)arc4random() << 32 | arc4random();
+ 
+     /*
+      * Send out a random 64-bit number as our transmit time.  The NTP
+@@ -300,7 +301,7 @@ write_packet(int fd, struct ntp_data *data)
+      * the transmit field intelligible.
+      */
+ 
+-    *(u_int64_t *)(packet + NTP_TRANSMIT) = data->xmitck;
++    *(uint64_t *)(packet + NTP_TRANSMIT) = data->xmitck;
+ 
+     data->originate = current_time(JAN_1970);
+ 
+@@ -453,7 +454,7 @@ double
+ current_time(double offset)
+ {
+     struct timeval current;
+-    u_int64_t t;
++    uint64_t t;
+ 
+     if (gettimeofday(&current, NULL))
+         err(1, "Could not get local time of day");
+--- a/src/ntpleaps.c
++++ b/src/ntpleaps.c
+@@ -45,12 +45,13 @@
+ #include <fcntl.h>
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <stdint.h>
+ #include <string.h>
+ #include <unistd.h>
+ 
+ #include "ntpleaps.h"
+ 
+-static u_int64_t *leapsecs;
++static uint64_t *leapsecs;
+ static unsigned int leapsecs_num;
+ 
+ 
+@@ -81,10 +82,10 @@ ntpleaps_init(void)
+ }
+ 
+ int
+-ntpleaps_sub(u_int64_t *t)
++ntpleaps_sub(uint64_t *t)
+ {
+     unsigned int i = 0;
+-    u_int64_t u;
++    uint64_t u;
+     int r = 1;
+ 
+     if (ntpleaps_init() == -1)
+@@ -105,10 +106,10 @@ ntpleaps_sub(u_int64_t *t)
+     return (r);
+ }
+ 
+-u_int32_t
+-read_be_dword(u_int8_t *ptr)
++uint32_t
++read_be_dword(uint8_t *ptr)
+ {
+-    u_int32_t res;
++    uint32_t res;
+ 
+     memcpy(&res, ptr, 4);
+     return (ntohl(res));
+@@ -120,10 +121,10 @@ ntpleaps_read(void)
+ {
+     int fd;
+     unsigned int r;
+-    u_int8_t buf[32];
+-    u_int32_t m1, m2, m3;
+-    u_int64_t s;
+-    u_int64_t *l;
++    uint8_t buf[32];
++    uint32_t m1, m2, m3;
++    uint64_t s;
++    uint64_t *l;
+ 
+     fd = open("/usr/share/zoneinfo/right/UTC", O_RDONLY | O_NDELAY);
+     if (fd == -1)
+@@ -153,7 +154,7 @@ ntpleaps_read(void)
+         close(fd);
+         return (-1);
+     }
+-    if ((l = (u_int64_t *)malloc(r << 3)) == NULL) {
++    if ((l = (uint64_t *)malloc(r << 3)) == NULL) {
+         close(fd);
+         return (-1);
+     }
+--- a/src/ntpleaps.h
++++ b/src/ntpleaps.h
+@@ -46,11 +46,13 @@
+ #ifndef _NTPLEAPS_H
+ #define _NTPLEAPS_H
+ 
++#include <stdint.h>
++
+ /* Offset between struct timeval.tv_sec and a tai64_t */
+ #define	NTPLEAPS_OFFSET	(4611686018427387914ULL)
+ 
+ /* Hide this ugly value from programmes */
+-#define	SEC_TO_TAI64(s)	(NTPLEAPS_OFFSET + (u_int64_t)(s))
++#define	SEC_TO_TAI64(s)	(NTPLEAPS_OFFSET + (uint64_t)(s))
+ #define	TAI64_TO_SEC(t)	((t) - NTPLEAPS_OFFSET)
+ 
+ /* Initializes the leap second table. Does not need to be called
+@@ -70,6 +72,6 @@ int ntpleaps_read(void);
+  * to posix clock tick time.
+  * returns 0 on success, -1 on error (time is unchanged), 1 on leap second
+  */
+-int ntpleaps_sub(u_int64_t *);
++int ntpleaps_sub(uint64_t *);
+ 
+ #endif
+--- a/src/rfc868time.c
++++ b/src/rfc868time.c
+@@ -50,6 +50,7 @@
+ #include <stdio.h>
+ #include <ctype.h>
+ #include <err.h>
++#include <stdint.h>
+ #include <string.h>
+ #include <netdb.h>
+ #include <unistd.h>
+@@ -68,10 +69,10 @@ rfc868time_client (const char *hostname, int family, struct timeval *new,
+ {
+     struct addrinfo hints, *res0, *res;
+     struct timeval old;
+-    u_int32_t tim;	/* RFC 868 states clearly this is an uint32 */
++    uint32_t tim;	/* RFC 868 states clearly this is an uint32 */
+     int s;
+     int error;
+-    u_int64_t td;
++    uint64_t td;
+ 
+     memset(&hints, 0, sizeof(hints));
+     hints.ai_family = family;

diff --git a/net-misc/rdate/rdate-1.10.2.ebuild b/net-misc/rdate/rdate-1.10.2.ebuild
index 85c5f91b3cf8..40191e638b49 100644
--- a/net-misc/rdate/rdate-1.10.2.ebuild
+++ b/net-misc/rdate/rdate-1.10.2.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -17,7 +17,11 @@ SLOT="0"
 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
 
 DEPEND="dev-libs/libbsd"
-RDEPEND=${DEPEND}
+RDEPEND="${DEPEND}"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-1.10.2-fix-musl-compat-stdint.patch
+)
 
 src_prepare() {
 	default


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-03  9:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-03  9:34 [gentoo-commits] repo/gentoo:master commit in: net-misc/rdate/, net-misc/rdate/files/ Sam James
  -- strict thread matches above, loose matches on Subject: below --
2022-02-03  9:34 Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox