git: 5c01d7a330c3 - main - lang/janet: Update to 1.42.0

From: Adam Weinberger <adamw_at_FreeBSD.org>
Date: Tue, 08 Sep 2026 00:53:58 UTC
The branch main has been updated by adamw:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5c01d7a330c3ff8c750eea5c052c8db3165d7d00

commit 5c01d7a330c3ff8c750eea5c052c8db3165d7d00
Author:     Dave Marker <dave@freedave.net>
AuthorDate: 2026-09-08 00:52:34 +0000
Commit:     Adam Weinberger <adamw@FreeBSD.org>
CommitDate: 2026-09-08 00:53:46 +0000

    lang/janet: Update to 1.42.0
    
    Differential Revision:  https://reviews.freebsd.org/D59342
---
 lang/janet/Makefile                               | 19 +++++--
 lang/janet/distinfo                               |  6 +--
 lang/janet/files/patch-src_core_filewatch.c       | 65 +++++++++++++++++++++++
 lang/janet/files/patch-test_suite-filewatch.janet | 34 ++++++++++++
 4 files changed, 118 insertions(+), 6 deletions(-)

diff --git a/lang/janet/Makefile b/lang/janet/Makefile
index 0ffc47ef4a24..90476a3305c6 100644
--- a/lang/janet/Makefile
+++ b/lang/janet/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	janet
 DISTVERSIONPREFIX=	v
-DISTVERSION=	1.41.2
+DISTVERSION=	1.42.0
 CATEGORIES=	lang
 
 MAINTAINER=	bsd.hsw@gmail.com
@@ -10,7 +10,7 @@ WWW=		https://janet-lang.org/
 LICENSE=	MIT
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-USES=		meson
+USES=		inotify meson
 USE_GITHUB=	yes
 GH_ACCOUNT=	janet-lang
 USE_LDCONFIG=	yes
@@ -18,4 +18,17 @@ USE_LDCONFIG=	yes
 PLIST_SUB=	SOVERSION=${DISTVERSION} \
 		SOVERSION_R=${DISTVERSION:R}
 
-.include <bsd.port.mk>
+# if it has native (not port) use that for filewatch otherwise let it use kqueue.
+# Once FreeBSD14.4 is retired merge upstream.
+.include <bsd.port.pre.mk>
+post-patch:
+.if defined(INOTIFY_PORT)
+	${REINPLACE_CMD} -e 's:%INOTIFY%::' ${WRKSRC}/src/core/filewatch.c
+	${REINPLACE_CMD} -e 's|%KQUEUE%|:freebsd|' -e 's|%INOTIFY%||' \
+		${WRKSRC}/test/suite-filewatch.janet
+.else
+	${REINPLACE_CMD} -e 's:%INOTIFY%:|| defined(__FreeBSD__):' ${WRKSRC}/src/core/filewatch.c
+	${REINPLACE_CMD} -e 's|%KQUEUE%||' -e 's|%INOTIFY%|:freebsd|' \
+		${WRKSRC}/test/suite-filewatch.janet
+.endif
+.include <bsd.port.post.mk>
diff --git a/lang/janet/distinfo b/lang/janet/distinfo
index 398d582de39a..f1673ddf3198 100644
--- a/lang/janet/distinfo
+++ b/lang/janet/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1771928845
-SHA256 (janet-lang-janet-v1.41.2_GH0.tar.gz) = 168e97e1b790f6e9d1e43685019efecc4ee473d6b9f8c421b49c195336c0b725
-SIZE (janet-lang-janet-v1.41.2_GH0.tar.gz) = 612285
+TIMESTAMP = 1788435710
+SHA256 (janet-lang-janet-v1.42.0_GH0.tar.gz) = 8d246df6e4034e4b7b8a55a468a43865bf4ef0cfe543de4ba81db4b1f0b39a0f
+SIZE (janet-lang-janet-v1.42.0_GH0.tar.gz) = 630683
diff --git a/lang/janet/files/patch-src_core_filewatch.c b/lang/janet/files/patch-src_core_filewatch.c
new file mode 100644
index 000000000000..85d178159b3d
--- /dev/null
+++ b/lang/janet/files/patch-src_core_filewatch.c
@@ -0,0 +1,65 @@
+--- src/core/filewatch.c.orig	2026-08-31 23:24:25 UTC
++++ src/core/filewatch.c
+@@ -29,7 +29,15 @@
+ #ifdef JANET_EV
+ #ifdef JANET_FILEWATCH
+ 
+-#ifdef JANET_LINUX
++#if defined(JANET_APPLE) || defined(JANET_BSD)
++#define JANET_KQUEUE 1
++#endif
++#if defined(JANET_LINUX) %INOTIFY%
++#undef  JANET_KQUEUE
++#define JANET_INOTIFY 1
++#endif
++
++#ifdef JANET_INOTIFY
+ #include <sys/inotify.h>
+ #include <unistd.h>
+ #endif
+@@ -38,7 +46,7 @@
+ #include <windows.h>
+ #endif
+ 
+-#if defined(JANET_APPLE) || defined(JANET_BSD)
++#ifdef JANET_KQUEUE
+ #include <sys/event.h>
+ #include <sys/stat.h>
+ #include <unistd.h>
+@@ -60,7 +68,7 @@ typedef struct {
+     int is_watching;
+ } JanetWatcher;
+ 
+-#ifdef JANET_LINUX
++#ifdef JANET_INOTIFY
+ 
+ #include <sys/inotify.h>
+ #include <unistd.h>
+@@ -96,7 +104,7 @@ static uint32_t decode_watch_flags(const Janet *option
+             sizeof(JanetWatchFlagName),
+             keyw);
+         if (!result) {
+-            janet_panicf("unknown linux flag %v", options[i]);
++            janet_panicf("unknown inotify flag %v", options[i]);
+         }
+         flags |= result->flag;
+     }
+@@ -122,7 +130,8 @@ static void janet_watcher_add(JanetWatcher *watcher, c
+     if (watcher->stream == NULL) janet_panic("watcher closed");
+     int result;
+     do {
+-        result = inotify_add_watch(watcher->stream->handle, path, flags);
++        /* FreeBSD is not forgiving about returned-only flags, just make sure off */
++        result = inotify_add_watch(watcher->stream->handle, path, flags & ~(IN_IGNORED|IN_ISDIR|IN_Q_OVERFLOW|IN_UNMOUNT));
+     } while (result == -1 && errno == EINTR);
+     if (result == -1) {
+         janet_panicv(janet_ev_lasterr());
+@@ -514,7 +523,7 @@ static void janet_watcher_unlisten(JanetWatcher *watch
+     janet_gcunroot(janet_wrap_abstract(watcher));
+ }
+ 
+-#elif defined(JANET_APPLE) || defined(JANET_BSD)
++#elif JANET_KQUEUE
+ 
+ /* kqueue implementation */
+ 
diff --git a/lang/janet/files/patch-test_suite-filewatch.janet b/lang/janet/files/patch-test_suite-filewatch.janet
new file mode 100644
index 000000000000..219fffb7e080
--- /dev/null
+++ b/lang/janet/files/patch-test_suite-filewatch.janet
@@ -0,0 +1,34 @@
+--- test/suite-filewatch.janet.orig	2026-08-31 23:24:25 UTC
++++ test/suite-filewatch.janet
+@@ -25,9 +25,10 @@
+ 
+ (def chan (ev/chan 1000))
+ (var is-win (or (= :mingw (os/which)) (= :windows (os/which))))
+-(var is-linux (= :linux (os/which)))
+-(def bsds [:freebsd :macos :openbsd :bsd :dragonfly :netbsd])
+-(var is-kqueue (index-of (os/which) bsds))
++(def inotifies [:linux %INOTIFY%])
++(var is-inotify (index-of (os/which) inotifies))
++(def kqs [%KQUEUE% :macos :openbsd :bsd :dragonfly :netbsd])
++(var is-kqueue (index-of (os/which) kqs))
+ 
+ # If not supported, exit early
+ (def [supported msg] (protect (filewatch/new chan)))
+@@ -95,7 +96,7 @@
+ (when is-win
+   (filewatch/add fw td1 :last-write :last-access :file-name :dir-name :size :attributes :recursive)
+   (filewatch/add fw td2 :last-write :last-access :file-name :dir-name :size :attributes))
+-(when is-linux
++(when is-inotify
+   (filewatch/add fw (string td3 "/file3.txt") :close-write :create :delete)
+   (filewatch/add fw td1 :close-write :create :delete)
+   (filewatch/add fw td2 :close-write :create :delete :ignored))
+@@ -155,7 +156,7 @@
+ # Linux file writing
+ #
+ 
+-(when is-linux
++(when is-inotify
+   (spit-file td1 "file1.txt")
+   (expect :type :create :file-name "file1.txt" :dir-name td1)
+   (expect :type :close-write)