Thanks, much appreciated. :)
Here's a patch with what I'm currently working with.
I have some upcoming ports that will be using this.
It's not amazing, but it's a start.
Next step is to use the STRIP env var and come
up with something like ${INSTALL_TCLSH_SCRIPT}
and ${INSTALL_WISH_SCRIPT}.
Stu
Index: tcl.port.mk
===================================================================
RCS file: /cvs/ports/lang/tcl/tcl.port.mk,v
retrieving revision 1.2
diff -u -r1.2 tcl.port.mk
--- tcl.port.mk 8 Jul 2008 04:32:06 -0000 1.2
+++ tcl.port.mk 25 Jan 2009 21:25:22 -0000
@@ -13,5 +13,19 @@
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
+
+# Set 'tclsh' for executable scripts
+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
+MODTCL_WISH_ADJ =
${MODTCL_TCLSH_ADJ:S/tclsh${MODTCL_VERSION}/wish${MODTCL_VERSION}/}
+
+
SUBST_VARS += MODTCL_VERSION MODTCL_BIN
Steven Mestdagh wrote:
Ok, I committed a change in the invocation line.
Sorry for the delay, just a general lack of time.
You talked about evolving to some standard; well it would be cool if we
could have a variable in the tcl/tk modules which just takes care of this.
e.g. MODTK_BIN_WITH_ARGS, etc. If that is possible, of course.
Or MODTK_SUBST_STUFF, even, if you want to avoid patching.
Stuart Cassoff [2009-01-25, 10:00:45]:
Still no reply of any sort.
Do you want to be the maintainer of this port?
I can give it up, no prob.
Just don't treat me like a slob.
Stu
Stuart Cassoff wrote:
No reply ... no change ...
Could this be put back as I had it?
It's similar to the way some Python ports work.
I'm trying to evolve some 'standard' in my (or others') Tcl ports.
Thanks.
Stuart Cassoff wrote:
Steven Mestdagh wrote:
Stuart Cassoff [2008-10-21, 01:53:17]:
New [dict] lessons, bugfixes.
Theoretically improved port Makefile.
Committed, along with your 8.5.5 update for tcl/tk.
I did the substitution in a simpler way. SUBST_CMD will do what you
need in
many cases, which avoids too much perl in the makefiles ;)
Great - thanks! But ...
There are two commonly used methods to start Tcl scripts.
Discussed in detail here: http://wiki.tcl.tk/812
That removed line of perl takes care of the most common case.
This is also in the tkcon port.
Your patch does not implement the preferred "$0" ${1+"$@"} style.
Would 'exec wish8.5' not be preferred over 'exec
/usr/local/bin/wish8.5'?
In case a person wants to change their path, run a different wish, etc.
Thing is, this is going to have to be done to practically all Tcl
scripts,
for either tclsh or wish, and I'd rather come up with something
that could eventually go into tcl.port.mk than patching.
Something that a porter could easily use perhaps simply by setting
a variable with the names of the files to be adjusted or ... something?
I'm not too sure about the path to take so I started with this small
bit.
Stu