ports/109097: [PATCH] Mk/bsd.tcl.mk improvement proposal
Martin Matuska
martin at matuska.org
Mon Feb 12 17:40:04 UTC 2007
>Number: 109097
>Category: ports
>Synopsis: [PATCH] Mk/bsd.tcl.mk improvement proposal
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Mon Feb 12 17:40:03 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator: Martin Matuska
>Release: FreeBSD 6.2-RELEASE amd64
>Organization:
>Environment:
System: FreeBSD 6.2-RELEASE amd64/i386
>Description:
- adds threads support for tcl
- enables settings for 83+ 84+ and 85+ (Tcl and Tk),
others are possible
- supersedes ports/109082
>How-To-Repeat:
>Fix:
--- Mk/bsd.tcl.mk.orig Mon Feb 12 10:30:50 2007
+++ Mk/bsd.tcl.mk Mon Feb 12 17:29:25 2007
@@ -13,16 +13,23 @@
# 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)
#
# 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 +54,138 @@
# 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
+.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_MINIMUM_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_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_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
+. 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
+.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(NO_TK_RUN_DEPENDS)
+_TK_NORUN= yes
+. endif
_TK_BUILD= yes
.endif
@@ -109,6 +193,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 +227,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 +242,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)
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list