Abstract
This chapter describes how to build and install
pgtcl, making it available for use
in your applications.
You should check the release for README
or
INSTALL
files,
which may contain more up-to-date information.
This chapter only applies to the pgtcl-ng implementation of pgtcl. For other implementations, check the included documentation.
Abstract
This section describes how to build and install pgtcl on Unix-like systems, including Linux.
To build pgtcl on Unix-like Systems, you need:
Tcl/Tk version 8.3.1 or higher, with 8.4.4 or higher strongly recommended.
PostgreSQL version 7.4 or higher, with 8.1.4 or higher recommended.
The usual building tools such as C compiler, make, and a shell.
Pgtcl is Tcl Extension Architecture (TEA)
compliant, shipping with a standard configure
script. You do not need to have a PostgreSQL
source distribution available to build pgtcl,
but you need a PostgreSQL installation
with libraries and header files.
After unpacking the pgtcl distribution, change directory into the top level of the distribution.
To configure pgtcl, you must specify the path
to the PostgreSQL include files and library files.
If you have the pg_config program, supplied with
PostgreSQL, on your PATH
,
you can use it to specify the directories as follows:
$
./configure --prefix=/usr/local \ --libdir=/usr/lib/tcl8.4 \ --with-postgres-include=$(pg_config --includedir) \ --with-postgres-lib=$(pg_config --libdir)
If you don't have pg_config available, you can specify the directories on the command line, for example:
$
./configure --prefix=/usr/local \ --libdir=/usr/lib/tcl8.4 \ --with-postgres-include=/opt/postgres/include \ --with-postgres-lib=/opt/postgres/lib
assuming you have installed PostgreSQL
in the directory /opt/postgres
.
In the above configure commands, we have specified both
--prefix
and --libdir
.
If you are going to manually install the product (which is easy, since
there is just one file produced), you can use anything you want or omit these.
If you plan to use the install
target in the
Makefile, you need to point --libdir
to a
location where Tcl will look for package directories. On a typical
system, this may be /usr/lib/tcl8.4/
as shown above.
The --prefix
is only used for the header file
installation (which is normally not needed anyway).
To build pgtcl, just type:
$
make
If all goes well, you will end up with a sharable library file
named something like libpgtcl#.#.#.so
.
You can install pgtcl with:
$
make install
to install everything in the paths set during configure, as indicated above. If the paths are chosen right, the result will be enabled for package loading, as described in Section 3.1, “Using the Tcl Package Command”.
You may choose instead to manually install pgtcl.
Refer to Chapter 3, Loading pgtcl into an Application for methods of using
pgtcl with your application.
If you will be loading libpgtcl
directly
in your application, you need only copy that file into a convenient
location for loading. Note that libpgtcl
will
need to find the PostgreSQL libpq
loadable library.
If you want to be able to load pgtcl into applications using
package require Pgtcl
you need to install libpgtcl
into a subdirectory
of Tcl's tcl_pkgPath
or auto_path
,
and include the file pkgIndex.tcl
which tells Tcl
how to load the package. For example:
$
mkdir /usr/lib/tcl8.4/pgtcl1.5
$
cp libpgtcl1.5.3.so pkgIndex.tcl /usr/lib/tcl8.4/pgtcl1.5
This is what the make install
target does.
Note: The name of the directory under the Tcl library directory is not
important, as the extension will be found regardless of the directory name.
You may choose to use the three-part version number in the name, or just
the major and minor version numbers.