--- Mk/bsd.tcl.mk.orig Mon Feb 12 10:30:50 2007 +++ Mk/bsd.tcl.mk Fri Feb 16 10:38:47 2007 @@ -10,19 +10,28 @@ Tcl_Include_MAINTAINER= ports@FreeBSD.org # USE_TCL - Depend on tcl to run. In case of incompatible APIs of -# different TCL versions the version can be specified directly. +# different Tcl versions the version can be specified directly. # If version is not specified (USE_TCL=yes) then the latest # version is used (8.4 currently). -# Available values are: 85, 85-thread, 84, 84-thread, 83, 82, -# 81 and 80. -# USE_TCL_BUILD - Build time dependency on tcl. Same semantics as USE_TCL. +# Available values are: 85+, 84+, 83+, 85, 84, 83, 82, 81 and 80. +# USE_TCL_BUILD - Set to add build time dependency on tcl, requires USE_TCL. +# TCL_NO_RUN_DEPENDS - Set to disable runtime dependency on Tcl (requires USE_TCL_BUILD) +# +# USE_TCL_THREADS - If unset, non-threaded Tcl is required by default. If a threaded version +# is installed, port uses the threaded version. +# If set, a threaded build of Tcl is always required. +# USE_TCL_NOTHREADS - If set, a non-threaded Tcl is always required. +# (overrides USE_TCL_THREADS if set) +# TCL_HAS_THREADS - Detected by bsd.tcl.mk. If set, a threaded version of Tcl is already +# installed or going to be installed. # # USE_TK - Depend on tk to run. In case of incompatible APIs of different # TK versions the version can be specified directly. If version # is not specified (USE_TK=yes) then the latest version is # used (8.4 currently). -# Available values are: 85, 84, 83, 82, 81 and 80. -# USE_TK_BUILD - Build time dependency on tk. Same semantics as USE_TK. +# Available values are: 85+, 84+, 83+, 85, 84, 83, 82, 81 and 80. +# USE_TK_BUILD - Set to add build time dependency on tk. +# TK_NO_RUN_DEPENDS - Set to disable runtime dependency on Tk (requires USE_TK_BUILD) ## # TCL_LIBDIR - Path where tcl libraries can be found # @@ -47,61 +56,143 @@ # wish calls with wish${TK_VER} calls. Also note that # post-patch target is used. -.if defined(USE_TCL) || defined(USE_TCL_BUILD) - -_TCL_VERSIONS= 85 85-thread 84 84-thread 83 82 81 80 +# Backwards compatibility with old USE_TCL_BUILD +.if defined(USE_TCL_BUILD) && !defined(USE_TCL) +USE_TCL= ${USE_TCL_BUILD} +USE_TCL_BUILD= yes +TCL_NO_RUN_DEPENDS= yes +.endif +# Tcl part .if defined(USE_TCL) -_RUN= yes -.endif -.if defined(USE_TCL_BUILD) -USE_TCL= ${USE_TCL_BUILD} -_BUILD= yes -.endif +_TCL_VERSIONS= 85 84 84 83 82 81 80 +_TCL_THREADED_VERSIONS= 85 84 81 +_TCL_RANGE_VERSIONS= 85+ 84+ 83+ + +# For specifying [85, 84, 83, ..]+ +_TCL_83P= 83 84 85 +_TCL_84P= 84 85 +_TCL_85P= 85 + +# Support for obsolete 84-thread and 85-thread definitions +. if ${USE_TCL} == "84-thread" || ${USE_TCL} == "85-thread" +_USE_TCL= ${USE_TCL:S/-thread//} +USE_TCL= ${_USE_TCL} +USE_TCL_THREADS= yes +. endif .if ${USE_TCL} == "yes" USE_TCL= 84 .endif -TCL_VER:= ${USE_TCL:S/8/8./:S/-thread//} +.if defined(USE_TCL_BUILD) +. if defined(TCL_NO_RUN_DEPENDS) +_NORUN= yes +. endif +_BUILD= yes +.endif # Special case .if ${USE_TCL} == "81" -USE_TCL= tcl81-thread +USE_TCL_THREADS= yes +.endif + +# Check if a tcl build with threads is required +.if defined(USE_TCL_THREADS) && !defined(USE_TCL_NOTHREADS) +TCL_HAS_THREADS= yes +_TCL_THREADED= _THREADED +_TCL_THREADED_PORT= -thread +_TCL_THREADED_IGNORE= (with threads) +.endif + +# Check for highest installed Tcl (if e.g. 83+ is specified) +_TCL_VER= no +.for ver in ${_TCL_RANGE_VERSIONS} +. if ${USE_TCL} == "${ver}" && ${_TCL_VER} == "no" +_MATCHED_TCL_VER:= ${USE_TCL:S/+//} +. for tcl in ${_TCL_${_MATCHED_TCL_VER}P} +. if exists(${LOCALBASE}/include/tcl${tcl:S/8/8./}/tcl.h) +_TCL_VER=${tcl} +. endif +. endfor +. endif +.endfor +.if defined(_MATCHED_TCL_VER) +. if ${_TCL_VER} != "no" +USE_TCL= ${_TCL_VER} +. else +USE_TCL= ${_MATCHED_TCL_VER} +. endif .endif +TCL_VER:= ${USE_TCL:S/8/8./} + +# Check if correct Tcl version was specified _FOUND= no -.for ver in ${_TCL_VERSIONS} +.for ver in ${_TCL${_TCL_THREADED}_VERSIONS} . if ${USE_TCL} == "${ver}" _FOUND= yes -. if defined(_BUILD) -BUILD_DEPENDS+= tclsh${TCL_VER}:${PORTSDIR}/lang/tcl${USE_TCL} -. endif -. if defined(_RUN) -RUN_DEPENDS+= tclsh${TCL_VER}:${PORTSDIR}/lang/tcl${USE_TCL} -. endif + TCL_INCLUDEDIR= ${LOCALBASE}/include/tcl${TCL_VER} TCL_LIBDIR= ${LOCALBASE}/lib/tcl${TCL_VER} TCLSH= ${LOCALBASE}/bin/tclsh${TCL_VER} + +# Check if a threaded or non-threaded Tcl is installed +. if exists(${TCLSH}) +_TCL_IS_THREADED!= echo 'puts [array names tcl_platform -exact threaded]' | ${TCLSH} || return 0 +. if ${_TCL_IS_THREADED} != "threaded" +. if defined(USE_TCL_THREADS) +IGNORE= Tcl ${TCL_VER} with threads required. The installed version does not support threads +. endif +. else +TCL_HAS_THREADS= yes +. if defined(USE_TCL_NOTHREADS) +IGNORE= Tcl ${TCL_VER} without threads required. The installed version uses threads +. else +_TCL_THREADED_PORT= -thread +. endif +. endif +. endif + +# Add dependencies +. if defined(_BUILD) +BUILD_DEPENDS+= tclsh${TCL_VER}:${PORTSDIR}/lang/tcl${USE_TCL}${_TCL_THREADED_PORT} +. endif +. if !defined(_NORUN) +RUN_DEPENDS+= tclsh${TCL_VER}:${PORTSDIR}/lang/tcl${USE_TCL}${_TCL_THREADED_PORT} +. endif . endif .endfor .if ${_FOUND} == "no" -IGNORE= Unknown TCL version specified: ${USE_TCL} +IGNORE= Unknown Tcl version specified: ${USE_TCL} ${_TCL_THREADED_IGNORE} .endif -.endif # defined(USE_TCL) || defined(USE_TCL_BUILD) -.if defined(USE_TK) || defined(USE_TK_BUILD) +.endif # defined(USE_TCL) -_TK_VERSIONS= 85 84 83 82 81 80 +# Backwards compatibility with old USE_TK_BUILD +.if defined(USE_TK_BUILD) && !defined(USE_TK) +USE_TK= ${USE_TK_BUILD} +USE_TK_BUILD= yes +TK_NO_RUN_DEPENDS= yes +.endif +# TK part .if defined(USE_TK) -_TK_RUN= yes -.endif + +_TK_VERSIONS= 85 84 83 82 81 80 +_TK_RANGE_VERSIONS= 85+ 84+ 83+ + +# For specifying [85, 84, 83, ..]+ +_TK_83P= 83 84 85 +_TK_84P= 84 85 +_TK_85P= 85 .if defined(USE_TK_BUILD) -USE_TK= ${USE_TK_BUILD} +. if defined(TK_NO_RUN_DEPENDS) +_TK_NORUN= yes +. endif _TK_BUILD= yes .endif @@ -109,6 +200,26 @@ USE_TK= 84 .endif +# Check for highest installed TK (if e.g. 83+ is specified) +_TK_VER= no +.for ver in ${_TK_RANGE_VERSIONS} +. if ${USE_TK} == "${ver}" && ${_TK_VER} == "no" +_MATCHED_TK_VER:= ${USE_TK:S/+//} +. for tk in ${_TK_${_MATCHED_TK_VER}P} +. if exists(${LOCALBASE}/include/tk${tk:S/8/8./}/tk.h) +_TK_VER=${tk} +. endif +. endfor +. endif +.endfor +.if defined(_MATCHED_TK_VER) +. if ${_TK_VER} != "no" +USE_TK= ${_TK_VER} +. else +USE_TK= ${_MATCHED_TK_VER} +. endif +.endif + TK_VER:= ${USE_TK:S/8/8./} TCL_VER?= ${TK_VER} @@ -123,7 +234,7 @@ . if defined(_TK_BUILD) BUILD_DEPENDS+= wish${TK_VER}:${PORTSDIR}/x11-toolkits/tk${USE_TK} .endif -. if defined(_TK_RUN) +. if !defined(_TK_NORUN) RUN_DEPENDS+= wish${TK_VER}:${PORTSDIR}/x11-toolkits/tk${USE_TK} .endif TCL_INCLUDEDIR= ${LOCALBASE}/include/tcl${TK_VER} @@ -138,7 +249,7 @@ .if ${_FOUND} == "no" IGNORE= Unknown TK version specified: ${USE_TK} .endif -.endif # defined(USE_TK) || defined(USE_TK_BUILD) +.endif # defined(USE_TK) .endif # !defined(_POSTMKINCLUDED) && !defined(Tcl_Pre_Include)