ports/183205: [patch] devel/tcltls -- refactoring

Pietro Cerutti gahr at FreeBSD.org
Tue Oct 22 15:40:01 UTC 2013


>Number:         183205
>Category:       ports
>Synopsis:       [patch] devel/tcltls -- refactoring
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 22 15:40:01 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Pietro Cerutti
>Release:        
>Organization:
The FreeBSD Project
>Environment:
>Description:
The following patch is a general refactor to the devel/tcltls port, which brings these (imho) enhancements:

- no more custom Makefile; use the bundled TEA-based configure script instead, as most Tcl extensions do
- USE_TCL --> USES+=tcl
- Use PLIST_FILES and PLIST_DIRS, instead of a pkg-plist file for just a bunch of entries
- Switch to new OPTIONS framework (DOCS)
- A few other cleanups

Also, I'd be happy to take this port under the maintainership of tcltk at FreeBSD.org, if you agree.

Thanks.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

Index: Makefile
===================================================================
--- Makefile	(revision 331258)
+++ Makefile	(working copy)
@@ -11,55 +11,40 @@
 MAINTAINER=	mi at aldan.algebra.com
 COMMENT=	SSL extensions for TCL; dynamicly loadable
 
-LIB_DEPENDS+=	tcl${TCLVND}:${PORTSDIR}/lang/tcl${TCLVND}
+OPTIONS_DEFINE=	DOCS
 
-USE_TCL=	84+
+USES+=		tcl
 USE_OPENSSL=	yes
+GNU_CONFIGURE=	yes
+CONFIGURE_ARGS+=--with-tcl=${TCL_LIBDIR} \
+		--with-ssl-dir=${OPENSSLBASE}
 
-WRKSRC=	${WRKDIR}/tls${PORTVERSION}
+TCLPKG=		tls${PORTVERSION}
+WRKSRC=		${WRKDIR}/${TCLPKG}
+PLIST_FILES=	lib/${TCLPKG}/lib${TCLPKG}.so \
+		lib/${TCLPKG}/pkgIndex.tcl \
+		lib/${TCLPKG}/tls.tcl
+PLIST_DIRS=	lib/${TCLPKG}
+PORTDOCS=	*
 
-PLIST_SUB+=	TCL_VER=${TCL_VER} DISTNAME="${DISTNAME}"
-MAKEFILE=	${FILESDIR}/Makefile.bsd
-MAKE_ENV=	TCL_VER=${TCL_VER} MKDIR="${MKDIR}" \
-		INSTALL_DATA="${INSTALL_DATA}" \
-		SHLIB_NAME=libtls.so.1 \
-		PORTVERSION="${PORTVERSION}" SED="${SED}"
-REINPLACE_ARGS=	-i ""
-ALL_TARGET=	-j`${SYSCTL} -n hw.ncpu` all
-PLIST_SUB=	TLS_VERSION=${PORTVERSION}
+.include <bsd.port.options.mk>
 
-NO_STAGE=	yes
 post-patch:
 	${REINPLACE_CMD} -e \
-		's,package require tls.*,load ${WRKSRC}/libtls.so;\
+		's,package require tls.*,load ${WRKSRC}/lib${TCLPKG}.so;\
 			source ${WRKSRC}/tls.tcl,' \
 		${WRKSRC}/tests/*.test
 	# The tests in ciphers.test are meaningless so far:
 	${MV} ${WRKSRC}/tests/ciphers.test ${WRKSRC}/tests/ciphers.test.broken
 
-.if !defined(NOPORTDOCS)
+.if ${PORT_OPTIONS:MDOCS}
 post-install:
-	${MKDIR} ${PREFIX}/share/doc/tls
-	${INSTALL_DATA} ${WRKSRC}/tls.htm ${PREFIX}/share/doc/tls/
+	${MKDIR} ${STAGEDIR}${DOCSDIR}
+	${INSTALL_DATA} ${WRKSRC}/tls.htm ${STAGEDIR}${DOCSDIR}
 .endif
 
-post-build:
-	#
-	#
-	# Please, try performing `make test' now and report any failures
-	# to the ${PORTNAME} developers:
-	#	http://sourceforge.net/tracker/?group_id=13248&atid=113248
-	# and/or ${MAINTAINER}.
-	#
-	#
-
-test:
+regression-test:
 	cd ${WRKSRC}/tests && env TCL_LIBRARY="${WRKSRC}" \
 		tclsh${TCL_VER} all.tcl
 
-TCLVND=		${TCL_VER:S/.//}
-
 .include <bsd.port.mk>
-
-PLIST_SUBP!=	${SETENV} ${MAKE_ENV} ${MAKE} -f ${MAKEFILE} environ
-PLIST_SUB+=	${PLIST_SUBP}
Index: files/Makefile.bsd
===================================================================
--- files/Makefile.bsd	(revision 331258)
+++ files/Makefile.bsd	(working copy)
@@ -1,52 +0,0 @@
-PACKAGE		= tls
-VERSION		?= ${PORTVERSION}
-.ifndef(SHLIB_NAME)
-LIB		= ${PACKAGE}
-SHLIB_MAJOR	= ${VERSION:R}
-SHLIB_MINOR	= ${VERSION:E}
-.endif
-
-SRCS		= tls.c tlsIO.c tlsBIO.c tlsX509.c # fixstrtod.c strncasecmp.c
-
-PREFIX		?=/usr/local
-TCL_VER		?=8.3
-
-.if exists(${PREFIX}/lib/tcl${TCL_VER}/tclConfig.sh)
-# If for some reason  the file does not exist -- make the best guess. In
-# reality, it will exist by the time we are actually doing the build, so
-# the quality of the guess does not matter. But we still try well. -mi
-TCL_STUB_LIB_SPEC!=	. ${PREFIX}/lib/tcl${TCL_VER}/tclConfig.sh; \
-		echo $$TCL_STUB_LIB_SPEC
-.else
-TCL_STUB_LIB_SPEC=	-L${PREFIX}/lib -ltclstub${TCL_VER:S/.//}
-.endif
-
-LDADD		+= ${TCL_STUB_LIB_SPEC} -L${OPENSSLLIB} -lcrypto -lssl
-
-CFLAGS		+=-I${PREFIX}/include/tcl${TCL_VER} -I${OPENSSLINC}
-CFLAGS		+=-DNDEBUG -I. -DUSE_TCL_STUBS -I${PREFIX}/include
-CFLAGS		+=-DPACKAGE_VERSION=\"${VERSION}\" -DPACKAGE_NAME=\"${PACKAGE}\"
-
-all: ${SHLIB_NAME} pkgIndex.tcl
-
-pkgIndex.tcl:
-	(echo 'package ifneeded $(PACKAGE) $(VERSION) \
-	    "[list source [file join $$dir tls.tcl]] ; \
-	     [list tls::initlib ${LIBDIR} ${SHLIB_NAME}]"'\
-	) > pkgIndex.tcl
-
-SCRIPTDIR	= lib/tls
-SCRIPTPATH	= ${PREFIX}/${SCRIPTDIR}
-LIBDIR		= ${PREFIX}/lib
-
-${SCRIPTPATH}:
-	${MKDIR} ${SCRIPTPATH}
-
-environ:
-	@${ECHO} SHLIB_NAME="${SHLIB_NAME}" SHLIB_LINK="${SHLIB_LINK}" \
-		SCRIPTDIR="${SCRIPTDIR}"
-
-beforeinstall: ${SCRIPTPATH}
-	${INSTALL_DATA} pkgIndex.tcl ${.CURDIR}/tls.tcl ${SCRIPTPATH}
-
-.include <bsd.lib.mk>
Index: files/patch-warnings
===================================================================
--- files/patch-warnings	(revision 331258)
+++ files/patch-warnings	(working copy)
@@ -84,9 +84,11 @@
 +    dprintf(stderr,"\nWaitForConnect(%p)", (void *)statePtr);
  
      for (;;) {
---- tls.c	Thu Feb 12 21:09:21 2004
-+++ tls.c	Mon Jun 20 10:23:44 2005
-@@ -459,5 +459,5 @@
+ 
+--- tls.c.orig	2008-03-19 23:06:13.000000000 +0100
++++ tls.c	2013-10-22 14:32:14.000000000 +0200
+@@ -468,7 +468,7 @@
+ 	"ssl2",	"ssl3",	"tls1",	NULL
      };
      enum protocol {
 -	TLS_SSL2, TLS_SSL3, TLS_TLS1, TLS_NONE
@@ -93,10 +95,34 @@
 +	TLS_SSL2, TLS_SSL3, TLS_TLS1
      };
      Tcl_Obj *objPtr;
-@@ -1168,5 +1168,5 @@
+     SSL_CTX *ctx = NULL;
+@@ -1225,7 +1225,7 @@
+     Tcl_Obj	*CONST objv[];
  {
-     const char *commands [] = { "req", NULL };
+     CONST84 char *commands [] = { "req", NULL };
 -    enum command { C_REQ, C_DUMMY };
 +    enum command { C_REQ };
      int cmd;
  
+     if (objc < 2) {
+@@ -1329,13 +1329,13 @@
+ 		
+ 		name=X509_get_subject_name(cert);
+ 
+-		X509_NAME_add_entry_by_txt(name,"C", MBSTRING_ASC, k_C, -1, -1, 0);
+-		X509_NAME_add_entry_by_txt(name,"ST", MBSTRING_ASC, k_ST, -1, -1, 0);
+-		X509_NAME_add_entry_by_txt(name,"L", MBSTRING_ASC, k_L, -1, -1, 0);
+-		X509_NAME_add_entry_by_txt(name,"O", MBSTRING_ASC, k_O, -1, -1, 0);
+-		X509_NAME_add_entry_by_txt(name,"OU", MBSTRING_ASC, k_OU, -1, -1, 0);
+-		X509_NAME_add_entry_by_txt(name,"CN", MBSTRING_ASC, k_CN, -1, -1, 0);
+-		X509_NAME_add_entry_by_txt(name,"Email", MBSTRING_ASC, k_Email, -1, -1, 0);
++		X509_NAME_add_entry_by_txt(name,"C",     MBSTRING_ASC, (const unsigned char *)k_C, -1, -1, 0);
++		X509_NAME_add_entry_by_txt(name,"ST",    MBSTRING_ASC, (const unsigned char *)k_ST, -1, -1, 0);
++		X509_NAME_add_entry_by_txt(name,"L",     MBSTRING_ASC, (const unsigned char *)k_L, -1, -1, 0);
++		X509_NAME_add_entry_by_txt(name,"O",     MBSTRING_ASC, (const unsigned char *)k_O, -1, -1, 0);
++		X509_NAME_add_entry_by_txt(name,"OU",    MBSTRING_ASC, (const unsigned char *)k_OU, -1, -1, 0);
++		X509_NAME_add_entry_by_txt(name,"CN",    MBSTRING_ASC, (const unsigned char *)k_CN, -1, -1, 0);
++		X509_NAME_add_entry_by_txt(name,"Email", MBSTRING_ASC, (const unsigned char *)k_Email, -1, -1, 0);
+ 
+ 		X509_set_subject_name(cert,name);
+ 
Index: pkg-descr
===================================================================
--- pkg-descr	(revision 331258)
+++ pkg-descr	(working copy)
@@ -2,7 +2,4 @@
 This extension can be used to utilize SSL encryption on top of any valid
 Tcl Channel - not just sockets!
 
-Note,  that Scriptics  has released  this newer  version (1.4),  but the
-author's web-site listed below still only lists 1.3.
-
 WWW: http://www.sensus.org/tcl/tls.htm
Index: pkg-plist
===================================================================
--- pkg-plist	(revision 331258)
+++ pkg-plist	(working copy)
@@ -1,7 +0,0 @@
-%%SCRIPTDIR%%/pkgIndex.tcl
-%%SCRIPTDIR%%/tls.tcl
- at dirrm %%SCRIPTDIR%%
-lib/%%SHLIB_NAME%%
-lib/%%SHLIB_LINK%%
-%%PORTDOCS%%share/doc/tls/tls.htm
-%%PORTDOCS%%@dirrm share/doc/tls


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-ports-bugs mailing list