PasHi Build Instructions

Introduction

These instructions show how to build the PasHi command line program and, optionally, PasHiGUI - the GUI front end to PasHi.

The programs are written in Object Pascal and are targetted at Delphi 2006.

The Delphi IDE can be used to modify the source and to perform test builds. Final builds should be built using the provided makefiles, but you can get away with using the IDE if you don't change any resources.

Note: These notes do not apply to PasH * v1.0.0 or earlier or to PasHGUI * v0.1.0. For instructions on how to build these versions please refer to files named ReadMe-Src.txt that are to be found in the Docs or root directories of the relevant source code trees.

* PasH and PasHGUI are the old names for PasHi and PasHiGUI.

Dependencies

Libraries

PasHi

Code from the Stream Extension Classes by DelphiDabbler is required to compile PasHi. The code is included in the PasHi source code in the 3rdParty directory, so there is no need to download or install it.

PasHiGUI

No libraries are required to build PasHiGUI

Delphi VCL

You need the Delphi VCL in order to compile the programs.

Build Tools

The following tools are required to build the programs.

Delphi

A copy of Delphi is required to build the object Pascal code. Delphi 2006 is the preferred compiler.

Delphi 2005 to 2007 should be able to compile the source. Delphi 2009 and later may work, but the code hasn't been written with Unicode support in mind, so there may be problems. Delphi 7 may compile PasHi but is unlikely to compile PasHiGUI without some significant changes. Earlier Delphis are unlikely to be suitable, but this hasn't been tested.

You can use the Delphi IDE to edit the code and test compile it. The makefiles require the following command line tools:

DCC32
The Delphi command line compiler.
BRCC32
The Borland resource compiler. Used to compile various resource source (.rc) files.

The following environment variables are associated with these tools:

DELPHIROOT - required unless DELPHI2006 is set.
Should be set to the install directory of the version of Delphi being used. DCC32 and BRCC32 are expected to be in the Bin sub-directory of DELPHIROOT.
DELPHI2006 - optional
If you are using Delphi 2006 this environment variable should be set to the Delphi install directory. When specified DELPHIROOT will ignore its own value and use the value of DELPHI2006 instead.

Borland MAKE

This is the make tool that ships with Delphi. You can use any version that works.

DelphiDabbler Version Information Editor (VIEd)

This tool is used to compile version information (.vi) files into intermediate resource source (.rc) files. Version 2.11.2 or later is required. Version Information Editor can be obtained from http://www.delphidabbler.com/software/vied.

The program is expected to be on the path unless its install directory is specified by the VIEDROOT environment variable.

Zip

This program is used to create release files. You can get a Windows command line version at http://stahlforce.com/dev/index.php?tool=zipunzip.

The program is expected to be on the path unless its install directory is specified by the ZIPROOT environment variable.

Preparation

Configure the environment.

The first step is to configure the required DELPHIROOT or DELPHI2006 environment variables.

Next, set any of the optional VIEDROOT and ZIPROOT environment variables that are needed to specify the path to any tools that are not on the system path.

You can configure environment variables either by modifying your system environment variables or by creating a batch file that you run before performing the build.

Get the Source Code

If you don't already have it, download or checkout the PasHi source code, which should include the source for PasHiGUI. There are several options:

  1. If you are a Subversion user you can:
    These commands get code from the current development tree. To get the code of a suitable stable release replace trunk with tags/XXXX where XXX specifies the version.
  2. Download a suitable source zip file from Google Code.
  3. Grab the source code of the latest release from DelphiDabbler.com.

If you modify the code and want to submit it for inclusion in the repository please raise a new issue in the issue tracker, select a type (defect, enhancement etc.) and attach a zip file or tarball containing your enhancment, preferably as a patch file.

Configure the Source Tree

After checking out or downloading and extracting the source code you should have the following directory structure:

./
  |
  +-- Docs                  - documentation
  |   |
  |   +-- GUI               - documentation that applies to PasHiGUI only
  |
  +-- Src                   - source code for PasHi
  |   |
  |   +-- 3rdParty          - third party source code required by PasHi
  |   |
  |   +-- Assets            - assets required to build PasHi's resources
  |   |
  |   +-- GUI               - source code of the GUI application, PasHiGUI
  |       |
  |       +-- Resources     - assets required to build PasHiGUI's resources
  |     
  +-- Test                  - contains test file

If, by chance, you also have a Bin, Exe and Release directory don't worry - all will become clear. Subversion users will also see the usual .svn hidden directories. If you have done some editing you may also see occasional hidden __history folders, depending on which version of Delphi you are using.

Before you can get hacking, you need to prepare the code tree. Open a command console and navigate into the Src sub-folder. Run any script you have created to set the required environment variables then do:

Src> Make config

You may need to replace Make with the full path to Make if it isn't on the path, or if the Make that runs isn't the Borland / CodeGear version. If this is the case try:

Src> %DELPHIROOT%\Bin\Make config

or

Src> %DELPHI2006%\Bin\Make config

depending on which environment variable you have set.

Once Make config has completed your folder structure should have acquired the following new folders:

./
  +-- Bin                   - receives object files and .res files for PasHi
  |
  +-- Docs                  - documentation
  |   |
  |   +-- GUI               - documentation that applies to PasHiGUI only
  |
  +-- Exe                   - receives executable code
  |
  +-- Release               - receives release files
  |
  +-- Src                   - source code for PasHi
  |   |
  |   +-- 3rdParty          - third party source code required by PasHi
  |   |
  |   +-- Assets            - assets required to build PasHi's resources
  |   |
  |   +-- GUI               - source code of the GUI application, PasHiGUI
  |       |
  |       +-- Resources     - assets required to build PasHiGUI's resources
  |     
  +-- Test                  - contains test file

Make will have created .cfg and .bdsproj files from templates in the Src folder. .cfg files are needed for DCC32 to run correctly and .bdsproj files enable the use of the Delphi IDE. These files will be ignored by Subversion.

If you also want to compile PasHiGUI you must now do:

Src> cd GUI
Src\GUI> Make config
Src\GUI> cd ..

This runs a separate makefile in the GUI directory and further configures the source tree to enable PasHiGUI to be compiled. The source tree should have been changed slightly to look like this:

./
  +-- Bin                   - receives object files and .res files for PasHi
  |   |
  |   +-- GUI
  |
  +-- Docs                  - documentation
  |   |
  |   +-- GUI               - documentation that applies to PasHiGUI only
  |
  +-- Exe                   - receives executable code
  |
  +-- Release               - receives release files
  |
  +-- Src                   - source code for PasHi
  |   |
  |   +-- 3rdParty          - third party source code required by PasHi
  |   |
  |   +-- Assets            - assets required to build PasHi's resources
  |   |
  |   +-- GUI               - source code of the GUI application, PasHiGUI
  |       |
  |       +-- Resources     - assets required to build PasHiGUI's resources
  |     
  +-- Test                  - contains test file

Make will also have created the required .cfg and .bdsproj files in the Src\GUI directory.

If you are intending to use the Delphi IDE to compile code, you should also do:

Src> Make resources

and, for PasHiGUI:

Src> cd GUI
Src\GUI> Make resources
Src\GUI> cd ..

This compiles the resource files that the IDE needs to link into compiled executables.

You are now ready to build the source.

Building The Programs

Once the source tree has been configured, and before you can build the Pascal code, you must create the program's resources. For PasHi do:

Src> Make resources

and for PasHiGUI do:

Src> cd GUI
Src\GUI> Make resources
Src\GUI> cd ..

And now you can build the Pascal code:

Src> Make pascal

or

Src> cd GUI
Src\GUI> Make pascal
Src\GUI> cd ..

Should you want to build an executable from a clean source tree there is a shortcut. Simply running:

> Make

on its own is the same as doing:

> Make config
> Make resources
> Make pascal

So, to build PasHi and PasHiGUI and place PasHi.exe and PasHiGUI.exe in the Exe folder do this:

Src> Make
Src> cd GUI
Src\GUI> Make
Src\GUI> cd ..

Creating the Release zip file

You can create a zip file containing PasHi, PasHiGUI and required documentation once the .exe files have been generated (see above). You create the zip by doing:

Src> Make release

Note, this only works with the makefile in the Src directory: the release target is not supported by Src\GUI\Makefile.

By default the release file is called dd-pashi.zip. You can change this name by defining the RELEASEFILENAME enviroment variable or macro. For example, you can name the release MyRelease.zip by doing:

Src> Make -DRELEASEFILENAME=MyRelease release

Release zip files are always placed in the Release directory. The directory is created if it doesn't exist.

Clean Up

Various temporary files and directories are created by the IDE. These can be deleted by running:

Src> Make clean

This command is only available in the makefile in the Src directory and acts on the whole source tree, including the GUI sub-tree.

Be warned that this command removes any __history folders that some versions of Delphi use to maintain earlier versions of files.

Make clean leaves behind the files and directories created by Make config. To delete these files and folders in addition to performing a normal clean run:

Src> Make deepclean

Once again this command deep cleans both the Src and Src\GUI directories.

Copyright

If you are planning to re-use or modify any of the code, please see the SourceCodeLicenses.txt files in the Docs and Docs\GUI directories for an overview of the open source licenses that apply to the source code.