diff options
author | gahr <gahr@FreeBSD.org> | 2013-09-27 20:53:20 +0800 |
---|---|---|
committer | gahr <gahr@FreeBSD.org> | 2013-09-27 20:53:20 +0800 |
commit | 840a6f36d2cc5d70b19abd73dfcdcade9456c441 (patch) | |
tree | 161bb7ce777f047e57a90992818e4a82609b3db5 /Mk | |
parent | 59bac4481025afe89137cb50057c42eb4a65ee91 (diff) | |
download | freebsd-ports-graphics-840a6f36d2cc5d70b19abd73dfcdcade9456c441.tar.gz freebsd-ports-graphics-840a6f36d2cc5d70b19abd73dfcdcade9456c441.tar.zst freebsd-ports-graphics-840a6f36d2cc5d70b19abd73dfcdcade9456c441.zip |
- 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)
Diffstat (limited to 'Mk')
-rw-r--r-- | Mk/Uses/tcl.mk | 77 |
1 files changed, 59 insertions, 18 deletions
diff --git a/Mk/Uses/tcl.mk b/Mk/Uses/tcl.mk index 65230321c05..4d0a376c7e8 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./} |