A file named
build directs the process of building and installing data files to be provided by binary packages. It must be a makefile, and it must be executable by all users (mode 0755 octal).
The first line of this file must name a make(1) interpreter in a magic number sample as follows:
#! /usr/bin/make -f
Any number of spaces and/or tabs may be used after the
#! magic number and before the
The following targets are required:
build target should perform all the configuration and compilation needed to produce files for installation into binary packages.
build target should create a file named
build in the build work area to prevent configuration and compilation from being performed multiple times.
build target must not do anything that might require superuser privilege.
install target should install data files into the data directories of binary packages (see § 7.2 for information on these directories).
install target should depend on the
install target shall be invoked as the superuser.
The required targets and their dependencies must not require interactive user input.
Additional targets may exist in the
Certain environment variables (see § 7.3) shall be set when the
build makefile is executed.
When building packages, a new directory named
tmp shall be created in the source package directory. In this directory, the package source code shall be copied or unpacked into a directory called
For each binary package, the
build file (see § 7.1) must create within the work area
tmp a directory named
<binpkg> is the name of the binary package. See § 4.5.2 for the requirements on binary package names.
Before installing binary package data files into
build file may stage them in a different directory immediately under the work area directory
tmp. For example, opkhelper's oh-autoinstall(1) installs files into
tmp/dest/ before oh-installfiles(1) moves them to
After all expected binary packages have been built, the work area (
tmp and its children) shall be removed.
Certain environment variables shall be set to provide to the configuration script and build makefile information about the package and the environments in and for which binary packages are to be built.
The following environment variables shall be set to describe the source package:
The source package name, as given in the most recent entry of the change log. See § 4.2 for more information on the source package name.
The source package version, as given in the most recent entry of the change log. See § 4.6 for the syntax of source package version identifiers.
A list of binary packages to be built.
This may not include all packages for which the source package has metadata. The
Architecture field of some packages may not match the host architecture for which packages are to be built. Only architecture-dependent or architecture-independent packages may have been selected for building.
The absolute path to the build work area (see § 7.2).
The terms "build system" and "host system" are used according to the convention set by GNU Autoconf. The build system is the type of system on which a package is built. The host system is the type of system on which a binary package is expected to be natively installed and used.
The following environment variables shall be set to describe the build system:
The distribution architecture string of the build system.
The CPU component of the distribution architecture string of the build system.
The kernel component of the distribution architecture string of the build system.
The system libraries component of the distribution architecture string of the build system.
The GNU system type of the build system.
The application platform of the build system.
The following environment variables shall be set to describe the host system:
The distribution architecture string of the host system.
The CPU component of the distribution architecture string of the host system.
The kernel component of the distribution architecture string of the host system.
The system libraries component of the distribution architecture string of the host system.
The GNU system type of the host system.
The application platform of the host system.
The following environment variables shall be set to describe the toolchain:
Note that this list of environment variables assumes the use of GNU Binutils, GCC, and the ELF binary format. Support for other toolchains may be specified in a future version of this source package format.