Fink

打包 - 6. 操作手册

6.1 构建过程

要理解一些字段的含义,你需要有对 Fink 所采用的构建过程有些了解。它由五个阶段组成:解压,补丁,编译,安装和构建。下面的示例路径是关于安装在 /opt/sw 的 gimp-1.2.1-1 软件包的。

解压阶段/opt/sw/src/fink.build/gimp-1.2.1-1 这个目录会被创建,源代码压缩档会被在这里解压。多数情况下,这会创建一个名为 gimp-1.2.1 的目录,里面包括源代码;下面的操作步骤会在那个目录里面执行(即 /opt/sw/src/fink.build/gimp-1.2.1-1/gimp-1.2.1)。我们可以使用 SourceDirectory,NoSourceDirectory 和 SourceNExtractDir 这三个字段来控制有关细节。

补丁阶段,源代码会被打上补丁,以使得可以在 Darwin 下面编译。由 UpdateConfigGuess,UpdateLibtool,Patch 和 PatchScrip 这几个字段所指明的操作将被按照顺序执行。

编译阶段,源代码被配置和编译。通常这会以某些参数来调用 configure 脚本,然后执行一个 make 命令。 详细信息请查看 CompileScript 字段的描述。 If test suites are enabled for the build (a new feature in fink 0.25, currently achieved by building in maintainer mode), the TestScript will be run immediately after the CompileScript.

安装阶段,软件包被安装到一个临时目录,/opt/sw/src/fink.build/root-gimp-1.2.1-1 (= %d)。(注意 "root-" 部分。) 所有通常应该安装到 /opt/sw 的文件现在被安装在 /opt/sw/src/fink.build/root-gimp-1.2.1-1/opt/sw (= %i = %d%p)。 详细信息请查看 InstallScript 字段的描述。

(从 fink 0.9.9 开始,可以通过 SplitOff 字段从一个软件包描述文件生成几个软件包。在安装阶段的尾段,会为每个软件包建立一个单独的安装目录,文件会被移到相应的目录中,)

构建阶段,会根据临时文件夹的内容构建一个二进制安装包(.deb)文件。你不能直接影响这个步骤,但软件包描述里面的许多字段会用于生成 dpkg 的 control 文件。

6.2 字段

我们在这里把字段分成几类。这里所描述的内容并不一定包括全部的字段。:-)

初始化数据:

FieldValue
Package

软件包名。 可以包括小写字母,数字和这几个特殊字符:"."', "+" 和 "-"。 不可以使用下划线("_"),不可以使用大写字母。 这是一个必需字段。

对这个字段,只可应用 %N、%{Ni}、%type_raw[] 和 %type_pkg[] 这几种百分号扩展。

作为 Fink 的打包规则,给定的软件包应该总是使用相同的选项进行编译。 如果对一个软件包由多个变种(查阅关于 Type 字段的文档),你必须在 Package 字段中加入特定变种的信息(查阅关于 %type_pkg[] 百分号展开的文档)。 这样每个变种会由一个唯一的名称,软件包名字会指明包含了哪些变种的选项。 注意在 Package 字段使用 %type_pkg[] 和 %type_raw[] 百分号展开是新的功能,并与旧的 fink 版本严重不兼容,所以这些软件包的描述应该嵌入在 InfoN (N>=2)字段中。

Version

上游版本号。与 Package 字段具有同样的限制。 这是一个必需字段。

Note that some programs use nonstandard version numbering schemes that may cause sorting confusion or that contain characters that are not allowed in this field. In these situations, when writing the Fink package, you must convert the upstream value to one that is acceptable and that allows the versions to be arranged in the correct order. When in doubt about how version strings will be sorted, you can use the dpkg command at a shell prompt. For example,

  dpkg --compare-versions 1.2.1 lt 1.3 && echo "true"

will print "true" because version string "1.2.1" is less than "1.3". See the dpkg manpage for more details.

Revision

软件包的修订版号。 当你对一个相同的上游版本提供一个新的描述文件的时候,需要增加它。 修订版号从 1 开始。 这是一个必需字段。

Fink's policy is that any time you make a change to the .info file that results in changes to the binary (compiled) form of a package (the .deb file), you must increase Revision. This includes changing the Depends or other package lists, and adding, removing, or renaming splitoff packages or shifting files among them. When migrating a package to a new tree (from 10.2 to 10.3, for example) involves such changes, you should increase Revision by 10 (or some other large number) in the newer tree in order to leave space for future updates to the package in the older tree.

Architecture

A comma-separated list of CPU architecture(s) for which the package (and any splitoff packages) are intended. At present, the only valid values for architecture are powerpc and i386. If this field is present and not blank after conditional handling, fink will ignore the package description(s) if the local machine architecture is not listed. If the field is omitted or the value is blank, all architectures are assumed. (Introduced in a post-0.24.11 CVS version of fink.)

At present, the most common use of this field will be for packages which require a compiler earlier than gcc-4.0 (or packages which depend on such packages), which should be declared to have architecture powerpc.

This field supports the standard conditional syntax for any value in the value list and percent-expansions can be used (see the Depends field for more information). In this manner, certain variants can be restricted to certain architectures. For example:

  Package: foo-pm%type_pkg[perl]
  Type: perl (5.8.1 5.8.4 5.8.6)
  Architecture: (%type_pkg[perl] = 581) powerpc

will result in the field for the foo-pm581 variant being powerpc and the field being blank for all other variants. Remember that omitting a certain architecture value does not mean that the package is not for that architecture.

Distribution

A comma-separated list of distribution(s) for which the package (and any splitoff packages) are intended. At present, the only valid values for distribution are 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11, 10.12, 10.13, 10.14, 10.14.5, and 10.15 . If this field is present and not blank after conditional handling, fink will ignore the package description(s) if the local machine distribution is not listed. If the field is omitted or the value is blank, all distributions are assumed. (Introduced in fink 0.26.0.)

Since Fink's 10.9 through 10.14.5 distributions share a common set of finkinfo files, the most common use of this field will be for packages which are suitable for one of those distributions but not the other.

This field supports the standard conditional syntax for any value in the value list and percent-expansions can be used (see the Depends field for more information). In this manner, certain variants can be restricted to certain architectures. For example:

  Package: foo-pm%type_pkg[perl]
  Type: perl (5.8.1 5.8.6)
  Distribution: (%type_pkg[perl] = 581) 10.3, (%type_pkg[perl] = 581) 10.4

will result in the field for the foo-pm581 variant being 10.3, 10.4 and the field being blank for the foo-pm586 variant.

Since python 2.5 is not available in the 10.7+ distributions, and the available perl versions vary by distribution, these package types provide a common use of this field. For reference, we note the availabilty of various perl versions in the 10.3 through 13.0 distributions (bolded systems indicate system-perl at that version):

    perl 5.6.0:  10.3
    perl 5.8.0:  10.3
    perl 5.8.1:  10.3, 10.4
    perl 5.8.4:  10.3, 10.4
    perl 5.8.6:  10.3, 10.4, 10.5
    perl 5.8.8:        10.4, 10.5, 10.6
    perl 5.10.0:             10.5, 10.6
    perl 5.12.3:                         10.7, 10.8, 10.9
    perl 5.12.4:                         10.7, 10.8, 10.9
    perl 5.16.2:                         10.7, 10.8, 10.9, 10.10, 10.11, 10.12, 10.13
    perl 5.18.2:                         10.7, 10.8, 10.9, 10.10, 10.11, 10.12, 10.13, 10.14, 10.14.5, 10.15, 11.0, 11.3, 12.0, 13.0
    perl 5.18.4:                                     10.9, 10.10, 10.11, 10.12, 10.13, 10.14, 10.14.5, 10.15, 11.0, 11.3, 12.0, 13.0
    perl 5.28.2:                                     10.9, 10.10, 10.11, 10.12, 10.13, 10.14, 10.14.5, 10.15, 11.0, 11.3, 12.0, 13.0
    perl 5.30.2:                                     10.9, 10.10, 10.11, 10.12, 10.13, 10.14, 10.14.5, 10.15, 11.0, 11.3, 12.0, 13.0
    perl 5.30.3:                                     10.9, 10.10, 10.11, 10.12, 10.13, 10.14, 10.14.5, 10.15, 11.0, 11.3, 12.0, 13.0

A way to include all variants in a single finkinfo file is as follows.

  Package: foo-pm%type_pkg[perl]
  Type: perl (5.6.0 5.8.0 5.8.1 5.8.4 5.8.6 5.8.8 5.10.0 5.12.3)
  Distribution: <<
   (%type_pkg[perl] = 560) 10.3, (%type_pkg[perl] = 580) 10.3, 
   (%type_pkg[perl] = 581) 10.3, (%type_pkg[perl] = 581) 10.4, 
   (%type_pkg[perl] = 584) 10.3, (%type_pkg[perl] = 584) 10.4, 
   (%type_pkg[perl] = 586) 10.3, (%type_pkg[perl] = 586) 10.4, (%type_pkg[perl] = 586) 10.5,
   (%type_pkg[perl] = 588) 10.4, (%type_pkg[perl] = 588) 10.5, (%type_pkg[perl] = 588) 10.6,
   (%type_pkg[perl] = 5100) 10.5, (%type_pkg[perl] = 5100) 10.6,
   (%type_pkg[perl] = 5123) 10.7
  <<

Note that we do not include old distributions, such as 10.2 or 10.4-transitional, since the versions of fink which are relevant for them do not recognize this field.

Epoch

从 fink 0.12.0 开始。 这个可选字段可以用来指明软件包关键版本号(如果没有提供,默认值为 0).更多信息参考Debian 规则手册. Because Fink and some of the underlying Debian tools use name-version-revision as the unique identifier of a package, you must not create a package that differs from another solely by its epoch.

Description

对软件包的一个简单描述(有关它是什么东西的问题。)这是一个会显示在列表中的一行描述,所以它要简单明了。它应该少于 45 字符,必需少于 60 字符。在这个字段里面不需要重复软件包的名字-它总会被显式正确的上下文中。这是一个必需字段。

Type

这可以设为 bundle。 束(Bundle)软件包可以用于一套相关的软件包归类在一起。 它们只有依赖管理,但没有代码和安装文件。 对于束文件包,Source,PatchScript,CompileScript,InstallScript 以及其它相关的字段都会被忽略。

nosource 是一个很类似的类型。 它表明没有源程序压缩档,所以不会有东西被下载,解压阶段只是创建一个空目录。 不过,补丁,编译和安装阶段则会正常执行。 这样你可以通过补丁放进全部代码,或者只是在 InstallScript 中创建一些目录。 从 fink 0.18.0 开始,你可以通过设置 Source: none 来获得同样的效果。这样你可以把 "Type" 字段用于其它目的(比如:Type: perl,等等)。

从 fink 0.9.5 开始,开始有 perl 类型,它会对编译和安装脚本使用另外一套默认值。 从 fink 0.13.0 开始,有个这种类型的变种, perl $version,其中 $version 是 perl 的一个版本号,它由句点分开的三个数字组成,例如: perl 5.6.0

在 fink-0.19.2 后的一个 CVS 版本开始,language/language-version use 被通用化,以允许使用任意维护者定义的类型以及相应的子类型,并对一个给定的软件包可以使用多于一种类型。 类型和子类型均为不包含空白字符的任意字符串(但不应该使括号、逗号、花括号和百分号);不会进行百分号展开,类型(并非子类型)数值会被转换成小写。 多种类型值(每个类型可以有一个用空白字符分开的可选的子类型)可以用逗号分隔的列表指定。

另外,存在“变种”的概念,即一个 .info 文件描述一族相关的使用不同编译选项的软件包。 这个过程的关键是使用一系列子类型。 我们不使用单个字符串,而是使用括号中的一列用空格分开的字符串。 Fink 会对每种子类型克隆软件包描述文件,并在其中使用其中一个子类型。 例如:

Type: perl (5.6.0 5.8.1)

提供两个软件包描述,其中一个作为 Type: perl 5.6.0,另外一个作为 Type: perl 5.8.1。 特殊的子类型清单 "(boolean)" 代表一个包含它自己和一个句点的清单,因此下面的两种形式是相同的:

Type: -x11 (boolean)
Type: -x11 (-x11 .)

子类型清单展开/软件包克隆是递归的;如果在子类型清单中有多个类型,你会活得所有可能的组合:

Type: -ssl (boolean), perl (5.6.0 5.8.1)

可以使用 %type_raw[] 和 %type_pkg[] 伪哈希值来在其它字段中访问特定的变种子类型。 这里是两个示范的 .info 片段:

Info2: <<
Package: foo-pm%type_pkg[perl]
Type: perl (5.6.0 5.8.1)
Depends: perl%type_pkg[perl]-core
 <<
Info2: <<
Package: bar%type_pkg[-x11]
Type: -x11 (boolean)
Depends: (%type_raw[-x11] = -x11) x11
CompileScript:  <<
  #!/bin/bash -ev
  if [ "%type_raw[-x11]" == "-x11" ]; then
    ./configure %c --with-x11
  else
    ./configure %c --without-x11
  fi
  make
<<
<<

Starting in fink 0.26.0, there is a special Type: -64bit which controls a new percent expansion %lib and also changes the default value of LDFLAGS. When combined with the new construction %type_num[], this allows a single .info file to build both a 32-bit version of a library and a 64-bit version. Here's some sample code:

Info2: <<
Package: foo%type_pkg[-64bit]
Type: -64bit (boolean)
Depends: (%type_raw[-64bit] = -64bit) 64bit-cpu
ConfigureParams: --libdir='${prefix}/%lib'
SplitOff: <<
 Package: %N-shlibs
 Files: %lib/libfoo.*.dylib
 Shlibs: <<
    %p/%lib/libfoo.1.dylib 1.0.0 %n (>= 1.0-1) %type_num[-64bit]
  <<
<<
<<
License

本字段给出软件包发布所依据的授权协议的性质。它必须是本文档前面软件包授权协议中所描述的值之一。 另外,只有软件包确实满足打包规则在这方面的要求时,比如已经在软件包的 doc 目录安装了一份授权协议,才能够设置这个字段。

Maintainer

负责本软件包的人的姓名和电子邮件地址。这是一个必需字段,而且必需是下面格式的一个名字和地址:

Firstname Lastname <user@host.domain.com>
InfoN

本字段允许 fink 在软件包描述文件中实现后向兼容的语法改变。 一个给定版本的 fink 被配置为能够处理某个最大的 "N" 整数值。 任意在更高的 InfoN 字段的软件包会被忽略,所以这种机制仅在有需要的时候才使用,否则那些使用较旧版本的用户就会被没有必要地区别出去了。 要使用这个机制,把整个软件包描述放到合适的 InfoN 字段中间。 参考前面的 "File Format" 部分了解多行字段的语法。 Here are the features added for each InfoN level, along with the earliest version of fink that supports it:

  • Info2 (fink>=0.20.0): Ability to use percent-expansions in the main Package field of the .info file and the ability to use the %type_* percent-expansions in the Package field of SplitOff (and SplitOffN) packages.
  • Info3 (fink>=0.25.0): Can indent nicely in .info files, no more support for RFC-822 multi-lines, and can put comments in pkglist fields.
  • Info4 (fink>=0.26.2): adds %V expansion, and permits %lib in ConfigureParams field.

依赖关系:

FieldValue
Depends

在本软件包构建前必需安装的软件包的列表。 在这个字段中会进行百分号展开(也包括这部分中的其它软件包列表字段:BuildDepends、RuntimeDepends、Provides、Conflicts、Replaces、Recommends、Suggests 和 Enhances)。 通常,它只是以逗号分割软件包名清单,但 Fink 现在也和 dpkg 一样支持替代软件包和版本子句。 一个体现全部特性的例子是:

Depends: daemonic (>= 20010902-1), emacs | xemacs

注意,其实没有办法去表达真正的可选依赖关系。 如果一个软件包在有和没有另外一个软件包的情况下都可以工作,你必需要么确定即使有那个软件包存在的情况下都不会去使用它,或者把它添加到依赖关系字段中。 如果你想提供给用户两种选择,你应该使用两个软件包,例如:wget 和 wget-ssl。

操作顺序:在逗号分隔的列表中的每个软件包(或替代关系的集合)中,逻辑"OR"(可替代项的列表)具有比逻辑"AND"更优先的操作次序。不象算术中可以使用括号,没有办法特别在 Depends 或类似的字段中指明某个软件包组具有优先的次序。

从 fink 的 0.18.2 后 CVS 版本开始,你可以使用条件依赖关系。它通过在软件包名字前面放置 (string1 op string2) 来指定。首先会对这两个字符串进行通常的百分号展开,然后这两个字符串(都不能为空)会按照 op 运算符进行比较:<<, <=,=,!=,>>,>=。只有在比较的结果为真的时候,后面的软件包才会被认为是一个依赖关系。

你可以使用这个格式来简化维护几个类似的软件包的工作。例如,elinks 和 elinks-ssl 包里面都可以这样写:

Depends: (%n = elinks-ssl) openssl097-shlibs, expat-shlibs

这和在 elinks 中写:

Depends: expat-shlibs

elinks-ssl 中写:

Depends: openssl097-shlibs, expat-shlibs

是等价的。

作为替代的语法格式,如果 string 不为空的话,你也可以指定 (string) 为"true"。例如:

package: nethack%type_pkg[-x11]
Type: -x11 (boolean)
Depends: (%type_pkg[-x11]) x11

会把软件包 X11 设为 nethack-x11 变量的一个依赖关系,而不是 nethack。

Note that when using Depends/BuildDepends for shared library packages for which more than one major-version is available, you must not do the following:

  Package: foo
  Depends: id3lib3.7-shlibs | id3lib3.7-shlibs
  BuildDepends: id3lib3.7-dev | id3lib4-dev

even if your package could work with either library. Pick one (preferably the highest version that can be used successfully) and use it consistently in your package.

As explained in the Shared Library Policy, only one of the -dev packages can be installed at a time, and each has links of the same name that could point to different filenames in the associated -shlibs package. When compiling package foo, the actual filename (in the -shlibs package) gets hard-coded into the foo binary. That means the resulting package needs the specific -shlibs package associated with the -dev that was installed at compile-time. As a result, one cannot have a Depends that indicates that either one will suffice.

In the past, non-essential packages implicitly depended on the essential ones; this is no longer true.

BuildDepends

从 fink 0.9.0 开始。 只在编译时需要的依赖关系的清单。 这可以用于列出构建软件包必须使用工具(比如 flex)。它支持和 Depends 相同的语法。 If a build is being done with test suites enabled, the dependencies in the TestDepends field will be added to this list.

RuntimeDepends

从 fink 0.32.0 开始。 A list of dependencies that is applied at run time only, that is, when the package is being installed. This can be used to list packages that must be present to run the package, but which are not used at build time. Supports the same syntax as Depends.

Provides

一个逗号分隔的软件包名字清单,它表示本软件包会"提供"那些软件包的功能。 如果一个名为 "pine" 的软件包指明 Provides: mailer 的话,那么只要安装了"pine",所有对"mailer"的依赖关系都会被认为已经满足。 你通常会把这些软件包名字同时列在 "Conflicts" 和 "Replaces" 字段。

Note that there is no versioning data associated with Provides items. They do not inherit from the parent package that contains the Provides list nor is there a syntax for specifing an arbitrary version in the Provides field itself. Further, a dependency that contains a version specification is not satisfied by a package that Provides that needed package name. As a result, having many variants provide a common surrogate package may be harmful, because it precludes the use of versioned dependencies. For example, if foo-gnome and foo-nognome both have "Provides: foo", another package with "Depends: foo (> 1.1)" will not work.

Conflicts

一个逗号分隔的软件包名清单,这些软件包不应该和本软件安装在同一台机器上。 对于虚拟软件包,可以把它们代表的软件包的名字列在这里,它们会被自动正确处理。这个也支持和 Depend 字段类似的版本相关的依赖关系,但没有替换选择(这也不符合逻辑)。如果一个软件被列为它自己的 Conflicts 字段中,它将被从中清除(不会有特别的提示),这个功能在 fink 的 0.18.2 后 CVS 版本中提供。

注意:Fink 自己本身会忽略这个字段。不过,它会被传递给 dpkg 并做相应的处理。概括来说,它仅影响运行时,而不应该构建时。

BuildConflicts

A list of packages that must not be installed while this package is being compiled. This can be used to prevent ./configure or the compiler from seeing undesired library headers or to avoid use of a version of a tool that is known to be broken (for example, a bug in a certain version of sed). If a build is being done with test suites enabled, the packages in the TestConflicts field will be added to this list.

Replaces

这和 "Conflicts" 同时使用,当软件包不仅仅替代冲突的软件包的功能,还会有一些共同的文件的时候。 没有这个字段的话,dpkg 会按安装的时候报错,因为这些文件还由别的软件包所拥有。 它也可以作为一个提示说,这两个软件是真正的完全替代的,一个可以完全替代另外一个。如果一个软件列为它自己的 Replaces,它会被自动(没有提示)地从中清除(从 fink 的 0.18.2 后 CVS 版本开始提供)。

注意:Fink 自己本身会忽略这个字段。不过,它会被传递给 dpkg 并做相应的处理。概括来说,它仅影响运行时,而不应该构建时。

Recommends, Suggests, Enhances

这些字段以其它依赖关系的风格,指明一些额外的软件包关系。这三个关系不会影响通过dpkgapt-get 的实际安装过程。 它们由 dselect 或其它前端程序来帮助用户作出合理的选择。

Pre-Depends

对 Depends 字段进行更强的要求的特殊变量。 本字段只有在开发者邮件列表中经过讨论,并被大部分人同意需要这样做以后才可以使用。

Essential

一个表明是关键软件包的布尔值。 所有的非关键软件包都隐含地依赖于关键软件包。 dpkg 会拒绝从系统中删除关键软件包,除非设置了特别的标识来覆盖它。 In the past, non-essential packages implicitly depended on the essential ones; this is no longer true.

BuildDependsOnly

从 fink 0.9.9 开始。 一个布尔值,它表明没有其它软件包会依赖于它,它们应该只是 BuildDepend。 Unlike usual boolean fields, BuildDependsOnly is tri-state: leaving it undefined (not specifying it at all) is different than defining it as logically false. See the Shared Library Policy for more information.

As of fink 0.20.5, the presence or absence of this field, and its value if present, are recorded into the .deb file when the package is built. Therefore, if you change the value of BuildDependsOnly or if you add or remove it, you must increase the revision number of the package.

解压阶段:

FieldValue
CustomMirror

镜像站点的列表。每个镜像站点占一行,格式如下:<location>: <url>location 可以是洲代号(例如 nam),也可以是国家代号(比如 nam-us),或者其它的东西;镜像站点会按照它的顺序来进行尝试。 例如:

CustomMirror: <<
nam-US: ftp://ftp.fooquux.com/pub/bar
asi-JP: ftp://ftp.qiixbar.jp/pub/mirror/bar
eur-DE: ftp://ftp.barfoo.de/bar
Primary: ftp://ftp.barbarorg/pub/
>>

The standard continent and country codes are listed in /opt/sw/lib/fink/mirror/_keys, which is part of the fink or fink-mirrors package.

Source

源代码压缩档的 URL。它应该是一个 HTTP 或 FTP URL,但 Fink 本身并不关心这一点-它只是把它传递给 wget。这个字段对镜像站点的 URL 标记模式: mirror:<mirror-name>:<relative-path>。 这会在 Fink 的配置中寻找 mirror-name 镜像的设置,然后添加 relative-path 部分,并把结果作为实际的 URL。已知的 mirror-name 被列在 /opt/sw/lib/fink/mirror/_list 中。它是 fink 或 fink-mirror 软件包的一部分。另一方面,使用 custom 作为 mirror-name 会使 Fink 使用 CustomMirror 字段。 在 URL 使用前,会进行百分号展开。 记住 %n 包括所有 %type_ 变种数据,所以你可能会希望在这里使用 %{ni}(也许还包括一些特定的 %type_ 展开)。

从 0.18.0 开始,Source: none 具有特别的含义。它标识不需要下载源文件。参考 Type 字段的描述获取更多信息。 gnu 这个值代表 mirror:gnu:%n/%n-%v.tar.gzgnome 则代表 mirror:gnome:stable/sources/%n/%n-%v.tar.gz。默认值是 %n-%v.tar.gz (即一个手工指定的下载)。 This implicitly-defined Source form is deprecated (explicitly-stated simple filename/manual download is still okay).

Sources that are only needed in order to run test suites should use TestSource and related fields, inside the InfoTest block.

SourceN

如果一个软件包包含几个压缩档,在这些额外的字段中说明它们呢,从 N = 2 开始。所以,第一个压缩档(它应该是所谓的"主"压缩档)会被放在 Source,第二个压缩档则作为 Source2,依此类推。这里的规则和 Source 是一样的,区别只是 "gnu" 和 "gnome" 捷径不会被展开-那样做并没有意义。从 fink 的 0.19.2 后的一个 CVS 版本开始,你可以使用任意(不需要连续)的 N >= 2 的整数值。不过,你仍然要保证它们是不重复的。

SourceDirectory

在压缩档被解压到一个目录里面的时候必须使用,但目录名会和压缩档的基本部分不同。 通常,一个名为 "foo-1.0.tar.gz" 会产生一个名为 "foo-1.0" 的目录。如果它产生不同名字的目录,用这个参数指明它。对这个字段会应用百分号展开。

NoSourceDirectory

把这个布尔值参数设为真的话,压缩档不会展开到一个单独的目录中。 通常,一个名为 "foo-1.0.tar.gz" 会产生一个名为 "foo-1.0" 的目录。如果它只是把文件解压到当前目录,使用这个参数并把它设为真。

SourceNExtractDir

通常,一个辅助压缩档会被解压到主压缩档相同的目录中。如果你需要把它解压到一个特别的子目录中,使用这个字段来指明它。 正如一般人想象的一样,Source2ExtractDir 对应于 Source2 压缩档。查阅 ghostscript,vim 和 tetex 作为使用的例子。

SourceRename

这个字段可以在下载过程中改变源程序压缩档的名字。它经常用于在服务器上用目录来区别不同的版本,但压缩档的名字却都是相同的场合。例如: http://www.foobar.org/coolapp/1.2.3/source.tar.gz。要解决这个问题,你可以使用:

SourceRename: %n-%v.tar.gz

对于上面的例子,这会使得下载的源代码压缩档保存在 /opt/sw/src/coolapp-1.2.3.tar.gz,以满足我们的一般命名约定。

SourceNRename

这和 SourceRename 字段是一模一样的,除了它是用来重命名与 SourceN 字段对应的压缩档外。参考其它有关的部分来了解使用的例子。

Source-MD5

从 fink 0.10.0 开始。 在这个字段中,你可以指定源程序文件的 MD5 校验值。 这个信息会被 Fink 用来检测是否使用了错误的源文件版本,也就是说, 那些和维护者所使用的版本不同的软件包。通常引起这个问题的原因是:未完全下载的压缩档;上游维护者在未通知的情况下修改了源代码;木马或类似的攻击;等等。

典型的使用例子是:

Source-MD5: 4499443fa1d604243467afe64522abac

要计算校验值,可以使用 md5sum 工具。如果你希望检查压缩档 /opt/sw/src/apache_1.3.23.tar.gz 的校验值, 你可以运行下面的命令(下面还包括命令的输出结果):

fingolfin% md5sum /opt/sw/src/apache_1.3.23.tar.gz 
4499443fa1d604243467afe64522abac  /opt/sw/src/apache_1.3.23.tar.gz

正如你所看见的一样,靠左边的数值就是你需要的结果。

SourceN-MD5

从 fink 0.10.0 开始。 这个字段和 Source-MD5 字段完全一样,除了它是指定与 SourceN 字段对应的压缩档的 MD5 校验值。

Source-Checksum

Alternative method to list the checksum for a source file. This field takes a hash type, followed by the actual checksum. For example:

Source-Checksum: SHA256(5048f1c8fc509cc636c2f97f4b40c293338b6041a5652082d5ee2cf54b530c56)

Current valid checksums are MD5, SHA1, and SHA256. The shasum tool can be used to calculate SHA checksums:

$ shasum -a 256 /opt/sw/src/libexif-0.6.22.tar.xz 
5048f1c8fc509cc636c2f97f4b40c293338b6041a5652082d5ee2cf54b530c56  /opt/sw/src/libexif-0.6.22.tar.xz

The Source-Checksum field should only be used once per .info file. If both the Source-MD5 and Source-Checksum fields are present, Source-Checksum takes precedence.

SourceN-Checksum

This is just the same as the Source-Checksum field, except that it is used to specify the checksum of the tarball specified by the corresponding SourceN field.

TarFilesRename

从 fink 0.10.0 开始。 这个字段只对那些使用 tar 格式的源程序文件有效。

通过这个字段,你可以在解压压缩档的时候,重命名给定的源程序压缩档里面的文件。这是针对 HFS+ 文件系统大小写不敏感的特性的一个解决办法。比方说在标准的 Mac OS X 环境下 installINSTALL 这两个文件会发生冲突。通过这个字段,你可以不需要重新建立一个新的压缩档(过去需要这样做)就可以避免这个问题。

这个字段中,你只需要简单第列出需要重命名的文件。你可以使用通配符。 默认情况下,这些文件名后面会被加上 _tmp。你可以通过使用在 FilesDocFiles 字段中的相同语法来修改这个默认行为,就是在原来的文件名后面加上一个冒号,然后再加上新的文件名。 例如:

TarFilesRename: foo bar.* qux:quux
Tar2FilesRename: directory/INSTALL:directory/INSTALL.txt
TarNFilesRename

从 fink 0.10.0 开始。 这和 TarFilesRename 字段一致,除了它作用于与 SourceN 字段对应的压缩档以外。

补丁阶段:

FieldValue
UpdateConfigGuess

一个布尔值。如果为真的话,构建目录中的 config.guess 和 config.sub 会被替换为了解 Darwin 的版本。这发生在补丁阶段,并在 PatchScript 运行之前。仅仅 在你确定必须这么做的时候才使用它,即,当配置脚本以 "unknown host" 而失败的时候。

UpdateConfigGuessInDirs

从 0.9.0 后 CVS 版本开始。 这是一些子目录的清单。 这和 UpdateConfigGuess 完成相同的工作,但只对那些在几个子目录里面的 config.guess 文件是过期的情况下使用。 以前,你需要在 PatchScript 中手工拷贝/移动那里面的文件。 而有了这个新的字段以后,你可以仅仅是列出目录。 使用 . 来更新处于构建目录本身的文件。

UpdateLibtool

这是一个布尔值。如果为真的话,那么构建目录里面的 ltconfig 和 ltmain.sh 文件会被替换为与 Darwin 兼容的版本。 这发生在补丁阶段,在 PatchScript 脚本运行之前。 仅仅在你肯定需要软件包需要它的时候才这样做。 有些软件包会因为替换不正确版本的 libtool 脚本而被破坏。 查看libtool 网页获取更进一步的信息。

UpdateLibtoolInDirs

从 0.9.0 后 CVS 版本开始。 一个子目录的清单。 它和 UpdateLibtool 的作用一样,但只对那些源代码中几个目录中有过期的 libtool 1.3.x 脚本的软件包有用。 以前你需要在 PatchScript 脚本中手工拷贝/移动这些文件。 有了这个新的字段以后,你只需要指定这些目录。 使用 . 来更新在构建目录本身里面的文件。

UpdatePoMakefile

一个布尔值。 为真的话,在 po 目录中的 Makefile.in.in 文件会被替换为打过补丁的版本。 这发生在补丁阶段,并在 PatchScript 脚本运行之前。

打过补丁的版本可以识别 DESTDIR 并确保信息目录是在 /opt/sw/share/locale,而不是 /opt/sw/lib/locale。 在使用这个字段之前,确定你不会破坏软件包以及的确有这个必要。 你可以运行 diff 命令来找出软件包的版本和 Fink 的版本的区别(在 /opt/sw/lib/fink/update)。

Patch

应用于 patch -p1 <patch-file 命令的补丁文件的名字。这应该只是一个文件名;正确的路径会被自动添加(the same directory where the .info file  is located)。 在本字段中会应用百分号展开。所以典型的设置值只是 %f.patch%n.patch。补丁会在 PatchScript 脚本运行之前 in a separate step 应用(如果有的话)。

记住 %n 包括所有 %type_ 变种数据,所以你可能需要在这里使用 %{ni} (也许需要包括一些特定的 %type_ 展开)。 维护一个单独的补丁文件,然后在 PatchScript 字段中列出与变种有关的修改会比对每个变种使用单独的补丁文件容易些。

PatchFile

The same syntax as the Patch field. The full path to this file is available using the %{PatchFile} percent expansion--do not use %a to access this file. Unlike Patch, PatchFile is applied as part of PatchScript. Fink checks that the listed file exists, is readable, and that its checksum matches the PatchFile-MD5 field.

You may not use both Patch and PatchFile in the same package description. Any package that uses PatchFile must declare at least BuildDepends: fink (>= 0.24.12). Giving a higher version requirement is allowed if it is necessary for other reasons.

PatchFile-MD5

The MD5 checksum of the file given in the PatchFile field. This field is required if PatchFile is used. (Introduced in fink-0.24.12)

PatchScript

在补丁阶段运行的一系列命令。这是对软件包打补丁或修改软件包的地方。 参阅下面关于脚本的注意事项。 在命令运行之前,会进行百分号展开。 If a PatchFile field exists, the default PatchScript is:

patch -p1 < %{PatchFile}

If there is no PatchFile, the default is blank. If you have an explicit PatchScript, you must apply the PatchFile explicitly.

编译阶段:

FieldValue
SetENVVAR

在编译和安装阶段设置一些环境变量。这可以用于传递一些编译器标志等信息到 configure 脚本和 Makefile 文件。目前支持的变量包括: CC, CFLAGS, CPP, CPPFLAGS, CXX, CXXFLAGS, DYLD_LIBRARY_PATH, JAVA_HOME, LD, LDFLAGS, LIBRARY_PATH, LIBS, MACOSX_DEPLOYMENT_TARGET, MAKE, MFLAGS, MAKEFLAGS。 你指定的值也会应用前面说过百分号展开。一个常见的例子是:

SetCPPFLAGS: -no-cpp-precomp

Some environment variables have default preset values. If you specify a value for one of these, it will be prepended to the default value. The preset variables (and their default values) are:

CPPFLAGS: -I%p/include
LDFLAGS: -L%p/lib

Starting in fink 0.26.0, there is one exception to these defaults: if Type: -64bit is set to -64bit, then the default value of LDFLAGS is -L%p/%lib -L%p/lib instead.

Finally, MACOSX_DEPLOYMENT_TARGET is set to a default value depending on which version of OSX is being run, but setting a value for it for a package will override (rather than prepend to) the default value.

NoSetENVVAR

When set to a true value, deactivates the default values for the preset variables (such as CPPFLAGS, LDFLAGS, CXXFLAGS mentioned above). For example, if you want LDFLAGS to remain unset, specify NoSetLDFLAGS: true .

ConfigureParams

传递给 configure 脚本的额外参数(查阅 CompileScript 字段的说明获取详细信息)。 For packages not of Type: Perl, the parameter --prefix=%p is prepended to this value. As of fink > 0.13.7, this field will also work with perl modules Type: Perl; the default perl Makefile.PL string is prepended to the value supplied for ConfigureParams.

If a build is being done with test suites enabled, the value of the TestConfigureParams field will be appended to the normal ConfigureParams value.

Starting in fink-0.22.0, this field supports conditionals. The syntax is the same as that used in the Depends and other package-list fields. The conditional expression only applies to the whitespace-delimited "word" immediately following it. For example

Type: -x11 (boolean)
ConfigureParams: --mandir=%p/share/man (%type_pkg[-x11]) --with-x11 --disable-shared

will always pass the --mandir and --disable-shared flags, but only pass --with-x11 in the -x11 variant.

GCC

This field specifies the GCC-ABI used by C++ code in this package. (It is needed because that ABI has changed twice, and any libraries which you link to containing C++ code must be compiled with the same ABI you are currently using.)

The allowed values are: 2.95.2 (or 2.95), 3.1, 3.3, and 4.0. Our understanding is that the GCC authors intend to stabilize the GCC-ABI at some point; we can hope that it won't change again.

The GCC field does not have a default value, per se, since it is ignored if it is not set. However, for each tree, there is an expected value for GCC corresponding to the default g++ compiler for that tree. The expected values for the various package trees are: 2.95 in the 10.1 tree, 3.1 in the 10.2 tree, 3.3 in the 10.2-gcc3.3, 10.3, and 10.4-transitional trees, and 4.0 in the (upcoming) 10.4 tree.

Note that when the GCC value is different from the expected value, the compiler must be specified within the package (typically by setting the CC or CXX flags), and a dependency on one of the (virtual) gcc packages should be specified.

对于 fink 0.13.8,如果使用了这个标志,会使用 gcc_select 来检测 gcc 的版本,如果检测到错误的版本,fink 会出错退出。

This field was added to fink to aid maintainers in tracking the transition between the gcc compilers, which introduced a binary incompatibility between libraries that involve C++ code which is not reflected in the versioning scheme.

CompileScript

在编译阶段运行的一系列命令。这里是放置配置和编译软件包的命令的地方。 参阅下面关于脚本的注意事项。 在命令运行之前,会进行百分号展开。 通常默认值是:

./configure %c
make

这对于使用 GNU autoconf 的软件包是恰当的。 对于那些是 perl (通过 Type 字段指定)类型,但却没有指明 perl 版本的软件包,默认的替代值是:

perl Makefile.PL PREFIX=%p \
 INSTALLPRIVLIB=%p/lib/perl5 \
 INSTALLARCHLIB=%p/lib/perl5/darwin \
 INSTALLSITELIB=%p/lib/perl5 \
 INSTALLSITEARCH=%p/lib/perl5/darwin \
 INSTALLMAN1DIR=%p/share/man/man1 \
 INSTALLMAN3DIR=%p/share/man/man3 \
 INSTALLSITEMAN1DIR=%p/share/man/man1 \
 INSTALLSITEMAN3DIR=%p/share/man/man3 \
 INSTALLBIN=%p/bin \
 INSTALLSITEBIN=%p/bin \
 INSTALLSCRIPT=%p/bin
make
make test

如果是指定版本的 perl $version 类型(比如 $version 可能是 5.6.0), 默认值是:

perl$version Makefile.PL \
 PERL=perl$version PREFIX=%p \
 INSTALLPRIVLIB=%p/lib/perl5/$version \
 INSTALLARCHLIB=%p/lib/perl5/$version/$perlarchdir \
 INSTALLSITELIB=%p/lib/perl5/$version \
 INSTALLSITEARCH=%p/lib/perl5/$version/$perlarchdir \
 INSTALLMAN1DIR=%p/share/man/man1 \
 INSTALLMAN3DIR=%p/share/man/man3 \
 INSTALLSITEMAN1DIR=%p/share/man/man1 \
 INSTALLSITEMAN3DIR=%p/share/man/man3 \
 INSTALLBIN=%p/bin \
 INSTALLSITEBIN=%p/bin \
 INSTALLSCRIPT=%p/bin
make
make test

where $perlarchdir is "darwin" for versions 5.8.0 and earlier, and is "darwin-thread-multi-2level" for versions 5.8.1 and later.

NoPerlTests

从 fink 0.13.7 之后开始。 一个针对 perl 模块软件包的布尔值。如果为真的话,CompileScriptmake test 部分会对那些指定的 perl 模块忽略。

Test Suites:

FieldValue
InfoTest

Introduced in fink 0.25. This field encapsulates information that will only be used when performing a build with test suites enabled. It contains other fields. If present, this field must contain a TestScript. All other fields are optional. The following fields are allowed inside InfoTest:

  • TestScript: A script which runs the test suite. This script should exit with status 0 if the suite passes, 1 to indicate warnings, or any other value to indicate failures serious enough to be considered fatal. Because of this tri-state logic, you should explicitly set an exit value in this script. For instance, make check is a bad script, since it will exit with status 1 if the check target doesn't exist. make check || exit 2 would be a better script.
  • TestConfigureParams: A value which will be appended to ConfigureParams.
  • TestDepends and TestConflicts: Lists of packages that will be added to the BuildDepends or BuildConflicts lists.
  • TestSource: Extra sources necessary to run the test suite. All of the affiliated fields are also supported, so you must also specify TestSource-MD5 or TestSource-Checksum, and you may also have TestSourceN and corresponding TestSourceN-MD5, TestSourceN-Checksum, TestTarFilesRename, etc.
  • TestSuiteSize: Describes approximately how long the test suite takes to run. Valid values are small, medium, and large. This field is currently ignored.
  • Any other standard field. If a field is specified both inside and outside InfoTest, the value inside InfoTest will replace the other value when test suites are active.

Here's an example:

InfoTest: <<
    TestScript: make check || exit 2
    TestConfigureParams: --enable-tests
<<

安装阶段:

FieldValue
UpdatePOD

从 fink 0.9.5 开始。 一个针对 perl 模块软件包的布尔值。 为真的话,它会添加代码到 install,postrm 和 postinst 脚本来维护 perl 软件包所提供的 .pod 文件。 这包括在中央的/opt/sw/lib/perl5/darwin/perllocal.pod文件中添加和删除 .pod 数据。 (如果类型是以 perl $version 这样包括特定版本的形式给出,例如 5.6.0,那么这些脚本会被用于处理在 /opt/sw/lib/perl5/$version/perllocal.pod 的中央 .pod 文件。)

InstallScript

一系列在安装阶段运行的命令。 这是把软件包的需要文件拷贝到正确的地方的指令。 参阅下面关于脚本的注意事项。 在命令运行之前,会进行百分号展开。 通常的默认值是:

make install prefix=%i

这么默认值对使用 GNU autoconf 的软件包是合适的。 对于那些 perl (通过 Type 字段指明) 模块类型的软件包, 如果没有指定 perl 版本的话, 默认的值为:

make install INSTALLPRIVLIB=%i/lib/perl5 \
 INSTALLARCHLIB=%i/lib/perl5/darwin \
 INSTALLSITELIB=%i/lib/perl5 \
 INSTALLSITEARCH=%i/lib/perl5/darwin \
 INSTALLMAN1DIR=%i/share/man/man1 \
 INSTALLMAN3DIR=%i/share/man/man3

如果类型是指定版本 perl $version (比如 $version 为 5.6.0)的 perl 模块, 默认值为:

make install INSTALLPRIVLIB=%i/lib/perl5/$version \
 INSTALLARCHLIB=%i/lib/perl5/$version/darwin \
 INSTALLSITELIB=%i/lib/perl5/$version \
 INSTALLSITEARCH=%i/lib/perl5/$version/darwin \
 INSTALLMAN1DIR=%i/share/man/man1 \
 INSTALLMAN3DIR=%i/share/man/man3

如果软件包支持的话,首选会使用 make install DESTDIR=%d

AppBundles

Introduced in a post-0.23.1 version. This field installs the specified application bundle(s) into %p/Applications. It will also create a symlink to the /Applications/Fink directory. Example:

AppBundles: build/*.app Foo.app
JarFiles

从 fink 0.10.0 开始。 这个字段和 DocFiles 有些类似。它安装指定的 jar 文件到 %p/share/java/%n 目录中。 例如:

JarFiles: lib/*.jar foo.jar:fooBar.jar

这将安装全部原来在 lib 目录中 jar 文件,同时会把 foo.jar 安装为 fooBar.jar。

它同时确保这些 jar 文件(尤其是:所有在 %p/share/java/%n 目录中以 .jar 结尾的文件) 被添加到 CLASSPATH 环境变量中。 这使得象 configure 或 ant 之类的工具能够正确地检测到已安装的 jar 文件。

DocFiles

这个字段提供一个安装软件包中 doc 目录中%p/share/doc/%n README 或 COPYING 文件的方便方法。 它的值是一些以空格分开的文件清单。 你可以从构建目录的子目录拷贝文件,但最后它们应该拷贝到 doc 目录本身,而不是它的子目录。 可以使用 Shell 通配符。 也可以在拷贝的同时重命名某个文件,这可以在一个冒号后面添加新的文件名来实现, 比如 libgimp/COPYING:COPYING.libgimp。 这个字段的功能是通过在 InstallScript 中添加合适的 install 命令。

Shlibs

从 fink 0.11.0 开始。 这个字段声明软件包中要安装的共享库。 There is one line for each shared library, which contains the -install_name of the library and information about its binary compatibility. Shared libraries that are "public" (i.e., provided for use by other packages) have, separated by whitespace after the filename, the -compatibility_version, versioned package dependency information specifying the Fink package which provides this library at this compatibility version, and the library architecture. (The library architecture may either be "32", "64", or "32-64", and may be absent; the value defaults to "32" if it is absent.) 依赖信息应该以下面的形式描述: foo (>= version-revision) 其中 version-revision 指提供(这个兼容版本)函数库的 Fink 软件包的 第一个版本。 Shlibs 声明表明维护者承诺这个名字和至少 -compatibility_version的兼容版本号的函数库会在这个 Fink 软件包的新版本中找到。 Shared libraries that are "private" are denoted by an exclamation mark preceeding the filename, and no compatilibity or versioning information is given. See the Shared Library Policy for more information.

RuntimeVars

从 fink 0.10.0 开始。 这个字段提供设置运行时环境变量为一些静态值的简便方法(如果你需要更灵活的方式,参考 profile.d 脚本部分)。在你的软件包安装以后,这些变量会通过 /opt/sw/bin/init.[c]sh 脚本设置。

你的环境的值可以包括空格(尾部的连续空格会被截断);另外,百分号展开也会进行。例如:

RuntimeVars: <<
 SomeVar: %p/Value
 AnotherVar: foo bar
<<

会设置两个环境变量 "SomeVar" 和 "AnotherVar",它们的值相应地被设置为 "/opt/sw/Value" (或你选择的前缀)以及 "foo bar"。

这个字段通过添加合适的命令到 InstallScript 来实现。 这些命令为每个变量添加一行 setenv/export 到软件包的 profile.d 脚本,所以你也提供你自己,它们不会被覆盖。这些行被作为脚本考虑,你可以在你的脚本中使用这些变量。

SplitOff

从 fink 0.9.9 开始。 在同一个编译/安装过程中产生第二个软件包。 有关详细信息,查看下面单独的 剥离(splitoff)部分

SplitOffN

Introduced in fink 0.9.9. 这和 SplitOff 一样,用于从同一个编译/安装过程产生第三、第四个等等软件包。 从 fink 0.19.2 后的一个 CVS 版本开始,你可以使用 N >=2 的任意整数值。不过,你仍然要保证它们是互不重复的。

Files

从 fink 0.9.9 开始。 SplitOffSplitOffN 字段内使用, 它用于指定哪些文件和目录需要从父文件包的安装目录 %I 移动到当前安装目录 %i。 注意这在父文件包的 InstallScript 和 DocFiles 之后,但在当前文件包的 InstallScript 和 Docfiles 之前执行。

构建阶段:

FieldValue
PreInstScript, PostInstScript, PreRmScript, PostRmScript

这些字段指明当软件包安装、升级或删除的时候执行的 shell 脚本。 Fink 会自动添加脚本的头部 #!/bin/sh,并调用 set -e,所以任何失败的命令都会导致脚本的立即终止。 Fink 还会在最后添加一个 exit 0。 要指明错误,从脚本中以一个非零值退出。 第一个参数 ($1) 被设为一个指明应该采用什么操作的值。 一些可能的值包括 installupgraderemovepurge。 注意还有更多的值,用于错误回退或因为另外一个文件包而删除的情况。

脚本会在下面的时候被调用:

  • PreInstScript: 当软件包第一次安装和升级到这个版本时。
  • PostInstScript: 解压和设置软件包之后。
  • PreRmScript: 软件包被删除或升级到新版本之前。
  • PostRmScript: 软件包被删除或升级到新版本之后。

更清楚地说,升级过程包括:新版本的 Inst scripts,和旧版本的 Rm scripts。 细节可以在 Debian 规则手册找到, 第六章.

脚本中会进行百分号展开。 命令通常会不使用完整路径来调用。

ConfFiles

以空格分开的用户可以编辑的配置文件的列表。 Percent expansion  is performed on this field. 这些文件必须以绝对路径指明,例如,%p/etc/%n.conf。 这些文件会被 dpkg 特别对待。 当软件包被升级,而软件包和磁盘上的文件相比被改动过的话,用户会被询问使用哪个版本,以及是否需要进行备份。 当一个软件包被删除后,配置文件仍然还保留在磁盘上。 只有 "purge" 会删除配置文件。

InfoDocs

软件包安装在 %p/share/info 目录的信息文件的清单。 这会在 postinst 和 prerm 脚本中添加合适的代码来维护 Info 目录的文件 dir文件。

Note: Only use the un-numbered file in the case of split Info documents. E.g. if a package has:

foo.info
foo.info-1
foo.info-2

you should only use:

InfoDocs:  foo.info

这个特性仍然在增加过程,将来可能会加入更多的字段以获得更精细的控制。

DaemonicFile

给出 daemonic 的服务描述。 daemonic 被 Fink 用于创建和删除 daemon 进程的 StartupItems (例如 web 服务器)。 描述会被作为一个名为 %p/etc/daemons/name.xml 的文件添加到软件包中,这里 name 由 DaemonicName 字段指定,默认为软件包名字。 对本字段的内容可以进行百分号展开。 注意如果你的软件包需要使用它的时候,你必须添加 daemonic 到依赖关系清单中。

DaemonicName

daemonic 服务描述文件的名字。 查看 DaemonicFile 字段的描述获取更多的信息。

额外数据:

FieldValue
Homepage

软件包上游提供者的首页 URL。

DescDetail

一个相比 Description 字段更详细的描述(内容包括它是什么,我可以用它来做什么?)。 这里允许使用多行。因为这个字段在显示的时候不会由自动单词绕回,你应该手工插入分行符,使得每行不超过 79 个字符(如果可能的话)。

DescUsage

这是对如果使用软件有关的信息(我怎么使用它?)。 就好象 "在使用 WindowMaker 运行 wmaker.inst 一次" 这样的信息。可以使用多行。因为这个字段在显示的时候不会由自动单词绕回,你应该手工插入分行符,使得每行不超过 79 个字符(如果可能的话)。

DescPackaging

关于软件包的注解。类似 "对 Makefile 进行修正已使得正确放置所有的文件" 之类的信息会放在这里。可以使用多行。

DescPort

这是专门针对移植到 Darwin 的软件包的。 象 "config.guess 和 libtool 脚本已被更新,需要使用 -no-cpp-precomp " 之类的信息会被放在这里。可以使用多行。

6.3 剥离分支(SplitOffs)

从 fink 0.9.9 开始,可以用一个单独的 .info 文件来构建多个软件包。 安装阶段和正常的类似,执行 InstallScriptDocFiles 命令。 如果存在 SplitOffSplitOffN 字段,会触发额外一个安装目录的创建。 在 SplitOffSplitOffN 字段里面,新的安装目录以 %i 代表, 而父文件包的原始安装目录则用 %I 代表。

每个 SplitOffSplitOffN 字段必须包含它自己的一系列字段。 事实上,它由一个备有包含字段的一个完整的软件包描述组成。下面是在子描述里面可以包含的内容(分类说明):

Because %n-%v-%r is treated as the unique identifier of a package, you must not have the same Package (at the same Version and Revision) listed as a SplitOff (or SplitOffN) of multiple packages. If you use variants, remember that each variant is considered an independent package, so the following package layout is forbidden:

Package: mime-base64-pm%type_pkg[perl]
Type: perl (5.8.1 5.8.6)
SplitOff: <<
  Package: mime-base64-pm-bin
<<

在安装阶段,父文件包的 InstallScriptDocFiles 会被首先执行。 然后处理 SplitOffSplitOffN 字段。对每个这种字段,Files 命令会导致命令中所列的文件和目录会从父文件包的安装目录 %I 移到当前的安装目录 %i。然后给定 SplitOffSplitOffN 软件包的 InstallScriptDocFiles 会被执行。

目前,SplitOff 会被首先执行(如果存在的话),然后是按照 N 的顺序执行每个 SplitOffN。 不过,在将来这可能会被改变。因此,例如:

SplitOff: <<
  Description: Some header files
  Files: include/foo.h include/bar.h
<<
SplitOff2: <<
  Description: All other header files
  Files: include/*
<<

只有 SplitOffSplitOff2 之前处理才是正确的。 比较安全的作法是在每个块中都显式列出每个文件(或使用更明确的文件名描述)。

在构建阶段,每个软件包的安装/删除的前/后脚本会通过相应软件包构建阶段的命令来生成。

每个被构建的软件包都要求把授权协议文件存放到 %i/share/doc/%n (当然对于每个软件包 %n 有不同的取值)目录中。 注意 DocFiles 是拷贝文件而不是移动它们,所以可以通过多次使用 DocFiles 命令而把一个相同文档拷贝安装在几个不同的地方。

6.4 脚本

PatchScript,CompileScript 和 InstallScript 字段允许你指定需要执行的 shell 命令。 构建目录(%b)是脚本执行的当前目录。 你应该总是使用相对路径名或百分号扩展来引用 fink 目录结构中的文件和目录,而不应该是绝对路径的形式。 它有两种形式。

这个字段可以是命令的简单罗列。它和一个 shell 脚本类似。不过,命令是通过 system() 调用执行的,每次一行,所以设置环境变量和更改路径只对同一行有效。从 fink 0.18.2 后的 CVS 版本开始,你可以用与普通 shell 脚本类似的方法来绕回太长的行: 在一行末尾的反斜线 (\) 表明下一行是一个续行。

作为替代方案,你可以在这里嵌入一个完整的脚本,使用你选择的解析器。 对于任何 Unix 脚本,第一行必须以 #! 开始,后面紧跟解析器的完整路径名以及需要的标志(例如 #!/bin/csh#!/bin/bash -ev等等)。在这种情况下,整个 *Script 字段会被写到一个临时文件,然后被执行。

6.5 补丁

如果你的软件包需要补丁采可以在 Darwin 上编译(或与 Fink 配合), 把补丁命名为与软件包描述文件相同的名字,使用 ".patch" 来取代 ".info" 作为扩展名,并把它放在和 .info 文件相同的目录下面。 如果你在文件名中使用完整的软件包名,那么使用下面的任意一种方式(它们是等效的):

Patch: %f.patch
PatchScript: patch -p1 <%a/%f.patch

如果你使用比较新的简单软件包命名约定,使用 %n 来代替 %f。这两个字段不是互斥的,你可以两个都使用,它们都会被执行。这种情况下,PatchScript 会在后面被执行。 Alternately, you can use the newer PatchFile instead of Patch and apply with an implicit or explicit PatchScript--see the descriptions of the PatchFile and PatchScript fields for more information.

因为你可能会在补丁文件中允许用户选择安装前缀,建议在补丁文件中使用类似 @PREFIX@ 的变量来代替 /opt/sw,然后使用:

PatchScript: sed 's|@PREFIX@|%p|g' <%a/%f.patch | patch -p1

补丁文件应该是 unidiff 格式,而且一般应该通过:

diff -urN <originalsourcedir> <patchedsourcedir>

命令产生。

如果你用过 emacs 编辑文件,你可以在上面的 diff 命令中加上 -x'*~' 来派出自动产生的后备文件。

另外需要注意的是非常大的补丁不应该放到 CVS 中。 它们应该被放到一个 web/ftp 服务器,并使用 SourceN: 字段来指明。如果你自己没有网站,fink 项目管理员可以把它放到 fink 自己的网站上。如果你的补丁大于 30Kb,你应该考虑把它作为一个单独的下载。

6.6 Profile.d 脚本

如果你的软件包需要一些运行时的初始化(例如,设置环境变量),你可以使用 profile.d 脚本。 这些脚本片段由 /opt/sw/bin/init.[c]sh 脚本所运行。通常,所有 fink 的用户都会把这些脚本放到它们的起动文件(.cshrc 或类似的文件)中。 你的软件包必须为两个变种都提供脚本:一个给 sh 兼容的 shells (sh, zsh, bash, ksh, ...) 而另一个给 csh 兼容的 shells (csh, tcsh)。它们应该被安装在 /opt/sw/etc/profile.d/%n.[c]sh (和往常一样,%n 代表软件包名)。 另外,它们的可读和可执行属性都应该被设置(即,用 -m 755 参数安装它们),否则它们不能被正确加载。

如果你只需要设置一些环境变量(例如,把 QTDIR 设置为 '/opt/sw'),你可以使用 RuntimeVars 字段来比较方便地实现这个所说的功能。