Sign in Join
Wiki copytemporary

fppkg: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11## Introduction
22
33Fppkg is the Free Pascal package manager. It is used to compile and install Free Pascal packages which are based on [[FPMake]]. It also resolves dependencies between packages and can fetch the packages from a central repository.
44
55## Fppkg walk-through
66
77### Step 1, install package
88
99To install a package, just run 'fppkg install \<packagename\>'. This will look like this:
1010
11-`$ fppkg install cnocasn1`\
12-`Downloading package cnocASN1 version 0.9.0`\
13-`Start compiling package cnocASN1 for target x86_64-linux.`\
14-`       Compiling cnocasn1.pas`\
15-`       Compiling cnocasn1decoder.pas`\
16-`       Compiling cnocasn1tagfactory.pas`\
17-`       Compiling cnocasn1tagfactory.pas`\
18-`       Compiling cnocasn1encoder.pas`\
19-`       Compiling cnocasn1element.pas`\
20-`       Compiling cnocasn1decoder.pas`\
21-`[100%] Compiled package cnocASN1`\
22-`Installing package cnocASN1`\
23-`Installation package cnocASN1 for target x86_64-linux succeeded`
11+```text
12+$ fppkg install cnocasn1
13+Downloading package cnocASN1 version 0.9.0
14+Start compiling package cnocASN1 for target x86_64-linux.
15+ Compiling cnocasn1.pas
16+ Compiling cnocasn1decoder.pas
17+ Compiling cnocasn1tagfactory.pas
18+ Compiling cnocasn1tagfactory.pas
19+ Compiling cnocasn1encoder.pas
20+ Compiling cnocasn1element.pas
21+ Compiling cnocasn1decoder.pas
22+[100%] Compiled package cnocASN1
23+Installing package cnocASN1
24+Installation package cnocASN1 for target x86_64-linux succeeded
25+```
2426
2527First the cnocasn1 package is downloaded from a central repository. Then it is compiled and installed. Now with the package installed it is possible to use it's units (like cnocasn1, cnocasn1encoder etc) into any Free Pascal application.
2628
2729When installing the package does not work for you, take a look at the troubleshooting section.
2830
2931### Step 2, list installed packages
3032
3133Fppkg can give a list of all installed packages, and the packages which are available for installation. This could be that they could be downloaded, or the source might be available locally. Below a (cropped) list of all packages after the installation of cnocasn1.
3234
33-`$ fppkg list`\
34-`Name                 Installed      Available     `\
35-`a52                  3.3.1          -             `\
36-`aspell               3.3.1          -             `\
37-`bfd                  3.3.1          -             `\
38-`bzip2                3.3.1          -             `\
39-`cairo                3.3.1          -             `\
40-`cdrom                3.3.1          -             `\
41-`chm                  3.3.1          -             `\
42-`cnocASN1             0.9.0          0.9.0         `\
43-`codetools            1.0.1          -             `\
44-`dblib                3.3.1          -             `
35+```text
36+$ fppkg list
37+Name Installed Available
38+a52 3.3.1 -
39+aspell 3.3.1 -
40+bfd 3.3.1 -
41+bzip2 3.3.1 -
42+cairo 3.3.1 -
43+cdrom 3.3.1 -
44+chm 3.3.1 -
45+cnocASN1 0.9.0 0.9.0
46+codetools 1.0.1 -
47+dblib 3.3.1 -
48+```
4549
4650The packages which are part of fpc itself, like chm, are installed but not (online) available. This is because fpc version 3.3.1 is a moving target. When an official version of fpc is being used, all the packages are also available in the online repository.
4751
4852### Step 3, install package with a dependency
4953
5054All (maybe except the RTL) packages have dependencies on other packages. When fppkg is used to install a package, it will check all dependencies before compilation. When a dependency is not available locally, fppkg will lookup the package in the central repository and, if available, download and install them. See for example:
5155
52-`$ fppkg install cnocoidc`\
53-`Downloading package cnocOIDC version 0.9.0`\
54-`Install dependencies`\
55-`Downloading package cnocRSA version 0.9.0`\
56-`Start compiling package cnocRSA for target x86_64-linux.`\
57-`       Compiling cnocrsa.pas`\
58-`[100%] Compiled package cnocRSA`\
59-`Installing package cnocRSA`\
60-`Installation package cnocRSA for target x86_64-linux succeeded`\
61-`Dependencies installed`\
62-`Start compiling package cnocOIDC for target x86_64-linux.`\
63-`       Compiling cnocopenidconnect.pas`\
64-`       Compiling cnocoidcidtoken.pas`\
65-`       Compiling cnocoidcidtoken.pas`\
66-`[100%] Compiled package cnocOIDC`\
67-`Installing package cnocOIDC`\
68-`Installation package cnocOIDC for target x86_64-linux succeeded`
56+```text
57+$ fppkg install cnocoidc
58+Downloading package cnocOIDC version 0.9.0
59+Install dependencies
60+Downloading package cnocRSA version 0.9.0
61+Start compiling package cnocRSA for target x86_64-linux.
62+ Compiling cnocrsa.pas
63+[100%] Compiled package cnocRSA
64+Installing package cnocRSA
65+Installation package cnocRSA for target x86_64-linux succeeded
66+Dependencies installed
67+Start compiling package cnocOIDC for target x86_64-linux.
68+ Compiling cnocopenidconnect.pas
69+ Compiling cnocoidcidtoken.pas
70+ Compiling cnocoidcidtoken.pas
71+[100%] Compiled package cnocOIDC
72+Installing package cnocOIDC
73+Installation package cnocOIDC for target x86_64-linux succeeded
74+```
6975
7076Before installing cnocOIDC, the missing dependency cnocRSA is downloaded and installed. Note that the cnocRSA package depends on the cnocasn1 package, but this package is already installed during step 1 and is therefore not installed again.
7177
7278### Step 4, re-install an already installed package
7379
7480Fppkg will not only install dependencies, but will also re-compile all packages that depend on a newly installed package. Suppose you want to have debug-information for the cnocasn1 package. This is possible as follows:
7581
76-`$ fppkg install -o -gl cnocasn1`\
77-`Start compiling package cnocASN1 for target x86_64-linux.`\
78-`       Compiling cnocasn1.pas`\
79-`       Compiling cnocasn1decoder.pas`\
80-`       Compiling cnocasn1tagfactory.pas`\
81-`       Compiling cnocasn1encoder.pas`\
82-`       Compiling cnocasn1element.pas`\
83-`[100%] Compiled package cnocASN1`\
84-`Installing package cnocASN1`\
85-`Installation package cnocASN1 for target x86_64-linux succeeded`\
86-`Re-install packages which are dependent on just installed packages`\
87-`Start compiling package cnocRSA for target x86_64-linux.`\
88-`       Compiling cnocrsa.pas`\
89-`[100%] Compiled package cnocRSA`\
90-`Installing package cnocRSA`\
91-`Installation package cnocRSA for target x86_64-linux succeeded`\
92-`Start compiling package cnocOIDC for target x86_64-linux.`\
93-`       Compiling cnocopenidconnect.pas`\
94-`       Compiling cnocoidcidtoken.pas`\
95-`[100%] Compiled package cnocOIDC`\
96-`Installing package cnocOIDC`\
97-`Installation package cnocOIDC for target x86_64-linux succeeded`
82+```text
83+$ fppkg install -o -gl cnocasn1
84+Start compiling package cnocASN1 for target x86_64-linux.
85+ Compiling cnocasn1.pas
86+ Compiling cnocasn1decoder.pas
87+ Compiling cnocasn1tagfactory.pas
88+ Compiling cnocasn1encoder.pas
89+ Compiling cnocasn1element.pas
90+[100%] Compiled package cnocASN1
91+Installing package cnocASN1
92+Installation package cnocASN1 for target x86_64-linux succeeded
93+Re-install packages which are dependent on just installed packages
94+Start compiling package cnocRSA for target x86_64-linux.
95+ Compiling cnocrsa.pas
96+[100%] Compiled package cnocRSA
97+Installing package cnocRSA
98+Installation package cnocRSA for target x86_64-linux succeeded
99+Start compiling package cnocOIDC for target x86_64-linux.
100+ Compiling cnocopenidconnect.pas
101+ Compiling cnocoidcidtoken.pas
102+[100%] Compiled package cnocOIDC
103+Installing package cnocOIDC
104+Installation package cnocOIDC for target x86_64-linux succeeded
105+```
98106
99107This will re-install the cnocasn1 package with the -gl option passed to the compiler. (-gl means build with debug-information) But this is not the only thing Fppkg does. It will also re-build cnocrsa and cnocoidc, because cnocrsa depends on cnocasn1 and cnocoidc depends on cnocrsa. Note that in this case recompiling both packages is not necessary, because the -gl option does not change the interface of the package. But Fppkg can not detect this and will rebuild and reinstall the packages.
100108
101109### Step 5, install a package from source
102110
103111In the previous steps a package was installed from a central repository. But it is also possible to install a package from a local harddisk. To do this, change the current directory to the source-directory of the package. This is the directory that contains the fpmake.pp file. Then just call fppkg but omit the package-name from the command line. All dependencies will be resolved automatically in this case also.
104112
105113Hint: If you want to test this but do not have the sources of a fpmake-package available, most Free Pascal users do have the sources of the packages that come with the compiler installed onto their machine. Below is the cropped output of the installation of the fcl-db package:
106114
107-`$ fppkg install`\
108-`Start compiling package fcl-db for target x86_64-linux.`\
109-`       Compiling src/base/dbconst.pas`\
110-`       Compiling src/base/db.pas`\
111-`       Compiling src/dbase/dbf_prssupp.pas`
115+```text
116+$ fppkg install
117+Start compiling package fcl-db for target x86_64-linux.
118+ Compiling src/base/dbconst.pas
119+ Compiling src/base/db.pas
120+ Compiling src/dbase/dbf_prssupp.pas
121+```
112122
113-`Warning: Circular dependency detected when compiling target dbf_fields with target dbf_dbffile`\
114-`       Compiling src/dbase/dbf_fields.pas`\
115-`Warning: Circular dependency detected when compiling target dbf_memo with target dbf_dbffile`\
116-`       Compiling src/dbase/dbf_memo.pas`\
117-`Warning: Circular dependency detected when compiling target dbf_parser with target dbf`\
118-`Warning: Circular dependency detected when compiling target dbf_parser with target dbf_dbffile`\
119-`       Compiling src/dbase/dbf_parser.pas`\
120-`       Compiling src/dbase/dbf_parser.pas`\
121-`       Compiling src/dbase/dbf_lang.pas`\
122-`       Compiling src/dbase/dbf_collate.pas`\
123-`Warning: Circular dependency detected when compiling target dbf_idxfile with target dbf_dbffile`\
124-`       Compiling src/dbase/dbf_idxfile.pas`\
125-`[100%] Compiled package fcl-db`\
126-`Installing package fcl-db`\
127-`Installation package fcl-db for target x86_64-linux succeeded`\
128-`Re-install packages which are dependent on just installed packages`\
129-`Start compiling package fpindexer for target x86_64-linux.`\
130-`       Compiling src/fpmasks.pp`\
131-`       Compiling src/fpindexer.pp`\
132-`       Compiling src/memindexdb.pp`\
133-`       Compiling src/ireaderhtml.pp`
123+```text
124+Warning: Circular dependency detected when compiling target dbf_fields with target dbf_dbffile
125+ Compiling src/dbase/dbf_fields.pas
126+Warning: Circular dependency detected when compiling target dbf_memo with target dbf_dbffile
127+ Compiling src/dbase/dbf_memo.pas
128+Warning: Circular dependency detected when compiling target dbf_parser with target dbf
129+Warning: Circular dependency detected when compiling target dbf_parser with target dbf_dbffile
130+ Compiling src/dbase/dbf_parser.pas
131+ Compiling src/dbase/dbf_parser.pas
132+ Compiling src/dbase/dbf_lang.pas
133+ Compiling src/dbase/dbf_collate.pas
134+Warning: Circular dependency detected when compiling target dbf_idxfile with target dbf_dbffile
135+ Compiling src/dbase/dbf_idxfile.pas
136+[100%] Compiled package fcl-db
137+Installing package fcl-db
138+Installation package fcl-db for target x86_64-linux succeeded
139+Re-install packages which are dependent on just installed packages
140+Start compiling package fpindexer for target x86_64-linux.
141+ Compiling src/fpmasks.pp
142+ Compiling src/fpindexer.pp
143+ Compiling src/memindexdb.pp
144+ Compiling src/ireaderhtml.pp
145+```
134146
135-`Installing package cnocRSA`\
136-`Installation package cnocRSA for target x86_64-linux succeeded`\
137-`Start compiling package cnocOIDC for target x86_64-linux.`\
138-`       Compiling cnocopenidconnect.pas`\
139-`       Compiling cnocoidcidtoken.pas`\
140-`[100%] Compiled package cnocOIDC`\
141-`Installing package cnocOIDC`\
142-`Installation package cnocOIDC for target x86_64-linux succeeded`
147+```text
148+Installing package cnocRSA
149+Installation package cnocRSA for target x86_64-linux succeeded
150+Start compiling package cnocOIDC for target x86_64-linux.
151+ Compiling cnocopenidconnect.pas
152+ Compiling cnocoidcidtoken.pas
153+[100%] Compiled package cnocOIDC
154+Installing package cnocOIDC
155+Installation package cnocOIDC for target x86_64-linux succeeded
156+```
143157
144158### Step 6, uninstall a package
145159
146160Uninstalling a package is as simple as 'fppkg uninstall \<packagename\>'.
147161
148-`$ fppkg uninstall cnocasn1`\
149-`Uninstalling package cnocASN1`
162+```text
163+$ fppkg uninstall cnocasn1
164+Uninstalling package cnocASN1
165+```
150166
151167Fppkg does not do any dependency checks, so use with care. It is possible to leave your configuration in a broken state, when some other installed packages depend on the uninstalled package. (This will probably change in the future, not checking for dependencies on uninstall seems like a bug to me)
152168
153169### Step 7, fix broken dependencies
154170
155171It might be that the dependencies between the packages get broken. This might happen when a package has been deleted, while some other packages still depend on it. (See step 6) Another way dependencies might get broken is when Free Pascal has been re-installed.
156172
157173Broken packages are marked (B) in the list of available packages. Running 'fppkg list' with the -v option gives some hints why a packages is broken:
158174
159-`$ fppkg list -v`\
160-`Start loading configuration file "/home/joost/.config/fppkg.cfg"`\
161-`Loaded global configuration from "/home/joost/.config/fppkg.cfg"`
175+```text
176+$ fppkg list -v
177+Start loading configuration file "/home/joost/.config/fppkg.cfg"
178+Loaded global configuration from "/home/joost/.config/fppkg.cfg"
179+```
162180
163-`Name                 Installed      Available     `\
164-`a52                  3.3.1          -             `\
165-`aspell               3.3.1          -             `\
166-`bfd                  3.3.1          -             `\
167-`bzip2                3.3.1          -             `\
168-`cairo                3.3.1          -             `\
169-`cdrom                3.3.1          -             `\
170-`chm                  3.3.1          -             `\
171-`cnocASN1             -              0.9.0         `\
172-`Package cnocRSA depends on package cnocASN1 which is not installed anymore`\
173-`Package cnocOIDC (user) needs to be rebuild, dependency cnocRSA (user) is broken`\
174-`cnocOIDC             0.9.0 (B)      0.9.0         `\
175-`Package cnocRSA depends on package cnocASN1 which is not installed anymore`\
176-`cnocRSA              0.9.0 (B)      0.9.0         `\
177-`dblib                3.3.1          -`
181+```text
182+Name Installed Available
183+a52 3.3.1 -
184+aspell 3.3.1 -
185+bfd 3.3.1 -
186+bzip2 3.3.1 -
187+cairo 3.3.1 -
188+cdrom 3.3.1 -
189+chm 3.3.1 -
190+cnocASN1 - 0.9.0
191+Package cnocRSA depends on package cnocASN1 which is not installed anymore
192+Package cnocOIDC (user) needs to be rebuild, dependency cnocRSA (user) is broken
193+cnocOIDC 0.9.0 (B) 0.9.0
194+Package cnocRSA depends on package cnocASN1 which is not installed anymore
195+cnocRSA 0.9.0 (B) 0.9.0
196+dblib 3.3.1 -
197+```
178198
179199To fix all broken dependencies, use 'fppkg fixbroken':
180200
181-`$ fppkg fixbroken`\
182-`Re-install packages which are dependent on just installed packages`\
183-`Install dependencies`\
184-`Start compiling package cnocASN1 for target x86_64-linux.`\
185-`       Compiling cnocasn1.pas`\
186-`       Compiling cnocasn1decoder.pas`\
187-`       Compiling cnocasn1tagfactory.pas`\
188-`       Compiling cnocasn1tagfactory.pas`\
189-`       Compiling cnocasn1encoder.pas`\
190-`       Compiling cnocasn1element.pas`\
191-`       Compiling cnocasn1decoder.pas`\
192-`[100%] Compiled package cnocASN1`\
193-`Installing package cnocASN1`\
194-`Installation package cnocASN1 for target x86_64-linux succeeded`\
195-`Dependencies installed`\
196-`Start compiling package cnocRSA for target x86_64-linux.`\
197-`       Compiling cnocrsa.pas`\
198-`[100%] Compiled package cnocRSA`\
199-`Installing package cnocRSA`\
200-`Installation package cnocRSA for target x86_64-linux succeeded`\
201-`Start compiling package cnocOIDC for target x86_64-linux.`\
202-`       Compiling cnocopenidconnect.pas`\
203-`       Compiling cnocoidcidtoken.pas`\
204-`[100%] Compiled package cnocOIDC`\
205-`Installing package cnocOIDC`\
206-`Installation package cnocOIDC for target x86_64-linux succeeded`
201+```text
202+$ fppkg fixbroken
203+Re-install packages which are dependent on just installed packages
204+Install dependencies
205+Start compiling package cnocASN1 for target x86_64-linux.
206+ Compiling cnocasn1.pas
207+ Compiling cnocasn1decoder.pas
208+ Compiling cnocasn1tagfactory.pas
209+ Compiling cnocasn1tagfactory.pas
210+ Compiling cnocasn1encoder.pas
211+ Compiling cnocasn1element.pas
212+ Compiling cnocasn1decoder.pas
213+[100%] Compiled package cnocASN1
214+Installing package cnocASN1
215+Installation package cnocASN1 for target x86_64-linux succeeded
216+Dependencies installed
217+Start compiling package cnocRSA for target x86_64-linux.
218+ Compiling cnocrsa.pas
219+[100%] Compiled package cnocRSA
220+Installing package cnocRSA
221+Installation package cnocRSA for target x86_64-linux succeeded
222+Start compiling package cnocOIDC for target x86_64-linux.
223+ Compiling cnocopenidconnect.pas
224+ Compiling cnocoidcidtoken.pas
225+[100%] Compiled package cnocOIDC
226+Installing package cnocOIDC
227+Installation package cnocOIDC for target x86_64-linux succeeded
228+```
207229
208230### Step 8, fix broken dependencies manually
209231
210232When some packages are broken, it is not possible to run any fppkg commands. Doing so will give messages like these:
211233
212-`$ fppkg install cnocasn1`\
213-`The FPC Package tool encountered the following error:`\
214-`Found broken packages, run "fppkg fixbroken" first`
234+```text
235+$ fppkg install cnocasn1
236+The FPC Package tool encountered the following error:
237+Found broken packages, run "fppkg fixbroken" first
238+```
215239
216240To install the missing package, use the -b parameter:
217241
218-`$ fppkg install -b cnocasn1`\
219-`Start compiling package cnocASN1 for target x86_64-linux.`\
220-`       Compiling cnocasn1.pas`\
221-`       Compiling cnocasn1decoder.pas`\
222-`       Compiling cnocasn1tagfactory.pas`\
223-`       Compiling cnocasn1tagfactory.pas`\
224-`       Compiling cnocasn1encoder.pas`\
225-`       Compiling cnocasn1element.pas`\
226-`       Compiling cnocasn1decoder.pas`\
227-`[100%] Compiled package cnocASN1`\
228-`Installing package cnocASN1`\
229-`Installation package cnocASN1 for target x86_64-linux succeeded`\
230-`Re-install packages which are dependent on just installed packages`
242+```text
243+$ fppkg install -b cnocasn1
244+Start compiling package cnocASN1 for target x86_64-linux.
245+ Compiling cnocasn1.pas
246+ Compiling cnocasn1decoder.pas
247+ Compiling cnocasn1tagfactory.pas
248+ Compiling cnocasn1tagfactory.pas
249+ Compiling cnocasn1encoder.pas
250+ Compiling cnocasn1element.pas
251+ Compiling cnocasn1decoder.pas
252+[100%] Compiled package cnocASN1
253+Installing package cnocASN1
254+Installation package cnocASN1 for target x86_64-linux succeeded
255+Re-install packages which are dependent on just installed packages
256+```
231257
232258## Quick-start guide
233259
234260Note: this section is only valid for fppkg from fpc version 2.5.1 or higher.
235261
236262### Setting up
237263
238264When 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' in a console window. You should see something like this:
239265
240-`Name                 Installed    Available   `\
241-`a52                  2.5.1-1      -           `\
242-`aspell               2.5.1-1      -           `\
243-`bfd                  2.5.1-1      -           `\
244-`lnet                 -            0.6.3-0  `
266+```text
267+Name Installed Available
268+a52 2.5.1-1 -
269+aspell 2.5.1-1 -
270+bfd 2.5.1-1 -
271+lnet - 0.6.3-0
272+```
245273
246274A list with all packages which are installed and the packages which are available for download are showed. You can see which version of each package is available and/or installed.
247275
248276If fppkg only shows available packages but not any installed packages, you have to adapt your fppkg configuration. Run 'fppkg listsettings' to see the current settings and the location of the configuration files. Locate the compiler configuration file and open it in a text-editor. Now change the 'GlobalPrefix' setting to the location where fpc is installed. For example: 'GlobalPrefix=/usr/lib/fpc' or 'c:\pp'. Save the file and run 'fppkg list' again.
249277
250278If you have still problems please read the section about configuring fppkg.
251279
252280#### Configuring the compiler
253281
254282The last step is configuring the Free Pascal compiler in such a way that it finds 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. Run 'fppkg listsettings' to see where fppkg installs the user-specific packages. This location is listed as the 'LocalInstallDir'.
255283
256284Now add this line to your Free Pascal compiler configuration file fpc.cfg:
257285
258-`-Fu<LocalInstallDir>/units/$fpctarget/*`
286+```text
287+-Fu<LocalInstallDir>/units/$fpctarget/*
288+```
259289
260290Replace \<LocalInstallDir\> with the value of the 'LocalInstallDir' setting as showed by 'fppkg list'. For example:
261291
262292Linux: (/etc/fpc.cfg or ~/.fpc.cfg)
263293
264-`-Fu~/.fppkg/lib/fpc/$fpcversion/units/$fpctarget/*`
294+```text
295+-Fu~/.fppkg/lib/fpc/$fpcversion/units/$fpctarget/*
296+```
265297
266298Windows: (fpc.cfg)
267299
268-`-Fuc:\users\username\AppData\Local\FreePascal\fppkg\units\$fpctarget*`
300+```text
301+-Fuc:\users\username\AppData\Local\FreePascal\fppkg\units\$fpctarget*
302+```
269303
270304Now you can use the units from the installed packages in all your programs. If you place the line at the bottom of the fpc.cfg, you are sure that the compiler will prefer the (locally) installed packages above the globally installed ones. This way you can install newer versions of packages locally (specific for one user), without having to change the global setup.
271305
272306### Installing a package
273307
274308Installing 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.
275309
276310## Commandline arguments
277311
278312Output of fppkg -h
279313
280314 Usage: fppkg [options] <action> <package>
281315 Options:
282316 -C --config-file Specify the configuration file to use
283317 -c --config Set compiler configuration to use
284318 -g --global Prefer global configuration file over local configuration file.
285319 -h --help This help
286320 -V --version Show version and exit
287321 -v --verbose Show more information
288322 -d --debug Show debugging information
289323 -f --force Force installation also if the package is already installed
290324 -r --recovery Recovery mode, use always internal fpmkunit
291325 -b --broken Do not stop on broken packages
292326 -l --showlocation Show in which repository the the packages are installed
293327 -o --options=value Pass extra options to the compiler
294328 -n Do not read the default configuration files
295329 -p --prefix=value Specify the prefix
296330 -s --skipbroken Skip the rebuild of depending packages after installation
297331 -i --installlocation Specify the repository to install packages intoallation
298332 --compiler=value Specify the compiler-executable
299333 --cpu=value Specify the target cpu to compile for
300334 --os=value Specify the target operating system to compile for
301335 Actions:
302336 update Update packages list
303337 list List available and installed packages
304338 build Build package
305339 compile Compile package
306340 install Install package
307341 uninstall Uninstall package
308342 clean Clean package
309343 archive Create archive of package
310344 download Download package
311345 convertmk Convert Makefile.fpc to fpmake.pp
312346 info Show more information about a package
313347 fixbroken Recompile all (broken) packages with changed dependencies
314348 listsettings Show the values for all fppkg settings
315349 config Get/Set configuration file values
316350 Config commands:
317351 config get a.b Get setting from config file, section a, key b
318352 config get a b Get setting from config file, section a, key b
319353 config set a.b c Set setting from config file, section a, key b to value c
320354 config set a b c Set setting from config file, section a, key b to value c
321355
322356All the actions are described below.
323357
324358The package parameter can mean the following:
325359
326360- *Packagename:*The package name as it appears on the used repository. All available package names are listed by 'fppkg list'.
327361- *Zipfile:* The full name of a zip-file (including the .zip extension) which contains a package.
328362- *Current directory:* When there is no package parameter, fppkg looks for a file called 'fpmake.pp' in the current directory, and if it is found, use the package defined by that file. In this case the compiled files are not placed elsewhere (See the 'BuildDir' setting) but within the 'units' directory in the current directory.
329363
330364## Actions
331365
332366### Update
333367
334368Update packages list
335369
336370### List
337371
338372List available and installed packages
339373
340374### Build
341375
342376Build package
343377
344378### Install
345379
346380Install package
347381
348382### Download
349383
350384Download package
351385
352386### Convertmk
353387
354388Convert Makefile.fpc to fpmake.pp
355389
356390### Config
357391
358392Use this to quickly get or set configuration settings.
359393
360394## Configuration
361395
362396### General configuration
363397
364398On startup fppkg reads it's settings from fppkg.cfg. If it can not find it, it will try to create one with some default values. In this configuration file the location of the local repository is set. Normally this is in the user's home-directory. It is also possible to add custom options which are always passed when fpmake is called. This can be used by fpmake-addins. For all other options see the global configuration file.
365399
366400Besides the global configuration file, there is also a file which is specific for a compiler version. You can add as much of these files as you want, using different compiler versions or compiler options. A common use is for cross-compiling. You can specify which configuration file to use on the fppkg command line with the '-c' option. The location of these configuration files is set in fppkg.cfg. when no configuration file is specified, the file called 'default' is used. (This can be set in fppkg.cfg)
367401
368402Most important settings in these configuration files are the locations of where the packages have to be installed. Fppkg supports two different locations for installed packages. One 'global' location, which normally can be used by all users of the computer. And a 'local' location which in most cases is in a user's home-directory. These locations can be set with the 'localprefix' and 'globalprefix' settings. If you want that fppkg detects which packages are installed by fpc itself, the 'globalprefix' has to be set to match the prefix of your fpc-installation. It is common to use the location of the local repository (set in fppkg.cfg) as setting for the localprefix. For a better explanation of all options see the compiler configuration files.
369403
370404The 'fppkg listsettings' command will show the values for all settings and the names of the used configuration files. From settings that allow macros the value as it is set by the user and the value when all macros are evaluated are both shown.
371405
372406### The global configuration file
373407
374408The global configuration file contains general information for fppkg, like the repository to download from and where to place the temporary files. A typical global configuration file looks like this: (linux)
375409
376-`[Defaults]`\
377-`ConfigVersion=4`\
378-`LocalRepository={UserDir}.fppkg/`\
379-`BuildDir={LocalRepository}build/`\
380-`ArchivesDir={LocalRepository}archives/`\
381-`CompilerConfigDir={LocalRepository}config/`\
382-`RemoteMirrors=`[`http://www.freepascal.org/repository/mirrors.xml`](http://www.freepascal.org/repository/mirrors.xml)\
383-`RemoteRepository=auto`\
384-`CompilerConfig=default`\
385-`FPMakeCompilerConfig=default`\
386-`Downloader=lnet`
410+```text
411+[Defaults]
412+ConfigVersion=4
413+LocalRepository={UserDir}.fppkg/
414+BuildDir={LocalRepository}build/
415+ArchivesDir={LocalRepository}archives/
416+CompilerConfigDir={LocalRepository}config/
417+RemoteMirrors=http://www.freepascal.org/repository/mirrors.xml
418+RemoteRepository=auto
419+CompilerConfig=default
420+FPMakeCompilerConfig=default
421+Downloader=lnet
422+```
387423
388424When fppkg is started it first tries to load fppkg.cfg from a user-specific location. If a user-specific version can not be found fppkg searches for a system-wide fppkg.cfg. See the table for the exact location of these files. 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.
389425
390426When you have the installed FPC packages used from FPC instalation or from Lazarus instalation that you need also write repository sections into the global configuration file. A typical global configuration file looks like this: (Windows)
391427
392-`[Global]`\
393-`ConfigVersion=5`\
394-`RemoteMirrors=`[`https://www.freepascal.org/repository/mirrors.xml`](https://www.freepascal.org/repository/mirrors.xml)\
395-`LocalRepository=C:\Users\UserName\AppData\Local\FreePascal\fppkg\`\
396-`BuildDir={LocalRepository}build\`\
397-`ArchivesDir={LocalRepository}archives\`\
398-`CompilerConfigDir={LocalRepository}config\`\
399-`CompilerConfig=default`\
400-`FPMakeCompilerConfig=default`\
401-`RemoteRepository=auto`\
402-`FPMakeOptions=--lazarusdir=C:\lazarus`\
403-`Downloader=FPC`\
404-`InstallRepository=user`\
428+```text
429+[Global]
430+ConfigVersion=5
431+RemoteMirrors=https://www.freepascal.org/repository/mirrors.xml
432+LocalRepository=C:\Users\UserName\AppData\Local\FreePascal\fppkg\
433+BuildDir={LocalRepository}build\
434+ArchivesDir={LocalRepository}archives\
435+CompilerConfigDir={LocalRepository}config\
436+CompilerConfig=default
437+FPMakeCompilerConfig=default
438+RemoteRepository=auto
439+FPMakeOptions=--lazarusdir=C:\lazarus
440+Downloader=FPC
441+InstallRepository=user
405442
406-`[Repository]`\
407-`Name=lazarus_fpc`\
408-`Description=Packages which are installed along with the Lazarus Free Pascal Compiler `\
409-`Path=C:\lazarus\fpc\3.2.0`\
410-`Prefix=C:\lazarus\fpc\3.2.0`\
443+[Repository]
444+Name=lazarus_fpc
445+Description=Packages which are installed along with the Lazarus Free Pascal Compiler
446+Path=C:\lazarus\fpc\3.2.0
447+Prefix=C:\lazarus\fpc\3.2.0
411448
412-`[Repository]`\
413-`Name=user`\
414-`Description=User-installed packages`\
415-`Path={LocalRepository}units/{CompilerVersion}`\
416-`Prefix={LocalRepository}`
449+[Repository]
450+Name=user
451+Description=User-installed packages
452+Path={LocalRepository}units/{CompilerVersion}
453+Prefix={LocalRepository}
454+```
417455
418456When you want to know for sure which configuration files fppkg uses, use the 'listsettings' action. It will list which configuration files are used plus the values for all settings.
419457
420458| OS | User-specific configuration file | System-wide configuration file |
421459|----|----|----|
422460| Unix/Linux | ~/.config/fppkg.cfg | /etc/fppkg.cfg |
423461| Windows | %localsettings%\FreePascal\fppkg\fppkg.cfg | |
424462
425463Location of configuration files on different OS'es
426464
427465The following settings are available:
428466
429467LocalRepository
430468The location where local repository information is stored. Supports macros.
431469
432470BuildDir
433471The location where packages are build when a package is supplied. When the package in the current directory is used, this setting is ignored. Supports macros.
434472
435473ArchivesDir
436474Place where packages downloaded from a remote repository are stored. Supports macros.
437475
438476CompilerConfigDir
439477Place where the compiler-configuration files can be found. Supports macros.
440478
441479RemoteMirrors
442480The URL to a file which contains all mirrors for a remote repository.
443481
444482RemoteRepository
445483Contains the repository which has to be used. Selecting 'auto' will result in a random repository selected from the mirror list.
446484
447485Compilerconfig
448486The filename of the compiler-configuration file which has to be used by default.
449487
450488FPMakeCompilerconfig
451489The filename of the compiler-configuration file which has to be used by default for compiling the fpmake.pp files.
452490
453491Downloader
454492Select the download-mechanism. lnet is the default.
455493
456494FPMakeOptions
457495Specifies options which have to be added to each call to fpmake. Use this if you have fpmake-addons installed that need some specific settings. An example is the lazmkunit-addin, which needs the lazarusdir setting. (FPMakeOptions=--lazarusdir=/path/to/lazarus)
458496
459497ConfigVersion
460498The version number of the used configuration-file format. Is used internally to check if the configuration file is in the format fppkg expects. Do not change.
461499
462500InstallRepository
463501Repository name for update and install the packages.
464502
465503#### Configuration for use with Lazarus
466504
467505Some packages use the lazmkunit to integrate with Lazarus. When these packages are installed they need to know where Lazarus is installed. Add the following line with the path to your lazarus installation to fppkg.cfg:
468506
469-`FPMakeOptions=--lazarusdir=/path/to/lazarus`
507+```text
508+FPMakeOptions=--lazarusdir=/path/to/lazarus
509+```
470510
471511### Compiler configuration files
472512
473513A compiler configuration file contains all information necessary to select which fpc-compiler to use. A typical compiler-configuration file looks like this:
474514
475-`[Defaults]`\
476-`ConfigVersion=4`\
477-`GlobalPrefix=/usr/local/lib/fpc`\
478-`LocalPrefix={LocalRepository}`\
479-`Compiler=/usr/local/bin/fpc`\
480-`OS=linux`\
481-`CPU=i386`\
482-`Version=2.5.1`\
483-`CompilerOptions=-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -WM10.14`
515+```text
516+[Defaults]
517+ConfigVersion=4
518+GlobalPrefix=/usr/local/lib/fpc
519+LocalPrefix={LocalRepository}
520+Compiler=/usr/local/bin/fpc
521+OS=linux
522+CPU=i386
523+Version=2.5.1
524+CompilerOptions=-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -WM10.14
525+```
484526
485527The following settings are available:
486528
487529GlobalPrefix
488530The prefix which has to be used when installing global packages. Normally this is the prefix of where fpc is installed, so that the packages which are installed by fpc are recognised. Supports macros.
489531
490532LocalPrefix
491533Supports macros.
492534
493535GlobalInstallDir
494536This is the location where the global packages are installed. The default value is {GlobalPrefix}lib/fpc/{compilerversion}/ on unices, and {globalprefix} on other operating systems. Supports macros.
495537
496538LocalInstallDir
497539This is the location where the user-specifig (local) packages are installed. Add this path to the search path of the compiler if you want to use one of the packages installed into this location. The default value is {LocalPrefix}lib/fpc/{compilerversion}/ on unices, and {LocalPrefix} on other operating systems. Supports macros.
498540
499541Compiler
500542The executable name of the compiler which has to be used.
501543
502544OS
503545The target OS.
504546
505547CPU
506548The target CPU-family.
507549
508550Version
509551The version of the used compiler.
510552
511553ConfigVersion
512554The version number of the used configuration-file format. Is used internally to check if the configuration file is in the format fppkg expects.
513555
514556CompilerOptions
515557Additional compiler options to be used when compiling fpmake and/or other packages. All compiler invocations are done with the -n command-line, causing the compiler not to read your fpc config file. This means that if your system needs additional options to work correctly (such as the MacOS development kit location) then you must set them here.
516558
517559### Using macros in the configuration files
518560
519561To make life easier you can use macros within the configuration-files. Macro's are between accolades '{}' and they are substituted on by some dynamic values. The following macros are available:
520562
521563AppConfigDir
522564Returns the location where fppkg stores it's user-specific configuration files. In fact it calls [GetAppConfigDir](http://www.freepascal.org/docs-html/rtl/sysutils/getappconfigdir.html) with Global=false.
523565
524566UserDir
525567Returns the location of the user's home-directory. ([GetUserDir](http://www.freepascal.org/docs-html/rtl/sysutils/getuserdir.html))
526568
527569LocalRepository
528570The value of LocalRepository in the global configuration file
529571
530572CompilerVersion
531573The version of the compiler as set in the compile configuration file, or the version detected from the compiler executable. This macro is not available in the global configuration file.
532574
533575## Upgrade
534576
535577After upgrading the compiler your old fppkg directory is outdated.
536578
537579- If you use only one compiler version remove your **~/.fppkg/config/default** directory and do **fppkg update**.
538580- If you use multiple compiler versions copy the **~/.fppkg/config/default** to **~/.fppkg/config/3.1.1** and then use **fppkg -c 3.1.1**.
539581
540582---
541583*From the Free Pascal wiki, page "fppkg", as it stood on 2020-11-13 after a change by SeniorAndre, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
542584Category: FPC
543585Category: Packages

Back to history