fppkg
Introduction
Fppkg is the freepascal package manager. This tool manages packages from a repository, unzips, builds and installs.
See also FPMake.
Basics
Quick-start guide
Note: this section is only valid for fppkg from fpc version 2.5.1 or higher.
Setting up
When you run fppkg for the first time, it will create new configuration files with the default values. To check if these values are ok, run 'fppkg list'. You should see something like below.
Name Installed Available a52 2.5.1-1 - aspell 2.5.1-1 - bfd 2.5.1-1 - lnet - 0.6.3-0
If fppkg does not show any installed packages, you have to adapt the path to your fpc-installation in the default compiler configuration file.
By default this file is named '~/.fppkg/config/default' on Unix/Linux/Posix and '%appdata%\fpc\fppkg\config\default' on windows systems. If you have found this file, open it in your favourite text editor and change the 'GlobalInstallDir' to the location where fpc is installed. For example: 'GlobalInstallDir=/home/joost/fpc-trunk/lib/fpc/2.5.1/'. Save the file and run 'fppkg list' again.
If you have still problems please read the section about configuring fppkg.
Installing a package
Installing a package is as simple as 'fppkg install [packagename]'. This will download, compile and install the package. When no error appears, use 'fppkg list' to check if the package is correctly installed. By default the package is installed for the current user only, if you want to force a system-wide installation, use the '-g' parameter. Note however that in that case you need to have the proper rights.
Configuring the compiler
As a last step, the freepascal-compiler has to find the installed packages. By default the packages are installed in a user-specific location and this location is by default not searched by the compiler. To add it, add the following line to your fpc.cfg:
Linux: (/etc/fpc.cfg or ~/.fpc.cfg)
#-Fu~/.fppkg/lib/$fpcversion/units/$fpctarget/*
Windows: (fpc.cfg)
#-Fu...
Now you can use the units from the installed packages in all your programs
Commandline arguments
Output of fppkg -h
Usage: .../fppkg [options] <action> <package> Options: -c --config Set compiler configuration to use -h --help This help -v --verbose Show more information -d --debug Show debugging information -g --global Force installation to global (system-wide) directory -f --force Force installation also if the package is already installed -r --recovery Recovery mode, use always internal fpmkunit Actions: update Update packages list list List available and installed packages build Build package compile Compile package install Install package clean Clean package archive Create archive of package download Download package convertmk Convert Makefile.fpc to fpmake.pp
Actions
Update
Update packages list
List
List available and installed packages
Build
Build package
Install
Install package
Download
Download package
Convertmk
Convert Makefile.fpc to fpmake.pp
Configuration
Which configuration file is used?
Fppkg always uses two configuration files. One with some global information and one for the specific compiler that is used. When you have more then one version of freepascal installed a different compiler-configuration file is used.
When fppkg is started it tries to read it's global configuration first from a user-specific configuration file. See the table for the exact filenames. When this file does not exist it searches for a system-wide configuration file. If both files do not exist a configuration file is created. When the current user is a superuser, a system-wide configuration file is made, else a user-specific one. When creating the configuration file fppkg tries some reasonable defaults for all settings. When you set the location of the fpc-installation in the enviroment-option FPCDIR, fppkg will use this location in the generated configuration files.
OS | User-specific configuration file | System-wide configuration file |
---|---|---|
Unix/Linux | ~/.config/fppkg.cfg | /etc/fppkg.cfg |
Windows | %localsettings%\FreePascal\Packages.cfg |
The location of the compiler-configuration files is given in the global-configuration file. When you want to know for sure which configuration file fppkg uses, add the '-d' parameter to fppkg. It will list which configuration files are used and all the used settings.