Tcl Source Code

View Ticket
Login
Ticket UUID: 1960628
Title: TEA adjustments/fixes
Type: Patch Version: None
Submitter: stwo Created on: 2008-05-09 00:06:47
Subsystem: 70. Sample Extension Assigned To: jenglish
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2009-03-17 06:49:48
Resolution: Accepted Closed By: jenglish
    Closed on: 2009-03-16 23:49:48
Description:
If the VPATH needs to deviate from the standard four dirs (src, src/generic,src/unix,wrc/win) an extension writer would need to alter the tcl.m4 file as well as Makefile.in as opposed to need to simply alter configure.in.
The new macro, TEA_ADD_VPATH_DIR is used to add directories to the VPATH. TEA_ADD_VPATH_DIR should be called before TEA_ADD_SOURCES or TEA_ADD_STUB_SOURCES to ensure that all source files are found. The default search dirs are now only the src snd src/generic dirs. If needed,  src/unix and src/win have to be added manually using TCL_ADD_VPATH_DIR. Also in this patch is a small adjustment to pkgIndex.tcl.in which removes the need to edit pkgIndex.tcl.in for basic usage cases. Also updates TEA_VERSION to 3.7.
User Comments: jenglish added on 2009-03-17 06:49:48:
stu explains on the chat:

> tkConfig.sh has the correct TK_INCLUDE_SPEC but TEA_PUBLIC_TK_HEADERS 
> does not use it.
> [...] suggest grepping for TK_INCLUDE_SPEC  and you'd see that it's not used, except for 
> mac framework builds.
> imho, TEA_PUBLIC_TCL_HEADERS and TEA_PUBLIC_TK_HEADERS should be 
> (nearly) identical but for s/TCL/TK/

... and jenglish finally gets it.  This part of the patch:

if test x"${TK_INCLUDE_SPEC}" != x ; then
    d=`echo "${TK_INCLUDE_SPEC}" | sed -e 's/^-I//'`
    list="$list `ls -d ${d} 2>/dev/null`"
fi

is , I maintain, still buggy [*] (as is most of the surrounding autogoo), but without it TEA_PUBLIC_TK_HEADERS DFW at all if Tk has been installed in a nonstandard location.

Remainder of the patch committed (tclconfig/tcl.m4 r1.130 -> r1.131).  Closing.

[*] bugs: makes several unwarranted assumptions about the nature and form of TK_INCLUDE_SPEC.

jenglish added on 2009-03-17 06:21:37:
OK, so: this is *not* just the standard ELF SONAME rules as Linux/Solaris/IRIX/etc., interpret them, the *BSDs really are different here.

And the ${SHLIB_VERSION} part of the patch really needs to be applied to the core's (tcl and tk) build system, so *BSD porters can specify an appropriate name for libtclXY.so.${SHLIB_VERSION} and libtkXY.so.${SHLIB_VERSION}.  For TEA, for extensions, it's still irrelevant.  (Do I have that right, or am I still missing something)?

... and it looks like tcl/unix/tcl.m4 and tk/unix/tcl.m4 already support configure-time overriding of  ${SHLIB_VERSION}, so nothing to do here.

One more part to go, see next message.

stwo added on 2009-03-12 20:28:10:
${SHLIB_VERSION}, not ${SHARED_LIB_SUFFIX}.
${SHLIB_VERSION} is used by the ports/packages system for dependencies.
For example, the shared lib for tcl8.5.6 would (initially) be libtcl85.so.0.0.
If there were a minor adjustment made to the the tcl8.5.6 port (let's say a small fix taken from tcl's cvs) then the resultant lib would be libtcl85.so.0.1.
If there were a tcl8.5.7 release then the resultant lib (on OpenBSD) would be libtcl85.so.1.0.
Without these numbers there'd be no way for the ports/packages system to resolve dependencies, since the lib names in the above examples would all be the same (libtcl85.so). This 'dependency resolving' is crucial for automatic package updates.

Without ${SHLIB_VERSION}, tcl.m4 would have to always be patched to set the proper ${SHLIB_VERSION} as can currently be seen in the ports trees of all the BSDs. Using ${SHLIB_VERSION} will obviate patching for this purpose, saving others the trouble and hence making Tcl/Tk and any TEA extension slightly more friendly to the ports/packages systems of these os's.

Those using non-BSD os's can safely continue to ignore this but hopefully now they'll understand why the BSD's need it.

jenglish added on 2009-03-12 13:46:04:
(For future reference): On the chat, stu pointed (again) to: http://www.openbsd.org/porting/libraries.html

... which if I understand correctly is talking about more or less the standard ELF rules for dynamically-linked libraries and SONAMES.  So there doesn't seem to be anything hugely different between the *BSDs and other modern Unices.

However -- and this is the part that seems to be widely misunderstood -- the "libfoo.so.major.minor" SONAME naming scheme is only relevant for shared libraries that are dynamically *linked*.

For shared libraries that are dynamically *loaded* -- like Tcl extensions! -- the SONAME, and the filename, are utterly irrelevant as far as dlopen() is concerned. 

(And as far as the Tcl [load] command is concerned, the only part of the filename that matters is the bit between the optional leading "lib" and the first nonalphaorunderline character.  See Tcl_LoadObjCmd()).

AFAICT, all the autogoo trying to guess the "right" ${SHARED_LIB_SUFFIX} is a PWOT, a WOMBAT, a tapdancing badger.   On every Unix I've seen in the last 10 years, you could name the shared library "FOO.DLL" and in Tcl say [package ifneeded foo X.Y [list load [file join $dir FOO.DLL]]] and everything would work Just Fine.

What am I missing?

jenglish added on 2009-03-12 10:25:17:
(For future reference): Stu explained on the chat that ${SHLIB_VERSION} was added so that porters could override the hardcoded ".1.0" part of "libfooXY.so.1.0" at configure-time.

(Stu -- if you could further elaborate *why* one might want/need to do so, it would be appreciated.  Why not f'rinstance just name the shared library "libfooXY.so" -- or better yet, just "foo.so"?  That works just fine on every other ELF-based Unix, why is BSD different here?)

jenglish added on 2009-03-12 08:01:15:
patch-pkgIndex_tcl and (most of) patch-tclconfig_tcl_m4 committed.

stwo added on 2009-03-10 13:18:40:

File Added - 317124: patch-tclconfig_tcl_m4

Slightly improved versions of previous patches.
Older patches left for reference/ideas for possible future changes.
File Added: patch-tclconfig_tcl_m4

stwo added on 2009-03-10 13:18:06:

File Added - 317123: patch-pkgIndex_tcl

Slightly improved versions of previous patches.
Older patches left for reference/ideas for possible future changes.
File Added: patch-pkgIndex_tcl

kennykb added on 2009-01-26 10:06:26:
Ahh. The patch has evolved over time, but I'll still give it a review.

kennykb added on 2009-01-26 10:05:05:
The idea of allowing the VPATH to be extended with whatever the extension needs appears to make eminent sense.  I'll have a look at this patch.

stwo added on 2008-09-04 02:20:07:

File Added - 291950: tea36.patch

Logged In: YES 
user_id=143350
Originator: YES

New, simpler patch.

pkgIndex.tcl.in:
Replace 'Tclsha1' with '@PACKAGE_NAME@' to free
an extension writer from having to modify the file.

tcl.m4:
Use TK_INCLUDE_SPEC to find tk.h, same way as
TCL_INCLUDE_SPEC is used to find tcl.h, fixes
bug where TEA can't find Tk headers. As part
of this, ensure variable 'list' is empty before
filling - I don't think it should contain the
list of directories for TCL_PUBLIC_HEADERS
when it looks for TK_PUBLIC_HEADERS.

Remove -Wno-implicit-int from CFLAGS_WARNING.

Add AC var SHLIB_VERSION used like:
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
to free porters/builders from having to patch tcl.m4
on systems where the shared library version is important.

Assorted code/spelling/typo fixes/uniformity.

Does not change ephemeral TEA version number '3.6'.
File Added: tea36.patch

stwo added on 2008-05-12 00:57:29:

File Deleted - 277251: 



File Added - 277475: tea_3.6-3.7.patch

Logged In: YES 
user_id=143350
Originator: YES

New patch does everything the original did plus the following:

Uses TK_INCLUDE_SPEC to find tk.h, same way as
TCL_INCLUDE_SPEC is used to find tcl.h

Additionally checks for tclConfig.sh in:
${exec_prefix}/lib/tcl[8-9].[0-9]
${exec}/lib/tcl[8-9].[0-9]
/usr/local/lib/tcl[8-9].[0-9]

Additionally checks for tkConfig.sh in:
${exec_prefix}/lib/tk[8-9].[0-9]
${exec}/lib/tk[8-9].[0-9]
/usr/local/lib/tk[8-9].[0-9]

Added INSTALL_LIBRARY macro.
Suitable for archs where install options for
binaries and libraries are different (ex: binaries
are stripped, libraries aren't).
Currently set to ${INSTALL_PROGRAM} - no functional change.
Groundwork for future install improvements.

Assorted code/spelling/typo fixes/uniformity.
File Added: tea_3.6-3.7.patch

stwo added on 2008-05-09 07:06:47:

File Added - 277251: tea_add_vpath_dir.patch

Attachments: