On 05/06/13 15:10, Vadim Zhukov wrote:
> This patch cleans up path adjustments in Tcl/Tk ports. List of changes:

Thanks for taking time to work on this.


>   * MODTCL_WISH_ADJ is renamed to MODTK_WISH_ADJ and moved to a more
>     appropriate place - tk.port.mk;

This has come up before.
I like them in tcl.port.mk; it's handy to have all the tools in one toolbox.


>   * MODTCL_TCLSH_ADJ now touches only tclsh* strings, and
>     MODTCL_WISH_ADJ now touches only wish* strings;

No. These should set the *sh to what the porter wants.


>   * MODTCL_TCLSH_ADJ and MODTCL_WISH_ADJ now use full path for replacement

Others have requested this as well. Ok.


>     instead of "#!/usr/bin/env ..." trick;

It's not a trick, it's a perfectly cromulent way to start a script
and some people write their scripts like that.


>   * Also those two macros do now overwrite tclsh/wish command-line options
>     in shebang, if there are any;

I don't think there are many cases of needing this but it's a good idea. Ok.


>   * productivity/sl is turned to use MODTCL_TCLSH_ADJ now, as it works.

Hmm, '.*/bin/tclsh' is rare. Just sayin'.


> 
> All users of MODTCL_TCLSH_ADJ and MODTCL_WISH_ADJ are bumped.

The port-modules man page would have to be updated as well.


How's this? It's a lot less work overall.

* /*bin/ adjustment
* better whitespace handling
* use full path to binaries
* preserve command-line options for bin and env


Stu



Index: tcl.port.mk
===================================================================
RCS file: /cvs/ports/lang/tcl/tcl.port.mk,v
retrieving revision 1.14
diff -u -p -u -p -r1.14 tcl.port.mk
--- tcl.port.mk 2 Feb 2013 11:15:33 -0000       1.14
+++ tcl.port.mk 25 May 2013 07:39:20 -0000
@@ -34,9 +34,10 @@ 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;'
+       -e '$$. == 1 && s!env\s+(tclsh|wish)\S*(\s+.+)?$$!env 
${MODTCL_BIN}$$2!;' \
+       -e '$$. == 1 && s!/\S*bin/(tclsh|wish)\S*(\s+.+)?$$!${MODTCL_BIN}$$2!;' 
\
+       -e '$$. >= 3 && $$. <= 30 && s!exec\s+(tclsh|wish).*$$!exec 
${MODTCL_BIN} "\$$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}/}



Index: Makefile
===================================================================
RCS file: /cvs/ports/productivity/sl/Makefile,v
retrieving revision 1.2
diff -u -p -u -p -r1.2 Makefile
--- Makefile    16 Mar 2013 13:25:21 -0000      1.2
+++ Makefile    25 May 2013 06:14:39 -0000
@@ -3,6 +3,7 @@
 COMMENT =      substantially more useful ls
 DISTNAME =     sl-ls-1.1.2
 CATEGORIES =   productivity sysutils
+REVISION =     0

 HOMEPAGE =     http://practicalthought.com/sl/

@@ -21,8 +22,7 @@ NO_BUILD =    Yes
 NO_TEST =      Yes

 pre-configure:
-# XXX: Use ${MODTCL_TCLSH_ADJ} someday
-       perl -pi -e s,/usr/bin/tclsh,${PREFIX}/bin/tclsh${MODTCL_VERSION},g 
${WRKSRC}/sl
+       ${MODTCL_TCLSH_ADJ} ${WRKSRC}/sl

 do-install:
        ${INSTALL_SCRIPT} ${WRKSRC}/sl ${PREFIX}/bin


Reply via email to