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 2010.

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 instructions do not apply to the following versions of the program:

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

Dependencies

Libraries

PasHi

No libraries are required to build PasHi

PasHiGUI

No libraries are required to build PasHiGUI

Delphi VCL

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

Build Tools

The following tools are needed to build the programs.

Delphi

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

The code should be able to compile with Delphi XE and later. It is possible that Delphi 2009 may compile the code, but it hasn't been tested. Versions earlier than Delphi 2009 are not suitable due to their lack of Unicode support.

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 DELPHI2010 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.
DELPHI2010 - optional
If you are using Delphi 2010 this environment variable should be set to the Delphi install directory. When DELPHI2010 is specified DELPHIROOT will ignore its own value and use the value of DELPHI2010 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.

Inno Setup

The Unicode version on the Inno setup command line compiler is needed to create CodeSnip's install program. v5.4.0 (u) or later is required as is a compatible version of the ISPP pre-processor. You can get Inno Setup with ISPP at http://www.jrsoftware.org/isinfo.php. Choose the Unicode version. If you already have the ANSI version the Unicode version can be installed alongside it - just use a different install directory and program group name.

The program is expected to be on the path unless its install directory is specified by the INNOSETUP 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 DELPHI2010 environment variables.

Next, set any of the optional VIEDROOT, INNOSETUP 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 including a patch file.

Configure the Source Tree

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

./
  |
  +-- Config                - config files to be installed with PasHi
  |
  +-- Docs                  - documentation
  |
  +-- Src                   - source code for PasHi
  |   |
  |   +-- 3rdParty          - any 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 Bin, Exe and Release directories don't worry - all will become clear. Subversion users may also see the usual .svn "hidden" directories or directory. If you have done some editing you may also have occasional "hidden" __history folders.

Before you can get hacking, you need to prepare the source 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> %DELPHI2010%\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
  |
  +-- Config                - config files to be installed with PasHi
  |
  +-- Docs                  - documentation
  |
  +-- Exe                   - receives executable code
  |
  +-- Release               - receives release files
  |
  +-- Src                   - source code for PasHi
  |   |
  |   +-- 3rdParty          - any 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 a .cfg file from the template in the Src folder. .cfg files are needed for DCC32 to run correctly. This new file 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               - receives object files and .res files for PasHiGUI
  |
  +-- Config                - config files to be installed with PasHi
  |
  +-- Docs                  - documentation
  |
  +-- Exe                   - receives executable code
  |
  +-- Release               - receives release files
  |
  +-- Src                   - source code for PasHi
  |   |
  |   +-- 3rdParty          - any 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 file 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

Creating The Executables

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 ..

There's a shortcut for building PasHiGUI: using the main makefile just do:

Src> Make pashigui

When both the PasHi and PasHiGUI executables have been built you can create the setup program. This is done from the main makefile with:

Src> Make setup

Creating the Release zip file

Once the setup program has been generated you can create a zip file containing the setup program and the required documentation files. You create the zip by doing:

Src> Make release

Note that 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.

One-shot Build and Release

When you are ready to create a release there is a shortcut you can use to configure the source tree, build the executables and the setup program, and finally package the release zip file. Use the following command:

Src> Make all

Once again you can change the release file name using the RELEASEFILENAME environment variable or macro:

Src> Make -DRELEASEFILENAME=MyRelease all

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 the __history folders that Delphi uses to record earlier versions of files.

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

Src> Make deepclean

Once again this command deep operates on 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 file in the Docs directory for an overview of the open source licenses that apply to the source code.