These instructions only apply to building the current release of BDiff / BPatch.
BDiff / BPatch are written in Object Pascal and are designed to be compiled with Delphi 13 or later. The programs can be built entirely from within the Delphi IDE, provided that some prerequisites are met.
⛔ Versions of Delphi prior to Delphi 13 will not compile the code.
Both BDiff and BPatch can be compiled as either 32 or 64 bit Windows programs.
Releases are compiled and packaged using Deploy.bat run from the command line. This script calls msbuild to build the projects.
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.
Version Information Editor is required to convert the .vi files that specify version information into an intermediate .rc file that is compiled by BRCC32.
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:
-
msbuildrequires certain environment variables to be set. These can be set by runningBin\rsvars.batthat is located in the Delphi installation directory. -
BDSBINmust be set to%BDS%\bin. (BDSwill have been set whenrsvars.batwas run.) -
VIEdRootmust be set to the directory where Version Information Editor was installed. -
ZipRootmust be set to the directory wherezip.exewas installed.
The source code of BDiff / BPatch is maintained in the ddabapps/bdiff Git repository on GitHub.
You can get the source code of the latest release by using Git to clone https://github.com/ddabapps/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 & sample files }
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 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. Once BDiff and BPatch have both been built for both Windows 32-bit and Windows 64-bit target platforms, you will see the following sub-directories under _build:
+-- _build
| |
| +-- Win32
| | |
| | +-- bin
| | | |
| | | +-- bdiff {.dcu & .res files for BDiff }
| | | |
| | | +-- bpatch {.dcu & .res files for BPatch }
| | |
| | +-- exe { BDiff.exe and BPatch.exe }
| |
| +-- Win64
| | |
| | +-- bin
| | | |
| | | +-- bdiff {.dcu & .res files for BDiff }
| | | |
| | | +-- bpatch {.dcu & .res files for BPatch }
| | |
| | +-- exe { BDiff.exe and BPatch.exe }
.
. { remainder of source tree }
.
In cases where only one program has been built, or only one target platform has been selected, there will be fewer sub-directories.
Some simple tests can be run to check that BDiff and BPatch are working correctly. For details see Test/ReadMe.md.
If you want to create zip files containing the executable programs and associated documentation do the following:
-
ensure the correct version number, build number, and optional version number suffix are set in
Src/VERSION -
open a terminal
-
switch to the root of the source tree
-
set up the necessary environment variables: details are included as comments in
Deploy.bat. -
do
> Deploy
This will build 32 and 64 bit versions of both BDiff.exe and BPatch.exe and then package them, with documentation and tests, in zip files named bdiff-exe32-x.y.z.zip and bdiff-exe64-x.y.z.zip. Note that x.y.z represents the release version number (and optional suffix), as specified as values of the version and suffix keys in Src/VERSION.
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.