[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Debian tcl/tk policy: where to put shared libs?

On Sun, May 11, 2008 at 03:34:40PM -0500, Steve M. Robbins wrote:
> Hi,
> I need some help packaging Tcl language bindings for ITK [1].  I've
> read the policy (in package tcl-doc) but I'm not sure whether
> I'm doing the right thing.
> I am essentially tcl illiterate, so please explain things in full.
> Examples help.
> ITK generates about 9 shared libs and 4 .tcl files, including a
> pkgIndex.tcl.  I'm only building for the default version of tcl right
> now, so I created a package tcl8.4-insighttoolkit3 and installed the
> tcl files into /usr/share/tcltk/tcl8.4/insighttoolkit3.  Does that
> sound right?
> Now: where do the shared libs go?  If this is covered in the policy, I
> have missed it.  I decided to put them into /usr/lib.

/usr/lib/tcltk/<your_pkg> is the right path for shared libs like those you pointed.
Only arch-independent files (e.g. .tcl files) should go into /usr/share/tcltk/<your_pkg>. 
It is generally not appopriate moving them under a per-version tcl subdir

> The pkgIndex.tcl file contains the following
>   proc ConfigureTclPackage {libName version} {
>     set libPrefix "lib"
>     set libPath "[file dirname [file dirname [info script]]]"
>     set libExt [info sharedlibextension]
>     set libFile [file join $libPath "$libPrefix$libName$libExt"]
>     set package [string tolower $libName]
>     package ifneeded $package $version "
>       namespace eval ::itk::loader {
>         set curDir \[pwd\]
>         cd {$libPath}
>         if {\[catch { load \"$libFile\" } errorMessage \]} { puts \$errorMessage }
>         cd \$curDir
>      }
>     "
>   }
> With some puts-style debugging (as mentioned, I'm tcl illiterate), I
> concluded that this snippet is expecting the shared libs in the parent
> directory of that containing pkgIndex.tcl; i.e. libPath is set to
> /usr/share/tcltk/tcl8.4.  Is this common practice or is it an upstream
> quirk?  It doesn't strike me as a good idea to put shared objects into
> /usr/share/...
> My current plan is simply to patch this to read
>     set libPath "/usr/lib"
> But that just as well could be "/usr/lib/tcltk/...." or somesuch.
> Hence my question about where to put shared libs.
> Any additional insights or pointers are most welcome.  This is
> my first attempt at packaging Tcl bindings.

pkgIndex.tcl index is one of the ways to support packages in Tcl.
That file can be either created by pkg_mkIndex or by hand when
the automatic creation is not appropriate. In your case it seems
it has been manually created. Using /usr/lib is not appropriate
for the reasons listed in the draft policy, so it is better 
using a subdir there and try to use 'package require <package_name>'
within tclsh to see if the Tcl interpreter is finally able to
load the extension and modules.

> Thanks,
> -Steve
> [1] http://packages.qa.debian.org/i/insighttoolkit.html
> The Tcl bindings are not yet present; it will be a new package
> appearing with version 3.6.0.
> P.S. I searched in vain for a debian-tcl mailing list, so I'm sending
> this to debian-devel as well as the two names listed in the Tcl/Tk
> policy package and the pkg-tcltk-devel list.  If this is not the right
> place, please advise and do feel free to forward this email to the
> right place.

This is the right place.

Francesco P. Lovergine

Reply to: