pkg-buildpackage — helper utility for building package suites
pkg-buildpackage [-b] [--uc] [ --nc | --no-pre-clean ] [--pre-clean] [ --rules-file | -R rules-command]
pkg-buildpackage uses rules-command to create a suite of packages.
What packages to create as part of the package suite, and how to create them, is entirely the private realm of rules-command.
rules-command defaults to debian/rules on Linux-based operating systems, and bsd/rules everywhere else.
If a substitute rules-command is given that unlike those does not contain a “/” character, then the value of the PATH environment variable is used to locate the command in the usual manner.
The -b and --uc options are compatibility options and are ignored. pkg-buildpackage only builds binary packages; not source packages, which are not even a concept with some packaging systems. It also has no direct involvement in package metadata, such as manifests, build info, description, and suchlike; and no mechanism for signing them.
Normally, pkg-buildpackage invokes rules-command three times:
rules-command clean
rules-command build
rules-command binary
The --nc and --no-pre-clean options cause the first invocation to be skipped. The --pre-clean option is a compatibility option that is ignored, as cleaning is the default behaviour.
{ clean | build | binary }rules-command
rules-command is an executable program that is invoked with subcommands:
Clean the staging areas for all packages, and any associated temporary areas.
Build the package contents from source into some work area.
Copy the built package contents from the work area into the actual binary package staging areas, and run tools to build the binary packages from those staging areas.
No shell is involved in executing rules-command.
It cannot be a shell function or alias, but it need not be a compiled program.
Indeed, the usual (but not required) implementation strategy is for it to be an executable Makefile(5) beginning with an interpreter line telling the kernel to give it to make(1) when executed.
#!/usr/bin/make -sf
rules-command must not require superuser privileges when executed.
Where package file and directory contents are to be owned by root (the usual case) or any other specific user, rules-command must supersede any file and directory ownerships that it finds in the filesystem when it creates the manifest listings for packages and archives their contents, rather than attempt to change them.
pkg-gencontrol(1) generates package manifests ignoring the actual file and directory ownerships, for example.