On 05/27/13 14:34, Vadim Zhukov wrote: > So here is a second try, after input from stu@. Differences from > previous version: > > * More compact and correct whitespace handling (with some ideas from > stu@'s diff); > > * Rewrite both tclsh and wish lines in both macros; > > * Use MODTCL_BIN also for rewritting "exec" lines in shell snippets; > > * Do not move _WISH_ADJ macro to x11/tk module (shrinks diff a lot). > > Comments/okays? > -- > WBR, > Vadim Zhukov > > > Index: lang/tcl/tcl.port.mk > =================================================================== > RCS file: /cvs/ports/lang/tcl/tcl.port.mk,v > retrieving revision 1.14 > diff -u -p -r1.14 tcl.port.mk > --- lang/tcl/tcl.port.mk 2 Feb 2013 11:15:33 -0000 1.14 > +++ lang/tcl/tcl.port.mk 27 May 2013 18:20:06 -0000 > @@ -34,13 +34,12 @@ MODTCL_WANTLIB ?= ${MODTCL_LIB} > > # 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 && $$. <= 30 && 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}/} > + -e '$$. == 1 && s!/\S*bin/(?:tcl|wi)sh\S*(\s.*)?$$!${MODTCL_BIN}$$1!;' \ > + -e '$$. == 1 && > s!/\S*env\s+(?:tcl|wi)sh\S*(\s.*)?$$!${MODTCL_BIN}$$1!;' \ > + -e '$$. >= 3 && $$. <= 30 && s!exec (?:tcl|wi)sh.*$$!exec ${MODTCL_BIN} > "\$$0" \$${1+"\$$@"}!;' \ > + -e 'close ARGV if eof;' > > +MODTCL_WISH_ADJ = ${MODTCL_TCLSH_ADJ:S/tclsh/wish/g} > > SUBST_VARS += MODTCL_VERSION MODTCL_BIN >
I dunno, it's still almost understandable. Any way to make this impenetrable? I prefer (\s+.+) to (\s.*) Stu