openbsd-ports/lang/tcl/tcl.port.mk
stu 9e9c68c951 Bump number of lines processed to 20
in MODTCL_TCLSH_ADJ and MODTCL_WISH_ADJ.
Catches more scripts; lessens the need for patching.

ok landry@
2012-07-04 17:04:01 +00:00

44 lines
1.4 KiB
Makefile

# $OpenBSD: tcl.port.mk,v 1.12 2012/07/04 17:04:01 stu Exp $
CATEGORIES += lang/tcl
MODTCL_VERSION ?= 8.5
.if ${MODTCL_VERSION} == 8.4
_MODTCL_SPEC = tcl->=${MODTCL_VERSION},<8.5
MODTCL_LIB ?= tcl84
.elif ${MODTCL_VERSION} == 8.5
_MODTCL_SPEC = tcl->=${MODTCL_VERSION},<8.6
MODTCL_LIB ?= tcl85
.endif
MODTCL_BIN ?= ${LOCALBASE}/bin/tclsh${MODTCL_VERSION}
MODTCL_INCDIR ?= ${LOCALBASE}/include/tcl${MODTCL_VERSION}
MODTCL_TCLDIR ?= ${LOCALBASE}/lib/tcl
MODTCL_MODDIR ?= ${LOCALBASE}/lib/tcl/modules
MODTCL_LIBDIR ?= ${MODTCL_TCLDIR}/tcl${MODTCL_VERSION}
MODTCL_CONFIG ?= ${MODTCL_LIBDIR}/tclConfig.sh
MODTCL_BUILD_DEPENDS ?= ${_MODTCL_SPEC}:lang/tcl/${MODTCL_VERSION}
MODTCL_RUN_DEPENDS ?= ${_MODTCL_SPEC}:lang/tcl/${MODTCL_VERSION}
MODTCL_LIB_DEPENDS ?= ${_MODTCL_SPEC}:lang/tcl/${MODTCL_VERSION}
MODTCL_WANTLIB ?= ${MODTCL_LIB}
# 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 && $$. <= 20 && 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