Page MenuHomeFreeBSD

D59342.diff
No OneTemporary

D59342.diff

diff --git a/lang/janet/Makefile b/lang/janet/Makefile
--- 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 @@
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 @@
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
--- 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
--- /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
--- /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)

File Metadata

Mime Type
text/plain
Expires
Wed, Sep 9, 12:49 AM (8 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38388996
Default Alt Text
D59342.diff (5 KB)

Event Timeline