git: 50e80b4f157f - main - devel/desed: fix build on powerpc by merging upstream kqueue commit

From: Piotr Kubaj <pkubaj_at_FreeBSD.org>
Date: Tue, 14 Mar 2023 19:05:03 UTC
The branch main has been updated by pkubaj:

URL: https://cgit.FreeBSD.org/ports/commit/?id=50e80b4f157f3f34b1bc6262480cb563a52fdff7

commit 50e80b4f157f3f34b1bc6262480cb563a52fdff7
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2023-03-14 19:04:25 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2023-03-14 19:04:25 +0000

    devel/desed: fix build on powerpc by merging upstream kqueue commit
---
 .../patch-cargo-crates_kqueue-1.0.6_src_time.rs    | 42 ++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/devel/desed/files/patch-cargo-crates_kqueue-1.0.6_src_time.rs b/devel/desed/files/patch-cargo-crates_kqueue-1.0.6_src_time.rs
new file mode 100644
index 000000000000..57d3f86795e6
--- /dev/null
+++ b/devel/desed/files/patch-cargo-crates_kqueue-1.0.6_src_time.rs
@@ -0,0 +1,42 @@
+--- cargo-crates/kqueue-1.0.6/src/time.rs.orig	1973-11-29 21:33:09 UTC
++++ cargo-crates/kqueue-1.0.6/src/time.rs
+@@ -1,32 +1,14 @@
+-use libc::timespec;
++use libc::{c_long, time_t, timespec};
+ use std::time::Duration;
+ 
+-#[cfg(not(all(
+-    any(target_os = "freebsd", target_os = "macos"),
+-    any(target_arch = "x86", target_arch = "powerpc")
+-)))]
+-pub(crate) fn duration_to_timespec(d: Duration) -> timespec {
+-    let tv_sec = d.as_secs() as i64;
+-    let tv_nsec = d.subsec_nanos() as i64;
++#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
++type NSec = i64;
++#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
++type NSec = c_long;
+ 
+-    if tv_sec.is_negative() {
+-        panic!("Duration seconds is negative");
+-    }
+-
+-    if tv_nsec.is_negative() {
+-        panic!("Duration nsecs is negative");
+-    }
+-
+-    timespec { tv_sec, tv_nsec }
+-}
+-
+-#[cfg(all(
+-    any(target_os = "freebsd", target_os = "macos"),
+-    any(target_arch = "x86", target_arch = "powerpc")
+-))]
+ pub(crate) fn duration_to_timespec(d: Duration) -> timespec {
+-    let tv_sec = d.as_secs() as i32;
+-    let tv_nsec = d.subsec_nanos() as i32;
++    let tv_sec = d.as_secs() as time_t;
++    let tv_nsec = d.subsec_nanos() as NSec;
+ 
+     if tv_sec.is_negative() {
+         panic!("Duration seconds is negative");