This section describes how to build and install pgtcl-ng on Windows systems using MinGW. Building on Windows systems is less automated than on Unix-like systems, and you are advised to fetch a binary release instead of building it yourself. If you get a binary release, follow the instructions in the release to install it. If you want to compile your own pgtcl-ng using MinGW, read the following sections. A Makefile for MinGW is supplied in the source release. You will edit and use the Makefile to build pgtcl-ng for Windows, as described below.
Here are the prerequisites for building pgtcl-ng on Windows using MinGW. Note that specific versions of each product are mentioned. Newer versions will probably work, and older versions are less likely to work. The versions listed here have been tested.
To build pgtcl-ng on Windows with MinGW tools, you need:
ActiveState ActiveTcl Tcl/Tk version 8.5.10, installed with libraries and header files. Note: You may be able to use a MinGW-built Tcl/Tk instead, but this has not been tested.
MinGW tools, installed. The exact minimum package requirements are not clear, but you just need to be able to compile programs with GCC. These packages were used: binutils, gcc-4.5.x, gcc-core, libgcc, libgmp, libmpc, libmpfr, libpthread, make, mingwrt, and w32api.
EnterpriseDB PostgreSQL for Windows 9.1.x, 9.0.x, or 8.4.x binary release. You may download the Zip file instead of using the installer if you aren't actually going to run the PostgreSQL server on Windows. (Go to http://www.postgresql.org and follow the links to Downloads, then Windows to get to the EnterpriseDB Zip package.) All you need from the download is the include files and the library files (include and bin directories). But if you are not using the EnterpriseDB Installer, you need to make sure the target PC(s) have the Microsoft Visual C++ 2008 Redistributables (including msvcr90.dll), which are needed by the PostgreSQL libraries. You do not need PostgreSQL sources. Note: You may be able to use a MinGW-built PostgreSQL instead, but this has not been tested.
To build with MinGW, simply edit the Makefile mingw.mak
with any text editor and set the pathnames as shown below.
Note that you can use either forward (/) or backward (\) slashes when
specifying pathnames in this Makefile.
Change directory to the unpacked pgtclng source distribution. For example:
C:\>
cd c:\src\pgtcl
Edit the file mingw.mak
as follows:
Define PGSQL
to point to the top-level directory
of your PostgreSQL installation.
Define TCL
to point to the top of your Tcl installation
directory.
Check the TCLLIB definition in the Makefile and the associated comments. If you are not building with Tcl stubs, make the changes indicated in the file.
Now build libpgtcl:
C:\>
mingw32-make -f mingw.mak
This will create the file libpgtcl.dll
.
To use pgtcl on Windows, you will need the
libpgtcl.dll
and also the EnterpriseDB PostgreSQL
loadable libraries. The main dependency is the front-end library
libpq.dll
, but that has other dependent libraries
which are distributed with EnterpriseDB's PostgreSQL. In order to run
pgtcl applications, you should have the entire
EnterpriseDB PostgreSQL distribution bin
directory,
and it must be in your PATH before loading libpgtcl.dll.
Refer to Chapter 3, Loading pgtcl into an Application for information about using these
from your application.
The MinGW Makefile does not currently contain installation commands.