[jp-insert-adsense-main]

[jp-insert-prog-spec-table]

Download

[jp-insert-download-block]

Description

DpkGen is a very small command line utility which allows you to generate Delphi package files (DPK) based on the given template file.

[jp-insert-donation-button]

The program is intended mainly for Delphi programmers managing package/component collections.

If you want to compile the program yourself, here you will find source files and compilation instructions: https://github.com/jackdp/DpkGen

Usage

Usage: DpkGen.exe -t=FILE -o=FILE [-d=STR] [-p=STR] [-s=STR] [-v=STR] [-h] [-V] [--home]

Mandatory arguments to long options are mandatory for short options too.
Options are case-sensitive. Options in square brackets are optional. Equality characters (=) are also optional.

Input / Output options

-t--template-file=FILE
Template DPK file.

-o--output-file=FILE
The output DPK file.

-d--description=STR
Package description. All instances of the text <DESCRIPTION> in the template file will be replaced by the string specified in this option.

-p--lib-prefix=STR
Library prefix. All instances of the text <LIBPREFIX> in the template file will be replaced by the string specified in this option.

-s--lib-suffix=STR
Library suffix. All instances of the text <LIBSUFFIX> in the template file will be replaced by the string specified in this option.

-v--lib-version=STR
Library version. All instances of the text <LIBVERSION> in the template file will be replaced by the string specified in this option.

Information

-h--help
Show help.

-V--version
Show application version.

--home
Opens program homepage in the default browser.

Exit codes

ValueDescription
0OK – no errors
2Syntax error
1Other error

Hint

You can use relative paths when specifying an input template file and an output DPK file. If the output directory does not exist, it will be created automatically.

Template files

The template file should be a regular DPK package, with one exception – the following strings (placeholders) in the DPK file will be replaced by values passed from the command line to the DpkGen program:

DPK string (placeholder)cmd-line option with sample value
<description>-d "SomeLib - Runtime package"
<libprefix>-p dcl
<libsuffix>-s XE4
<libversion>-v 1.1.0
package SomeLib;
{$R *.res}
{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users}
{$ALIGN 8}
{.....}
{$ENDIF IMPLICITBUILDING}
{$DESCRIPTION '<description>'}
{$LIBPREFIX '<libprefix>'}
{$LIBSUFFIX '<libsuffix>'}
{$LIBVERSION '<libversion>'}
{$RUNONLY}
requires
  rtl;
contains
  Unit1 in '..\..\Source\Unit1.pas';
end.

After launching the DpkGen with the parameters as in the above table, we will get:

package SomeLib;
{$R *.res}
{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users}
{$ALIGN 8}
{.....}
{$ENDIF IMPLICITBUILDING}
{$DESCRIPTION 'SomeLib - Runtime package'}
{$LIBPREFIX 'dcl'}
{$LIBSUFFIX 'XE4'}
{$LIBVERSION '1.1.0'}
{$RUNONLY}
requires
  rtl;
contains
  Unit1 in '..\..\Source\Unit1.pas';
end.

When you manage a collection of packages for many versions of Delphi, thanks to DpkGen, you can create one general template and quickly generate all necessary packages. You can use, for example, a batch file from the example below.

As you can see, the program is very simple (just ordinary StringReplace), but if you manage multiple packages from many libraries, DpkGen can save you a lot of time.

The program has a built-in advanced command line option parser, has a flexible structure and can be easily expanded with additional functions: simply register the command line option in the RegisterOptions procedure, read / check the option value in the ProcessOptions and perform the appropriate actions in the CreateDpkFile.

Of course, similar functionality can be achieved using more complex scripts or grep-like applications. Just choose the solution that you prefer.

Example

This example shows how to generate DPK files for the Delphi version from XE2 to 10.3 Rio using the DpkGen program launched from a batch file:

@echo off

set Template=JPLib_TEMPLATE.dpk
set Desc="JPLib Runtime Package"
set BaseOutDir=..\Delphi
set ShortDpkName=JPLib.dpk

for %%x in (XE2,XE3,XE4,XE5,XE6,XE7,XE8) do (
  DpkGen -t %Template% -d %Desc% -o %BaseOutDir%_%%x\%ShortDpkName% -s %%x
)

DpkGen -t %Template% -d %Desc% -o %BaseOutDir%_10.0_Seattle\%ShortDpkName% -s Seattle
DpkGen -t %Template% -d %Desc% -o %BaseOutDir%_10.1_Berlin\%ShortDpkName% -s Berlin
DpkGen -t %Template% -d %Desc% -o %BaseOutDir%_10.2_Tokyo\%ShortDpkName% -s Tokyo
DpkGen -t %Template% -d %Desc% -o %BaseOutDir%_10.3_Rio\%ShortDpkName% -s Rio

How to uninstall?

[jp-insert-uninstall-info-zip]

End User License Agreement

[jp-insert-license-info-total-free]

Jacek

Recent Posts

FUPX

FUPX is an advanced graphical interface for the UPX (Ultimate Packer for eXecutables). It allows…

2 years ago

Rozeta

Rozeta is a program that plots rose diagrams commonly used in geology.

3 years ago

Pazera Free MP4 Video Converter

Pazera Free MP4 Video Converter is a free program that allows you to convert almost…

3 years ago

QuickChangeResolution

Small utility that allows you to quickly change the display resolution

3 years ago

TxtAn – Text Analyzer

A simple text files analyzer. The program counts the lines of text in the given…

3 years ago

Free WebM to MP3 Converter

Free WebM to MP3 Converter is an absolutely free program that converts videos downloaded from…

4 years ago