Bug 83718

Summary: Add bsd.tcl.mk for convinience for tcl/tk ports
Product: Ports & Packages Reporter: Vsevolod Stakhov <vsevolod>
Component: Individual Port(s)Assignee: Port Management Team <portmgr>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Vsevolod Stakhov 2005-07-19 13:10:15 UTC
This can be comfortable for tcl/tk ports to use some knobs to depend from different
tcl/tk versions. Also many tcl/tk ports patches their scripts to change wish and 
tclsh to wish8.4 and tclsh8.4 for example. bsd.tcl.mk can solve such problems.

Fix: -- bsd.tcl.mk begins here --

# -*- mode: Makefile; tab-width: 4; -*-
# ex: ts=4
#
# $FreeBSD$
#

.if !defined(_POSTMKINCLUDED) && !defined(Tcl_Pre_Include)

Tcl_Pre_Include=         bsd.tcl.mk

# USE_TCL:		Depend from tcl for run. Due to incompatible API of different 
#				TCL versions the version must be specified directly. If version
#				is not specified then the latest version is used (8.4 currently).
#				Available values are: 84, 83, 82, 81 and 80.
#
# USE_TK:		Depend from tk for run. Due to incompatible API of different 
#				TK versions the version must be specified directly. If version
#				is not specified then the latest version is used (8.4 currently).
#				Available values are: 84, 83, 82, 81 and 80.
#				This option implies USE_TCL as tk depends on tcl implicitly.
##
# TCL_LIBDIR:		Path where tcl libraries can be found
#
# TCL_INCLUDEDIR: 	Path where tcl C headers can be found
##
# TK_LIBDIR:		Path where tk libraries can be found
#
# TK_INCLUDEDIR: 	Path where tk C headers can be found
##
# TCLSH:		Path to tclsh executable respecting tcl version
#
# WISH:			Path to wish executable respecting tk version
##
# PATCH_TCL_SCRIPTS: 	List of tcl scripts that need to be patched to replace tclsh
#				calls to tclsh${TK_VER} calls. Note that this implies USE_REINPLACE
#				as REINPLACE_CMD is used for patching. Also note that post-patch
#				target is used.
#
# PATCH_TK_SCRIPTS: 	List of tcl scripts that need to be patched to replace wish
#				calls to wish${TK_VER} calls. Note that this implies USE_REINPLACE
#				as REINPLACE_CMD is used for patching. Also note that post-patch
#				target is used.

.if defined(USE_TCL) || defined(USE_TCL_BUILD)

_TCL_VERSIONS=	84 83 82 81 80

.if defined(USE_TCL_BUILD)
USE_TCL=	${USE_TCL_BUILD}
_BUILD=		yes
.endif

.if ${USE_TCL} == "yes"
USE_TCL=	84
.endif

TCL_VER:=	${USE_TCL:S/8/8./}

# Special case
.if ${USE_TCL} == "81"
USE_TCL=	tcl81-thread
.endif

_FOUND=		no
.for ver in ${_TCL_VERSIONS}
. if ${USE_TCL} == ${ver}
_FOUND=		yes
.  if defined(_BUILD)
BUILD_DEPENDS+=	tclsh${TCL_VER}:${PORTSDIR}/lang/tcl${USE_TCL}
.  else
RUN_DEPENDS+=	tclsh${TCL_VER}:${PORTSDIR}/lang/tcl${USE_TCL}
.  endif
TCL_INCLUDEDIR=	${LOCALBASE}/include/tcl${TCL_VER}
TCL_LIBDIR=		${LOCALBASE}/lib/tcl${TCL_VER}
TCLSH=			${LOCALBASE}/bin/tclsh${TCL_VER}
. endif
.endfor

.if ${_FOUND} == "no"
BROKEN=		Unknown TCL version
.endif
.endif # defined(USE_TCL)

.if defined(USE_TK)

_TK_VERSIONS=	84 83 82 81 80

.if ${USE_TK} == "yes"
USE_TK=		84
.endif

TK_VER:=	${USE_TK:S/8/8./}

.if defined(USE_TCL) && ${TCL_VER} != ${TK_VER}
BROKEN=		TCL and TK versions must be equal
.endif

_FOUND=		no
.for ver in ${_TK_VERSIONS}
. if ${USE_TK} == ${ver}
_FOUND=		yes
RUN_DEPENDS+=	wish${TK_VER}:${PORTSDIR}/x11-toolkits/tk${USE_TK}
TCL_INCLUDEDIR=	${LOCALBASE}/include/tcl${TK_VER}
TCL_LIBDIR=		${LOCALBASE}/lib/tcl${TK_VER}
TK_INCLUDEDIR=	${LOCALBASE}/include/tk${TK_VER}
TK_LIBDIR=		${LOCALBASE}/lib/tk${TK_VER}
TCLSH=			${LOCALBASE}/bin/tclsh${TK_VER}
WISH=			${LOCALBASE}/bin/wish${TK_VER}
. endif
.endfor

.if ${_FOUND} == "no"
BROKEN=		Unknown TK version
.endif
.endif # defined(USE_TK)

.if defined(PATCH_TCL_SCRIPTS) || defined (PATCH_TK_SCRIPTS)
USE_REINPLACE=	yes
.endif

.endif # !defined(_POSTMKINCLUDED) && !defined(Tcl_Pre_Include)

.if defined(_POSTMKINCLUDED) && !defined(Tcl_Post_Include)

Tcl_Post_Include=            bsd.tcl.mk

.if defined(PATCH_TCL_SCRIPTS) || defined (PATCH_TK_SCRIPTS)
.if !target(post-patch)
post-patch:
.if defined(PATCH_TCL_SCRIPTS) && defined(TCLSH)
. for tcl_script in ${PATCH_TCL_SCRIPTS}
	@${REINPLACE_CMD} -e 's,tclsh,${TCLSH},' ${WRKSRC}/${tcl_script}
. endfor
.endif
.if defined(PATCH_TK_SCRIPTS) && defined(WISH)
. for tk_script in ${PATCH_TK_SCRIPTS}
	@${REINPLACE_CMD} -e 's,wish,${WISH},' ${WRKSRC}/${tk_script}
. endfor
.endif
.endif # !target(post-patch)
.endif # defined(PATCH_TCL_SCRIPTS) || defined (PATCH_TK_SCRIPTS)

.endif # defined(_POSTMKINCLUDED) && !defined(Tcl_Post_Include)

-- bsd.tcl.mk ends here --



-- bsd.port.mk.diff begins here --



-- bsd.port.mk.diff ends here ----MsQP2aPQmntxLZ5wIrqgPdbtgqG3IVvb089iQ9KClotdxRZh
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- bsd.port.mk.orig	Thu Jul 14 14:57:43 2005
+++ bsd.port.mk	Tue Jul 19 15:26:05 2005
@@ -1339,6 +1339,10 @@
 .include "${PORTSDIR}/Mk/bsd.ruby.mk"
 .endif
 
+.if defined(USE_TCL) || defined(USE_TK)
+.include "${PORTSDIR}/Mk/bsd.tcl.mk"
+.endif
+
 .if defined(USE_QT_VER) || defined(USE_KDELIBS_VER) || defined(USE_KDEBASE_VER)
 .include "${PORTSDIR}/Mk/bsd.kde.mk"
 .endif
@@ -1833,6 +1837,10 @@
 
 .if defined(USE_PYTHON)
 .include "${PORTSDIR}/Mk/bsd.python.mk"
+.endif
+
+.if defined(USE_TCL) || defined(USE_TK)
+.include "${PORTSDIR}/Mk/bsd.tcl.mk"
 .endif
 
 .if exists(${PORTSDIR}/../Makefile.inc)
Comment 1 Erwin Lansing freebsd_committer freebsd_triage 2005-07-19 13:11:15 UTC
Responsible Changed
From-To: freebsd-ports-bugs->portmgr

Portmgr territory
Comment 2 edwin 2005-07-19 13:21:32 UTC
On Tue, Jul 19, 2005 at 04:00:15PM +0400, Vsevolod Stakhov wrote:
> # -*- mode: Makefile; tab-width: 4; -*-
> # ex: ts=4
> #
> # $FreeBSD$
> #

I would add TCL_Include_MAINTAINER so people know who is responsible
for it.

> .if !defined(_POSTMKINCLUDED) && !defined(Tcl_Pre_Include)
> 
> Tcl_Pre_Include=         bsd.tcl.mk
> 
> # USE_TCL:		Depend from tcl for run. Due to incompatible API of different 
> #				TCL versions the version must be specified directly. If version
> #				is not specified then the latest version is used (8.4 currently).
> #				Available values are: 84, 83, 82, 81 and 80.

This description conflicts with itself:


 # USE_TCL:	Depend on tcl to run. In case of incompatible APIs of different 
 #		TCL versions the version can be specified directly. If version
 #		is not specified (USE_TCL=yes) then the latest version is
 #		used (8.4 currently).
 #		Available values are: 84, 83, 82, 81 and 80.

> # USE_TK:	Depend from tk for run. Due to incompatible API of different 

Same here.

> .if ${_FOUND} == "no"
> BROKEN=		Unknown TCL version
> .endif

More verbose:
 BROKEN=		Unknown TCL version specified: ${USE_TCL}

> .if defined(USE_TCL) && ${TCL_VER} != ${TK_VER}
> BROKEN=		TCL and TK versions must be equal
> .endif

Here too:
 BROKEN=		TCL and TK versions must be equal (${TCL_VER} vs ${TK_VER})

> .if ${_FOUND} == "no"
> BROKEN=		Unknown TK version
> .endif

And here:
 BROKEN=		Unknown TK version specified: ${USE_TK}

Just my 2 cents.

Edwin

-- 
Edwin Groothuis      |            Personal website: http://www.mavetju.org
edwin@mavetju.org    |          Weblog: http://weblog.barnet.com.au/edwin/
Comment 3 Vsevolod Stakhov 2005-07-19 13:43:59 UTC
Edwin Groothuis wrote:
> On Tue, Jul 19, 2005 at 04:00:15PM +0400, Vsevolod Stakhov wrote:
> 
>># -*- mode: Makefile; tab-width: 4; -*-
>># ex: ts=4
>>#
>># $FreeBSD$
>>#
> 
> 
> I would add TCL_Include_MAINTAINER so people know who is responsible
> for it.

Yes you are right. But I do not know rules about this.

> 
>>.if !defined(_POSTMKINCLUDED) && !defined(Tcl_Pre_Include)
>>
>>Tcl_Pre_Include=         bsd.tcl.mk
>>
>># USE_TCL:		Depend from tcl for run. Due to incompatible API of different 
>>#				TCL versions the version must be specified directly. If version
>>#				is not specified then the latest version is used (8.4 currently).
>>#				Available values are: 84, 83, 82, 81 and 80.
> 
> 
> This description conflicts with itself:
> 
> 
>  # USE_TCL:	Depend on tcl to run. In case of incompatible APIs of different 
>  #		TCL versions the version can be specified directly. If version
>  #		is not specified (USE_TCL=yes) then the latest version is
>  #		used (8.4 currently).
>  #		Available values are: 84, 83, 82, 81 and 80.

Your version is much more literate as I'm not native English language 
speaker :(

> 
>># USE_TK:	Depend from tk for run. Due to incompatible API of different 
> 
> 
> Same here.
# USE_TK:	Depend on tk to run. In case of incompatible APIs of different
#		TK versions the version can be specified directly. If version
#		is not specified (USE_TK=yes) then the latest version is
#		used (8.4 currently).
#		Available values are: 84, 83, 82, 81 and 80.

> 
> 
>>.if ${_FOUND} == "no"
>>BROKEN=		Unknown TCL version
>>.endif
> 
> 
> More verbose:
>  BROKEN=		Unknown TCL version specified: ${USE_TCL}

It looks fine.

>>.if defined(USE_TCL) && ${TCL_VER} != ${TK_VER}
>>BROKEN=		TCL and TK versions must be equal
>>.endif
> 
> 
> Here too:
>  BROKEN=		TCL and TK versions must be equal (${TCL_VER} vs ${TK_VER})

Agreed.

> 
>>.if ${_FOUND} == "no"
>>BROKEN=		Unknown TK version
>>.endif
> 
> 
> And here:
>  BROKEN=		Unknown TK version specified: ${USE_TK}
> 
> Just my 2 cents.

Thanks a lot!
Comment 4 Mark Linimon 2005-07-19 22:20:49 UTC
On Tue, Jul 19, 2005 at 04:00:15PM +0400, Vsevolod Stakhov wrote:
> .if ${_FOUND} == "no"
> BROKEN=		Unknown TCL version
> .endif

It is true that you have followed existing practice in the other bsd.*.mk
files.  However, it is my belief that that practice is wrong, and I would
hope that we could not propogate it any further.

My understanding is that BROKEN is meant to tell the cluster, and users,
"it is not possible to install this port because it is temporarily broken"
and that IGNORE is meant to tell the cluster, and users, "it is not possible
to install this port because of some permanent reason" (such as CONFLICTS,
kernel source not having been installed, and so forth).  The cluster
will attempt to build ports marked BROKEN but it will not attempt to
build ports marked IGNORE.

If you can accept that, I would like to generate patches (rather than
just s/BROKEN/IGNORE/, the wording of the messages needs to change a
little bit).

Also, to reiterate, it is my understanding that BROKEN strings should
be quoted and IGNORE strings should not.  "One of these days" I intend
to go make a pass through the ports tree and try to clean that up ...

mcl
Comment 5 Vsevolod Stakhov 2005-07-19 23:09:22 UTC
On Tue, Jul 19, 2005 at 04:20:49PM -0500, Mark Linimon wrote:
> If you can accept that, I would like to generate patches (rather than
> just s/BROKEN/IGNORE/, the wording of the messages needs to change a
> little bit).
> 
> Also, to reiterate, it is my understanding that BROKEN strings should
> be quoted and IGNORE strings should not.  "One of these days" I intend
> to go make a pass through the ports tree and try to clean that up ...

I understand this and will remember for future. Thanks!
Comment 6 Clement Laforet freebsd_committer freebsd_triage 2005-09-17 11:35:53 UTC
Hi,

Could you please submit a patch to orignal bsd.tcl.mk file which 
includes suggested changes? So we can add it to next exp-build.

Thanks,
clem
Comment 7 Vsevolod Stakhov freebsd_committer freebsd_triage 2005-09-17 16:44:12 UTC
On Sat, Sep 17, 2005 at 12:35:53PM +0200, Clement Laforet wrote:
> Hi,
> 
> Could you please submit a patch to orignal bsd.tcl.mk file which 
> includes suggested changes? So we can add it to next exp-build.
> 
> Thanks,
> clem


--- bsd.tcl.mk.orig	Sat Sep 17 19:41:25 2005
+++ bsd.tcl.mk	Sat Sep 17 19:43:28 2005
@@ -6,18 +6,20 @@
 
 .if !defined(_POSTMKINCLUDED) && !defined(Tcl_Pre_Include)
 
-Tcl_Pre_Include=         bsd.tcl.mk
+Tcl_Pre_Include=		bsd.tcl.mk
+Tcl_Include_MAINTAINER=	vsevolod@FreeBSD.org
 
-# USE_TCL:		Depend from tcl for run. Due to incompatible API of different 
-#				TCL versions the version must be specified directly. If version
-#				is not specified then the latest version is used (8.4 currently).
+# USE_TCL:		Depend on tcl to run. In case of incompatible APIs of different 
+#				TCL versions the version can be specified directly. If version
+#				is not specified (USE_TCL=yes) then the latest version is
+#				used (8.4 currently).
 #				Available values are: 84, 83, 82, 81 and 80.
 #
-# USE_TK:		Depend from tk for run. Due to incompatible API of different 
-#				TK versions the version must be specified directly. If version
-#				is not specified then the latest version is used (8.4 currently).
+# USE_TK:		Depend on tk to run. In case of incompatible APIs of different
+#				TK versions the version can be specified directly. If version
+#				is not specified (USE_TK=yes) then the latest version is
+#				used (8.4 currently).
 #				Available values are: 84, 83, 82, 81 and 80.
-#				This option implies USE_TCL as tk depends on tcl implicitly.
 ##
 # TCL_LIBDIR:	Path where tcl libraries can be found
 #
@@ -77,7 +79,7 @@
 .endfor
 
 .if ${_FOUND} == "no"
-BROKEN=		Unknown TCL version
+IGNORE=		"Unknown TCL version specified: ${USE_TCL}"
 .endif
 .endif # defined(USE_TCL)
 
@@ -92,7 +94,7 @@
 TK_VER:=	${USE_TK:S/8/8./}
 
 .if defined(USE_TCL) && ${TCL_VER} != ${TK_VER}
-BROKEN=		TCL and TK versions must be equal
+IGNORE=		"TCL and TK versions must be equal (${TCL_VER} vs ${TK_VER})"
 .endif
 
 _FOUND=		no
@@ -110,7 +112,7 @@
 .endfor
 
 .if ${_FOUND} == "no"
-BROKEN=		Unknown TK version
+IGNORE=		"Unknown TK version specified: ${USE_TK}"
 .endif
 .endif # defined(USE_TK)
 
@@ -122,7 +124,7 @@
 
 .if defined(_POSTMKINCLUDED) && !defined(Tcl_Post_Include)
 
-Tcl_Post_Include=            bsd.tcl.mk
+Tcl_Post_Include=	bsd.tcl.mk
 
 .if defined(PATCH_TCL_SCRIPTS) || defined (PATCH_TK_SCRIPTS)
 .if !target(post-patch)
Comment 8 Clement Laforet freebsd_committer freebsd_triage 2005-10-19 20:18:49 UTC
State Changed
From-To: open->analyzed

Added to exp build. Thanks
Comment 9 Clement Laforet freebsd_committer freebsd_triage 2005-11-08 09:11:30 UTC
State Changed
From-To: analyzed->closed

Committed. Thanks!