Compiling From Source

PGOPHER is mainly written in Pascal, using the object oriented extensions originally available from the Borland Pascal compiler and now also available in the Free Pascal compiler (not GNU Pascal). The program is distributed as a zip file. Unpack this in a directory on its own, which will create 5 sub-directories.

Microsoft Windows

The current version is compiled with Borland (now Codegear) Delphi 2006, though it should compile with any recent version (6 or later) with minor modifications. The mkpgopher.bat file in the pgopher directory will compile it from the command line. Alternatively install the utils/Putils.dpk and wutils/Pcontrols.dpk packages into the IDE, after which the pgopher/Pgopher.dpr project can be loaded and compiled in the IDE.

Compilation using the open source Free Pascal (http://www.freepascal.org) and Lazarus (http://www.lazarus.freepascal.org) packages is also possible. Installing The current Lazarus snapshot gives a good starting point though the development version may be required for correct operation, particularly for Lazarus. There is a helpful wiki page on the Lazarus site at http://wiki.lazarus.freepascal.org/index.php/Installing_Lazarus on installing both the compiler and Lazarus. Once the Lazarus IDE and the PGOPHER source are installed:
  1. Start the IDE using the startlazarus shortcut
  2. Install the Putils package by:
    1. Go to "Components", "Open Package File" and open the Putils.lpk file in the utils directory.
    2. Click "Install", and accept the rebuild of Lazarus.
  3. Repeat the previous step for the Pcontrols.lpk package in the wutils directory and the lutils.lpk package in the lutils directory.
  4. Use "Project", "Open Project" to load pgopher.lpi in the pgopher directory.
  5. Compile and run with "Run", "Build All"

Linux

The current version is compiled the using the open source Free Pascal (http://www.freepascal.org) and Lazarus (http://www.lazarus.freepascal.org) packages. The development versions may be required for correct operation, particularly for Lazarus. There is a helpful wiki page on the Lazarus site at http://wiki.lazarus.freepascal.org/index.php/Installing_Lazarus on installing both the compiler and Lazarus. The standard development (compiler) tools will be required, together with some additional libraries that are often not installed by default, but can be installed using the standard package system for your distribution. Given this installation, PGOPHER can be compiled with the mkpgopher script in the pgopher directory (the LAZDIR variable may need setting manually). Alternatively install the utils/Putils.lpk, wutils/Pcontrols.lpk and lutils/lutils.lpk packages into the IDE, after which the pgopher/Pgopher.lpr project can be loaded and compiled in the IDE

Example compilation on Fedora Core 5

The same basic procedure should work on any Linux distribution, though with some possible minor changes to the packages names (gtk-devel for gtk+-devel for example). The Free Pascal compiler may be available already compiled, which makes the installation process easier. (On Fedora it is available through available through Fedora Extras).
  1. Install the standard set of development packages (if they are not already installed)
  2. Install the following packages: (Use yum install <packages> as root or use "Add/Remove Software"
  3. If using the development version of Lazarus: (these steps should be done as a normal user)
    1. svn checkout http://svn.freepascal.org/svn/lazarus/trunk/ lazarus (This will download the source for the current development version)
    2. cd lazarus
    3. make
    4. ./startlazarus (This will start the development environment. You need to do this at least once, even if you are using the mkpgopher script.)
  4. To use a released version of Lazarus, download the source tar (or zip) file. Note that you must currently compile Lazarus from source as a normal user if you are going to use the IDE.
    1. tar xzf lazarus-0.9.14-1.tar.gz
    2. cd lazarus
    3. make
    4. ./startlazarus (This will start the development environment. You need to do this at least once, even if you are using the mkpgopher script.)
  5. In a separate directory, unzip the PGOPHER source zip file. If a compiled.patch file is available execute:
    1. patch -p1 <compile.patch (in the same directory that you unzipped the source).
  6. If using the mkpgopher compiling script:
    1. cd pgopher (the directory containing the mkpgopher script)
    2. chmod +x mkpgopher (may not be needed on more recent versions)
    3. ./mkpgopher
  7. To use the Lazarus IDE to compile PGOPHER (easier to fix problems):
    1. Start the IDE using startlazarus
    2. Install the Putils package by:
      1. Go to "Components", "Open Package File" and open the Putils.lpk file in the utils directory produced in step 4.
      2. Click "Install", and accept the rebuild of Lazarus.
    3. Repeat the previous step for the Pcontrols.lpk package in the wutils directory and the lutils.lpk package in the lutils directory.
    4. Use "Project", "Open Project" to load pgopher.lpi in the pgopher directory.
    5. Compile and run with "Run", "Build All"

Mac

Compilation on the Mac is similar to the process on Linux; I suggest using Fink to install the required libraries. See the "Installing Free Pascal under Mac OS X" section in the Lazarus wiki page at http://wiki.lazarus.freepascal.org/index.php/Installing_Lazarus for more details. When the Free Pascal compiler is installed, steps 3 onward of the Fedora Core 5 instructions above should work from an X11 terminal. (Note that you must currently compile Lazarus from source if you are going to use the IDE rather than using a pre-compiled binary.)

LAPACK (and BLAS)

PGOPHER uses slightly modified versions of selected parts of the LAPACK library to diagonalize matrices. Precompiled versions of these (using g77 or gfortran) are included with the source distribution, as these do not normally need to be recompiled. For systems other than Microsoft Windows this can normally be accomplished using the command:
	make -f GNUmakefile
in the utils/blas and utils/lapack directories. The modifications are to allow thread safe operation, and so that the fortran run time library is not required.