Re: FindInotify devel/kf5/extra-cmake-modules

2020-05-22 Thread Antoine Jacoutot
On Fri, May 22, 2020 at 03:46:52PM +0200, Rafael Sadowski wrote:
> On Fri May 22, 2020 at 08:57:21AM +0100, Stuart Henderson wrote:
> > IIRC it's installed there on purpose, exactly so that it is not
> > automatically picked up.
> > 
> 
> Fair enough, here another try. Just help cmake if inotify is required
> "find_package(inotify REQUIRED)". This make porting consumer less
> painful.

Why not move libinotify in its intended location?

> Rafael
> 
> Index: Makefile
> ===
> RCS file: /cvs/ports/devel/kf5/extra-cmake-modules/Makefile,v
> retrieving revision 1.9
> diff -u -p -u -p -r1.9 Makefile
> --- Makefile  30 Mar 2020 15:00:38 -  1.9
> +++ Makefile  22 May 2020 13:45:52 -
> @@ -3,7 +3,7 @@
>  COMMENT =CMake modules required by KDE5
>  DISTNAME =   extra-cmake-modules-${VERSION}
>  HOMEPAGE =   
> https://projects.kde.org/projects/kdesupport/extra-cmake-modules
> -REVISION =   1
> +REVISION =   2
>  
>  WANTLIB- =
>  
> @@ -21,6 +21,9 @@ PKG_ARCH =  *
>  
>  # use depleted
>  CONFIGURE_ARGS +=-DMAN_INSTALL_DIR=${PREFIX}/man
> +
> +post-patch:
> + ${SUBST_CMD} ${WRKSRC}/find-modules/FindInotify.cmake
>  
>  post-install:
>   ${MODPY_BIN} ${MODPY_LIBDIR}/compileall.py \
> Index: patches/patch-find-modules_FindInotify_cmake
> ===
> RCS file: patches/patch-find-modules_FindInotify_cmake
> diff -N patches/patch-find-modules_FindInotify_cmake
> --- /dev/null 1 Jan 1970 00:00:00 -
> +++ patches/patch-find-modules_FindInotify_cmake  22 May 2020 13:45:52 
> -
> @@ -0,0 +1,33 @@
> +$OpenBSD$
> +
> +If inotify is required, help cmake to find it.
> +
> +Index: find-modules/FindInotify.cmake
> +--- find-modules/FindInotify.cmake.orig
>  find-modules/FindInotify.cmake
> +@@ -48,7 +48,11 @@
> + # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + 
> #=
> + 
> +-find_path(Inotify_INCLUDE_DIRS sys/inotify.h)
> ++if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD" AND Inotify_FIND_REQUIRED)
> ++find_path(Inotify_INCLUDE_DIRS NAMES sys/inotify.h PATHS 
> ${LOCALBASE}/include/inotify NO_DEFAULT_PATH)
> ++else()
> ++find_path(Inotify_INCLUDE_DIRS sys/inotify.h)
> ++endif()
> + 
> + if(Inotify_INCLUDE_DIRS)
> + # On Linux there is no library to link against, on the BSDs there is.
> +@@ -58,7 +62,11 @@ if(Inotify_INCLUDE_DIRS)
> + set(Inotify_LIBRARIES "")
> + set(Inotify_INCLUDE_DIRS "")
> + else()
> +-find_library(Inotify_LIBRARIES NAMES inotify)
> ++if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD" AND Inotify_FIND_REQUIRED)
> ++find_library(Inotify_LIBRARIES NAMES inotify PATHS 
> ${LOCALBASE}/lib/inotify NO_DEFAULT_PATH)
> ++else()
> ++find_library(Inotify_LIBRARIES NAMES inotify)
> ++endif()
> + include(FindPackageHandleStandardArgs)
> + find_package_handle_standard_args(Inotify
> + FOUND_VAR
> 

-- 
Antoine



Re: FindInotify devel/kf5/extra-cmake-modules

2020-05-22 Thread Rafael Sadowski
On Fri May 22, 2020 at 08:57:21AM +0100, Stuart Henderson wrote:
> IIRC it's installed there on purpose, exactly so that it is not
> automatically picked up.
> 

Fair enough, here another try. Just help cmake if inotify is required
"find_package(inotify REQUIRED)". This make porting consumer less
painful.

Rafael

Index: Makefile
===
RCS file: /cvs/ports/devel/kf5/extra-cmake-modules/Makefile,v
retrieving revision 1.9
diff -u -p -u -p -r1.9 Makefile
--- Makefile30 Mar 2020 15:00:38 -  1.9
+++ Makefile22 May 2020 13:45:52 -
@@ -3,7 +3,7 @@
 COMMENT =  CMake modules required by KDE5
 DISTNAME = extra-cmake-modules-${VERSION}
 HOMEPAGE = 
https://projects.kde.org/projects/kdesupport/extra-cmake-modules
-REVISION = 1
+REVISION = 2
 
 WANTLIB- =
 
@@ -21,6 +21,9 @@ PKG_ARCH =*
 
 # use depleted
 CONFIGURE_ARGS +=  -DMAN_INSTALL_DIR=${PREFIX}/man
+
+post-patch:
+   ${SUBST_CMD} ${WRKSRC}/find-modules/FindInotify.cmake
 
 post-install:
${MODPY_BIN} ${MODPY_LIBDIR}/compileall.py \
Index: patches/patch-find-modules_FindInotify_cmake
===
RCS file: patches/patch-find-modules_FindInotify_cmake
diff -N patches/patch-find-modules_FindInotify_cmake
--- /dev/null   1 Jan 1970 00:00:00 -
+++ patches/patch-find-modules_FindInotify_cmake22 May 2020 13:45:52 
-
@@ -0,0 +1,33 @@
+$OpenBSD$
+
+If inotify is required, help cmake to find it.
+
+Index: find-modules/FindInotify.cmake
+--- find-modules/FindInotify.cmake.orig
 find-modules/FindInotify.cmake
+@@ -48,7 +48,11 @@
+ # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ #=
+ 
+-find_path(Inotify_INCLUDE_DIRS sys/inotify.h)
++if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD" AND Inotify_FIND_REQUIRED)
++find_path(Inotify_INCLUDE_DIRS NAMES sys/inotify.h PATHS 
${LOCALBASE}/include/inotify NO_DEFAULT_PATH)
++else()
++find_path(Inotify_INCLUDE_DIRS sys/inotify.h)
++endif()
+ 
+ if(Inotify_INCLUDE_DIRS)
+ # On Linux there is no library to link against, on the BSDs there is.
+@@ -58,7 +62,11 @@ if(Inotify_INCLUDE_DIRS)
+ set(Inotify_LIBRARIES "")
+ set(Inotify_INCLUDE_DIRS "")
+ else()
+-find_library(Inotify_LIBRARIES NAMES inotify)
++if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD" AND Inotify_FIND_REQUIRED)
++find_library(Inotify_LIBRARIES NAMES inotify PATHS 
${LOCALBASE}/lib/inotify NO_DEFAULT_PATH)
++else()
++find_library(Inotify_LIBRARIES NAMES inotify)
++endif()
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(Inotify
+ FOUND_VAR



Re: FindInotify devel/kf5/extra-cmake-modules

2020-05-22 Thread Stuart Henderson
On 2020/05/22 12:10, Antoine Jacoutot wrote:
> On Fri, May 22, 2020 at 08:57:21AM +0100, Stuart Henderson wrote:
> > IIRC it's installed there on purpose, exactly so that it is not
> > automatically picked up.
> 
> Indeed.
> But should we change the rule now and install it under the default path?

I don't think this is something to be taken likely. As you know,
libinotify has different behaviour than linux inotify. It feels like
the problem with high FD use is manageable while it's opt-in and only a
few ports are involved, but if this is turned on for all ports that want
it we'll at least need to look closer into how they all behave.
Also we don't know how some programs will cope with the various inotify
events that aren't supported by libinotify.

I've made a list of ports with "inotify" in build log and not in the
port directory, it's not totally accurate but gives a reasonable picture
- obviously this doesn't mean that all of these ports will start using
it but it's a starting point of places where we'd need to look if we
do decide this is useful.

Compared to the work involved in looking at all of these (and future
ports), and possibly having to patch to disable libinotify in some
cases (which is often harder than patching a port to allow it to find
files in an unusual location), it feels like patching the few ports
that do really need libinotify is less work and easier work.

comms/smstools
databases/tdb
devel/clang-tools-extra
devel/glib2
devel/kf5/extra-cmake-modules
devel/kf5/kcoreaddons
devel/libev
devel/libivykis
devel/libtalloc
devel/p5-EV
devel/p5-File-ChangeNotify
devel/py-gevent
devel/spidermonkey60
devel/spidermonkey68
editors/emacs
games/mirrormagic
games/openclonk
graphics/feh
lang/mono
mail/dovecot
mail/extsmail
mail/mozilla-thunderbird
mail/mutt
mail/neomutt
mail/rspamd
math/graphviz
net/avahi
net/coredns
net/dnsmasq
net/gdnsd
net/ruby-eventmachine
net/samba
net/transmission
sysutils/conky
sysutils/consolekit
sysutils/coreutils
sysutils/direvent
sysutils/logfmon
sysutils/rsyslog
sysutils/ruby-libvirt
sysutils/syslog-ng
telephony/asterisk
textproc/calibre
textproc/wkhtmltopdf
www/firefox-esr
www/mozilla-firefox
www/tor-browser/browser
x11/dbus
x11/e17/ecore
x11/e17/eio
x11/e17/evas
x11/ede/lib
x11/emelfm2
x11/gnome/vfs2
x11/kde/libs3
x11/kde4/baloo
x11/kde4/pim
x11/kde4/workspace
x11/qt4
x11/rox-filer
x11/rxvt-unicode



Re: FindInotify devel/kf5/extra-cmake-modules

2020-05-22 Thread Antoine Jacoutot
On Fri, May 22, 2020 at 08:57:21AM +0100, Stuart Henderson wrote:
> IIRC it's installed there on purpose, exactly so that it is not
> automatically picked up.

Indeed.
But should we change the rule now and install it under the default path?


> On 22 May 2020 07:28:55 Rafael Sadowski  wrote:
> 
> > Simple patch to fix FindInotify. CMake needs some help to find
> > "sys/inotify.h" and libinotify because we do not install it under
> > LOCALBASE/{include,lib}.
> > 
> > OK?
> > 
> > Index: Makefile
> > ===
> > RCS file: /cvs/ports/devel/kf5/extra-cmake-modules/Makefile,v
> > retrieving revision 1.9
> > diff -u -p -u -p -r1.9 Makefile
> > --- Makefile30 Mar 2020 15:00:38 -  1.9
> > +++ Makefile22 May 2020 06:25:00 -
> > @@ -3,7 +3,7 @@
> > COMMENT =   CMake modules required by KDE5
> > DISTNAME =  extra-cmake-modules-${VERSION}
> > HOMEPAGE =  
> > https://projects.kde.org/projects/kdesupport/extra-cmake-modules
> > -REVISION = 1
> > +REVISION = 2
> > 
> > WANTLIB- =
> > 
> > @@ -21,6 +21,9 @@ PKG_ARCH =*
> > 
> > # use depleted
> > CONFIGURE_ARGS +=   -DMAN_INSTALL_DIR=${PREFIX}/man
> > +
> > +post-patch:
> > +   ${SUBST_CMD} ${WRKSRC}/find-modules/FindInotify.cmake
> > 
> > post-install:
> > ${MODPY_BIN} ${MODPY_LIBDIR}/compileall.py \
> > Index: patches/patch-find-modules_FindInotify_cmake
> > ===
> > RCS file: patches/patch-find-modules_FindInotify_cmake
> > diff -N patches/patch-find-modules_FindInotify_cmake
> > --- /dev/null   1 Jan 1970 00:00:00 -
> > +++ patches/patch-find-modules_FindInotify_cmake22 May 2020 06:25:00 
> > -
> > @@ -0,0 +1,25 @@
> > +$OpenBSD$
> > +
> > +inotify is not installed in the standard path
> > +
> > +Index: find-modules/FindInotify.cmake
> > +--- find-modules/FindInotify.cmake.orig
> >  find-modules/FindInotify.cmake
> > +@@ -48,7 +48,7 @@
> > + # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> > + 
> > #=
> > +
> > +-find_path(Inotify_INCLUDE_DIRS sys/inotify.h)
> > ++find_path(Inotify_INCLUDE_DIRS NAMES sys/inotify.h PATHS
> > ${LOCALBASE}/include/inotify NO_DEFAULT_PATH)
> > +
> > + if(Inotify_INCLUDE_DIRS)
> > + # On Linux there is no library to link against, on the BSDs there is.
> > +@@ -58,7 +58,7 @@ if(Inotify_INCLUDE_DIRS)
> > + set(Inotify_LIBRARIES "")
> > + set(Inotify_INCLUDE_DIRS "")
> > + else()
> > +-find_library(Inotify_LIBRARIES NAMES inotify)
> > ++find_library(Inotify_LIBRARIES NAMES inotify PATHS
> > ${LOCALBASE}/lib/inotify NO_DEFAULT_PATH)
> > + include(FindPackageHandleStandardArgs)
> > + find_package_handle_standard_args(Inotify
> > + FOUND_VAR
> 
> 
> 

-- 
Antoine



Re: FindInotify devel/kf5/extra-cmake-modules

2020-05-22 Thread Stuart Henderson
IIRC it's installed there on purpose, exactly so that it is not 
automatically picked up.



On 22 May 2020 07:28:55 Rafael Sadowski  wrote:


Simple patch to fix FindInotify. CMake needs some help to find
"sys/inotify.h" and libinotify because we do not install it under
LOCALBASE/{include,lib}.

OK?

Index: Makefile
===
RCS file: /cvs/ports/devel/kf5/extra-cmake-modules/Makefile,v
retrieving revision 1.9
diff -u -p -u -p -r1.9 Makefile
--- Makefile30 Mar 2020 15:00:38 -  1.9
+++ Makefile22 May 2020 06:25:00 -
@@ -3,7 +3,7 @@
COMMENT =   CMake modules required by KDE5
DISTNAME =  extra-cmake-modules-${VERSION}
HOMEPAGE =  
https://projects.kde.org/projects/kdesupport/extra-cmake-modules
-REVISION = 1
+REVISION = 2

WANTLIB- =

@@ -21,6 +21,9 @@ PKG_ARCH =*

# use depleted
CONFIGURE_ARGS +=   -DMAN_INSTALL_DIR=${PREFIX}/man
+
+post-patch:
+   ${SUBST_CMD} ${WRKSRC}/find-modules/FindInotify.cmake

post-install:
${MODPY_BIN} ${MODPY_LIBDIR}/compileall.py \
Index: patches/patch-find-modules_FindInotify_cmake
===
RCS file: patches/patch-find-modules_FindInotify_cmake
diff -N patches/patch-find-modules_FindInotify_cmake
--- /dev/null   1 Jan 1970 00:00:00 -
+++ patches/patch-find-modules_FindInotify_cmake22 May 2020 06:25:00 
-
@@ -0,0 +1,25 @@
+$OpenBSD$
+
+inotify is not installed in the standard path
+
+Index: find-modules/FindInotify.cmake
+--- find-modules/FindInotify.cmake.orig
 find-modules/FindInotify.cmake
+@@ -48,7 +48,7 @@
+ # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ 
#=

+
+-find_path(Inotify_INCLUDE_DIRS sys/inotify.h)
++find_path(Inotify_INCLUDE_DIRS NAMES sys/inotify.h PATHS 
${LOCALBASE}/include/inotify NO_DEFAULT_PATH)

+
+ if(Inotify_INCLUDE_DIRS)
+ # On Linux there is no library to link against, on the BSDs there is.
+@@ -58,7 +58,7 @@ if(Inotify_INCLUDE_DIRS)
+ set(Inotify_LIBRARIES "")
+ set(Inotify_INCLUDE_DIRS "")
+ else()
+-find_library(Inotify_LIBRARIES NAMES inotify)
++find_library(Inotify_LIBRARIES NAMES inotify PATHS 
${LOCALBASE}/lib/inotify NO_DEFAULT_PATH)

+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(Inotify
+ FOUND_VAR