Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Mar 2017 08:14:33 +0000 (UTC)
From:      Guido Falsi <madpilot@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r436802 - in head/net/unison: . files
Message-ID:  <201703240814.v2O8EXIv085886@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: madpilot
Date: Fri Mar 24 08:14:33 2017
New Revision: 436802
URL: https://svnweb.freebsd.org/changeset/ports/436802

Log:
  - Add FSMONITOR option (on by default) to compile the linux fsmonitor,
    leveraging the liinotify port. This enables the use of "repeat=watch"
    mode in FreeBSD
  - Convert port to using OPTIONS_SUB

Added:
  head/net/unison/files/patch-Makefile.OCaml   (contents, props changed)
  head/net/unison/files/patch-fsmonitor_linux_Makefile   (contents, props changed)
  head/net/unison/files/patch-fsmonitor_linux_inotify__stubs.c   (contents, props changed)
Modified:
  head/net/unison/Makefile
  head/net/unison/pkg-plist

Modified: head/net/unison/Makefile
==============================================================================
--- head/net/unison/Makefile	Fri Mar 24 08:08:02 2017	(r436801)
+++ head/net/unison/Makefile	Fri Mar 24 08:14:33 2017	(r436802)
@@ -3,7 +3,7 @@
 
 PORTNAME=	unison
 PORTVERSION=	2.48.4
-PORTREVISION?=	0
+PORTREVISION?=	1
 CATEGORIES=	net
 MASTER_SITES=	http://www.cis.upenn.edu/~bcpierce/unison/download/releases/${DISTNAME}/
 DISTFILES=	${EXTRACT_ONLY} ${EXTRA_DOCS}
@@ -16,14 +16,13 @@ COMMENT?=	User-level file synchronizatio
 LICENSE=	GPLv3
 
 PLIST_SUB=	PORTVERSION=${PORTVERSION}
-USES=		gmake
+USES=		gmake localbase
 USE_OCAML=	yes
 WRKSRC=		${WRKDIR}/src
 NO_OCAML_RUNDEPENDS=yes
 WANT_GNOME=	yes
-MAKE_ARGS=	CFLAGS=""
 CONFLICTS?=	unison-devel-[0-9]* unison-nox11-[0-9]*
-
+MAKE_ENV=	CLIBS="${LIBS:S/^-/-ccopt -/}" COFLAGS="${CFLAGS:C/ *(-[^ ]*) */ -ccopt \"\1 \"/gW}"
 MAKE_JOBS_UNSAFE=	yes
 ALL_TARGET=	unison all
 
@@ -31,28 +30,41 @@ DOCS=		BUGS.txt NEWS README
 EXTRA_DOCS=	${DISTNAME}-manual.html \
 		${DISTNAME}-manual.pdf ${DISTNAME}-manual.ps
 
-OPTIONS_DEFINE=		DOCS X11
-OPTIONS_DEFAULT?=	X11
+OPTIONS_DEFINE=		DOCS FSMONITOR X11
+OPTIONS_DEFAULT?=	FSMONITOR X11
+
+FSMONITOR_DESC=		Compile and install fsmonitor plugin
+
+OPTIONS_SUB=		YES
+
+FSMONITOR_LIB_DEPENDS=	libinotify.so:devel/libinotify
 
 X11_MAKE_ARGS=		UISTYLE=gtk2
-X11_PLIST_SUB=		TEXT=""
 X11_BUILD_DEPENDS=	lablgtk2:x11-toolkits/ocaml-lablgtk2 \
 			icotool:graphics/icoutils
 X11_RUN_DEPENDS=	lablgtk2:x11-toolkits/ocaml-lablgtk2
 X11_SUB_FILES=		${PORTNAME}.desktop
 
 X11_MAKE_ARGS_OFF=	UISTYLE=text
-X11_PLIST_SUB_OFF=	TEXT="@comment "
 X11_VARS_OFF=		PKGMESSAGE=${PKGDIR}/pkg-message.nox11
 
+post-patch-FSMONITOR-off:
+	@${REINPLACE_CMD} -e 's/-include fsmonitor/#&/' \
+		${WRKSRC}/Makefile.OCaml
+
+post-patch-X11-off:
+	@${REINPLACE_CMD} -e 's/CFLAGS/COFLAGS/g' \
+		${WRKSRC}/Makefile.OCaml ${WRKSRC}/fsmonitor/linux/Makefile
+
 post-patch-X11-on:
 	@${REINPLACE_CMD} -Ee 's@(\+|/)(lablgtk2)@\1site-lib/\2@' \
-		${WRKSRC}/Makefile.OCaml
+			-e 's/CFLAGS/COFLAGS/g' \
+		${WRKSRC}/Makefile.OCaml ${WRKSRC}/fsmonitor/linux/Makefile
 
 post-build-X11-on:
 	@${ECHO} Building text-only version
 	@${ECHO} ${WRKSRC}
-	${SETENV} ${MAKE_ENV} ${MAKE_CMD} -C ${WRKSRC} CFLAGS="" UISTYLE=text NAME=unison-text
+	${SETENV} ${MAKE_ENV} ${MAKE_CMD} -C ${WRKSRC} UISTYLE=text NAME=unison-text
 	@cd ${WRKSRC}/win32rc && ${LOCALBASE}/bin/icotool -x U.ico
 
 do-install:
@@ -61,6 +73,9 @@ do-install:
 	cd ${WRKSRC} && ${INSTALL_DATA} ${DOCS} ${STAGEDIR}${DOCSDIR}
 	cd ${DISTDIR}/${DIST_SUBDIR} && ${INSTALL_DATA} ${EXTRA_DOCS} ${STAGEDIR}${DOCSDIR}
 
+do-install-FSMONITOR-on:
+	${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME}-fsmonitor ${STAGEDIR}${PREFIX}/bin
+
 do-install-X11-on:
 	${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME}-text ${STAGEDIR}${PREFIX}/bin
 	${INSTALL_DATA} ${WRKDIR}/${PORTNAME}.desktop ${STAGEDIR}${DESKTOPDIR}

Added: head/net/unison/files/patch-Makefile.OCaml
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/unison/files/patch-Makefile.OCaml	Fri Mar 24 08:14:33 2017	(r436802)
@@ -0,0 +1,34 @@
+--- Makefile.OCaml.orig	2017-03-23 16:39:49 UTC
++++ Makefile.OCaml
+@@ -32,7 +32,11 @@ ifeq ($(shell uname),OpenBSD)
+ else
+ ifeq ($(shell uname),NetBSD)
+   OSARCH=NetBSD
++else
++ifeq ($(shell uname),FreeBSD)
++  OSARCH=FreeBSD
+ endif
++endif
+ ifeq ($(shell uname),Linux)
+   OSARCH=Linux
+ endif
+@@ -311,6 +315,10 @@ ifeq ($(OSARCH),Linux)
+ -include fsmonitor/linux/Makefile src/fsmonitor/linux/Makefile
+ endif
+ 
++ifeq ($(OSARCH),FreeBSD)
++-include fsmonitor/linux/Makefile src/fsmonitor/linux/Makefile
++endif
++
+ ifeq ($(OSARCH),win32gnuc)
+ -include fsmonitor/windows/Makefile src/fsmonitor/windows/Makefile
+ endif
+@@ -436,7 +444,7 @@ win32rc/unison.res.lib: win32rc/unison.res
+ 
+ %.o %.obj: %.c
+ 	@echo "$(OCAMLOPT): $< ---> $@"
+-	$(CAMLC) $(CAMLFLAGS) -ccopt $(OUTPUT_SEL)$(CWD)/$@ -c $(CWD)/$<
++	$(CAMLC) $(CAMLFLAGS) -ccopt $(OUTPUT_SEL)$(CWD)/$@ -c $(CFLAGS) $(CWD)/$<
+ 
+ $(NAME)$(EXEC_EXT): $(CAMLOBJS) $(COBJS)
+ 	@echo Linking $@

Added: head/net/unison/files/patch-fsmonitor_linux_Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/unison/files/patch-fsmonitor_linux_Makefile	Fri Mar 24 08:14:33 2017	(r436802)
@@ -0,0 +1,20 @@
+--- fsmonitor/linux/Makefile.orig	2017-03-23 16:47:46 UTC
++++ fsmonitor/linux/Makefile
+@@ -18,6 +18,10 @@ else
+   FSMCAMLLIBS=$(FSMOCAMLLIBS)
+ endif
+ 
++ifeq ($(OSARCH),FreeBSD)
++  CLIBS+=-cclib -linotify
++endif
++
+ buildexecutable:: $(FSMONITOR)$(EXEC_EXT)
+ 
+ $(FSMONITOR)$(EXEC_EXT): $(FSMCAMLOBJS) $(FSMCOBJS)
+@@ -26,4 +30,4 @@ $(FSMONITOR)$(EXEC_EXT): $(FSMCAMLOBJS) $(FSMCOBJS)
+ 
+ clean::
+ 	rm -f $(DIR)/*.cm[iox] $(DIR)/*.o $(DIR)/*~
+-	rm -f $(FSMONITOR)$(EXEC_EXT)
+\ No newline at end of file
++	rm -f $(FSMONITOR)$(EXEC_EXT)

Added: head/net/unison/files/patch-fsmonitor_linux_inotify__stubs.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/unison/files/patch-fsmonitor_linux_inotify__stubs.c	Fri Mar 24 08:14:33 2017	(r436802)
@@ -0,0 +1,17 @@
+--- fsmonitor/linux/inotify_stubs.c.orig	2017-03-23 16:25:03 UTC
++++ fsmonitor/linux/inotify_stubs.c
+@@ -27,9 +27,13 @@
+ #include <caml/signals.h>
+ #include <caml/callback.h>
+ 
++#include <sys/param.h>
++
++#if !defined(__FreeBSD__)
+ #include <features.h>
++#endif
+ 
+-#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 4
++#if (__GLIBC__ >= 2 && __GLIBC_MINOR__ >= 4) || defined(__FreeBSD__)
+ #define GLIBC_SUPPORT_INOTIFY 1
+ #else
+ #define GLIBC_SUPPORT_INOTIFY 0

Modified: head/net/unison/pkg-plist
==============================================================================
--- head/net/unison/pkg-plist	Fri Mar 24 08:08:02 2017	(r436801)
+++ head/net/unison/pkg-plist	Fri Mar 24 08:14:33 2017	(r436802)
@@ -1,7 +1,8 @@
 bin/unison
-%%TEXT%%share/applications/unison.desktop
-%%TEXT%%bin/unison-text
-%%TEXT%%share/pixmaps/unison.png
+%%FSMONITOR%%bin/unison-fsmonitor
+%%X11%%share/applications/unison.desktop
+%%X11%%bin/unison-text
+%%X11%%share/pixmaps/unison.png
 %%PORTDOCS%%%%DOCSDIR%%/BUGS.txt
 %%PORTDOCS%%%%DOCSDIR%%/NEWS
 %%PORTDOCS%%%%DOCSDIR%%/README



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703240814.v2O8EXIv085886>