svn commit: r316411 - in head/devel/tcl-mmap: . files

Pietro Cerutti gahr at FreeBSD.org
Wed Apr 24 08:09:58 UTC 2013


Author: gahr
Date: Wed Apr 24 08:09:56 2013
New Revision: 316411
URL: http://svnweb.freebsd.org/changeset/ports/316411

Log:
  - Use TEA configure script instead of our custom Makefile
  - Add regression-test target
  - Enhance pkg-descr

Deleted:
  head/devel/tcl-mmap/files/Makefile.bsd
Modified:
  head/devel/tcl-mmap/Makefile
  head/devel/tcl-mmap/files/patch-warnings
  head/devel/tcl-mmap/pkg-descr

Modified: head/devel/tcl-mmap/Makefile
==============================================================================
--- head/devel/tcl-mmap/Makefile	Wed Apr 24 08:01:28 2013	(r316410)
+++ head/devel/tcl-mmap/Makefile	Wed Apr 24 08:09:56 2013	(r316411)
@@ -3,25 +3,31 @@
 
 PORTNAME=	tcl-mmap
 PORTVERSION=	1.1
-CATEGORIES=	devel tcl
+CATEGORIES=	devel
 MASTER_SITES=	SF
 
 MAINTAINER=	tcltk at FreeBSD.org
 COMMENT=	New TCL channel type using mmap-ed files
 
-MAKEFILE=	${FILESDIR}/Makefile.bsd
+LICENSE=	GPLv3
 
 USE_TCL=	84+
-
-MAKE_ENV+=	TCL_VER=${TCL_VER} MKDIR="${MKDIR}" \
-		PORTVERSION="${PORTVERSION}" \
-		FILESDIR="${FILESDIR}" \
-		TCLSH="${TCLSH}" \
-		INSTALL_DATA="${INSTALL_DATA}"
-PLIST_DIRS=	lib/tcl${TCL_VER}/mmap
-PLIST_FILES=	${PLIST_DIRS}/pkgIndex.tcl ${PLIST_DIRS}/libmmap${PORTVERSION}.so
+GNU_CONFIGURE=	yes
+CONFIGURE_ARGS+=--with-tcl=${TCL_LIBDIR} \
+		--prefix=${PREFIX} \
+		--exec-prefix=${PREFIX}
+
+PLIST_DIRS=	lib/mmap${PORTVERSION}
+PLIST_FILES=	lib/mmap${PORTVERSION}/pkgIndex.tcl \
+		lib/mmap${PORTVERSION}/libmmap${PORTVERSION}.so
 
 MANN=	tcl-mmap.n
-MANCOMPRESSED=	maybe
+
+regression-test: build
+	cd ${WRKSRC}/tests; \
+	for t in *.tcl; \
+	do \
+	    echo "load ../libmmap${PORTVERSION}.so; source $$t" | ${TCLSH}; \
+	done;
 
 .include <bsd.port.mk>

Modified: head/devel/tcl-mmap/files/patch-warnings
==============================================================================
--- head/devel/tcl-mmap/files/patch-warnings	Wed Apr 24 08:01:28 2013	(r316410)
+++ head/devel/tcl-mmap/files/patch-warnings	Wed Apr 24 08:09:56 2013	(r316411)
@@ -1,148 +1,21 @@
-Submitted upstream as:
-
-https://sourceforge.net/tracker/?func=detail&aid=3603360&group_id=224597&atid=1062254
-
---- unix/mmap.c	2008-04-21 08:47:04.000000000 -0400
-+++ unix/mmap.c	2013-02-04 18:18:52.000000000 -0500
-@@ -37,23 +37,16 @@
-  */
- 
--static int MmapCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]);
-+Tcl_PackageInitProc Mmap_Init;
- 
--void NewChannelName(char *name, CONST char* prefix);
-+static Tcl_ObjCmdProc MmapCmd;
- 
--static int Input(ClientData instanceData, char *buf, int bufSize, int *errorCodePtr);
-+static void NewChannelName(char *name, const char* prefix);
- 
--static int Output(ClientData instanceData, const char *buf, int bufSize, int *errorCodePtr);
--
--static int Seek(ClientData instanceData, long offset, int seekMode, int *errorCodePtr);
--
--static int Close(ClientData instanceData, Tcl_Interp *interp);
--
--static void Watch(ClientData instanceData, int mask);
--
--//static int BlockMode(ClientData instanceData, int mode);
--
--static int GetHandle(ClientData instanceData, int direction, ClientData *handlePtr);
--
--//static void catch_signal(int sig_num);
-+static Tcl_DriverInputProc Input;
-+static Tcl_DriverOutputProc Output;
-+static Tcl_DriverSeekProc Seek;
-+static Tcl_DriverCloseProc Close;
-+static Tcl_DriverWatchProc Watch;
-+static Tcl_DriverGetHandleProc GetHandle;
- 
- /*
-@@ -62,19 +55,12 @@
- 
- static Tcl_ChannelType channelType = {
--        "mmap", /* Channel type name */
--        TCL_CHANNEL_VERSION_2,
--        (Tcl_DriverCloseProc *) Close,
--        (Tcl_DriverInputProc *) Input,
--        (Tcl_DriverOutputProc *) Output,
--        (Tcl_DriverSeekProc *) Seek,
--        (Tcl_DriverSetOptionProc *) NULL, /* no channel type specific options */
--        (Tcl_DriverGetOptionProc *) NULL, /* no channel type specific options */
--        (Tcl_DriverWatchProc *) Watch,
--        (Tcl_DriverGetHandleProc *) GetHandle, 
--        (Tcl_DriverClose2Proc *) NULL, /* no support for closing the read and write sides independently */
--        (Tcl_DriverBlockModeProc *) NULL, /* mmap channels are always in non-blocking mode */
--        //(Tcl_DriverBlockModeProc *) BlockMode,
--        (Tcl_DriverFlushProc *) NULL, /* currently reserved for future use. It should be set to NULL */
--        (Tcl_DriverHandlerProc *) NULL  /* this is not a stacked channel driver */
-+	.typeName = "mmap", /* Channel type name */
-+	.version = TCL_CHANNEL_VERSION_2,
-+	.closeProc = Close,
-+	.inputProc = Input,
-+	.outputProc =  Output,
-+	.seekProc = Seek,
-+	.watchProc = Watch,
-+	.getHandleProc = GetHandle
- }; 
- 
-@@ -129,9 +115,9 @@
-     }
- 
--    if (bufSize > data->length - data->seek) {
-+    if (bufSize > (int)(data->length - data->seek)) {
-         bufSize = data->length - data->seek;
-     }
- 
--    memcpy((char *)buf, (char *) (data->addr + data->seek), (size_t) bufSize);
-+    memcpy(buf, data->addr + data->seek, (size_t)bufSize);
-     data->seek += bufSize;
- 
-@@ -144,10 +130,10 @@
-     int ret;
- 
--    if (bufSize > data->length - data->seek) {
-+    if (bufSize > (int)(data->length - data->seek)) {
-         bufSize = data->length - data->seek;
--        memcpy((char *) (data->addr + data->seek), (char *) buf, (size_t) bufSize);
-+        memcpy(data->addr + data->seek, buf, (size_t)bufSize);
-         data->seek = 0;
-     } else {
--        memcpy((char *) (data->addr + data->seek), (char *) buf, (size_t) bufSize);
-+        memcpy(data->addr + data->seek, buf, (size_t)bufSize);
-         data->seek += bufSize;
-     }
-@@ -163,4 +149,5 @@
- static int Seek(ClientData instanceData, long offset, int seekMode, int *errorCodePtr) {
-     ChannelInstance* data;
-+    off_t seek;
-     data = (ChannelInstance*) instanceData;
- 
-@@ -178,21 +165,20 @@
-     switch (seekMode) {
-     case SEEK_SET:
--        data->seek = offset;
-+        seek = offset;
-         break;
- 
-     case SEEK_CUR:
--        data->seek += offset;
-+        seek += offset;
-         break;
- 
-     case SEEK_END:
--        data->seek = data->length + offset;
-+        seek = data->length + offset;
-         break;
+--- unix/mmap.c.orig	2013-04-24 09:59:16.000000000 +0200
++++ unix/mmap.c	2013-04-24 10:00:30.000000000 +0200
+@@ -190,8 +190,7 @@
      }
  
      /* We check if seek is within range, and fix */
 -    if (data->seek < 0) data->seek = 0;
 -    if (data->seek > data->length) data->seek = data->length;
--    
--    return data->seek;
-+    if (seek < 0) seek = 0;
-+    if (seek > (off_t)data->length) seek = data->length;
-+    return data->seek = seek;
++    if (data->seek > (unsigned long)data->length) data->seek = data->length;
+     
+     return data->seek;
  }
+@@ -271,7 +270,7 @@
  
-@@ -255,5 +241,5 @@
-  */
- static int MmapCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
--    static char* cmds[] = { "-shared", "-length", "-offset", NULL };
-+    static const char* cmds[] = { "-shared", "-length", "-offset", NULL };
-     int index;
-     int ret;
-@@ -329,5 +315,5 @@
-     ClientData cd;
-     ret = Tcl_GetChannelHandle(chan, mode, (ClientData *) &cd);
--    fd = (int) cd; // This should be ok because the pointer size in bytes is at least as may bytes as 'int'
-+    fd = (intptr_t) cd; // This should be ok because the pointer size in bytes is at least as may bytes as 'int'
-     if (ret != TCL_OK) {
-         Tcl_SetResult(interp, "Could not get file handle", TCL_STATIC);
-@@ -384,5 +370,5 @@
- }
+     int i;
+     for (i = 1; i < objc - 1; i++) {
+-        if (Tcl_GetIndexFromObj(interp, objv[i], cmds, "option", 0, &index) != TCL_OK)
++        if (Tcl_GetIndexFromObj(interp, objv[i], (const char **)cmds, "option", 0, &index) != TCL_OK)
+             return TCL_ERROR;
  
--void NewChannelName(char *name, CONST char* prefix) {
-+void NewChannelName(char *name, const char* prefix) {
-     TCL_DECLARE_MUTEX (mmapCounterMutex)
-         static unsigned long mmapCounter = 0;
+         switch (index) {

Modified: head/devel/tcl-mmap/pkg-descr
==============================================================================
--- head/devel/tcl-mmap/pkg-descr	Wed Apr 24 08:01:28 2013	(r316410)
+++ head/devel/tcl-mmap/pkg-descr	Wed Apr 24 08:09:56 2013	(r316411)
@@ -1,6 +1,11 @@
 This extension provides a Tcl interface to the mmap(2) POSIX system
 call.
 
+It provides a Tcl package that allows Tcl scripts to:
+1) Memory map files for improved access efficiency;
+2) Share memory between related processes;
+3) Easily implement cyclic persistent log files.
+
 The functionality of 'mmap' is exported from this extension in the
 form of a new Tcl channel type, named "mmap". A memory mapping is
 established with the 'mmap' command. Following 'mmap' execution,
@@ -8,4 +13,4 @@ access to the memory mapped file is done
 commands: puts/gets/seek/flush/close/fconfigure, only that this
 time these commands operate on memory, rather than on a file.
 
-WWW:	http://tcl-mmap.sourceforge.net/
+WWW: http://tcl-mmap.sourceforge.net/


More information about the svn-ports-all mailing list