Packaging - 2. Package Descriptions
2.1 Tree Layout
Package descriptions are read from the finkinfo
directories below the /opt/sw/fink/dists
directory.
The "Trees" setting in /opt/sw/etc/fink.conf
controls
which directories are read.
The name of package description files must be the full package name
plus the extension ".info".
As of fink 0.26.0, there are several different ways to specify the
filename: it is recommended to use the shortest version which is
consistent with other needed package files. The filename takes
the form: the invariant packagename, optionally
followed by the architecture, optionally followed by the
distribution,
optionally followed by either version or version-revision, each delimited by
hyphens, concluding with ".info".
The "architecture" and "distribution" components are only allowed
if the corresponding field is present in the package, and if it specifies
exactly one value.
The package description tree is organized with several levels of directories. The directories in top-down order:
dists
is where it starts. Thedists
directory is necessary for the Debian tools. In recent versions of fink, this is a symlink to a directory with a distribution-inspired name.- The distribution. There is
stable
,unstable
andlocal
. Thelocal
directory is under the control of the local administrator/user. Thestable
andunstable
directories are part of Fink. - The tree. The
main
tree contains the bulk of the packages. Prior to July 1, 2010, the Cryptographic software was kept in a separate tree,crypto
, but this is now a section of themain
tree. finkinfo
vs.binary-darwin-powerpc
.finkinfo
contains the Fink package descriptions and patches, whilebinary-darwin-powerpc
contains the.deb
binary packages.- Sections. The
main
tree is subdivided into thematic sections to make it manageable.
2.2 File Format
The description files are simple lists of key-value pairs, also called 'fields'. Each line starts with a key, terminated by a colon (:) and followed by the value, like this:
Key: Value
There are two notations for fields that must span multiple lines.
The preferred notation is based on the here-document
syntax in shell scripts.
In this syntax, the first line consists of the key, followed by <<
as the value.
All following lines are treated as the actual value, until a line with
just <<
on it is encountered.
The example from above now looks like this:
InstallScript: << mkdir -p %i/share/man make install prefix=%i mandir=%i/share/man mkdir -p %i/share/doc/%n install -m 644 COPYING %i/share/doc/%n <<
Indentation using this format is optional, but it can be used to improve readability.
The here-document syntax can be nested. This is often used in
a SplitOff
or SplitOffN
field.
These fields contain other fields (multiple lines), and this syntax
allows these sub-fields to have multiple lines themselves. The same
terminator <<
is used for the sub-here-document.
Here is an example:
SplitOff: << Package: %N-shlibs InstallScript: << ln -s %p/lib/libfoo.2.dylib %i/lib/libfoo.%v.dylib << <<
In this format, empty lines and lines starting with a hash (#) are ignored.
Keys (field names) are case-insensitive in Fink, so you can write
InstallScript
, installscript
or
INSTALLSCRIPT
as you please.
The first capitalization form is preferred for readability, though.
Some fields take a boolean value - any of "true", "yes", "on", "1"
(case-insensitive) are treated as true, all other values are treated
as false.
2.3 Percent Expansion
To make life easier, Fink supports a set of expansions that are
performed on some fields.
In order to prevent ambiguity, you can use curly-braces to denote
exactly what character(s) should be considered for a percent
expansion. For example, %{n}
has the same meaning
as %n
.
The available expansions are:
%n |
the name of the current package |
%N |
the Name of the parent package (the same as %n unless within a
Note: If a parent |
%e |
the package epoch |
%v |
the package version. Note that the Epoch is not part
of |
%V |
the full package Version, which automatically includes the Epoch
if present. Note that this percent expansion is only available for
packages whose |
%r |
the package revision |
%f |
the full package name (%n-%v-%r). Note that the Epoch is not
part of |
%p, %P |
the prefix where Fink is installed, e.g. |
%d |
the destination directory where the tree to be packaged is built, e.g.
|
%D |
the Destination for the parent package (the same as %d unless within a
|
%i |
the full install-phase prefix, equivalent to %d%p |
%I |
the Install prefix of the parent package, equivalent to %D%P (the same
as %i unless within a |
%a |
the path where the patches can be found. As of fink-0.29.0, this variable should not be used. Use |
%b |
the build directory, e.g. Note: Use this only when there is no other way. The build directory is the current directory when scripts are executed; you should use relative path names in commands. |
%c |
the parameters for configure: |
%m |
the machine architecture string. This is no longer strictly dictated by the type of machine, but is rather a choice made by the user upon fink installation among those architectures which will run on the user's hardware. Current possible values are 'powerpc' for ppc machines and either 'i386' or 'x86_64' for x86 machines. The choice 'x86_64' is only available if the machine is capable of running 64-bit libraries and executables. (This item was introduced in the fink-0.12 era; the current description is valid for fink-0.29.5 and later.) |
%% |
the percent character (one that will not be expanded according to whatever follows it). Expansion occurs strictly left-to-right, so %%n is not anything related to the package name, but rather is the string %n. (Introduced in fink-0.18.0) |
%type_raw[type], %type_pkg[type], %type_num[type] |
pseudo-hashes returning the subtype for the given type. See
documentation for the
Note that when the |
%{ni}, %{Ni} |
the package name invariant portion. These are like %n and %N, except all %type_pkg[] and %type_raw[] are blanked out. (Introduced in a post-0.19.2 CVS version of fink) You should use %{ni} and %{Ni} to avoid confusion with the %n and %N expansions. |
%{default_script} |
Valid only in |
%{PatchFile} |
The full path to the file given in the |
%{PatchFileN} |
The full path to the file given in the |
%lib |
If Note that |
Next: 3. Packaging Policy