Page MenuHomeFreeBSD

Uses/inotify.mk: Create
ClosedPublic

Authored by adamw on Dec 7 2025, 11:29 PM.
Tags
None
Referenced Files
F144637265: D54116.id167676.diff
Tue, Feb 10, 12:28 PM
F144637256: D54116.id.diff
Tue, Feb 10, 12:28 PM
F144584856: D54116.id171429.diff
Mon, Feb 9, 10:16 PM
Unknown Object (File)
Mon, Feb 9, 6:32 PM
Unknown Object (File)
Mon, Feb 9, 1:12 PM
Unknown Object (File)
Mon, Feb 9, 5:42 AM
Unknown Object (File)
Sat, Feb 7, 8:04 PM
Unknown Object (File)
Sat, Feb 7, 7:33 PM

Details

Summary

FreeBSD 15 added inotify support into libc, meaning that the libinotify port is only needed conditionally.

A quick and dirty grep suggests that we have somewhere around 100 ports that use it:

[1825.05 adamw@apnoea /usr/ports] rg :devel/libinotify | sort | uniq | wc -l
     103

The included diff is based largely off of iconv.h, but is much simpler. It determines what to do based on capability (presence of the associated header) rather than looking at OSVERSION. Because of pkgbase, I don't know whether we can rely on checking OSVERSION for these sorts of things.

Test Plan
14jail
lua-language-server$ make -V LIB_DEPENDS -V INOTIFY_PORT -V INOTIFY_INCLUDE_PATH -V INOTIFY_LIB -V INOTIFY_LIB_PATH -V 'CMAKE_ARGS:M*INOTIFY*'
libinotify.so:devel/libinotify
true
/usr/local/include/sys
-linotify
/usr/local/lib/libinotify.so
-DINOTIFY_INCLUDE_DIR=/usr/local/include/sys -DINOTIFY_LIBRARIES=/usr/local/lib/libinotify.so -DINOTIFY_LIBRARY=/usr/local/lib/libinotify.so -DLIBINOTIFY_INCLUDE_DIR=/usr/local/include/sys -DLIBINOTIFY_LIBRARIES=/usr/local/lib/libinotify.so -DLIBINOTIFY_LIBRARY=/usr/local/lib/libinotify.so
15jail
lua-language-server$ make -V LIB_DEPENDS -V INOTIFY_PORT -V INOTIFY_INCLUDE_PATH -V INOTIFY_LIB -V INOTIFY_LIB_PATH -V 'CMAKE_ARGS:M*INOTIFY*'


/usr/include/sys

/usr/lib/libc.so
-DINOTIFY_INCLUDE_DIR=/usr/include/sys -DINOTIFY_LIBRARIES=/usr/lib/libc.so -DINOTIFY_LIBRARY=/usr/lib/libc.so -DLIBINOTIFY_INCLUDE_DIR=/usr/include/sys -DLIBINOTIFY_LIBRARIES=/usr/lib/libc.so -DLIBINOTIFY_LIBRARY=/usr/lib/libc.so

Diff Detail

Repository
R11 FreeBSD ports repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

adamw requested review of this revision.Dec 7 2025, 11:29 PM
adamw created this revision.

@portmgr: I've not submitted one of these before. Could you please take a gander and let me know if I'm on the right path and should continue putting work into this? Or is there a better approach that I overlooked?

It feels ok to me, yes.
Maybe there is a need to add some autotools env variables too, or maybe those should go in Templates/config.site.

Mk/Uses/inotify.mk
13

When writing .if/.else, the .if condition should be positive to make it easier to read.
Could you invert the condition and swap the two code blocks.

27โ€“29

Is this really needed? it feels like it should not be used as we have an implementation in the base system.

31โ€“36

Should this be outside of the .if/.else?
It feels like it should work in both cases.

How many ports does this actually affect as in does it make sense to add yet another USES helper? Ahh... about a hundred temporarily, I'm not sure if it's worth the effort then and handbook entry is missing too.

How many ports does this actually affect as in does it make sense to add yet another USES helper? Ahh... about a hundred temporarily, I'm not sure if it's worth the effort then and handbook entry is missing too.

If this were just a USES helper to simplify a dependency, I'd agree with you there. But this exists to make sure that the base library is used in the correct versions of FreeBSD, which means that each of those 100 ports (and any future ports that use inotify) would need that logic. North of 100 ports passes the bar for cost vs. DRY benefit for me personally. What feels like the right number for you, and also what would you recommend as an alternative?

This looks good, could my comments be addressed ?

adamw edited the test plan for this revision. (Show Details)

Thank you for all your patience. 2026 has been.... difficult.

I'm updating the patch with all of Mat's comments addressed.

I removed that block that registered a LIB_DEPENDS on ${LOCALBASE}/lib/libinotify.so if it's present, which was definitely the wrong solution. The idea was to mitigate weirdness in some ports that will inevitably try to link against ${LOCALBASE}/lib/libinotify.so when it finds it, but after more thought, that's the responsibility of maintainers, not the framework, and this was not even close to the correct solution ๐Ÿ˜„ .

adamw marked 3 inline comments as done.Sat, Feb 7, 8:03 PM

Updated a comment to be correcter.

adamw accepted this revision.EditedSat, Feb 7, 8:21 PM

So, here's the deal. This patch looks great, it tests perfectly for me, and I'm happy to commit it. Just give me a sign when you're ready and I'll make it happen.

Oh gosh, that was meant for an entirely different Review! Please ignore. ๐Ÿ˜“

I don't think it lets me un-approve it.

Approved, with a small change.

Mk/Uses/inotify.mk
15

I think this line should be removed so that people can test .if defined(INOTIFY_PORT), it makes things even simpler.

This revision is now accepted and ready to land.Sun, Feb 8, 12:15 PM
Mk/Uses/inotify.mk
15

I think this line should be removed so that people can test .if defined(INOTIFY_PORT), it makes things even simpler.

Oh I like that!

This revision was automatically updated to reflect the committed changes.