HTMLRes Build Instructions

Introduction

HTMLRes is written in Object Pascal and is targeted at Delphi 7. The Delphi IDE can be used to modify the source and to perform test builds. Final builds should be built using the provided makefile, but you can get away with using the IDE if you don't change any resources.

These notes apply only to source code of releases after HTMLRes v1.2.0. For any earlier version please see the file named ReadMe-Src.txt that will be in either the root directory or the Docs sub-directory.

Dependencies

The following libraries and components are required in to compile HTMLRes:

Version Information Component by DelphiDabbler
Used to access the program's version information resources. The code is available from http://www.delphidabbler.com/software/verinfo. v3.1.1 or later is required.
Resource File Unit by DelphiDabbler
Used to create and edit resources and resource files. http://www.delphidabbler.com/software/resfile.

You should download these DelphiDabbler code libraries and install them all together into a package or at least ensure that the compiled .dcu files are all in the same folder. It's easiest to use the Delphi IDE to do this.

Set the DELPHIDABLIB environment variable to the folder where you placed the compiled library code.

Delphi VCL

You need the Delphi VCL in order to compile this code.

Build Tools

The following tools are required to build HTMLRes.

Delphi

A copy of Delphi is required to build the object Pascal code. Delphi 7 is preferred. Delphi 2005 to 2008 should be able to compile the source. Delphi 2009 and later may work, but the code hasn't been written with Delphi 2009's Unicode support in mind, so there may be problems. Delphis earlier than version 7 are likely to fail to compile HTML, but this hasn't been tested.

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

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

The following environment variables are associated with these tools:

DELPHIROOT - required unless DELPH7 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.
DELPHI7 - optional
If you are using Delphi 7 this environment variable should be set to the Delphi install directory. When specified DELPHIROOT will ignore its own value and use the value of DELPHI7 instead.
DELPHIDABLIB - required unless DELPHIDABLIB7 is set.
Should be set to the directory where the compiler can find the required DelphiDabbler library compiled units. The code in this directory must have been compiled with the same version of Delphi used to compile HTMLRes.
DELPHIDABLIB7 - optional
If you are using Delphi 7 this enviroment variable may be set to the install directory of the library code described above. When set the value of this variable is used by DELPHIDABLIB regardless of its own value.

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 Inno setup command line compiler is used to create HTMLRes' install program. The compiler is supplied with Inno Setup v5.2.3 or later. The ISPP pre-processor v5.2.3 or later is also required. You can get Inno Setup at http://www.innosetup.com/.

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 HTMLRes' release file. 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 environment variables.

Set any of the optional 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 the HTMLRes source code. How to go about that is explained at http://www.delphidabbler.com/software/htmlres/download. If necessary, extract the source code into a folder, preserving the directory structure.

Configure the Source Tree

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

./
  |
  +-- Demo                  - demonstration source code & support files
  |
  +-- Docs                  - documentation
  |
  +-- Src                   - source code

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:

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

> %DELPHIROOT%\Bin\Make config

or

> %DELPHI7%\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 
  |
  ...
  |
  +-- Exe                   - receives executable code
  |
  +-- Release               - receives release files
  |
  ...

If the Bin, Exe and Release folders already existed they will have been emptied. In addition, Make will have created .cfg and .dof files from templates in the Src folder. .cfg files are needed for DCC32 to run correctly and .dof files enable the use of the Delphi IDE. These files will be ignored by Subversion.

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

> Make resources

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

You are now ready to build the source.

Building HTMLRes

You have several options:

Each of these options is described below. All except the last assume that Make config has been run.

Build the HTMLRes Executable

This is the most common build and is achieved by using the following commands:

> Make resources
> Make pascal

HTMLRes.exe will be generated and placed in the Exe folder.

Build the Setup Program

The setup program requires that HTMLRes.exe is present in the Exe directory.

Once you have built all the required files you build the setup file by doing:

> Make setup

The setup program is named HTMLRes-Setup-x.x.x.exe, where x.x.x is the version number extracted from HTMLRes' version information. It is placed in the Exe directory.

Build the Release Zip File

Once the setup file has been created you can create a zip file containing the setup file along with ReadMe.txt from the Docs directory. If either file is missing the release fails. Build the release by doing:

> Make release

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

> Make -DRELEASEFILENAME=MyRelease release

Build and Release Everything

You can do a clean build of everything, and generate the release zip file simply by doing:

> Make

without specifying a target. This is the equivalent of:

> Make config
> Make resources
> Make pascal
> Make setup
> Make release

Clean Up

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

> Make clean

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

Copyright

If you are planning to re-use or modify any of the code, please see the file SourceCodeLicenses.txt in the Docs directory for an overview of the open source licenses that apply to the HTMLRes source code.