Skip to content

Latest commit

 

History

History
117 lines (74 loc) · 4.77 KB

Build.md

File metadata and controls

117 lines (74 loc) · 4.77 KB

BDiff / BPatch Build Instructions

These instructions only apply to building the current release of BDiff / BPatch.

Introduction

BDiff / BPatch are written in Object Pascal and are designed to be compiled with Delphi 11 Alexandria. The programs can be built entirely from within the Delphi IDE, provided that some prerequisites are met.

Versions of Delphi other than Delphi 11 Alexandria may work, providing they support fully qualified unit scope names. However, no other compilers have been tested.

Both BDiff and BPatch should only be compiled as 32 bit targets.

Release builds are compiled and packaged using Deploy.bat run from the command line. This script calls msbuild to build the projects.

Prerequisites

Compilation from the IDE

You need DelphiDabbler Version Information Editor to be installed. The VIEDROOT environment variable must be set to the program's install directory.

The environment variable can either be set in your global environment variables or from within the Delphi IDE by using the IDE | Environment Variables page of Delphi's Tools | Options dialogue box.

This program is required to convert the .vi files that specify version information into an intermediate .rc file that is compiled by BRCC32.

Building releases using Deploy.bat

Once again, DelphiDabbler Version Information Editor must be installed.

In addition InfoZip zip.exe is required. This can be downloaded from https://delphidabbler.com/extras/info-zip.

The following environment variables are required:

  • msbuild requires certain environment variables to be set. These can be set by running Bin\rsvars.bat that is located in the Delphi installation directory.

  • BDSBIN must be set to %BDS%\bin. (BDS is set in the previous step.)

  • VIEdRoot must be set to the directory where Version Information Editor was installed.

  • ZipRoot must be set to the directory where zip.exe was installed.

Get the source code

The source code of BDiff / BPatch is maintained in the delphidabbler/bdiff Git repository on GitHub.

You can get the source code of the latest release by using Git to clone https://github.com/delphidabbler/bdiff.git. Switch to the master branch. If you want the latest development code make sure to pull the develop branch and switch to that.

Alternatively you can download a source code archive from GitHub. Ensure you download the latest release and unzip it with the directory structure preserved.

Once you have the source code you should have a folder structure like this:

+--+                { root: .gitignore, docs & Deploy.bat }
   |
   +-- Docs         { documentation files }
   |
   +-- Src          { project group & VERSION files }
   |   |
   |   +-- BDiff    { source code for BDiff }
   |   |
   |   +-- BPatch   { source code for BPatch }
   |   |
   |   +-- Common   { code common to both programs }
   |
   +-- Test         { test scripts }

Modify the source

If you plan to modify the source, you can do it now.

If you are using the Delphi IDE you should load the BDiff.groupproj project group file from the Src folder into the IDE - this contains both the BDiff and BPatch targets.

Compile

Compile the code from the Delphi IDE.

Delphi uses pre-build events to compile the custom .rc files and the .vi (version information) files.

Post-build events are used to tidy up unwanted files generated by the build.

All binary output from the compilation will be written to the _build directory, with the following structure:

+-- _build
|   |
|   +-- bin
|   |   |
|   |   +-- bdiff   {.dcu & .res files for BDiff }
|   |   |
|   |   +-- bpatch  {.dcu & .res files for BPatch }
|   |
|   +-- exe         { BDiff.exe and BPatch.exe }
.
.                   { remainder of source tree }
.

Testing

Some simple tests can be run to check that BDiff and BPatch are working correctly. For details see Test/ReadMe.md.

Create a release

If you want to create a zip file containing the executable programs and associated documentation do the following:

  • open a terminal

  • switch to the root of the source tree

  • set up the necessary environment variables

  • do

    > Deploy x.y.z

    where x.y.z are the major, minor and patch versions for the release.

This will build both BDiff.exe and BPatch.exe and then package them both, with documentation and tests, in a zip file named bdiff-exe-x.y.z.zip.

All files generated during the build process will be created in the _build directory, as described in the Compile section above. The zip file will be located in the _build/release directory.