pgScript Install Guide

Mickael Deloison


Table of Contents

Requirements
Basic install
Library install
From CVS
How to install MinGW and the required libraries
MinGW
PostgreSQL
wxWidgets

Requirements

Linux or MinGW environment (should work on MacOS)

g++.exe (GCC) >= 3.4.x

wxWidgets >= 2.8.7

PostgreSQL (libpq) >= 8.0

Basic install

To compile pgScript with wxWidgets Unicode/Release/Static build:

./configure
make
make install

This will install pgScript executable. See USAGE for details on using pgScript.

Library install

If you want to install libpgs (pgScript static library) as well:

./configure--enable-instlib
make
make install

This will install both pgScript executable and pgScript library (libpgs static library and header files).

See src/pgsMain.cpp source code for details on using libpgs.

Basically you need to:

  • Include the header file pgscript/pgsApplication.h

    #include "pgscript/pgsApplication.h"
  • Create a pgsApplication and provide connection information

    pgsApplication app(host, db, user, pwd, port);
  • Create a new wxTextOutputStream

    wxFFileOutputStream output(stdout);
    wxTextOutputStream out(output, wxEOL_UNIX);
  • Parse a string or a file

    app.ParseString(wxString, wxTextOutputStream &);
    app.ParseFile(wxString, wxTextOutputStream &, wxMBConv *);
    app.ParseString(string, out);
    app.ParseFile(filepath, out, conv);

    filepath is the path to the file containing the program, string contains directly pgScript instructions.

    conv is optional for ParseFile and tells what encoding should be used for reading the file. Default is the system encoding.

  • Wait for the parser to be done

    app.Wait();

    To abort the script parsing use app.Terminate() instead.

From CVS

cvs -d :pserver:anonymous@cvs.pgfoundry.org:/cvsroot/pgscript pgScript
sh doc/generate.sh # Generates documentation
sh autofind.sh # Runs aclocal, autoheader, automake & autoconf
./configure
make
make install

How to install MinGW and the required libraries

MinGW

There is a very good tutorial for MinGW: http://www.mingw.org/MinGWiki/index.php/RealDumbQuickstart

Let's say MSYS has been installed in D:/msys/1.0. MSYS home folder is the default folder when MSYS is run: D:/msys/1.0/home/{Username}.

PostgreSQL

Apply this fix: http://archives.postgresql.org/pgsql-ports/2007-07/msg00002.php

Download postgresql-8.x.x.tar.gz from http://www.postgresql.org

Unzip it in the MinGW home folder:

cd postgresql-8.x.x
./configure --prefix /usr --without-readline --without-zlib
make
make install

You will have PostgreSQL installed.

wxWidgets

Download wxMSW-2.8.7.zip from http://www.wxwidgets.org

Unzip it in the MinGW home folder:

cd wxWidgets-2.8.7
./configure --disable-shared --enable-threads=yes --without-subdirs \
    --enable-unicode --enable-xrc=no --enable-debug=no
make
make install

You will have wxWidgets Unicode/Release/Static libraries installed.