Adds stuff for setting the correct tclsh and wish as needed, if needed.
A couple of ports will follow that make use of this, so let me know
if I'm going down the right path. If this is good, I'll be updating
some more ports to use it.
Stu
Index: lang/tcl/tcl.port.mk
===================================================================
RCS file: /cvs/ports/lang/tcl/tcl.port.mk,v
retrieving revision 1.2
diff -u -r1.2 tcl.port.mk
--- lang/tcl/tcl.port.mk 8 Jul 2008 04:32:06 -0000 1.2
+++ lang/tcl/tcl.port.mk 6 Feb 2009 12:36:25 -0000
@@ -13,5 +13,20 @@
MODTCL_RUN_DEPENDS ?= :tcl-${MODTCL_VERSION}.*:lang/tcl/${MODTCL_VERSION}
MODTCL_LIB_DEPENDS ?=
tcl${MODTCL_VERSION:S/.//}:tcl-${MODTCL_VERSION}.*:lang/tcl/${MODTCL_VERSION}
+
+# Handle the two most commonly used methods
+# for starting up executable Tcl scripts.
+# See http://wiki.tcl.tk/812 for more information.
+
+# Set 'tclsh' for executable scripts (in-place modification).
+MODTCL_TCLSH_ADJ = perl -pi \
+ -e '$$. == 1 && s!env (tclsh|wish).*$$!env
tclsh${MODTCL_VERSION}!;' \
+ -e '$$. == 3 && s!exec (tclsh|wish).*$$!exec tclsh${MODTCL_VERSION}
"\$$0" \$${1+"\$$@"}!;' \
+ -e 'close ARGV if eof;'
+
+# Set 'wish' for executable scripts (in-place modification).
+MODTCL_WISH_ADJ =
${MODTCL_TCLSH_ADJ:S/tclsh${MODTCL_VERSION}/wish${MODTCL_VERSION}/}
+
+
SUBST_VARS += MODTCL_VERSION MODTCL_BIN