heads up: tcl and tk 8.5

Michael Thomas wart at kobold.org
Wed Jan 2 23:00:59 UTC 2008


John Ellson wrote:
> Michael Thomas wrote:
>> John Ellson wrote:
>>  
>>>> The 'restricted auto_path' patch that we are adding will limit the
>>>> search to %{_libdir}/tcl8.5 and %{_datadir}/tcl8.5.  This greatly
>>>> improves the startup time for most Tcl applications.  However, it does
>>>> require that maintainers of Tcl extension packages make some changes to
>>>> ensure that the extensions get installed into %{_libdir}/tcl8.5 (or
>>>> %{_datadir}/tcl8.5) instead of %{_libdir} (or %{_datadir}).  I will be
>>>> happy to help out any maintainers that want help with this change.
>>>>       
>>> Will this information be available from some kind of introspection from
>>> running tclsh ?
>>>     
>>
>> Yes.  You can start tclsh and run 'set auto_path'.  This will print out
>> a list of the directories that will be searched for packages.
>>
>>  
>>> Has this change been accepted upstream so that it can be relied on on
>>> other platforms?
>>>     
>>
>> I had a discussion with upstream about this, and they blamed the problem
>> on the distributions installing Tcl and the extensions into too-generic
>> directories.  Unfortunately, most extensions were developed to be
>> installed directly into /usr/lib and /usr/share, and now need to be
>> patched to be installed elsewhere.
>>
>> In any case, you can always look at the contents of the auto_path
>> variable on any platform in Tcl to see where extensions are looked for.
>>
>> --Mike
>>
>>   
> A bit more clarification please.
> 
> This is not about where to look, its about where to install, so it must
> resolve to a single value.

In that case, no, there is no introspection in Tcl to get this
information.  This is because the choice of the directory in which to
install depends on whether you are installing an arch-specific or a
noarch package.  But the rule is simple:

noarch packages should get installed into
%{_datadir}/tcl8.5/%{name}-%{version}

arch-specific packages should get installed into
%{_libdir}/tcl8.5/%{name}-%{version}

The proposed Tcl packaging guidelines[1] have some scriptlets that you
can use at the top of your spec file to set the installation directory:

%{!?tcl_version: %define tcl_version %(echo 'puts $tcl_version' | tclsh)}
%{!?tcl_sitelib: %define tcl_sitelib %{_datadir}/tcl%{tcl_version}}
%{!?tcl_sitearch: %define tcl_sitearch %{_libdir}/tcl%{tcl_version}}

Use %{tcl_sitearch} as the base directory for arch-specific packages,
and %{tcl_sitelib} for noarch packages.

> Using a vanilla upstream build of tcl8.5 I get:
>    % set auto_path
>    /usr/local/lib/tcl8.5 /usr/local/lib
> 
> Should I always install in the first member of the list?  (which would
> be /usr/lib/tcl8.5 normally)
> 
> And under that, I presumably install in a package-specific subdirectory?
> Such as: /usr/lib/tcl8.5/graphviz/

Correct.  You could add %{version} to the package-specific subdirectory
name so that it's possible to have multiple versions installed at the
same time, but that's not a requirement.

--Wart
[1] http://fedoraproject.org/wiki/PackagingDrafts/Tcl




More information about the fedora-devel-list mailing list