Skip to content

TPackage

Central class for package management and building

Declaration

Source position: fpmkunit.pp line 932

type

  TPackage = class(TNamedItem)
  public
    constructor Create;
    destructor destroy;
    function HaveOptions : Boolean;
    function GetUnitsOutputDir(ACPU: TCpu; AOS: TOS; 
                          const aSubTarget: string) : string;
    function GetUnitsOutputDir(const aTarget: TCompileTarget) : string;
    function GetUnitConfigOutputFilename(ACPU: TCpu; AOS: TOS; 
                                    const aSubTarget: string) : string;
    function GetUnitConfigOutputFilename(const aTarget: TCompileTarget)
                                     : string;
    function GetBinOutputDir(ACPU: TCpu; AOS: TOS; const aSubTarget: string)
                         : string;
    function GetBinOutputDir(const aTarget: TCompileTarget) : string;
    procedure GetCleanFiles(List: TStrings; ACPU: TCpu; AOS: TOS; 
                       const aSubTarget: string);
    procedure GetCleanFiles(List: TStrings; const aTarget: TCompileTarget);
    procedure GetArchiveFiles(List: TStrings; ACPU: TCpu; AOS: TOS);
    procedure GetArchiveFiles(List: TStrings; aTarget: TCompileTarget);
    procedure InheritPackageVariantsFromDependency;
    function GetPackageVariantsByName : TPackageVariants;
    procedure SetUnitsOutputDir;
    function GetPackageUnitInstallDir : string;
    procedure SetPackageUnitInstallDir;
    function GetExamplesOutputDir : string;
    procedure GetInstallFiles;
    procedure GetInstallSourceFiles;
    procedure GetArchiveSourceFiles;
    procedure GetManifest;
    procedure ListPackage;
    procedure AddPackageVariant;
    procedure ApplyPackageVariantToCompilerOptions;
    procedure SetDefaultPackageVariant;
    procedure LoadUnitConfigFromFile;
    procedure SaveUnitConfigToFile;
    procedure EnterResolveDirsCS;
    procedure LeaveResolveDirsCS;
    function AddTargetsFromDir : LongInt;
    procedure ApplyNameSpaces(aEngine: TBuildEngine; aFileName: string; 
                         aTarget: TCompileTarget);
    procedure ApplyNameSpaces(aEngine: TBuildEngine; 
                         aTarget: TCompileTarget);
    function SubTargetAllowed : Boolean;
    property Version: string; {rw}
    property FileName: string; {rw}
    property ShortName: string; {rw}
    property HomepageURL: string; {rw}
    property DownloadURL: string; {rw}
    property Email: string; {rw}
    property Author: string; {rw}
    property License: string; {rw}
    property Directory: string; {rw}
    property Description: string; {rw}
    property DescriptionFile: string; {rw}
    property InstalledChecksum: Cardinal; {rw}
    property IsFPMakeAddIn: Boolean; {rw}
    property SupportBuildModes: TBuildModes; {rw}
    property BuildMode: TBuildMode; {r}
    property Flags: TStrings; {r}
    property PackageVersion: TFPVersion; {r}
    property TransmitOptions: TStrings; {rw}
    property OSes: TOSes; {rw}
    property CPUs: TCPUS; {rw}
    property SubTargets: TRTLStringDynArray; {rw}
    property NeedLibC: Boolean; {rw}
    property Options: TStrings; {rw}
    property UnitPath: TConditionalStrings; {r}
    property ObjectPath: TConditionalStrings; {r}
    property IncludePath: TConditionalStrings; {r}
    property SourcePath: TConditionalStrings; {r}
    property ExamplePath: TConditionalStrings; {r}
    property TestPath: TConditionalStrings; {r}
    property FPDocFormat: TFPDocFormats; {rw}
    property InstallFiles: TConditionalDestStrings; {r}
    property CleanFiles: TConditionalStrings; {r}
    property Dependencies: TDependencies; {r}
    property Commands: TCommands; {r}
    property State: TTargetState; {rw}
    property Targets: TTargets; {r}
    property Sources: TSources; {r}
    property UnitDir: string; {rw}
    property UnitConfigFileName: string; {rw}
    property NamespaceMap: string; {rw}
    property BeforeCompile: TNotifyEvent; {rw}
    property BeforeCompileProc: TNotifyProcEvent; {rw}
    property AfterCompile: TNotifyEvent; {rw}
    property AfterCompileProc: TNotifyProcEvent; {rw}
    property BeforeInstall: TNotifyEvent; {rw}
    property BeforeInstallProc: TNotifyProcEvent; {rw}
    property AfterInstall: TNotifyEvent; {rw}
    property AfterInstallProc: TNotifyProcEvent; {rw}
    property BeforeClean: TNotifyEvent; {rw}
    property BeforeCleanProc: TNotifyProcEvent; {rw}
    property AfterClean: TNotifyEvent; {rw}
    property AfterCleanProc: TNotifyProcEvent; {rw}
    property BeforeArchive: TNotifyEvent; {rw}
    property BeforeArchiveProc: TNotifyProcEvent; {rw}
    property AfterArchive: TNotifyEvent; {rw}
    property AfterArchiveProc: TNotifyProcEvent; {rw}
    property BeforeManifest: TNotifyEvent; {rw}
    property BeforeManifestProc: TNotifyProcEvent; {rw}
    property AfterManifest: TNotifyEvent; {rw}
    property AfterManifestProc: TNotifyProcEvent; {rw}
    property BeforePkgList: TNotifyEvent; {rw}
    property BeforePkgListProc: TNotifyProcEvent; {rw}
    property AfterPkgList: TNotifyEvent; {rw}
    property AfterPkgListProc: TNotifyProcEvent; {rw}
  end;

Description

TPackage is the central class in the fpmake build system that represents a complete package. A package contains build targets, dependencies, installation files, and all configuration needed for compilation and deployment.

Each package can contain multiple targets such as units, programs, and libraries. The package manages compilation options, search paths, dependencies on other packages, and installation procedures. It supports cross-platform compilation with CPU and OS-specific settings.

It handles the following aspects:

  • Management of TTarget build targets
  • Dependency tracking through TDependency objects
  • Cross-platform compilation support
  • Package variants for different build configurations
  • Custom installation and archiving procedures

Properties

Member Visibility Description
AfterArchive public Event handler executed after package archiving
AfterArchiveProc public Procedural event handler after archiving
AfterClean public Event handler executed after package cleanup
AfterCleanProc public Procedural event handler after cleanup
AfterCompile public Event handler executed after package compilation
AfterCompileProc public Procedural event handler after compilation
AfterInstall public Event handler executed after package installation
AfterInstallProc public Procedural event handler after installation
AfterManifest public Event handler executed after manifest creation
AfterManifestProc public Procedural event handler after manifest creation
AfterPkgList public Event handler executed after package listing
AfterPkgListProc public Procedural event handler after package listing
Author public Author or maintainer of the package
BeforeArchive public Event handler executed before package archiving
BeforeArchiveProc public Procedural event handler before archiving
BeforeClean public Event handler executed before package cleanup
BeforeCleanProc public Procedural event handler before cleanup
BeforeCompile public Event handler executed before package compilation
BeforeCompileProc public Procedural event handler before compilation
BeforeInstall public Event handler executed before package installation
BeforeInstallProc public Procedural event handler before installation
BeforeManifest public Event handler executed before manifest creation
BeforeManifestProc public Procedural event handler before manifest creation
BeforePkgList public Event handler executed before package listing
BeforePkgListProc public Procedural event handler before package listing
BuildMode read only public Default build mode configuration for the package
CleanFiles read only public Collection of files to be cleaned
Commands read only public Collection of custom build commands
CPUs public Supported CPU architectures for the package
Dependencies read only public Collection of package dependencies
Description public Descriptive text about the package
DescriptionFile public File containing package description text
Directory public Base directory path of the package
DownloadURL public URL for downloading the package
Email public Contact email address for the package
ExamplePath read only public Search paths for example files
FileName public Filename of the package definition file
Flags read only public Package flags and behavior settings
FPDocFormat public Output format for FPDoc documentation
HomepageURL public URL of the package homepage
IncludePath read only public Search paths for include files
InstalledChecksum public Checksum of installed package files
InstallFiles read only public Collection of files to be installed
IsFPMakeAddIn public Whether this package is an FPMake add-in
License public License terms for the package
NamespaceMap public Mapping of unit names to namespaces
NeedLibC public Whether package requires C library linkage
ObjectPath read only public Search paths for object files
Options public Compiler options for the package
OSes public Supported operating systems for the package
PackageVersion read only public Version information for the package
ShortName public Short name identifier for the package
SourcePath read only public Search paths for source files
Sources read only public Collection of source files
State public Current build state of the package
SubTargets public Subtarget configurations for the package
SupportBuildModes public Whether package supports different build modes
Targets read only public Collection of build targets
TestPath read only public Search paths for test files
TransmitOptions public Options transmitted to dependent packages
UnitConfigFileName public Filename for unit configuration file
UnitDir public Directory for compiled unit files
UnitPath read only public Search paths for unit files
Version public Version string of the package
See all Properties

Methods

Member Visibility Description
AddPackageVariant public Adds a package variant to the package
AddTargetsFromDir public
ApplyNameSpaces public Applies namespace settings to a filename
ApplyPackageVariantToCompilerOptions public Applies package variant settings to compiler options
Create public Creates a new package instance
destroy public Destroys the package instance and frees resources
EnterResolveDirsCS public Enters critical section for directory resolution
GetArchiveFiles public Gets list of files to include in package archive
GetArchiveSourceFiles public Gets list of source files for package archive
GetBinOutputDir public Returns the output directory for binary files
GetCleanFiles public Gets list of files to be cleaned for the package
GetExamplesOutputDir public
GetInstallFiles public Gets list of files to be installed for the package
GetInstallSourceFiles public Gets list of source files to be installed
GetManifest public Gets package manifest information
GetPackageUnitInstallDir public Gets installation directory for package units
GetPackageVariantsByName public Gets package variants collection by name
GetUnitConfigOutputFilename public Gets output filename for unit configuration file
GetUnitsOutputDir public Returns the output directory for compiled units
HaveOptions public Checks if package has global compilation options
InheritPackageVariantsFromDependency public Inherits package variants from a dependency package
LeaveResolveDirsCS public Leaves critical section for directory resolution
ListPackage public Lists package information to a string list
LoadUnitConfigFromFile public Loads unit configuration from a file
SaveUnitConfigToFile public Saves unit configuration to a file
SetDefaultPackageVariant public Sets the default package variant for the package
SetPackageUnitInstallDir public Sets installation directory for package units
SetUnitsOutputDir public Sets the output directory for compiled units
SubTargetAllowed public Checks if a subtarget is allowed for the package
See all Methods

See also

Name Description
TTarget Build target representation in the fpmake system
TTargets Collection class for managing build targets
TDependency Represents a build dependency in the fpmake system
TPackageVariants Collection of package variants
TBuildEngine Main build engine for compiling and installing packages
TCustomInstaller Base class for package installers