Tcl-wrapper installs a shell wrapper for the "tclsh" command that

comes with different versions of Tcl. Users can define in a configuration file
which version of the Tcl shell should be called.

- Martin Matuska
martin@matuska.org

PR:		ports/110626
Submitted by:	martin at matuska.org
This commit is contained in:
Martin Wilke 2007-03-27 10:52:18 +00:00
parent 8f6e2300a3
commit 8e204ccbd0
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=188523
8 changed files with 148 additions and 0 deletions

View file

@ -307,6 +307,7 @@
SUBDIR += t3x
SUBDIR += tcl-manual
SUBDIR += tcl-tk-wrapper
SUBDIR += tcl-wrapper
SUBDIR += tcl80
SUBDIR += tcl81-thread
SUBDIR += tcl82

71
lang/tcl-wrapper/Makefile Normal file
View file

@ -0,0 +1,71 @@
# Ports collection makefile for: tcl-wrapper
# Date created: 4 March 2007
# Whom: martin@matuska.org
#
# $FreeBSD$
#
PORTNAME= wrapper
PORTVERSION= 1.0
CATEGORIES= lang tcl84 tk84
MASTER_SITES= # empty
PKGNAMEPREFIX= ${TX_PORT}-
DISTFILES= # none
EXTRACT_ONLY= # empty
MAINTAINER= martin@matuska.org
COMMENT= Shell wrapper for ${TX_SHELL} (${TX_PORT_U})
NO_BUILD= yes
SUB_FILES= wrapper conf.sample pkg-message pkg-install pkg-deinstall
PKGINSTALL= ${WRKDIR}/pkg-install
PKGDEINSTALL= ${WRKDIR}/pkg-deinstall
TX_SHELL= tclsh
TX_PORT= tcl
TX_PORT_U= Tcl
TX_CAT= lang
.if defined(BUILDING_TK_WRAPPER)
TX_SHELL= wish
TX_PORT= tk
TX_PORT_U= Tk
TX_CAT= x11-toolkits
USE_TK= yes
.else
USE_TCL= yes
.endif
TX_CONF= ${TX_SHELL}.conf
TX_CONF_FULL= ${PREFIX}/etc/${TX_CONF}
PLIST_FILES= bin/${TX_SHELL} etc/${TX_CONF}.sample
.include <bsd.port.pre.mk>
.if defined(TK_VER)
TX_VER=${TK_VER}
.else
TX_VER=${TCL_VER}
.endif
SUB_LIST+= ECHO_CMD="${ECHO_CMD}" GREP="${GREP}" LS="${LS}" \
CP="${CP}" RM="${RM}" MD5="${MD5} -q" \
TX_SHELL="${TX_SHELL}" TX_SHELL_U="${TX_SHELL:U}" \
TX_PORT="${TX_PORT}" TX_PORT_U="${TX_PORT_U}" \
TX_CAT="${TX_CAT}" TX_VER="${TX_VER}" TX_CONF="${TX_CONF}" \
TX_CONF_FULL="${TX_CONF_FULL}"
do-install:
${INSTALL_SCRIPT} ${WRKDIR}/wrapper ${PREFIX}/bin/${TX_SHELL}
${INSTALL_DATA} ${WRKDIR}/conf.sample ${PREFIX}/etc/${TX_CONF}.sample
post-install:
@MD5SUM=`${MD5} -q ${WRKDIR}/conf.sample` && \
${REINPLACE_CMD} -e "s|^MD5SUM=.*$$|MD5SUM=$${MD5SUM}|g" ${WRKDIR}/pkg-deinstall
@PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
@${CAT} ${PKGMESSAGE}
.include <bsd.port.post.mk>

View file

@ -0,0 +1,6 @@
# This is a sample configuration file for %%TX_CONF%%
# Target for the "%%TX_SHELL%%" wrapper is configured here.
#
# %%TX_SHELL_U%%= full path to your %%TX_SHELL%% shell
%%TX_SHELL_U%%=%%PREFIX%%/bin/%%TX_SHELL%%%%TX_VER%%
#%%TX_SHELL_U%%=%%PREFIX%%/bin/%%TX_SHELL%%%%TX_VER%%-threads

View file

@ -0,0 +1,17 @@
#!/bin/sh
# $FreeBSD$
#
MD5="%%MD5%%"
MD5SUM=
RM="%%RM%%"
TX_CONF="%%TX_CONF_FULL%%"
if [ "$2" = "POST-DEINSTALL" ]; then
if [ -f ${TX_CONF} ]; then
MD5CHECK=`${MD5} ${TX_CONF}`
if [ "x${MD5CHECK}" = "x${MD5SUM}" ]; then
${RM} ${TX_CONF}
fi
fi
fi

View file

@ -0,0 +1,12 @@
#!/bin/sh
# $FreeBSD$
#
CP="%%CP%%"
TX_CONF="%%TX_CONF_FULL%%"
if [ "$2" = "POST-INSTALL" ]; then
if [ ! -f "${TX_CONF}" ]; then
${CP} "${TX_CONF}.sample" "${TX_CONF}"
fi
fi

View file

@ -0,0 +1,7 @@
*******************************************************************
You may wish to modify (or create) the configuration file:
%%TX_CONF_FULL%%
Sample configuration file is located at:
%%TX_CONF_FULL%%.sample
*******************************************************************

View file

@ -0,0 +1,28 @@
#!/bin/sh
# $FreeBSD: /tmp/pcvs/ports/lang/tcl-wrapper/files/wrapper.in,v 1.1 2007-03-27 10:52:18 miwi Exp $
#
# Wrapper for the %%TX_PORT%% shell "%%TX_SHELL%%"
%%TX_SHELL_U%%=
%%TX_SHELL_U%%_CONF=%%TX_CONF_FULL%%
if [ -f "${%%TX_SHELL_U%%_CONF}" ]; then
. ${%%TX_SHELL_U%%_CONF}
if [ -n "${%%TX_SHELL_U%%}" ]; then
if [ -x "${%%TX_SHELL_U%%}" ]; then
exec ${%%TX_SHELL_U%%} "$@"
else
%%ECHO_CMD%% "File not found or not executable: ${%%TX_SHELL_U%%}"
%%ECHO_CMD%% "Please check variable %%TX_SHELL_U%% in: ${%%TX_SHELL_U%%_CONF}"
fi
else
%%ECHO_CMD%% "You do not have set path to default %%TX_SHELL%% in the configuration file:"
%%ECHO_CMD%% "%%TX_CONF%%"
%%ECHO_CMD%% "Please see the sample configuration file for details:"
%%ECHO_CMD%% "%%TX_CONF%%.sample"
fi
else
%%ECHO_CMD%% "Configuration file not found: %%TX_CONF%%"
%%ECHO_CMD%% "Please see the sample configuration file for details:"
%%ECHO_CMD%% "%%TX_CONF%%.sample"
fi

View file

@ -0,0 +1,6 @@
Tcl-wrapper installs a shell wrapper for the "tclsh" command that
comes with different versions of Tcl. Users can define in a configuration file
which version of the Tcl shell should be called.
- Martin Matuska
martin@matuska.org