summaryrefslogtreecommitdiff
path: root/Mk/Uses/tcl.mk
diff options
context:
space:
mode:
authorPietro Cerutti <gahr@FreeBSD.org>2013-09-27 12:53:20 +0000
committerPietro Cerutti <gahr@FreeBSD.org>2013-09-27 12:53:20 +0000
commit3b9dcc5e6d36d1bbd8e6ef6fd9b235d8fe2c8233 (patch)
tree161bb7ce777f047e57a90992818e4a82609b3db5 /Mk/Uses/tcl.mk
parentSupport stage. (diff)
- USES+=tcl and USES+=tk
Add support for specifying multiple versions in arguments, e.g., USES+=tcl:84,85. The picked version is the highest available one. This basically brings in the last functionality that was left out in the switch from USE_TCL to USES+=tcl, namely TCL_INVALID_VER. To specify an invalid version, just list the valid ones. Reviewed by: bdrewery (portmgr)
Notes
Notes: svn path=/head/; revision=328462
Diffstat (limited to 'Mk/Uses/tcl.mk')
-rw-r--r--Mk/Uses/tcl.mk77
1 files changed, 59 insertions, 18 deletions
diff --git a/Mk/Uses/tcl.mk b/Mk/Uses/tcl.mk
index 65230321c054..4d0a376c7e8c 100644
--- a/Mk/Uses/tcl.mk
+++ b/Mk/Uses/tcl.mk
@@ -43,7 +43,9 @@
# is installed, bring in the default version. See
# ${_TCLTK_DEFAULT_VERSION} below.
#
-# - 84, 85, 86 - Depend on a specific version series of PORT.
+# - 84, 85, 86 - Depend on a specific version series of PORT. Multiple
+# values are OK. The highest version available is
+# picked.
#
# - 84+, 85+, 86+ - Depend on any installed version greater or equal to
# the specified version.
@@ -58,54 +60,93 @@
.if !defined(_INCLUDE_USES_TCL_MK)
_INCLUDE_USES_TCL_MK= yes
+#
+# List the currently available versions.
+#
_TCLTK_VALID_VERSIONS= 84 85 86
+#
+# Bring in the default and check that the specified version is in the list of
+# valid versions.
+#
.include "${PORTSDIR}/Mk/bsd.default-versions.mk"
_TCLTK_DEFAULT_VERSION= ${TCLTK_DEFAULT:S/.//}
-
.if ! ${_TCLTK_VALID_VERSIONS:M${_TCLTK_DEFAULT_VERSION}}
IGNORE= Invalid tcltk version ${TCLTK_DEFAULT}
.endif
-# _TCLTK_PORT might be set to tk if USES+= tk was used
+#
+# _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.
+#
_TCLTK_PORT?= tcl
-# Parse arguments
+#
+# Build a make(1)-friendly list of arguments (i.e., space separated).
+#
_TCL_ARGS= ${tcl_ARGS:S/,/ /g}
+#
+# Parse a ver+ argument.
+#
.if ${_TCL_ARGS:M*+}
-# using the ver+ variant
_TCLTK_MIN_VERSION:= ${_TCL_ARGS:M*+:S/+//}
-_TCLTK_WANTED_VERSION:= ${_TCLTK_DEFAULT_VERSION}
+_TCLTK_WANTED_VERSIONS:=${_TCLTK_DEFAULT_VERSION}
.endif
+#
+# Parse one or more ver arguments.
+#
.if ${_TCL_ARGS:M8[4-6]}
-# assume we specified a version
-_TCLTK_WANTED_VERSION:= ${_TCL_ARGS:M8[4-6]}
+_TCLTK_WANTED_VERSIONS:=${_TCL_ARGS:M8[4-6]}
.endif
-.if ${_TCL_ARGS:Mwrapper} && defined(_TCLTK_WANTED_VERSION)
+#
+# It makes little sense to specify both the wrapper and a specific version.
+#
+.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}
.endif
-.if !defined(_TCLTK_WANTED_VERSION)
-_TCLTK_WANTED_VERSION= ${_TCLTK_DEFAULT_VERSION}
-.endif
-
-# check that the specified ver+ is valid
-.if ! ${_TCLTK_VALID_VERSIONS:M${_TCLTK_WANTED_VERSION}}
-IGNORE= USES=${_TCLTK_PORT}: incorrect ${_TCLTK_PORT} version specified: ${_TCLTK_WANTED_VERSION}
+#
+# If no version was specified with any of the ver or ver+ arguments, set the
+# default version.
+#
+.if !defined(_TCLTK_WANTED_VERSIONS)
+_TCLTK_WANTED_VERSIONS= ${_TCLTK_DEFAULT_VERSION}
.endif
+#
+# Resolve minimum versions (ver+). Append anything greater or equal than the
+# specified minimum version to the list of wanted versions.
+#
.if defined(_TCLTK_MIN_VERSION)
. for _v in ${_TCLTK_VALID_VERSIONS}
-. if ${_TCLTK_MIN_VERSION} <= ${_v} && exists(${LOCALBASE}/lib/lib${_TCLTK_PORT}${_v}.so)
-_TCLTK_WANTED_VERSION= ${_v}
+. if ${_TCLTK_MIN_VERSION} <= ${_v}
+_TCLTK_WANTED_VERSIONS+=${_v}
. endif
. endfor
.endif
#
+# 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
+# already installed, if any.
+#
+.for _v in ${_TCLTK_WANTED_VERSIONS:O:u}
+_TCLTK_HIGHEST_VERSION:=${_v}
+. if exists(${LOCALBASE}/lib/lib${_TCLTK_PORT}${_v}.so)
+_TCLTK_WANTED_VERSION:= ${_v}
+. endif
+.endfor
+
+#
+# If we couldn't find any wanted version installed, depend on the highest one.
+.if !defined(_TCLTK_WANTED_VERSION)
+_TCLTK_WANTED_VERSION:= ${_TCLTK_HIGHEST_VERSION}
+.endif
+
+#
# Exported variables
#
TCL_VER:= ${_TCLTK_WANTED_VERSION:S/8/8./}