Version 17 of pkg_mkIndex

Updated 2011-07-10 17:01:07 by RLE

http://www.purl.org/tcl/home/man/tcl8.4/TclCmd/pkgMkIndex.htm

This is a proc in Tcl that is used to create the package index files, allowing packages to be loaded automatically when package require commands are executed.


LV So,

  • How does one use pkg_mkIndex? Reading the man page does not seem sufficient to answer this question.
  • What are the steps one should follow?
 $ cd /path/to/where/the/tcl/and/dll/files/are/located
 $ tclsh8.4
 % pkg_mkIndex . [glob *.tcl *.so]
  • Are there any tricks, etc.?

That's wrong. [pkg_mkIndex] does its own [glob]. The trailing arguments it expects are patterns, each pattern as a separate argument. Passing it a single argument that is a list of filesystem paths is just wrong. You probably meant:

 % pkg_mkIndex . *.tcl *.so

When I follow the above steps, I get this:

 $ cat pkgIndex.tcl
 # Tcl package index file, version 1.1
 # This file is generated by the "pkg_mkIndex" command
 # and sourced either when an application starts up or
 # by a "package unknown" script.  It invokes the
 # "package ifneeded" command to set up package-related
 # information so that packages will be loaded automatically
 # in response to "package require" commands.  When this
 # script is sourced, the variable $dir must contain the
 # full path name of this file's directory.
 $

This doesn't seem all that useful.


Answer 1: It isn't useful. Stop trying to use it.

Answer 2: The -verbose option can help point out what properties of your files are giving the [pkg_mkIndex] command trouble.


See also pkg_mkIndex pitfalls, pkgMkIndex, A simple package example, package management, How to build good packages, Better Static Package Support for Tcl9