From e97a2ce965c0359ec347775a8c37af13e80c426f Mon Sep 17 00:00:00 2001
From: mi <mi@FreeBSD.org>
Date: Fri, 1 Aug 2014 21:09:00 +0000
Subject: Upgrade from 8.4 to 8.4.1. The "profile" functionality remains
 completely broken, when compiled against Tcl-8.6

Fix the bundled self-tests.

PR:		192287
Submitted by:	gahr
---
 lang/tclX/Makefile               | 28 ++++++---------
 lang/tclX/distinfo               |  4 +--
 lang/tclX/files/patch-configure  | 18 ----------
 lang/tclX/files/patch-errorLine  | 73 ----------------------------------------
 lang/tclX/files/patch-profile    | 22 ++----------
 lang/tclX/files/tcl85-test-patch | 10 +++---
 6 files changed, 21 insertions(+), 134 deletions(-)
 delete mode 100644 lang/tclX/files/patch-configure
 delete mode 100644 lang/tclX/files/patch-errorLine

diff --git a/lang/tclX/Makefile b/lang/tclX/Makefile
index fb549ef6130c..5ce81a4128c5 100644
--- a/lang/tclX/Makefile
+++ b/lang/tclX/Makefile
@@ -2,10 +2,9 @@
 # $FreeBSD$
 
 PORTNAME=	tclX
-PORTVERSION=	8.4
-PORTREVISION=	3
+PORTVERSION=	8.4.1
 CATEGORIES=	lang tcl devel
-MASTER_SITES=	SF/${PORTNAME:tl}/TclX/${PORTVERSION}.0
+MASTER_SITES=	SF/${PORTNAME:tl}/TclX/${PORTVERSION}
 DISTNAME=	tclx${PORTVERSION}
 
 MAINTAINER=	mi@aldan.algebra.com
@@ -16,17 +15,16 @@ LICENSE_NAME=	Tcl/Tk License
 LICENSE_FILE=	${WRKSRC}/license.terms
 LICENSE_PERMS=	auto-accept dist-mirror dist-sell pkg-mirror pkg-sell
 
+WRKSRC=		${WRKDIR}/${PORTNAME:tl}${PORTVERSION:R}
 
 USES=		tcl tar:bzip2
-USE_LDCONFIG=	${PREFIX}/lib/tclx${PORTVERSION}
-GNU_CONFIGURE=	yes
-CPPFLAGS+=	-I${TCL_INCLUDEDIR}/unix\
-		-I${TCL_INCLUDEDIR}/generic
+USE_LDCONFIG=	${PREFIX}/lib/tclx${PORTVERSION:R}
+USE_AUTOTOOLS=	autoconf
 CONFIGURE_ARGS=	--exec-prefix=${PREFIX} \
 		--enable-shared \
 		--with-help=Help \
 		--with-tcl="${TCL_LIBDIR}"
-PLIST_SUB=	TCLX_VER=${PORTVERSION}
+PLIST_SUB=	TCLX_VER=${PORTVERSION:R}
 ALL_TARGET=	binaries libraries
 INSTALL_TARGET=	install-binaries install-libraries
 
@@ -34,17 +32,13 @@ INSTALL_TARGET=	install-binaries install-libraries
 
 .if ${TCL_VER} > 8.4
 EXTRA_PATCHES+=	${FILESDIR}/tcl85-test-patch
-PLIST_SUB+=	BELOW_85='@comment '
-.else
-PLIST_SUB+=	BELOW_85=''
 .endif
 
 post-configure:
-	${REINPLACE_CMD} -e	\
-	    's,^TCLSH_PROG.*,TCLSH_PROG=${TCLSH},' \
-	    -e 's,TCL_LIBRARY=.*,\\,' ${WRKSRC}/Makefile
-	# Disabling the failing help.test
-	${MV} ${WRKSRC}/tests/help.test ${WRKSRC}/tests/help.test.dis
+.if ${TCL_VER} == 8.6
+	# Disabling the failing profile.test
+	${MV} ${WRKSRC}/tests/profile.test ${WRKSRC}/tests/profile.test.dis
+.endif
 
 post-install:
 	${INSTALL_DATA} ${WRKSRC}/doc/TclX.n ${STAGEDIR}${PREFIX}/man/mann
@@ -63,7 +57,7 @@ post-install:
 	${LN} -s TclXInit.3.gz ${STAGEDIR}${PREFIX}/man/man3/${l}.3.gz
 .endfor
 
-regression-test: build
+regression-test test: build
 	${SETENV} ${MAKE_ENV} ${MAKE} -C ${WRKSRC} test
 
 .include <bsd.port.post.mk>
diff --git a/lang/tclX/distinfo b/lang/tclX/distinfo
index ab3174a59aab..6c6e82b5c377 100644
--- a/lang/tclX/distinfo
+++ b/lang/tclX/distinfo
@@ -1,2 +1,2 @@
-SHA256 (tclx8.4.tar.bz2) = 257591f9dffc21cf3ed541a9ef81a3ff5dd739dff5cebb70c4cec7010e2def66
-SIZE (tclx8.4.tar.bz2) = 313595
+SHA256 (tclx8.4.1.tar.bz2) = a9b41f606ec6c1268b9c78512e6e1cb533bd9ae3e786e650d111fc16ffe758ec
+SIZE (tclx8.4.1.tar.bz2) = 330073
diff --git a/lang/tclX/files/patch-configure b/lang/tclX/files/patch-configure
deleted file mode 100644
index 8f438103e3fe..000000000000
--- a/lang/tclX/files/patch-configure
+++ /dev/null
@@ -1,18 +0,0 @@
---- configure.orig	Sat Oct  8 01:17:50 2005
-+++ configure	Sun Mar 25 15:34:58 2007
-@@ -6917,7 +6917,7 @@
-         fi
-     else
-         # tclConfig.sh is in $INSTALL/lib directory
--        REAL_TCL_BIN_DIR=`cd ${TCL_BIN_DIR}/../bin/;pwd`
-+        REAL_TCL_BIN_DIR=`cd ${TCL_BIN_DIR}/../../bin/;pwd`
-         if test "$TEA_PLATFORM" = "windows"; then
-             TCLSH_PROG=${REAL_TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}
-         else
-@@ -7000,5 +7000,5 @@
- 
- 	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
--		system=MP-RAS-`awk '{print }' /etc/.relid'`
-+		system=MP-RAS-`awk '{print }' /etc/.relid`
- 	    fi
- 	    if test "`uname -s`" = "AIX" ; then
diff --git a/lang/tclX/files/patch-errorLine b/lang/tclX/files/patch-errorLine
deleted file mode 100644
index f30c85e7a990..000000000000
--- a/lang/tclX/files/patch-errorLine
+++ /dev/null
@@ -1,73 +0,0 @@
-Index: generic/tclExtdInt.h
-===================================================================
-RCS file: /cvsroot/tclx/tclx/generic/tclExtdInt.h,v
-retrieving revision 1.7
-retrieving revision 1.8
-diff -U2 -r1.7 -r1.8
---- generic/tclExtdInt.h	12 Jul 2005 19:03:15 -0000	1.7
-+++ generic/tclExtdInt.h	15 Dec 2008 20:00:27 -0000	1.8
-@@ -13,5 +13,5 @@
-  * implied warranty.
-  *-----------------------------------------------------------------------------
-- * $Id: tclExtdInt.h,v 1.7 2005/07/12 19:03:15 hobbs Exp $
-+ * $Id: tclExtdInt.h,v 1.8 2008/12/15 20:00:27 andreas_kupries Exp $
-  *-----------------------------------------------------------------------------
-  */
-@@ -186,4 +186,13 @@
- 
- /*
-+ * Handle hiding of errorLine in 8.6
-+ */
-+#if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 6)
-+#define ERRORLINE(interp) ((interp)->errorLine)
-+#else
-+#define ERRORLINE(interp) (Tcl_GetErrorLine(interp))
-+#endif
-+
-+/*
-  * Callback type for walking directories.
-  */
-Index: generic/tclXgeneral.c
-===================================================================
-RCS file: /cvsroot/tclx/tclx/generic/tclXgeneral.c,v
-retrieving revision 1.3
-retrieving revision 1.4
-diff -U2 -r1.3 -r1.4
---- generic/tclXgeneral.c	4 Apr 2002 06:09:05 -0000	1.3
-+++ generic/tclXgeneral.c	15 Dec 2008 20:00:27 -0000	1.4
-@@ -13,5 +13,5 @@
-  * implied warranty.
-  *-----------------------------------------------------------------------------
-- * $Id: tclXgeneral.c,v 1.3 2002/04/04 06:09:05 hobbs Exp $
-+ * $Id: tclXgeneral.c,v 1.4 2008/12/15 20:00:27 andreas_kupries Exp $
-  *-----------------------------------------------------------------------------
-  */
-@@ -406,5 +406,5 @@
- 		
- 		sprintf (buf, "\n    (\"loop\" body line %d)", 
--			interp->errorLine);
-+			ERRORLINE(interp));
- 		Tcl_AddErrorInfo (interp, buf);
- 	    }
-Index: generic/tclXlib.c
-===================================================================
-RCS file: /cvsroot/tclx/tclx/generic/tclXlib.c,v
-retrieving revision 1.4
-retrieving revision 1.5
-diff -U2 -r1.4 -r1.5
---- generic/tclXlib.c	24 Mar 2005 05:04:38 -0000	1.4
-+++ generic/tclXlib.c	15 Dec 2008 20:00:27 -0000	1.5
-@@ -13,5 +13,5 @@
-  * implied warranty.
-  *-----------------------------------------------------------------------------
-- * $Id: tclXlib.c,v 1.4 2005/03/24 05:04:38 hobbs Exp $
-+ * $Id: tclXlib.c,v 1.5 2008/12/15 20:00:27 andreas_kupries Exp $
-  *-----------------------------------------------------------------------------
-  */
-@@ -240,5 +240,5 @@
-     buf = ckalloc (strlen (fileName) + 64);
-     sprintf (buf, "\n    (file \"%s\" line %d)", fileName,
--             interp->errorLine);
-+             ERRORLINE(interp));
-     Tcl_AddErrorInfo (interp, buf);
-     ckfree (buf);
diff --git a/lang/tclX/files/patch-profile b/lang/tclX/files/patch-profile
index a7a4f0131c9b..395d1f7bd3d8 100644
--- a/lang/tclX/files/patch-profile
+++ b/lang/tclX/files/patch-profile
@@ -1,28 +1,10 @@
-This first patch fixes a seg-fault at `make test' time -- profile.test crashes
-without this change.
-
-Submitted to maintainers:
-
-https://sourceforge.net/tracker/index.php?func=detail&aid=1925400&group_id=13247&atid=113247
-
-and committed upstream.
-
-The second changes TclXOSElapsedTime to better handles clock_t being too
-narrow (32-bit on FreeBSD).
+Change TclXOSElapsedTime to better handles clock_t being too narrow
+(32-bit on FreeBSD).
 
 Getting it committed upstream...
 
 	-mi
 
---- generic/tclXprofile.c	2004-11-22 19:12:54.000000000 -0500
-+++ generic/tclXprofile.c	2009-07-31 02:44:11.000000000 -0400
-@@ -674,5 +674,5 @@
-     CallFrame  *framePtr;
- {
--    if (framePtr == NULL)
-+    if (framePtr == NULL || framePtr->objv == NULL)
-         return;
-     InitializeProcStack (infoPtr, framePtr->callerPtr);
 --- unix/tclXunixOS.c	2005-07-12 15:03:15.000000000 -0400
 +++ unix/tclXunixOS.c	2009-11-27 02:00:57.000000000 -0500
 @@ -550,4 +550,10 @@
diff --git a/lang/tclX/files/tcl85-test-patch b/lang/tclX/files/tcl85-test-patch
index 9d7a3d2bcfe8..e647f20f0231 100644
--- a/lang/tclX/files/tcl85-test-patch
+++ b/lang/tclX/files/tcl85-test-patch
@@ -56,20 +56,22 @@ Tcl-versions, should still do that...
  ERRORCODE]
 --- tests/string.test	2002-09-25 20:19:02.000000000 -0400
 +++ tests/string.test	2009-10-13 18:25:03.000000000 -0400
-@@ -47,9 +47,19 @@
+@@ -47,9 +47,21 @@
  } 0 {E}
  
 +switch $tcl_version {
 +8.3	{
 +	set anticipate "syntax error in expression \"4x-3\""
 +} 8.4 {
-+	puts stderr "tcl_version is $tcl_version"
 +	set anticipate "syntax error in expression \"4x-3\": extra tokens at end of expression"
-+} default {
++} 8.5 {
 +	set anticipate {invalid bareword "x"
 +in expression "4_@_x-3";
 +should be "$x" or "{x}" or "x(...)" or ...}
-+}}
++} default {
++	set anticipate {invalid bareword "4x"
++in expression "4x-3";
++should be "$4x" or "{4x}" or "4x(...)" or ...}
 +
  Test string-1.7 {cindex tests} {
 -    cindex ABCDEFG lenx-3
-- 
cgit