Changeset View
Changeset View
Standalone View
Standalone View
Mk/Uses/tcl.mk
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | |||||
# Build-time / Run-time only dependencies can be specified with build or run. | # Build-time / Run-time only dependencies can be specified with build or run. | ||||
# | # | ||||
# Tea can be used for Tcl/Tk extensions that use the Tcl Extension Architecture | # Tea can be used for Tcl/Tk extensions that use the Tcl Extension Architecture | ||||
# [http://www.tcl.tk/doc/tea] and allows to set common autoconf parameters. | # [http://www.tcl.tk/doc/tea] and allows to set common autoconf parameters. | ||||
# | # | ||||
# MAINTAINER: tcltk@FreeBSD.org | # MAINTAINER: tcltk@FreeBSD.org | ||||
.if ${USES:Mtk} || ${USES:Mtk\:*} | .if ${USES:Mtk} || ${USES:Mtk\:*} | ||||
.if !defined(_TCLTK_PORT) | . if !defined(_TCLTK_PORT) | ||||
_TCLTK_IGNORE= yes | _TCLTK_IGNORE= yes | ||||
.endif | . endif | ||||
.endif | .endif | ||||
.if !defined(_INCLUDE_USES_TCL_MK) && !defined(_TCLTK_IGNORE) | .if !defined(_INCLUDE_USES_TCL_MK) && !defined(_TCLTK_IGNORE) | ||||
_INCLUDE_USES_TCL_MK= yes | _INCLUDE_USES_TCL_MK= yes | ||||
# | # | ||||
# List the currently available versions. | # List the currently available versions. | ||||
# | # | ||||
# When adding a version, please keep the comment in | # When adding a version, please keep the comment in | ||||
# Mk/bsd.default-versions.mk in sync. | # Mk/bsd.default-versions.mk in sync. | ||||
_TCLTK_VALID_VERSIONS= 85 86 87 | _TCLTK_VALID_VERSIONS= 85 86 87 | ||||
# | # | ||||
# Bring in the default and check that the specified version is in the list of | # Bring in the default and check that the specified version is in the list of | ||||
# valid versions. | # valid versions. | ||||
# | # | ||||
_TCLTK_DEFAULT_VERSION= ${TCLTK_DEFAULT:S/.//} | _TCLTK_DEFAULT_VERSION= ${TCLTK_DEFAULT:S/.//} | ||||
.if ! ${_TCLTK_VALID_VERSIONS:M${_TCLTK_DEFAULT_VERSION}} | . if ! ${_TCLTK_VALID_VERSIONS:M${_TCLTK_DEFAULT_VERSION}} | ||||
IGNORE= Invalid tcltk version ${TCLTK_DEFAULT} | IGNORE= Invalid tcltk version ${TCLTK_DEFAULT} | ||||
.endif | . endif | ||||
# | # | ||||
# _TCLTK_PORT tells us whether we're depending on Tcl or Tk. When using | # _TCLTK_PORT tells us whether we're depending on Tcl or Tk. When using | ||||
# USES+=tk, the included file tk.mk sets this before including this file. | # USES+=tk, the included file tk.mk sets this before including this file. | ||||
# | # | ||||
_TCLTK_PORT?= tcl | _TCLTK_PORT?= tcl | ||||
# | # | ||||
# Parse a ver+ argument. | # Parse a ver+ argument. | ||||
# | # | ||||
.if ${tcl_ARGS:M*+} | . if ${tcl_ARGS:M*+} | ||||
_TCLTK_MIN_VERSION:= ${tcl_ARGS:M*+:S/+//} | _TCLTK_MIN_VERSION:= ${tcl_ARGS:M*+:S/+//} | ||||
_TCLTK_WANTED_VERSIONS:=${_TCLTK_DEFAULT_VERSION} | _TCLTK_WANTED_VERSIONS:=${_TCLTK_DEFAULT_VERSION} | ||||
.if ${_TCLTK_MIN_VERSION} == "85" | . if ${_TCLTK_MIN_VERSION} == "85" | ||||
IGNORE= Minimum tcltk version 85+ is meaningless | IGNORE= Minimum tcltk version 85+ is meaningless | ||||
.endif | . endif | ||||
.endif | . endif | ||||
# | # | ||||
# Parse one or more ver arguments. | # Parse one or more ver arguments. | ||||
# | # | ||||
.if ${tcl_ARGS:M8[5-7]} | . if ${tcl_ARGS:M8[5-7]} | ||||
_TCLTK_WANTED_VERSIONS:=${tcl_ARGS:M8[5-7]} | _TCLTK_WANTED_VERSIONS:=${tcl_ARGS:M8[5-7]} | ||||
.endif | . endif | ||||
# | # | ||||
# It makes little sense to specify both the wrapper and a specific version. | # It makes little sense to specify both the wrapper and a specific version. | ||||
# | # | ||||
.if ${tcl_ARGS:Mwrapper} && defined(_TCLTK_WANTED_VERSIONS) | . if ${tcl_ARGS:Mwrapper} && defined(_TCLTK_WANTED_VERSIONS) | ||||
IGNORE= USES=${_TCLTK_PORT}: it is not possible to specify both a version and the wrapper: ${tcl_ARGS} | IGNORE= USES=${_TCLTK_PORT}: it is not possible to specify both a version and the wrapper: ${tcl_ARGS} | ||||
.endif | . endif | ||||
# | # | ||||
# If no version was specified with any of the ver or ver+ arguments, set the | # If no version was specified with any of the ver or ver+ arguments, set the | ||||
# default version. | # default version. | ||||
# | # | ||||
.if !defined(_TCLTK_WANTED_VERSIONS) | . if !defined(_TCLTK_WANTED_VERSIONS) | ||||
_TCLTK_WANTED_VERSIONS= ${_TCLTK_DEFAULT_VERSION} | _TCLTK_WANTED_VERSIONS= ${_TCLTK_DEFAULT_VERSION} | ||||
.endif | . endif | ||||
# | # | ||||
# Resolve minimum versions (ver+). Append anything greater or equal than the | # Resolve minimum versions (ver+). Append anything greater or equal than the | ||||
# specified minimum version to the list of wanted versions. | # specified minimum version to the list of wanted versions. | ||||
# | # | ||||
.if defined(_TCLTK_MIN_VERSION) | . if defined(_TCLTK_MIN_VERSION) | ||||
. for _v in ${_TCLTK_VALID_VERSIONS} | . for _v in ${_TCLTK_VALID_VERSIONS} | ||||
. if ${_TCLTK_MIN_VERSION} <= ${_v} | . if ${_TCLTK_MIN_VERSION} <= ${_v} | ||||
_TCLTK_WANTED_VERSIONS+=${_v} | _TCLTK_WANTED_VERSIONS+=${_v} | ||||
. endif | . endif | ||||
. endfor | . endfor | ||||
.endif | . endif | ||||
# | # | ||||
# Right now we have built a list of potential versions that we may depend on. | # Right now we have built a list of potential versions that we may depend on. | ||||
# Let's sort them and remove any duplicates. We then locate the highest one | # Let's sort them and remove any duplicates. We then locate the highest one | ||||
# already installed, if any. | # already installed, if any. | ||||
# | # | ||||
.for _v in ${_TCLTK_WANTED_VERSIONS:O:u} | . for _v in ${_TCLTK_WANTED_VERSIONS:O:u} | ||||
_TCLTK_HIGHEST_VERSION:=${_v} | _TCLTK_HIGHEST_VERSION:=${_v} | ||||
. if exists(${LOCALBASE}/lib/lib${_TCLTK_PORT}${_v}.so) | . if exists(${LOCALBASE}/lib/lib${_TCLTK_PORT}${_v}.so) | ||||
_TCLTK_WANTED_VERSION:= ${_v} | _TCLTK_WANTED_VERSION:= ${_v} | ||||
. endif | . endif | ||||
.endfor | . endfor | ||||
# | # | ||||
# If we couldn't find any wanted version installed, depend on the default or the highest one. | # If we couldn't find any wanted version installed, depend on the default or the highest one. | ||||
.if !defined(_TCLTK_WANTED_VERSION) | . if !defined(_TCLTK_WANTED_VERSION) | ||||
. if ${_TCLTK_WANTED_VERSIONS:M${_TCLTK_DEFAULT_VERSION}} | . if ${_TCLTK_WANTED_VERSIONS:M${_TCLTK_DEFAULT_VERSION}} | ||||
_TCLTK_WANTED_VERSION:= ${_TCLTK_DEFAULT_VERSION} | _TCLTK_WANTED_VERSION:= ${_TCLTK_DEFAULT_VERSION} | ||||
. else | . else | ||||
_TCLTK_WANTED_VERSION:= ${_TCLTK_HIGHEST_VERSION} | _TCLTK_WANTED_VERSION:= ${_TCLTK_HIGHEST_VERSION} | ||||
. endif | . endif | ||||
.endif | . endif | ||||
# | # | ||||
# Deprecate by default all ports depending on 8.5 | # Deprecate by default all ports depending on 8.5 | ||||
.if ${_TCLTK_WANTED_VERSION} == "85" | . if ${_TCLTK_WANTED_VERSION} == "85" | ||||
DEPRECATED= Tcl/Tk 8.5 is nearing EOL, please consider porting to Tcl/Tk 8.6 | DEPRECATED= Tcl/Tk 8.5 is nearing EOL, please consider porting to Tcl/Tk 8.6 | ||||
.endif | . endif | ||||
# | # | ||||
# Exported variables | # Exported variables | ||||
# | # | ||||
TCL_VER:= ${_TCLTK_WANTED_VERSION:S/8/8./} | TCL_VER:= ${_TCLTK_WANTED_VERSION:S/8/8./} | ||||
TCL_SHLIB_VER:= ${_TCLTK_WANTED_VERSION} | TCL_SHLIB_VER:= ${_TCLTK_WANTED_VERSION} | ||||
TCLSH:= ${LOCALBASE}/bin/tclsh${TCL_VER} | TCLSH:= ${LOCALBASE}/bin/tclsh${TCL_VER} | ||||
TCL_LIBDIR:= ${LOCALBASE}/lib/tcl${TCL_VER} | TCL_LIBDIR:= ${LOCALBASE}/lib/tcl${TCL_VER} | ||||
TCL_INCLUDEDIR:=${LOCALBASE}/include/tcl${TCL_VER} | TCL_INCLUDEDIR:=${LOCALBASE}/include/tcl${TCL_VER} | ||||
.if ${_TCLTK_PORT} == "tk" | . if ${_TCLTK_PORT} == "tk" | ||||
TK_VER:= ${_TCLTK_WANTED_VERSION:S/8/8./} | TK_VER:= ${_TCLTK_WANTED_VERSION:S/8/8./} | ||||
TK_SHLIB_VER:= ${_TCLTK_WANTED_VERSION} | TK_SHLIB_VER:= ${_TCLTK_WANTED_VERSION} | ||||
WISH:= ${LOCALBASE}/bin/wish${TCL_VER} | WISH:= ${LOCALBASE}/bin/wish${TCL_VER} | ||||
TK_LIBDIR:= ${LOCALBASE}/lib/tk${TK_VER} | TK_LIBDIR:= ${LOCALBASE}/lib/tk${TK_VER} | ||||
TK_INCLUDEDIR:= ${LOCALBASE}/include/tk${TK_VER} | TK_INCLUDEDIR:= ${LOCALBASE}/include/tk${TK_VER} | ||||
.endif | . endif | ||||
# | # | ||||
# Dependencies | # Dependencies | ||||
# | # | ||||
_TCLTK_BUILD_DEPENDS= | _TCLTK_BUILD_DEPENDS= | ||||
_TCLTK_RUN_DEPENDS= | _TCLTK_RUN_DEPENDS= | ||||
_TCLTK_LIB_DEPENDS= | _TCLTK_LIB_DEPENDS= | ||||
# Construct the correct dependency lines (wrapper) | # Construct the correct dependency lines (wrapper) | ||||
.if ${tcl_ARGS:Mwrapper} | . if ${tcl_ARGS:Mwrapper} | ||||
. if ${_TCLTK_PORT} == "tcl" | . if ${_TCLTK_PORT} == "tcl" | ||||
_TCLTK_WRAPPER_PORT= tclsh:lang/tcl-wrapper | _TCLTK_WRAPPER_PORT= tclsh:lang/tcl-wrapper | ||||
. elif ${_TCLTK_PORT} == "tk" | . elif ${_TCLTK_PORT} == "tk" | ||||
_TCLTK_WRAPPER_PORT= wish:x11-toolkits/tk-wrapper | _TCLTK_WRAPPER_PORT= wish:x11-toolkits/tk-wrapper | ||||
. endif | . endif | ||||
.endif | . endif | ||||
# Construct the correct dependency lines (Tcl/Tk) | # Construct the correct dependency lines (Tcl/Tk) | ||||
.if ${_TCLTK_PORT} == "tcl" | . if ${_TCLTK_PORT} == "tcl" | ||||
_TCLTK_EXE_LINE= tclsh${TCL_VER}:lang/tcl${_TCLTK_WANTED_VERSION} | _TCLTK_EXE_LINE= tclsh${TCL_VER}:lang/tcl${_TCLTK_WANTED_VERSION} | ||||
_TCLTK_LIB_LINE= libtcl${TCL_SHLIB_VER}.so:lang/tcl${_TCLTK_WANTED_VERSION} | _TCLTK_LIB_LINE= libtcl${TCL_SHLIB_VER}.so:lang/tcl${_TCLTK_WANTED_VERSION} | ||||
.elif ${_TCLTK_PORT} == "tk" | . elif ${_TCLTK_PORT} == "tk" | ||||
_TCLTK_EXE_LINE= wish${TK_VER}:x11-toolkits/tk${_TCLTK_WANTED_VERSION} | _TCLTK_EXE_LINE= wish${TK_VER}:x11-toolkits/tk${_TCLTK_WANTED_VERSION} | ||||
_TCLTK_LIB_LINE= libtk${TK_SHLIB_VER}.so:x11-toolkits/tk${_TCLTK_WANTED_VERSION} \ | _TCLTK_LIB_LINE= libtk${TK_SHLIB_VER}.so:x11-toolkits/tk${_TCLTK_WANTED_VERSION} \ | ||||
libtcl${TCL_SHLIB_VER}.so:lang/tcl${_TCLTK_WANTED_VERSION} | libtcl${TCL_SHLIB_VER}.so:lang/tcl${_TCLTK_WANTED_VERSION} | ||||
.endif | . endif | ||||
.if ${tcl_ARGS:Mbuild} | . if ${tcl_ARGS:Mbuild} | ||||
BUILD_DEPENDS+= ${_TCLTK_WRAPPER_PORT} \ | BUILD_DEPENDS+= ${_TCLTK_WRAPPER_PORT} \ | ||||
${_TCLTK_EXE_LINE} | ${_TCLTK_EXE_LINE} | ||||
.elif ${tcl_ARGS:Mrun} | . elif ${tcl_ARGS:Mrun} | ||||
RUN_DEPENDS+= ${_TCLTK_WRAPPER_PORT} \ | RUN_DEPENDS+= ${_TCLTK_WRAPPER_PORT} \ | ||||
${_TCLTK_EXE_LINE} | ${_TCLTK_EXE_LINE} | ||||
.else | . else | ||||
RUN_DEPENDS+= ${_TCLTK_WRAPPER_PORT} | RUN_DEPENDS+= ${_TCLTK_WRAPPER_PORT} | ||||
LIB_DEPENDS+= ${_TCLTK_LIB_LINE} | LIB_DEPENDS+= ${_TCLTK_LIB_LINE} | ||||
.endif | . endif | ||||
# Setup TEA stuff | # Setup TEA stuff | ||||
.if ${tcl_ARGS:Mtea} | . if ${tcl_ARGS:Mtea} | ||||
GNU_CONFIGURE= yes | GNU_CONFIGURE= yes | ||||
TCL_PKG?= ${PORTNAME:C/^tcl(-?)//:C/(-?)tcl\$//}${PORTVERSION} | TCL_PKG?= ${PORTNAME:C/^tcl(-?)//:C/(-?)tcl\$//}${PORTVERSION} | ||||
PLIST_SUB+= TCL_PKG=${TCL_PKG} | PLIST_SUB+= TCL_PKG=${TCL_PKG} | ||||
CONFIGURE_ARGS+=--exec-prefix=${PREFIX} \ | CONFIGURE_ARGS+=--exec-prefix=${PREFIX} \ | ||||
--with-tcl=${TCL_LIBDIR} \ | --with-tcl=${TCL_LIBDIR} \ | ||||
--with-tclinclude=${TCL_INCLUDEDIR} | --with-tclinclude=${TCL_INCLUDEDIR} | ||||
. if ${_TCLTK_PORT} == "tk" | . if ${_TCLTK_PORT} == "tk" | ||||
CONFIGURE_ARGS+=--with-tk=${TK_LIBDIR} --with-tkinclude=${TK_INCLUDEDIR} | CONFIGURE_ARGS+=--with-tk=${TK_LIBDIR} --with-tkinclude=${TK_INCLUDEDIR} | ||||
. endif | . endif | ||||
.endif | . endif | ||||
.endif # defined(_INCLUDE_USES_TCL_MK) | .endif # defined(_INCLUDE_USES_TCL_MK) | ||||
.undef _TCLTK_IGNORE | .undef _TCLTK_IGNORE |