2014-03-22 05:26:09 +00:00
|
|
|
# The XBPS source packages manual
|
|
|
|
|
|
|
|
This article contains an exhaustive manual of how to create new source
|
|
|
|
packages for XBPS, the `Void Linux` native packaging system.
|
|
|
|
|
2016-10-11 16:30:46 +00:00
|
|
|
*Table of Contents*
|
2015-03-15 22:57:59 +00:00
|
|
|
|
|
|
|
* [Introduction](#Introduction)
|
2016-04-14 06:05:31 +00:00
|
|
|
* [Quality Requirements](#quality_requirements)
|
2015-03-15 22:57:59 +00:00
|
|
|
* [Package build phases](#buildphase)
|
|
|
|
* [Package naming conventions](#namingconvention)
|
|
|
|
* [Libraries](#libs)
|
|
|
|
* [Language Modules](#language_modules)
|
|
|
|
* [Language Bindings](#language_bindings)
|
|
|
|
* [Programs](#programs)
|
|
|
|
* [Global functions](#global_funcs)
|
|
|
|
* [Global variables](#global_vars)
|
|
|
|
* [Available variables](#available_vars)
|
|
|
|
* [Mandatory variables](#mandatory_vars)
|
|
|
|
* [Optional variables](#optional_vars)
|
2016-10-11 16:30:46 +00:00
|
|
|
* [About the depends variables](#explain_depends)
|
2015-03-15 22:57:59 +00:00
|
|
|
* [Repositories](#repositories)
|
|
|
|
* [Repositories defined by Branch](#repo_by_branch)
|
|
|
|
* [Package defined repositories](#pkg_defined_repo)
|
|
|
|
* [Checking for new upstream releases](#updates)
|
|
|
|
* [Build style scripts](#build_scripts)
|
|
|
|
* [Functions](#functions)
|
2015-03-16 05:45:04 +00:00
|
|
|
* [Build options](#build_options)
|
2015-03-15 22:57:59 +00:00
|
|
|
* [Runtime dependencies](#deps_runtime)
|
|
|
|
* [INSTALL and REMOVE files](#install_remove_files)
|
|
|
|
* [INSTALL.msg and REMOVE.msg files](#install_remove_files_msg)
|
|
|
|
* [Creating system accounts/groups at runtime](#runtime_account_creation)
|
|
|
|
* [32bit packages](#32bit_pkgs)
|
|
|
|
* [Subpackages](#pkgs_sub)
|
|
|
|
* [Development packages](#pkgs_development)
|
2015-09-28 07:07:16 +00:00
|
|
|
* [Data packages](#pkgs_data)
|
|
|
|
* [Documentation packages](#pkgs_documentation)
|
2015-03-15 22:57:59 +00:00
|
|
|
* [Python packages](#pkgs_python)
|
|
|
|
* [Go packages](#pkgs_go)
|
2015-09-14 15:06:38 +00:00
|
|
|
* [Haskell packages](#pkgs_haskell)
|
2015-03-15 22:57:59 +00:00
|
|
|
* [Notes](#notes)
|
|
|
|
* [Contributing via git](#contributing)
|
|
|
|
* [Help](#help)
|
2016-08-02 21:25:57 +00:00
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="Introduction"></a>
|
2014-03-22 05:26:09 +00:00
|
|
|
## Introduction
|
|
|
|
|
2014-10-09 15:24:27 +00:00
|
|
|
The `void-packages` repository contains all `source` packages that are the
|
2014-03-22 05:26:09 +00:00
|
|
|
recipes to download, compile and build binary packages for `Void`.
|
|
|
|
Those `source` package files are called `templates`.
|
|
|
|
|
|
|
|
The `template files` are `GNU bash` shell scripts that must define some required/optional
|
|
|
|
`variables` and `functions` that are processed by `xbps-src` (the package builder)
|
|
|
|
to generate the resulting binary packages.
|
|
|
|
|
|
|
|
A simple `template` example is as follows:
|
|
|
|
|
|
|
|
```
|
|
|
|
# Template file for 'foo'
|
|
|
|
|
|
|
|
pkgname="foo"
|
|
|
|
version="1.0"
|
|
|
|
revision=1
|
|
|
|
build_style=gnu-configure
|
|
|
|
short_desc="A short description max 72 chars"
|
|
|
|
maintainer="name <email>"
|
|
|
|
license="GPL-3"
|
|
|
|
homepage="http://www.foo.org"
|
|
|
|
distfiles="http://www.foo.org/foo-${version}.tar.gz"
|
|
|
|
checksum="fea0a94d4b605894f3e2d5572e3f96e4413bcad3a085aae7367c2cf07908b2ff"
|
|
|
|
```
|
|
|
|
|
|
|
|
The template file contains definitions to download, build and install the
|
|
|
|
package files to a `fake destdir`, and after this a binary package can be
|
|
|
|
generated with the definitions specified on it.
|
|
|
|
|
|
|
|
Don't worry if anything is not clear as it should be. The reserved `variables`
|
|
|
|
and `functions` will be explained later. This `template` file should be created
|
2014-10-09 15:24:27 +00:00
|
|
|
in a directory matching `$pkgname`, i.e: `void-packages/srcpkgs/foo/template`.
|
2014-03-22 05:56:05 +00:00
|
|
|
|
|
|
|
If everything went fine after running
|
|
|
|
|
2014-04-28 09:43:17 +00:00
|
|
|
$ ./xbps-src pkg <pkgname>
|
2016-08-02 21:25:57 +00:00
|
|
|
|
2014-03-22 05:56:05 +00:00
|
|
|
a binary package named `foo-1.0_1.<arch>.xbps` will be generated in the local repository
|
2014-04-22 15:01:03 +00:00
|
|
|
`hostdir/binpkgs`.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2016-04-14 06:05:31 +00:00
|
|
|
<a id="quality_requirements"></a>
|
|
|
|
### Quality Requirements
|
|
|
|
|
|
|
|
Follow this list to determine if a piece of software or other technology may be
|
|
|
|
permitted in the Void Linux repository. Exceptions to the list are possible,
|
|
|
|
and may be accepted, but are extremely unlikely. If you believe you have an
|
|
|
|
exception, start a PR and make an argument for why that particular piece of
|
|
|
|
software, while not meeting the below requirements, is a good candidate for
|
|
|
|
the Void packages system.
|
|
|
|
|
|
|
|
1. System: The software should be installed system-wide, not per-user.
|
|
|
|
|
2016-08-02 21:25:57 +00:00
|
|
|
1. Compiled: The software needs to be compiled before being used, even if it is
|
2016-04-14 06:05:31 +00:00
|
|
|
software that is not needed by the whole system.
|
|
|
|
|
|
|
|
1. Required: Another package either within the repository or pending inclusion
|
|
|
|
requires the package.
|
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="buildphase"></a>
|
2014-03-22 05:56:05 +00:00
|
|
|
### Package build phases
|
2014-03-22 05:26:09 +00:00
|
|
|
|
|
|
|
Building a package consist of the following phases:
|
|
|
|
|
2014-03-22 05:56:05 +00:00
|
|
|
- `setup` This phase prepares the environment for building a package.
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `fetch` This phase downloads required sources for a `source package`, as defined by
|
2014-03-22 05:26:09 +00:00
|
|
|
the `distfiles` variable or `do_fetch()` function.
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `extract` This phase extracts the `distfiles` files into `$wrksrc` or executes the `do_extract()`
|
2014-03-22 05:26:09 +00:00
|
|
|
function, which is the directory to be used to compile the `source package`.
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `configure` This phase executes the `configuration` of a `source package`, i.e `GNU configure scripts`.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `build` This phase compiles/prepares the `source files` via `make` or any other compatible method.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-05-02 07:05:29 +00:00
|
|
|
- `install` This phase installs the `package files` into the package destdir `<masterdir>/destdir/<pkgname>-<version>`,
|
2014-03-22 05:26:09 +00:00
|
|
|
via `make install` or any other compatible method.
|
|
|
|
|
2014-03-22 05:56:05 +00:00
|
|
|
- `pkg` This phase builds the `binary packages` with files stored in the
|
2014-03-22 05:26:09 +00:00
|
|
|
`package destdir` and registers them into the local repository.
|
|
|
|
|
2014-04-30 09:06:38 +00:00
|
|
|
- `clean` This phase cleans up the package (if defined).
|
|
|
|
|
2014-03-22 05:26:09 +00:00
|
|
|
`xbps-src` supports running just the specified phase, and if it ran
|
|
|
|
successfully, the phase will be skipped later (unless its work directory
|
|
|
|
`${wrksrc}` is removed with `xbps-src clean`).
|
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="namingconventions"></a>
|
2014-05-01 20:04:58 +00:00
|
|
|
### Package naming conventions
|
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="libs"></a>
|
2014-05-01 20:04:58 +00:00
|
|
|
#### Libraries
|
|
|
|
|
2014-05-02 06:05:55 +00:00
|
|
|
Libraries are packages which provide shared objects (\*.so) in /usr/lib.
|
2014-05-01 20:04:58 +00:00
|
|
|
They should be named like their upstream package name with the following
|
|
|
|
exceptions:
|
|
|
|
|
|
|
|
- The package is a subpackage of a front end application providing and provides
|
|
|
|
shared objects used by the base package and other third party libraries. In that
|
|
|
|
case it should be prefixed with 'lib'. An exception from that rule is: If an
|
|
|
|
executable is only used for building that package, it moves to the -devel
|
|
|
|
package.
|
|
|
|
|
|
|
|
Example: wireshark -> subpkg libwireshark
|
|
|
|
|
|
|
|
Libraries have to be split into two sub packages: <name> and <name>-devel.
|
|
|
|
|
|
|
|
- `<name>` should only contain those parts of a package which are needed to run
|
2014-09-03 15:00:53 +00:00
|
|
|
a linked program.
|
2014-05-01 20:04:58 +00:00
|
|
|
|
|
|
|
- `<name>-devel` should contain all files which are needed to compile a package
|
2014-05-20 09:02:25 +00:00
|
|
|
against this package. If the library is a sub package, its corresponding
|
|
|
|
development package should be named `lib<name>-devel`
|
2014-05-01 20:04:58 +00:00
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="language_modules"></a>
|
2014-05-01 20:04:58 +00:00
|
|
|
#### Language Modules
|
|
|
|
|
|
|
|
Language modules are extensions to script or compiled languages. Those packages
|
2014-05-02 06:05:55 +00:00
|
|
|
do not provide any executables themselves, but can be used by other packages
|
2014-05-01 20:04:58 +00:00
|
|
|
written in the same language.
|
|
|
|
|
|
|
|
The naming convention to those packages is:
|
|
|
|
|
|
|
|
```
|
|
|
|
<language>-<name>
|
|
|
|
```
|
|
|
|
|
|
|
|
If a package provides both, a module and a executable, it should be split into
|
|
|
|
a package providing the executable named `<name>` and the module named
|
|
|
|
`<language>-<name>`. If a package starts with the languages name itself, the
|
|
|
|
language prefix can be dropped. Short names for languages are no valid substitute
|
|
|
|
for the language prefix.
|
|
|
|
|
|
|
|
Example: python-pam, perl-URI, python-pyside
|
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="language_bindings"></a>
|
2014-05-01 20:04:58 +00:00
|
|
|
#### Language Bindings
|
|
|
|
|
2014-09-04 14:45:57 +00:00
|
|
|
Language Bindings are packages which allow programs or libraries to have
|
2015-06-28 09:14:05 +00:00
|
|
|
extensions or plugins written in a certain language.
|
2014-05-01 20:04:58 +00:00
|
|
|
|
|
|
|
The naming convention to those packages is:
|
|
|
|
```
|
|
|
|
<name>-<language>
|
|
|
|
```
|
|
|
|
|
2014-09-04 14:45:57 +00:00
|
|
|
Example: gimp-python, irssi-perl
|
2014-05-01 20:04:58 +00:00
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="programs"></a>
|
2014-05-01 20:04:58 +00:00
|
|
|
#### Programs
|
|
|
|
|
|
|
|
Programs put executables under /usr/bin (or in very special cases in other
|
|
|
|
.../bin directories)
|
|
|
|
|
|
|
|
For those packages the upstream packages name should be used. Remember that
|
|
|
|
in contrast to many other distributions, void doesn't lowercase package names.
|
|
|
|
As a rule of thumb, if the tar.gz of a package contains uppercase letter, then
|
|
|
|
the package name should contain them too; if it doesn't, the package name
|
|
|
|
is lowercase.
|
|
|
|
|
|
|
|
Programs can be split into program packages and library packages. The program
|
|
|
|
package should be named as describe above. The library package should be prefix
|
|
|
|
with "lib" (see section `Libraries`)
|
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="global_funcs"></a>
|
2014-03-22 05:26:09 +00:00
|
|
|
### Global functions
|
|
|
|
|
|
|
|
The following functions are defined by `xbps-src` and can be used on any template:
|
|
|
|
|
|
|
|
- *vinstall()* `vinstall <file> <mode> <targetdir> [<name>]`
|
|
|
|
|
2017-02-01 21:52:42 +00:00
|
|
|
Installs `file` with the specified `mode` into `targetdir` in the pkg `$DESTDIR`.
|
|
|
|
The optional 4th argument can be used to change the `file name`.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
|
|
|
- *vcopy()* `vcopy <pattern> <targetdir>`
|
|
|
|
|
2017-02-01 21:52:42 +00:00
|
|
|
Copies recursively all files in `pattern` to `targetdir` in the pkg `$DESTDIR`.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
|
|
|
- *vmove()* `vmove <pattern>`
|
|
|
|
|
2017-02-01 21:52:42 +00:00
|
|
|
Moves `pattern` to the specified directory in the pkg `$DESTDIR`.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
|
|
|
- *vmkdir()* `vmkdir <directory> [<mode>]`
|
|
|
|
|
|
|
|
Creates a directory in the pkg `$DESTDIR`. The 2nd optional argument sets the mode of the directory.
|
|
|
|
|
2014-07-04 05:42:16 +00:00
|
|
|
- *vbin()* `vbin <file> [<name>]`
|
|
|
|
|
2014-07-05 16:17:01 +00:00
|
|
|
Installs `file` into `usr/bin` in the pkg `$DESTDIR` with the
|
2014-07-04 05:42:16 +00:00
|
|
|
permissions 0755. The optional 2nd argument can be used to change
|
|
|
|
the `file name`.
|
|
|
|
|
2014-07-04 14:15:00 +00:00
|
|
|
- *vman()* `vman <file> [<name>]`
|
2014-07-04 05:42:16 +00:00
|
|
|
|
2014-07-04 14:15:00 +00:00
|
|
|
Installs `file` as a man page. `vman()` parses the name and
|
|
|
|
determines the section as well as localization. Example mappings:
|
|
|
|
|
2016-10-11 16:30:46 +00:00
|
|
|
`foo.1` -> `${DESTDIR}/usr/share/man/man1/foo.1`
|
|
|
|
`foo.fr.1` -> `${DESTDIR}/usr/share/man/fr/man1/foo.1`
|
|
|
|
`foo.1p` -> `${DESTDIR}/usr/share/man/man1/foo.1p`
|
2014-07-04 05:42:16 +00:00
|
|
|
|
|
|
|
- *vdoc()* `vdoc <file> [<name>]`
|
|
|
|
|
2014-07-05 16:17:01 +00:00
|
|
|
Installs `file` into `usr/share/doc/<pkgname>` in the pkg
|
2014-07-04 05:42:16 +00:00
|
|
|
`$DESTDIR`. The optional 2nd argument can be used to change the
|
|
|
|
`file name`.
|
|
|
|
|
2014-07-17 17:36:52 +00:00
|
|
|
- *vconf()* `vconf <file> [<name>]`
|
|
|
|
|
|
|
|
Installs `file` into `etc` in the pkg
|
|
|
|
`$DESTDIR`. The optional 2nd argument can be used to change the
|
|
|
|
`file name`.
|
|
|
|
|
2014-07-04 05:42:16 +00:00
|
|
|
- *vsconf()* `vsconf <file> [<name>]`
|
|
|
|
|
2014-07-05 16:17:01 +00:00
|
|
|
Installs `file` into `usr/share/examples/<pkgname>` in the pkg
|
2014-07-04 05:42:16 +00:00
|
|
|
`$DESTDIR`. The optional 2nd argument can be used to change the
|
|
|
|
`file name`.
|
|
|
|
|
|
|
|
- *vlicense()* `vlicense <file> [<name>]`
|
|
|
|
|
2014-07-05 16:17:01 +00:00
|
|
|
Installs `file` into `usr/share/licenses/<pkgname>` in the pkg
|
2014-07-04 05:42:16 +00:00
|
|
|
`$DESTDIR`. The optional 2nd argument can be used to change the
|
2016-08-02 21:25:57 +00:00
|
|
|
`file name`. Note: Non-`GPL` licenses, `MIT`, `BSD` and `ISC` require the
|
2015-08-29 00:01:55 +00:00
|
|
|
license file to be supplied with the binary package.
|
2014-07-04 05:42:16 +00:00
|
|
|
|
2015-02-17 14:40:04 +00:00
|
|
|
- *vsv()* `vsv <service>`
|
|
|
|
|
2014-10-13 09:09:07 +00:00
|
|
|
Installs `service` from `${FILESDIR}` to /etc/sv. The service must
|
2015-02-17 15:23:39 +00:00
|
|
|
be a directory containing at least a run script. Note the `supervise`
|
|
|
|
symlink will be created automatically by `vsv`.
|
2015-06-28 09:14:05 +00:00
|
|
|
For further information on how to create a new service directory see
|
2014-10-13 09:09:07 +00:00
|
|
|
[The corresponding section the FAQ](http://smarden.org/runit/faq.html#create).
|
|
|
|
|
2014-03-22 06:05:45 +00:00
|
|
|
> Shell wildcards must be properly quoted, i.e `vmove "usr/lib/*.a"`.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="global_vars"></a>
|
2014-03-22 05:26:09 +00:00
|
|
|
### Global variables
|
|
|
|
|
|
|
|
The following variables are defined by `xbps-src` and can be used on any template:
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `makejobs` Set to `-jX` if `XBPS_MAKEJOBS` is defined, to allow parallel jobs with `GNU make`.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `sourcepkg` Set to the to main package name, can be used to match the main package
|
2014-03-22 05:26:09 +00:00
|
|
|
rather than additional binary package names.
|
|
|
|
|
2014-09-04 14:45:57 +00:00
|
|
|
- `CHROOT_READY` Set if the target chroot (masterdir) is ready for chroot builds.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-09-04 14:45:57 +00:00
|
|
|
- `CROSS_BUILD` Set if `xbps-src` is cross compiling a package.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `DESTDIR` Full path to the fake destdir used by the source pkg, set to
|
2014-04-22 15:01:03 +00:00
|
|
|
`<masterdir>/destdir/${sourcepkg}-${version}`.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `FILESDIR` Full path to the `files` package directory, i.e `srcpkgs/foo/files`.
|
2014-03-22 05:26:09 +00:00
|
|
|
The `files` directory can be used to store additional files to be installed
|
|
|
|
as part of the source package.
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `PKGDESTDIR` Full path to the fake destdir used by the `pkg_install()` function in
|
2014-04-22 15:01:03 +00:00
|
|
|
`subpackages`, set to `<masterdir>/destdir/${pkgname}-${version}`.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `XBPS_BUILDDIR` Directory to store the `source code` of the source package being processed,
|
2014-04-22 15:01:03 +00:00
|
|
|
set to `<masterdir>/builddir`. The package `wrksrc` is always stored
|
2014-04-04 11:10:04 +00:00
|
|
|
in this directory such as `${XBPS_BUILDDIR}/${wrksrc}`.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `XBPS_MACHINE` The machine architecture as returned by `uname -m`.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `XBPS_SRCDISTDIR` Full path to where the `source distfiles` are stored, i.e `$XBPS_HOSTDIR/sources`.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `XBPS_SRCPKGDIR` Full path to the `srcpkgs` directory.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `XBPS_TARGET_MACHINE` The target machine architecture when cross compiling a package.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `XBPS_FETCH_CMD` The utility to fetch files from `ftp`, `http` of `https` servers.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="available_vars"></a>
|
2014-03-22 05:26:09 +00:00
|
|
|
### Available variables
|
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="mandatory_vars"></a>
|
2014-03-22 05:26:09 +00:00
|
|
|
#### Mandatory variables
|
|
|
|
|
|
|
|
The list of mandatory variables for a template:
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `homepage` A string pointing to the `upstream` homepage.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `license` A string matching any license file available in `/usr/share/licenses`.
|
2014-03-22 05:26:09 +00:00
|
|
|
Multiple licenses should be separated by commas, i.e `GPL-3, LGPL-2.1`.
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `maintainer` A string in the form of `name <user@domain>`.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `pkgname` A string with the package name, matching `srcpkgs/<pkgname>`.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `revision` A number that must be set to 1 when the `source package` is created, or
|
2014-03-22 05:26:09 +00:00
|
|
|
updated to a new `upstream version`. This should only be increased when
|
|
|
|
the generated `binary packages` have been modified.
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `short_desc` A string with a brief description for this package. Max 72 chars.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `version` A string with the package version. Must not contain dashes and at least
|
2014-03-22 05:26:09 +00:00
|
|
|
one digit is required.
|
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="optional_vars"></a>
|
2014-03-22 05:26:09 +00:00
|
|
|
#### Optional variables
|
|
|
|
|
2014-07-30 15:58:17 +00:00
|
|
|
- `hostmakedepends` The list of `host` dependencies required to build the package, and
|
2015-03-27 09:50:40 +00:00
|
|
|
that will be installed to the master directory. There is no need to specify a version
|
|
|
|
because the current version in srcpkgs will always be required.
|
|
|
|
Example `hostmakedepends="foo blah"`.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-07-30 15:58:17 +00:00
|
|
|
- `makedepends` The list of `target` dependencies required to build the package, and that
|
2015-03-27 09:50:40 +00:00
|
|
|
will be installed to the master directory. There is no need to specify a version
|
|
|
|
because the current version in srcpkgs will always be required.
|
|
|
|
Example `makedepends="foo blah"`.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-07-30 15:58:17 +00:00
|
|
|
- `depends` The list of dependencies required to run the package. These dependencies
|
|
|
|
are not installed to the master directory, rather are only checked if a binary package
|
|
|
|
in the local repository exists to satisfy the required version. Dependencies
|
2014-03-22 06:19:51 +00:00
|
|
|
can be specified with the following version comparators: `<`, `>`, `<=`, `>=`
|
|
|
|
or `foo-1.0_1` to match an exact version. If version comparator is not
|
|
|
|
defined (just a package name), the version comparator is automatically set to `>=0`.
|
|
|
|
Example `depends="foo blah>=1.0"`. See the `Runtime dependencies` section for more information.
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `bootstrap` If enabled the source package is considered to be part of the `bootstrap`
|
2014-03-22 05:26:09 +00:00
|
|
|
process and required to be able to build packages in the chroot. Only a
|
|
|
|
small number of packages must set this property.
|
|
|
|
|
2015-08-21 14:15:41 +00:00
|
|
|
- `conflicts` An optional list of packages conflicting with this package.
|
|
|
|
Conflicts can be specified with the following version comparators: `<`, `>`, `<=`, `>=`
|
|
|
|
or `foo-1.0_1` to match an exact version. If version comparator is not
|
|
|
|
defined (just a package name), the version comparator is automatically set to `>=0`.
|
|
|
|
Example `conflicts="foo blah>=0.42.3"`.
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `distfiles` The full URL to the `upstream` source distribution files. Multiple files
|
2014-03-22 05:26:09 +00:00
|
|
|
can be separated by whitespaces. The files must end in `.tar.lzma`, `.tar.xz`,
|
|
|
|
`.txz`, `.tar.bz2`, `.tbz`, `.tar.gz`, `.tgz`, `.gz`, `.bz2`, `.tar` or
|
|
|
|
`.zip`. To define a target filename, append `>filename` to the URL.
|
|
|
|
Example:
|
|
|
|
distfiles="http://foo.org/foo-1.0.tar.gz http://foo.org/bar-1.0.tar.gz>bar.tar.gz"
|
|
|
|
|
2014-08-23 16:19:21 +00:00
|
|
|
To avoid repetition, several variables for common hosting sites
|
|
|
|
exist:
|
|
|
|
|
|
|
|
| Variable | Value |
|
|
|
|
|------------------|-------------------------------------------------|
|
|
|
|
| CPAN_SITE | http://cpan.perl.org/modules/by-module |
|
|
|
|
| DEBIAN_SITE | http://ftp.debian.org/debian/pool |
|
|
|
|
| FREEDESKTOP_SITE | http://freedesktop.org/software |
|
|
|
|
| GNOME_SITE | http://ftp.gnome.org/pub/GNOME/sources |
|
|
|
|
| GNU_SITE | http://mirrors.kernel.org/gnu |
|
|
|
|
| KERNEL_SITE | http://www.kernel.org/pub/linux |
|
2016-02-14 11:08:24 +00:00
|
|
|
| MOZILLA_SITE | http://ftp.mozilla.org/pub |
|
2014-08-23 16:19:21 +00:00
|
|
|
| NONGNU_SITE | http://download.savannah.nongnu.org/releases |
|
2016-05-13 15:35:35 +00:00
|
|
|
| PYPI_SITE | https://files.pythonhosted.org/packages/source |
|
2014-08-23 16:19:21 +00:00
|
|
|
| SOURCEFORGE_SITE | http://downloads.sourceforge.net/sourceforge |
|
|
|
|
| UBUNTU_SITE | http://archive.ubuntu.com/ubuntu/pool |
|
|
|
|
| XORG_HOME | http://xorg.freedesktop.org/wiki/ |
|
|
|
|
| XORG_SITE | http://xorg.freedesktop.org/releases/individual |
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `checksum` The `sha256` digests matching `${distfiles}`. Multiple files can be
|
2014-03-22 05:26:09 +00:00
|
|
|
separated by blanks. Please note that the order must be the same than
|
|
|
|
was used in `${distfiles}`. Example `checksum="kkas00xjkjas"`
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `wrksrc` The directory name where the package sources are extracted, by default
|
2014-03-22 05:26:09 +00:00
|
|
|
set to `${pkgname}-${version}`.
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `build_wrksrc` A directory relative to `${wrksrc}` that will be used when building the package.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `create_wrksrc` Enable it to create the `${wrksrc}` directory. Required if a package
|
2014-03-22 05:26:09 +00:00
|
|
|
contains multiple `distfiles`.
|
|
|
|
|
2017-01-08 12:46:15 +00:00
|
|
|
- `only_for_archs` This expects a separated list of architectures where
|
|
|
|
the package can be built matching `uname -m` output. Reserved for uses
|
|
|
|
where the program really only will ever work on certain architectures, like
|
|
|
|
binary distributions or where the program is written in assembly. Example
|
|
|
|
`only_for_archs="x86_64 armv6l"`.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `build_style` This specifies the `build method` for a package. Read below to know more
|
2014-03-22 05:26:09 +00:00
|
|
|
about the available package `build methods`. If `build_style` is not set,
|
|
|
|
the package must define at least a `do_install()` function, and optionally
|
|
|
|
more build phases as such `do_configure()`, `do_build()`, etc.
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `configure_script` The name of the `configure` script to execute at the `configure` phase if
|
2014-03-22 05:26:09 +00:00
|
|
|
`${build_style}` is set to `configure` or `gnu-configure` build methods.
|
|
|
|
By default set to `./configure`.
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `configure_args` The arguments to be passed in to the `configure` script if `${build_style}`
|
2014-03-22 05:26:09 +00:00
|
|
|
is set to `configure` or `gnu-configure` build methods. By default, prefix
|
|
|
|
must be set to `/usr`. In `gnu-configure` packages, some options are already
|
|
|
|
set by default: `--prefix=/usr --sysconfdir=/etc --infodir=/usr/share/info --mandir=/usr/share/man --localstatedir=/var`.
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `make_cmd` The executable to run at the `build` phase if `${build_style}` is set to
|
2014-03-22 05:26:09 +00:00
|
|
|
`configure`, `gnu-configure` or `gnu-makefile` build methods.
|
|
|
|
By default set to `make`.
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `make_build_args` The arguments to be passed in to `${make_cmd}` at the build phase if
|
2015-05-31 18:57:33 +00:00
|
|
|
`${build_style}` is set to `configure`, `gnu-configure` or `gnu-makefile`
|
2014-03-22 05:26:09 +00:00
|
|
|
build methods. Unset by default.
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `make_install_args` The arguments to be passed in to `${make_cmd}` at the `install-destdir`
|
2014-03-22 05:26:09 +00:00
|
|
|
phase if `${build_style}` is set to `configure`, `gnu-configure` or
|
2015-05-31 18:57:33 +00:00
|
|
|
`gnu-makefile` build methods. By default set to
|
2014-03-22 05:26:09 +00:00
|
|
|
`PREFIX=/usr DESTDIR=${DESTDIR}`.
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `make_build_target` The target to be passed in to `${make_cmd}` at the build phase if
|
2015-05-31 18:57:33 +00:00
|
|
|
`${build_style}` is set to `configure`, `gnu-configure` or `gnu-makefile`
|
2014-03-22 05:26:09 +00:00
|
|
|
build methods. Unset by default (`all` target).
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `make_install_target` The target to be passed in to `${make_cmd}` at the `install-destdir` phase
|
2015-05-31 18:57:33 +00:00
|
|
|
if `${build_style}` is set to `configure`, `gnu-configure` or `gnu-makefile`
|
2014-03-22 05:26:09 +00:00
|
|
|
build methods. By default set to `install`.
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `patch_args` The arguments to be passed in to the `patch(1)` command when applying
|
2014-03-22 05:26:09 +00:00
|
|
|
patches to the package sources after `do_extract()`. Patches are stored in
|
|
|
|
`srcpkgs/<pkgname>/patches` and must be in `-p0` format. By default set to `-Np0`.
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `disable_parallel_build` If set the package won't be built in parallel
|
2014-03-22 05:26:09 +00:00
|
|
|
and `XBPS_MAKEJOBS` has no effect.
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `keep_libtool_archives` If enabled the `GNU Libtool` archives won't be removed. By default those
|
2014-03-22 05:26:09 +00:00
|
|
|
files are always removed automatically.
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `skip_extraction` A list of filenames that should not be extracted in the `extract` phase.
|
2014-03-22 05:26:09 +00:00
|
|
|
This must match the basename of any url defined in `${distfiles}`.
|
|
|
|
Example `skip_extraction="foo-${version}.tar.gz"`.
|
|
|
|
|
2014-11-16 10:52:36 +00:00
|
|
|
- `nodebug` If enabled -dbg packages won't be generated even if `XBPS_DEBUG_PKGS` is set.
|
2014-10-11 07:57:27 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `conf_files` A list of configuration files the binary package owns; this expects full
|
2015-11-26 07:31:02 +00:00
|
|
|
paths, wildcards will be extended, and multiple entries can be separated by blanks i.e:
|
|
|
|
`conf_files="/etc/foo.conf /etc/foo2.conf /etc/foo/*.conf"`.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2016-08-02 21:25:57 +00:00
|
|
|
- `mutable_files` A list of files the binary package owns, with the expectation
|
|
|
|
that those files will be changed. These act a lot like `conf_files` but
|
2016-05-01 08:49:30 +00:00
|
|
|
without the assumption that a human will edit them.
|
|
|
|
|
2016-04-27 09:51:06 +00:00
|
|
|
- `make_dirs` A list of entries defining directories and permissions to be
|
|
|
|
created at install time. Each entry should be space separated, and will
|
|
|
|
itself contain spaces. `make_dirs="/dir 0750 user group"`. User and group and
|
|
|
|
mode are required on every line, even if they are `755 root root`. By
|
|
|
|
convention, there is only one entry of `dir perms user group` per line.
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `noarch` If set, the binary package is not architecture specific and can be shared
|
2014-03-22 05:26:09 +00:00
|
|
|
by all supported architectures.
|
|
|
|
|
2014-11-01 12:41:38 +00:00
|
|
|
- `repository` Defines the repository in which the package will be placed. See
|
|
|
|
*Repositories* for a list of valid repositories.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `nostrip` If set, the ELF binaries with debugging symbols won't be stripped. By
|
2014-03-22 05:26:09 +00:00
|
|
|
default all binaries are stripped.
|
|
|
|
|
2015-02-05 10:37:10 +00:00
|
|
|
- `noshlibprovides` If set, the ELF binaries won't be inspected to collect the provided
|
|
|
|
sonames in shared libraries.
|
|
|
|
|
2014-08-22 14:47:35 +00:00
|
|
|
- `nocross` If set, cross compilation won't be allowed and will exit immediately.
|
2017-03-16 19:20:53 +00:00
|
|
|
This should be set to a string describing why it fails, or a link to a travis
|
|
|
|
buildlog demonstrating the failure.
|
2014-08-21 10:07:44 +00:00
|
|
|
|
2017-03-26 04:19:56 +00:00
|
|
|
- `restricted` If set, xbps-src will refuse to build the package unless
|
|
|
|
`etc/conf` has `XBPS_ALLOW_RESTRICTED=yes`. The primary builders for Void
|
|
|
|
Linux do not have this setting, so the primary repositories will not have any
|
|
|
|
restricted package. This is useful for packages where the license forbids
|
|
|
|
redistribution.
|
|
|
|
|
2014-07-23 13:44:36 +00:00
|
|
|
- `subpackages` A white space separated list of subpackages (matching `foo_package()`)
|
|
|
|
to override the guessed list. Only use this if a specific order of subpackages is required,
|
|
|
|
otherwise the default would work in most cases.
|
|
|
|
|
2014-08-22 14:47:35 +00:00
|
|
|
- `broken` If set, building the package won't be allowed because its state is currently broken.
|
2017-03-16 19:20:53 +00:00
|
|
|
This should be set to a string describing why it is broken, or a link to a travis
|
|
|
|
buildlog demonstrating the failure.
|
2014-08-22 14:47:35 +00:00
|
|
|
|
2014-09-10 09:23:33 +00:00
|
|
|
- `shlib_provides` A white space separated list of additional sonames the package provides on.
|
|
|
|
This appends to the generated file rather than replacing it.
|
|
|
|
|
|
|
|
- `shlib_requires` A white space separated list of additional sonames the package requires.
|
|
|
|
This appends to the generated file rather than replacing it.
|
|
|
|
|
2016-08-02 21:25:57 +00:00
|
|
|
- `nopie` Only needs to be set to something to make active, disables building the package with hardening
|
2015-11-17 10:13:11 +00:00
|
|
|
features (PIE, relro, etc). Not necessary for most packages.
|
|
|
|
|
2014-09-28 07:33:28 +00:00
|
|
|
- `reverts` xbps supports a unique feature which allows to downgrade from broken
|
2014-09-29 22:14:01 +00:00
|
|
|
packages automatically. In the `reverts` field one can define a list of broken
|
2014-09-28 07:33:28 +00:00
|
|
|
pkgver the resulting package should revert. This field *must* be defined before
|
2014-09-29 06:30:42 +00:00
|
|
|
`version` and `revision` fields in order to work as expected. The versions
|
2016-01-13 13:30:25 +00:00
|
|
|
defined in `reverts` must be bigger than the one defined in `version`.
|
|
|
|
Example:
|
|
|
|
|
|
|
|
```
|
|
|
|
reverts="2.0_1 2.0_2"
|
|
|
|
version=1.9
|
|
|
|
revision=2
|
|
|
|
```
|
2014-09-28 07:33:28 +00:00
|
|
|
|
2015-10-30 11:39:59 +00:00
|
|
|
- `alternatives` A white space separated list of supported alternatives the package provides.
|
|
|
|
A list is composed of three components separated by a colon: group, symlink and target.
|
|
|
|
i.e `alternatives="vi:/usr/bin/vi:/usr/bin/nvi ex:/usr/bin/ex:/usr/bin/nvi-ex"`.
|
|
|
|
|
2016-10-11 16:30:46 +00:00
|
|
|
<a id="explain_depends"></a>
|
|
|
|
#### About the many types of `depends` variable.
|
|
|
|
|
|
|
|
So far we have listed three types of `depends`, there are `hostmakedepends`,
|
|
|
|
`makedepends`, and plain old `depends`. To understand the difference between
|
|
|
|
them, understand this: Void Linux cross compiles for many arches. Sometimes in
|
|
|
|
a build process, certain programs must be run, for example `yacc`, or the
|
|
|
|
compiler itself for a C program. Those programs get put in `hostmakedepends`.
|
|
|
|
When the build runs, those will be installed on the host to help the build
|
2017-01-13 20:33:01 +00:00
|
|
|
complete.
|
2016-10-11 16:30:46 +00:00
|
|
|
|
|
|
|
Then there are those things for which a package either links against or
|
|
|
|
includes header files. These are `makedepends`, and regardless of the
|
|
|
|
architecture of the build machine, the architecture of the target machine must
|
|
|
|
be used. Typically the `makedepends` will be the only one of the three types of
|
|
|
|
`depends` to include `-devel` packages, and typically only `-devel` packages.
|
|
|
|
|
|
|
|
The final variable, `depends`, is for those things the package needs at
|
|
|
|
runtime and without which is unusable, and that xbps can't auto-detect.
|
|
|
|
These are not all the packages the package needs at runtime, but only those
|
|
|
|
that are not linked against. This variable is most useful for non-compiled
|
|
|
|
programs.
|
|
|
|
|
2017-01-13 20:33:01 +00:00
|
|
|
Finally, as a general rule, if something compiles the exact same way whether or
|
|
|
|
not you add a particular package to `makedepends` or `hostmakedepends`, it
|
|
|
|
shouldn't be added.
|
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="repositories"></a>
|
2014-11-01 12:41:38 +00:00
|
|
|
#### Repositories
|
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="repo_by_branch"></a>
|
2014-11-01 12:41:38 +00:00
|
|
|
##### Repositories defined by Branch
|
|
|
|
|
|
|
|
The global repository takes the name of
|
|
|
|
the current branch, except if the name of the branch is master. Then the resulting
|
|
|
|
repository will be at the global scope. The usage scenario is that the user can
|
|
|
|
update multiple packages in a second branch without polluting his local repository.
|
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="pkg_defined_repo"></a>
|
2014-11-01 12:41:38 +00:00
|
|
|
##### Package defined Repositories
|
|
|
|
|
|
|
|
The second way to define a repository is by setting the `repository` variable in
|
|
|
|
a template. This way the maintainer can define repositories for a specific
|
|
|
|
package or a group of packages. This is currently used to distinguish between
|
|
|
|
closed source packages, which are put in the `nonfree` repository and other
|
|
|
|
packages which are at the root-repository.
|
|
|
|
|
|
|
|
The following repository names are valid:
|
|
|
|
|
|
|
|
* `nonfree`: Repository for closed source packages.
|
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="updates"></a>
|
|
|
|
### Checking for new upstream releases
|
2014-10-31 14:49:22 +00:00
|
|
|
|
2015-01-15 09:34:44 +00:00
|
|
|
New upstream versions can be automatically checked using
|
|
|
|
`./xbps-src update-check <pkgname>`. In some cases you need to override
|
|
|
|
the sensible defaults by assigning the following variables in a `update`
|
|
|
|
file in the same directory as the relevant `template` file:
|
2014-10-31 14:49:22 +00:00
|
|
|
|
2015-01-15 09:34:44 +00:00
|
|
|
- `site` contains the URL where the version number is
|
2014-10-31 14:49:22 +00:00
|
|
|
mentioned. If unset, defaults to `homepage` and the directories where
|
|
|
|
`distfiles` reside.
|
|
|
|
|
2015-01-15 09:34:44 +00:00
|
|
|
- `pkgname` is the package name the default pattern checks for.
|
|
|
|
If unset, defaults to `pkgname` from the template.
|
2014-11-01 19:39:18 +00:00
|
|
|
|
2015-01-15 09:34:44 +00:00
|
|
|
- `pattern` is a perl-compatible regular expression
|
2014-10-31 14:49:22 +00:00
|
|
|
matching the version number. Anchor the version number using `\K`
|
2015-01-15 09:34:44 +00:00
|
|
|
and `(?=...)`. Example: `pattern='<b>\K[\d.]+(?=</b>)'`, this
|
2014-10-31 14:49:22 +00:00
|
|
|
matches a version number enclosed in `<b>...</b>` tags.
|
|
|
|
|
2015-01-15 09:34:44 +00:00
|
|
|
- `ignore` is a space-separated list of shell globs that match
|
2014-10-31 14:49:22 +00:00
|
|
|
version numbers which are not taken into account for checking newer
|
2015-01-15 09:34:44 +00:00
|
|
|
versions. Example: `ignore="*b*"`
|
2014-10-31 19:43:30 +00:00
|
|
|
|
2015-01-15 09:34:44 +00:00
|
|
|
- `version` is the version number used to compare against
|
|
|
|
upstream versions. Example: `version=${version//./_}`
|
2014-10-31 14:49:22 +00:00
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="build_scripts"></a>
|
2014-03-22 05:26:09 +00:00
|
|
|
### build style scripts
|
|
|
|
|
|
|
|
The `build_style` variable specifies the build method to build and install a
|
|
|
|
package. It expects the name of any available script in the
|
2015-02-21 11:13:07 +00:00
|
|
|
`void-packages/common/build-style` directory. Please note that required packages
|
2014-03-22 06:19:51 +00:00
|
|
|
to execute a `build_style` script must be defined via `$hostmakedepends`.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
|
|
|
The current list of available `build_style` scripts is the following:
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `cmake` For packages that use the CMake build system, configuration arguments
|
2015-06-29 11:19:50 +00:00
|
|
|
can be passed in via `configure_args`. The `cmake_builddir` variable may be
|
|
|
|
defined to specify the directory for building under `build_wrksrc` instead of
|
|
|
|
the default `build`.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `configure` For packages that use non-GNU configure scripts, at least `--prefix=/usr`
|
2014-03-22 05:26:09 +00:00
|
|
|
should be passed in via `configure_args`.
|
|
|
|
|
2014-07-12 15:42:21 +00:00
|
|
|
- `fetch` For packages that only fetch files and are installed as is via `do_install()`.
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `gnu-configure` For packages that use GNU configure scripts, additional configuration
|
2014-03-22 05:26:09 +00:00
|
|
|
arguments can be passed in via `configure_args`.
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `gnu-makefile` For packages that use GNU make, build arguments can be passed in via
|
2014-03-22 05:26:09 +00:00
|
|
|
`make_build_args` and install arguments via `make_install_args`. The build
|
2015-06-28 09:14:05 +00:00
|
|
|
target can be overridden via `make_build_target` and the install target
|
2017-03-07 09:34:38 +00:00
|
|
|
via `make_install_target`. This build style tries to compensate for makefiles
|
|
|
|
that do not respect environment variables, so well written makefiles, those
|
|
|
|
that do such things as append (`+=`) to variables, should have `make_use_env`
|
|
|
|
set in the body of the template.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2015-02-21 12:38:37 +00:00
|
|
|
- `go` For programs written in Go that follow the standard package
|
2015-02-21 12:52:10 +00:00
|
|
|
structure. The variable `go_import_path` must be set to the package's
|
2015-02-21 12:38:37 +00:00
|
|
|
import path, e.g. `github.com/github/hub` for the `hub` program. If
|
|
|
|
the variable `go_get` is set to `yes`, the package will be
|
|
|
|
downloaded with `go get`. Otherwise (the default) it's expected that
|
|
|
|
the distfile contains the package. In both cases, dependencies will
|
|
|
|
be downloaded with `go get`.
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `meta` For `meta-packages`, i.e packages that only install local files or simply
|
2014-03-22 05:26:09 +00:00
|
|
|
depend on additional packages. This build style does not install
|
|
|
|
dependencies to the root directory, and only checks if a binary package is
|
|
|
|
available in repositories.
|
|
|
|
|
2014-11-25 16:54:17 +00:00
|
|
|
- `ruby-module` For packages that are ruby modules and are installable via `ruby install.rb`.
|
|
|
|
Additional install arguments can be specified via `make_install_args`.
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `perl-ModuleBuild` For packages that use the Perl
|
2014-03-22 05:26:09 +00:00
|
|
|
[Module::Build](http://search.cpan.org/~leont/Module-Build-0.4202/lib/Module/Build.pm) method.
|
|
|
|
|
2016-03-22 00:39:01 +00:00
|
|
|
- `perl-module` For packages that use the Perl
|
2014-03-22 05:26:09 +00:00
|
|
|
[ExtUtils::MakeMaker](http://perldoc.perl.org/ExtUtils/MakeMaker.html) build method.
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `waf3` For packages that use the Python3 `waf` build method with python3.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `waf` For packages that use the Python `waf` method with python2.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2015-02-25 15:19:38 +00:00
|
|
|
- `slashpackage` For packages that use the /package hierarchy and package/compile to build,
|
|
|
|
such as `daemontools` or any `djb` software.
|
2015-02-24 03:50:51 +00:00
|
|
|
|
2015-08-20 19:29:37 +00:00
|
|
|
- `qmake` For packages that use Qt4/Qt5 qmake profiles (`*.pro`), qmake arguments
|
|
|
|
for the configure phase can be passed in via `configure_args`, make build arguments can
|
|
|
|
be passed in via `make_build_args` and install arguments via `make_install_args`. The build
|
|
|
|
target can be overridden via `make_build_target` and the install target
|
|
|
|
via `make_install_target`.
|
|
|
|
|
2016-10-16 14:46:46 +00:00
|
|
|
For packages that use the Python module build method (`setup.py`), you
|
|
|
|
can choose one of the following:
|
|
|
|
|
|
|
|
- `python-module` to build *both* Python 2.x and 3.x modules
|
|
|
|
|
|
|
|
- `python2-module` to build Python 2.x only modules
|
|
|
|
|
|
|
|
- `python3-module` to build Python 3.x only modules
|
|
|
|
|
2014-03-22 06:05:45 +00:00
|
|
|
> If `build_style` is not set, the template must (at least) define a
|
2014-03-22 05:26:09 +00:00
|
|
|
`do_install()` function and optionally more phases via `do_xxx()` functions.
|
|
|
|
|
2015-02-21 11:13:07 +00:00
|
|
|
Environment variables for a specific `build_style` can be declared in a filename
|
|
|
|
matching the `build_style` name, i.e:
|
|
|
|
|
|
|
|
`common/environment/build-style/gnu-configure.sh`
|
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="functions"></a>
|
2014-03-22 05:26:09 +00:00
|
|
|
### Functions
|
|
|
|
|
|
|
|
The following functions can be defined to change the behavior of how the
|
|
|
|
package is downloaded, compiled and installed.
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `do_fetch()` if defined and `distfiles` is not set, use it to fetch the required sources.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `do_extract()` if defined and `distfiles` is not set, use it to extract the required sources.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `post_extract()` Actions to execute after `do_extract()`.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `pre_configure()` Actions to execute after `post_extract()`.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `do_configure()` Actions to execute to configure the package; `${configure_args}` should
|
2014-03-22 05:26:09 +00:00
|
|
|
still be passed in if it's a GNU configure script.
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `post_configure()` Actions to execute after `do_configure()`.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `pre_build()` Actions to execute after `post_configure()`.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `do_build()` Actions to execute to build the package.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `post_build()` Actions to execute after `do_build()`.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-04-27 20:02:45 +00:00
|
|
|
- `pre_install()` Actions to execute after `post_build()`.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `do_install()` Actions to execute to install the package files into the `fake destdir`.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `post_install()` Actions to execute after `do_install()`.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-04-30 09:06:38 +00:00
|
|
|
- `do_clean()` Actions to execute to clean up after a successful package phase.
|
|
|
|
|
2014-03-22 06:05:45 +00:00
|
|
|
> A function defined in a template has preference over the same function
|
2014-03-22 05:26:09 +00:00
|
|
|
defined by a `build_style` script.
|
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="build_options"></a>
|
2014-03-22 05:26:09 +00:00
|
|
|
### Build options
|
|
|
|
|
|
|
|
Some packages might be built with different build options to enable/disable
|
2014-04-28 09:43:17 +00:00
|
|
|
additional features; The XBPS source packages collection allows you to do this with some simple tweaks
|
2014-03-22 05:26:09 +00:00
|
|
|
to the `template` file.
|
|
|
|
|
|
|
|
The following variables may be set to allow package build options:
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `build_options` Sets the build options supported by the source package.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `build_options_default` Sets the default build options to be used by the source package.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 06:05:45 +00:00
|
|
|
- `desc_option_<option>` Sets the description for the build option `option`. This must match the
|
2014-06-30 09:32:07 +00:00
|
|
|
keyword set in *build_options*. Note that if the build option is generic enough, its description
|
|
|
|
should be added to `common/options.description` instead.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
|
|
|
After defining those required variables, you can check for the
|
|
|
|
`build_option_<option>` variable to know if it has been set and adapt the source
|
2014-08-29 22:29:33 +00:00
|
|
|
package accordingly. Additionally, the following functions are available:
|
|
|
|
|
|
|
|
- *vopt_if()* `vopt_if <option> <if_true> [<if_false>]`
|
|
|
|
|
|
|
|
Outputs `if_true` if `option` is set, or `if_false` if it isn't set.
|
|
|
|
|
|
|
|
- *vopt_with()* `vopt_with <option> [<flag>]`
|
|
|
|
|
|
|
|
Outputs `--with-<flag>` if the option is set, or `--without-<flag>`
|
|
|
|
otherwise. If `flag` isn't set, it defaults to `option`.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
|
|
|
|
- `vopt_with dbus`
|
|
|
|
- `vopt_with xml xml2`
|
|
|
|
|
|
|
|
- *vopt_enable()* `vopt_enable <option> [<flag>]`
|
|
|
|
|
|
|
|
Same as `vopt_with`, but uses `--enable-<flag>` and
|
|
|
|
`--disable-<flag>` respectively.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-09-05 14:41:50 +00:00
|
|
|
- *vopt_conflict()* `vopt_conflict <option 1> <option 2>`
|
|
|
|
|
|
|
|
Emits an error and exits if both options are set at the same time.
|
|
|
|
|
2014-03-22 05:26:09 +00:00
|
|
|
The following example shows how to change a source package that uses GNU
|
|
|
|
configure to enable a new build option to support PNG images:
|
|
|
|
|
|
|
|
```
|
|
|
|
# Template file for 'foo'
|
|
|
|
pkgname=foo
|
|
|
|
version=1.0
|
|
|
|
revision=1
|
|
|
|
build_style=gnu-configure
|
2014-08-29 22:29:33 +00:00
|
|
|
configure_args="... $(vopt_with png)"
|
|
|
|
makedepends="... $(vopt_if png libpng-devel)"
|
2014-03-22 05:26:09 +00:00
|
|
|
...
|
|
|
|
|
|
|
|
# Package build options
|
|
|
|
build_options="png"
|
|
|
|
desc_option_png="Enable support for PNG images"
|
|
|
|
|
|
|
|
# To build the package by default with the `png` option:
|
|
|
|
#
|
|
|
|
# build_options_default="png"
|
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
```
|
|
|
|
|
2014-04-28 09:43:17 +00:00
|
|
|
The supported build options for a source package can be shown with `xbps-src`:
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-04-28 09:43:17 +00:00
|
|
|
$ ./xbps-src show-options foo
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-04-28 09:43:17 +00:00
|
|
|
Build options can be enabled with the `-o` flag of `xbps-src`:
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2016-11-25 13:29:16 +00:00
|
|
|
$ ./xbps-src -o option,option1 <cmd> foo
|
2014-03-22 05:26:09 +00:00
|
|
|
|
|
|
|
Build options can be disabled by prefixing them with `~`:
|
|
|
|
|
2016-11-25 13:29:16 +00:00
|
|
|
$ ./xbps-src -o ~option,~option1 <cmd> foo
|
2014-03-22 05:26:09 +00:00
|
|
|
|
|
|
|
Both ways can be used together to enable and/or disable multiple options
|
2014-04-28 09:43:17 +00:00
|
|
|
at the same time with `xbps-src`:
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2016-11-25 13:29:16 +00:00
|
|
|
$ ./xbps-src -o option,~option1,~option2 <cmd> foo
|
2014-03-22 05:26:09 +00:00
|
|
|
|
|
|
|
The build options can also be shown for binary packages via `xbps-query(8)`:
|
|
|
|
|
|
|
|
$ xbps-query -R --property=build-options foo
|
|
|
|
|
2014-06-30 09:32:07 +00:00
|
|
|
Permanent global package build options can be set via `XBPS_PKG_OPTIONS` variable in the
|
|
|
|
`etc/conf` configuration file. Per package build options can be set via
|
|
|
|
`XBPS_PKG_OPTIONS_<pkgname>`.
|
|
|
|
|
2014-07-19 08:39:22 +00:00
|
|
|
> NOTE: if `pkgname` contains `dashes`, those should be replaced by `underscores`
|
|
|
|
i.e `XBPS_PKG_OPTIONS_xorg_server=opt`.
|
|
|
|
|
2014-07-04 05:47:57 +00:00
|
|
|
The list of supported package build options and its description is defined in the
|
|
|
|
`common/options.description` file.
|
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="deps_runtime"></a>
|
2014-07-30 15:58:17 +00:00
|
|
|
#### Runtime dependencies
|
2014-03-22 05:35:22 +00:00
|
|
|
|
2014-03-22 06:05:45 +00:00
|
|
|
Dependencies for ELF objects are detected automatically by `xbps-src`, hence runtime
|
|
|
|
dependencies must not be specified in templates via `$depends` with the following exceptions:
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 06:05:45 +00:00
|
|
|
- ELF objects using dlopen(3).
|
2014-03-22 05:26:09 +00:00
|
|
|
- non ELF objects, i.e perl/python/ruby/etc modules.
|
|
|
|
- Overriding the minimal version specified in the `shlibs` file.
|
|
|
|
|
2014-03-22 06:05:45 +00:00
|
|
|
The runtime dependencies for ELF objects are detected by checking which SONAMEs
|
|
|
|
they require and then the SONAMEs are mapped to a binary package name with a minimal
|
2014-10-09 15:24:27 +00:00
|
|
|
required version. The `shlibs` file in the `void-packages/common` directory
|
2014-03-22 06:05:45 +00:00
|
|
|
sets up the `<SONAME> <pkgname>>=<version>` mappings.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
|
|
|
For example the `foo-1.0_1` package provides the `libfoo.so.1` SONAME and
|
|
|
|
software requiring this library will link to `libfoo`; the resulting binary
|
|
|
|
package will have a run-time dependency to `foo>=1.0_1` package as specified in
|
|
|
|
`common/shlibs`:
|
|
|
|
|
|
|
|
```
|
|
|
|
# common/shlibs
|
|
|
|
...
|
|
|
|
libfoo.so.1 foo-1.0_1
|
|
|
|
...
|
|
|
|
```
|
|
|
|
|
|
|
|
- The first field specifies the SONAME.
|
|
|
|
- The second field specified the package name and minimal version required.
|
2014-07-12 15:06:25 +00:00
|
|
|
- A third optional field (usually set to `ignore`) can be used to skip checks in soname bumps.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-07-30 15:58:17 +00:00
|
|
|
Dependencies declared via `${depends}` are not installed to the master directory, rather are
|
|
|
|
only checked if they exist as binary packages, and are built automatically by `xbps-src` if
|
|
|
|
the specified version is not in the local repository.
|
|
|
|
|
2014-08-20 09:17:26 +00:00
|
|
|
There's a special variant of how `virtual` dependencies can be specified as `runtime dependencies`
|
2014-08-20 09:48:00 +00:00
|
|
|
and is by using the `virtual?` keyword, i.e `depends="virtual?vpkg-0.1_1"`. This declares
|
2014-08-20 09:17:26 +00:00
|
|
|
a `runtime` virtual dependency to `vpkg-0.1_1`; this `virtual` dependency will be simply ignored
|
|
|
|
when the package is being built with `xbps-src`.
|
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="install_remove_files"></a>
|
2014-08-20 09:06:19 +00:00
|
|
|
### INSTALL and REMOVE files
|
|
|
|
|
|
|
|
The INSTALL and REMOVE shell snippets can be used to execute certain actions at a specified
|
|
|
|
stage when a binary package is installed, updated or removed. There are some variables
|
|
|
|
that are always set by `xbps` when the scripts are executed:
|
|
|
|
|
2014-08-20 09:10:15 +00:00
|
|
|
- `$ACTION`: to conditionalize its actions: `pre` or `post`.
|
|
|
|
- `$PKGNAME`: the package name.
|
|
|
|
- `$VERSION`: the package version.
|
|
|
|
- `$UPDATE`: set to `yes` if package is being upgraded, `no` if package is being `installed` or `removed`.
|
|
|
|
- `$CONF_FILE`: full path to `xbps.conf`.
|
|
|
|
- `$ARCH`: the target architecture it is running on.
|
2014-08-20 09:06:19 +00:00
|
|
|
|
|
|
|
An example of how an `INSTALL` or `REMOVE` script shall be created is shown below:
|
|
|
|
|
|
|
|
```
|
|
|
|
# INSTALL
|
|
|
|
case "$ACTION" in
|
|
|
|
pre)
|
|
|
|
# Actions to execute before the package files are unpacked.
|
|
|
|
...
|
|
|
|
;;
|
|
|
|
post)
|
|
|
|
if [ "$UPDATE" = "yes" ]; then
|
|
|
|
# actions to execute if package is being updated.
|
|
|
|
...
|
|
|
|
else
|
|
|
|
# actions to execute if package is being installed.
|
|
|
|
...
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
```
|
|
|
|
|
2014-09-15 14:14:08 +00:00
|
|
|
subpackages can also have their own `INSTALL` and `REMOVE` files, simply create them
|
|
|
|
as `srcpkgs/<pkgname>/<subpkg>.INSTALL` or `srcpkgs/<pkgname>/<subpkg>.REMOVE` respectively.
|
|
|
|
|
2014-08-20 09:06:19 +00:00
|
|
|
> NOTE: always use paths relative to the current working directory, otherwise if the scripts cannot
|
|
|
|
be executed via `chroot(2)` won't work correctly.
|
|
|
|
|
2014-09-15 14:18:46 +00:00
|
|
|
> NOTE: do not use INSTALL/REMOVE scripts to print messages, see the next section for
|
|
|
|
more information.
|
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="install_remove_files_msg"></a>
|
2014-09-15 14:18:46 +00:00
|
|
|
### INSTALL.msg and REMOVE.msg files
|
|
|
|
|
|
|
|
The `INSTALL.msg` and `REMOVE.msg` files can be used to print a message at post-install
|
|
|
|
or pre-remove time, respectively.
|
|
|
|
|
|
|
|
Ideally those files should not exceed 80 chars per line.
|
|
|
|
|
|
|
|
subpackages can also have their own `INSTALL.msg` and `REMOVE.msg` files, simply create them
|
|
|
|
as `srcpkgs/<pkgname>/<subpkg>.INSTALL.msg` or `srcpkgs/<pkgname>/<subpkg>.REMOVE.msg` respectively.
|
2014-09-15 14:14:08 +00:00
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="runtime_account_creation"></a>
|
2014-03-22 05:26:09 +00:00
|
|
|
### Creating system accounts/groups at runtime
|
|
|
|
|
|
|
|
There's a trigger along with some variables that are specifically to create
|
|
|
|
**system users and groups** when the binary package is being configured.
|
|
|
|
The following variables can be used for this purpose:
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `system_groups` This specifies the names of the new *system groups* to be created, separated
|
2014-03-22 05:26:09 +00:00
|
|
|
by blanks. Optionally the **gid** can be specified by delimiting it with a
|
|
|
|
colon, i.e `system_groups="mygroup:78"` or `system_groups="foo blah:8000"`.
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `system_accounts` This specifies the names of the new **system users/groups** to be created,
|
2014-07-30 10:17:27 +00:00
|
|
|
separated by blanks, i.e `system_accounts="foo blah:22"`. Optionally the **uid** and **gid**
|
2015-11-10 21:04:32 +00:00
|
|
|
can be specified by delimiting it with a colon, i.e `system_accounts="foo:48"`.
|
2014-07-30 10:17:27 +00:00
|
|
|
Additional variables for the **system accounts** can be specified to change its behavior:
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2015-04-09 10:29:20 +00:00
|
|
|
- `<account>_homedir` the home directory for the user. If unset defaults to `/var/empty`.
|
2014-03-22 05:32:58 +00:00
|
|
|
- `<account>_shell` the shell for the new user. If unset defaults to `/sbin/nologin`.
|
2015-02-23 21:09:20 +00:00
|
|
|
- `<account>_descr` the description for the new user. If unset defaults to `<account> unprivileged user`.
|
2014-03-22 05:32:58 +00:00
|
|
|
- `<account>_groups` additional groups to be added to for the new user.
|
2015-02-23 21:09:20 +00:00
|
|
|
- `<account>_pgroup` to set the primary group, by default primary group is set to `<account>`.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
|
|
|
The **system user** is created by using a dynamically allocated **uid/gid** in your system
|
2014-07-30 10:17:27 +00:00
|
|
|
and it's created as a `system account`, unless the **uid** is set. A new group will be created for the
|
2015-06-28 09:14:05 +00:00
|
|
|
specified `system account` and used exclusively for this purpose.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="32bit_pkgs"></a>
|
2014-03-22 05:26:09 +00:00
|
|
|
### 32bit packages
|
|
|
|
|
|
|
|
32bit packages are built automatically when the builder is x86 (32bit), but
|
|
|
|
there are some variables that can change the behavior:
|
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `lib32depends` If this variable is set, dependencies listed here will be used rather than
|
2014-04-28 09:43:17 +00:00
|
|
|
those detected automatically by `xbps-src` and **depends**. Please note that
|
2014-03-22 05:26:09 +00:00
|
|
|
dependencies must be specified with version comparators, i.e
|
|
|
|
`lib32depends="foo>=0 blah<2.0"`.
|
|
|
|
|
2014-03-22 06:05:45 +00:00
|
|
|
- `lib32disabled` If this variable is set, no 32bit package will be built.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-03-22 05:32:58 +00:00
|
|
|
- `lib32files` Additional files to be added to the **32bit** package. This expect absolute
|
2014-03-22 06:05:45 +00:00
|
|
|
paths separated by blanks, i.e `lib32files="/usr/bin/blah /usr/include/blah."`.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2015-10-19 11:00:33 +00:00
|
|
|
- `lib32symlinks` Makes a symlink of the target filename stored in the `lib32` directory.
|
|
|
|
This expects the basename of the target file, i.e `lib32symlinks="foo"`.
|
|
|
|
|
|
|
|
- `lib32mode` If unset, only shared/static libraries and pkg-config files will be copied to the
|
|
|
|
**32bit** package. If set to `full` all files will be copied to the 32bit package, unmodified.
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="pkgs_sub"></a>
|
2014-03-22 06:19:51 +00:00
|
|
|
### Subpackages
|
|
|
|
|
|
|
|
In the example shown above just a binary package is generated, but with some
|
|
|
|
simple tweaks multiple binary packages can be generated from a single
|
|
|
|
template/build, this is called `subpackages`.
|
|
|
|
|
|
|
|
To create additional `subpackages` the `template` must define a new function
|
|
|
|
with this naming: `<subpkgname>_package()`, i.e:
|
|
|
|
|
|
|
|
```
|
|
|
|
# Template file for 'foo'
|
|
|
|
|
|
|
|
pkgname="foo"
|
|
|
|
version="1.0"
|
|
|
|
revision=1
|
|
|
|
build_style=gnu-configure
|
|
|
|
short_desc="A short description max 72 chars"
|
|
|
|
maintainer="name <email>"
|
|
|
|
license="GPL-3"
|
|
|
|
homepage="http://www.foo.org"
|
|
|
|
distfiles="http://www.foo.org/foo-${version}.tar.gz"
|
|
|
|
checksum="fea0a94d4b605894f3e2d5572e3f96e4413bcad3a085aae7367c2cf07908b2ff"
|
|
|
|
|
|
|
|
# foo-devel is a subpkg
|
|
|
|
foo-devel_package() {
|
|
|
|
short_desc+=" - development files"
|
|
|
|
depends="${sourcepkg}>=${version}_${revision}"
|
|
|
|
pkg_install() {
|
|
|
|
vmove usr/include
|
|
|
|
vmove usr/lib/*.a
|
|
|
|
vmove usr/lib/*.so
|
|
|
|
vmove usr/lib/pkgconfig
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
All subpackages need an additional symlink to the `main` pkg, otherwise dependencies
|
|
|
|
requiring those packages won't find its `template` i.e:
|
|
|
|
|
|
|
|
```
|
|
|
|
/srcpkgs
|
|
|
|
|- foo <- directory (main pkg)
|
|
|
|
| |- template
|
|
|
|
|- foo-devel <- symlink to `foo`
|
|
|
|
```
|
|
|
|
|
|
|
|
The main package should specify all required `build dependencies` to be able to build
|
|
|
|
all subpackages defined in the template.
|
|
|
|
|
|
|
|
An important point of `subpackages` is that they are processed after the main
|
|
|
|
package has run its `install` phase. The `pkg_install()` function specified on them
|
|
|
|
commonly is used to move files from the `main` package destdir to the `subpackage` destdir.
|
|
|
|
|
|
|
|
The helper functions `vinstall`, `vmkdir`, `vcopy` and `vmove` are just wrappers that simplify
|
|
|
|
the process of creating, copying and moving files/directories between the `main` package
|
|
|
|
destdir (`$DESTDIR`) to the `subpackage` destdir (`$PKGDESTDIR`).
|
|
|
|
|
2014-08-25 20:43:06 +00:00
|
|
|
Subpackages are processed always in alphabetical order; To force a custom order,
|
2014-08-25 20:41:19 +00:00
|
|
|
the `subpackages` variable can be declared with the wanted order.
|
2014-08-25 15:58:46 +00:00
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="pkgs_development"></a>
|
2014-03-22 06:19:51 +00:00
|
|
|
### Development packages
|
|
|
|
|
|
|
|
A development package, commonly generated as a subpackage, shall only contain
|
|
|
|
files required for development, that is, headers, static libraries, shared
|
|
|
|
library symlinks, pkg-config files, API documentation or any other script
|
2014-05-20 08:56:26 +00:00
|
|
|
that is only useful when developing for the target software.
|
2014-03-22 06:19:51 +00:00
|
|
|
|
|
|
|
A development package should depend on packages that are required to link
|
|
|
|
against the provided shared libraries, i.e if `libfoo` provides the
|
|
|
|
`libfoo.so.2` shared library and the linking needs `-lbar`, the package
|
|
|
|
providing the `libbar` shared library should be added as a dependency;
|
|
|
|
and most likely it shall depend on its development package.
|
|
|
|
|
|
|
|
If a development package provides a `pkg-config` file, you should verify
|
|
|
|
what dependencies the package needs for dynamic or static linking, and add
|
2015-06-28 09:14:05 +00:00
|
|
|
the appropriate `development` packages as dependencies.
|
2014-03-22 18:35:20 +00:00
|
|
|
|
2015-09-28 07:07:16 +00:00
|
|
|
Development packages for the C and C++ languages usually `vmove` the
|
|
|
|
following subset of files from the main package:
|
|
|
|
|
|
|
|
* Header files `usr/include`
|
|
|
|
* Static libraries `usr/lib/*.a`
|
|
|
|
* Shared library symbolic links `usr/lib/*.so`
|
|
|
|
* Cmake rules `usr/lib/cmake`
|
|
|
|
* Package config files `usr/lib/pkgconfig`
|
|
|
|
|
|
|
|
<a id="pkgs_data"></a>
|
|
|
|
### Data packages
|
|
|
|
|
|
|
|
Another common subpackage type is the `-data` subpackage. This subpackage
|
|
|
|
type used to split architecture independent, big(ger) or huge amounts
|
|
|
|
of data from a package's main and architecture dependent part. It is up
|
|
|
|
to you to decide, if a `-data` subpackage makes sense for your package.
|
|
|
|
This type is common for games (graphics, sound and music), part libraries (CAD)
|
|
|
|
or card material (maps). Data subpackages are almost always `noarch=yes`.
|
|
|
|
The main package must then have `depends="${pkgname}-data-${version}_${revision}"`,
|
|
|
|
possibly in addition to other, non-automatic depends.
|
|
|
|
|
|
|
|
<a id="pkgs_documentation"></a>
|
|
|
|
### Documentation packages
|
|
|
|
|
|
|
|
Packages intended for user interaction do not always unconditionally require
|
|
|
|
their documentation part. A user who does not want to e.g. develop
|
|
|
|
with Qt5 will not need to install the (huge) qt5-doc package.
|
|
|
|
An expert may not need it or opt to use an online version.
|
|
|
|
|
|
|
|
In general a `-doc` package is useful, if the main package can be used both with
|
|
|
|
or without documentation and the size of the documentation isn't really small.
|
|
|
|
The base package and the `-devel` subpackage should be kept small so that when
|
|
|
|
building packages depending on a specific package there is no need to install large
|
|
|
|
amounts of documentation for no reason. Thus the size of the documentation part should
|
|
|
|
be your guidance to decide whether or not to split off a `-doc` subpackage.
|
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="pkgs_python"></a>
|
2014-07-04 05:37:05 +00:00
|
|
|
### Python packages
|
|
|
|
|
2016-10-16 14:46:46 +00:00
|
|
|
Python packages should be built with the `python{,2,3}-module` build style, if possible.
|
|
|
|
This sets some environment variables required to allow cross compilation. Support to allow
|
|
|
|
building a python module for multiple versions from a single template is also possible.
|
2014-07-04 05:37:05 +00:00
|
|
|
|
|
|
|
To allow cross compilation, the `python-devel` package (for python 2.7) must be added
|
|
|
|
to `hostmakedepends` and `makedepends`. If any other python version is also supported,
|
|
|
|
for example python3.4, those must also be added as host and target build dependencies.
|
|
|
|
|
|
|
|
The following variables may influence how the python packages are built and configured
|
|
|
|
at post-install time:
|
|
|
|
|
|
|
|
- `pycompile_module`: this variable expects the python modules that should be `byte-compiled`
|
|
|
|
at post-install time. Python modules are those that are installed into the `site-packages`
|
|
|
|
prefix: `usr/lib/pythonX.X/site-packages`. Multiple python modules may be specified separated
|
|
|
|
by blanks, i.e `pycompile_module="foo blah"`.
|
|
|
|
|
|
|
|
- `pycompile_dirs`: this variable expects the python directories that should be `byte-compiled`
|
2015-06-28 09:14:05 +00:00
|
|
|
recursively by the target python version. This differs from `pycompile_module` in that any
|
2014-07-04 05:37:05 +00:00
|
|
|
path may be specified, i.e `pycompile_dirs="usr/share/foo"`.
|
|
|
|
|
2016-10-16 14:46:46 +00:00
|
|
|
- `pycompile_version`: this variable expects the python version that is used to
|
|
|
|
byte-compile the python code (it generates the `.py[co]` files at post-install time).
|
|
|
|
By default it's set to `2.7` for `python 2.x` packages.
|
|
|
|
|
|
|
|
> NOTE: you need to define it *only* for non-Python modules.
|
|
|
|
|
2016-11-17 16:37:37 +00:00
|
|
|
- `python_version`: this variable expects the supported Python major version.
|
|
|
|
By default it's set to `2`. This variable is needed for multi-language
|
|
|
|
applications (e.g., the application is written in C while the command is
|
|
|
|
written in Python) or just single Python file ones that live in `/usr/bin`.
|
|
|
|
|
2016-10-16 14:46:46 +00:00
|
|
|
Also, a set of useful variables are defined to use in the templates:
|
|
|
|
|
|
|
|
| Variable | Value |
|
|
|
|
|-------------|----------------------------------|
|
|
|
|
| py2_ver | 2.X |
|
|
|
|
| py2_lib | /usr/lib/python2.X |
|
|
|
|
| py2_sitelib | /usr/lib/python2.X/site-packages |
|
|
|
|
| py2_inc | /usr/include/python2.X |
|
|
|
|
| py3_ver | 3.X |
|
|
|
|
| py3_lib | /usr/lib/python3.X |
|
|
|
|
| py3_sitelib | /usr/lib/python3.X/site-packages |
|
|
|
|
| py3_inc | /usr/include/python3.Xm |
|
|
|
|
|
2014-07-04 05:37:05 +00:00
|
|
|
> NOTE: it's expected that additional subpkgs must be generated to allow packaging for multiple
|
|
|
|
python versions.
|
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="pkgs_go"></a>
|
2015-02-21 12:38:37 +00:00
|
|
|
### Go packages
|
|
|
|
|
|
|
|
Go packages should be built with the `go` build style, if possible.
|
|
|
|
The `go` build style takes care of downloading Go dependencies and
|
|
|
|
setting up cross compilation.
|
|
|
|
|
|
|
|
The following variables influence how Go packages are built:
|
|
|
|
|
2015-04-17 16:18:35 +00:00
|
|
|
- `go_import_path`: The import path of the package included in the
|
|
|
|
distfile, as it would be used with `go get`. For example, GitHub's
|
|
|
|
`hub` program has the import path `github.com/github/hub`. This
|
|
|
|
variable is required.
|
2015-05-04 11:39:15 +00:00
|
|
|
- `go_package`: A space-separated list of import paths of the packages
|
|
|
|
that should be built. Defaults to `go_import_path`.
|
2015-02-21 12:52:10 +00:00
|
|
|
- `go_get`: If set to yes, the package specified via `go_import_path`
|
2015-02-21 12:38:37 +00:00
|
|
|
will be downloaded with `go get`. Otherwise, a distfile has to be
|
|
|
|
provided. This option should only be used with `-git` (or similar)
|
2015-06-28 09:14:05 +00:00
|
|
|
packages; using a versioned distfile is preferred.
|
2016-03-16 17:45:31 +00:00
|
|
|
- `go_build_tags`: An optional, space-separated list of build tags to
|
|
|
|
pass to Go.
|
2015-02-21 12:38:37 +00:00
|
|
|
|
2015-09-14 15:06:38 +00:00
|
|
|
<a id="pkgs_haskell"></a>
|
|
|
|
### Haskell packages
|
|
|
|
|
|
|
|
We build Haskell package using `stack` from
|
|
|
|
[Stackage](http://www.stackage.org/), generally the LTS versions.
|
|
|
|
Haskell templates need to have host dependencies on `ghc` and `stack`,
|
|
|
|
and set build style to `haskell-stack`.
|
|
|
|
|
|
|
|
The following variables influence how Haskell packages are built:
|
|
|
|
|
|
|
|
- `stackage`: The Stackage version used to build the package, e.g.
|
|
|
|
`lts-3.5`. Alternatively, you can prepare a `stack.yaml`
|
|
|
|
configuration for the project and put it into `files/stack.yaml`.
|
|
|
|
- `make_build_args`: This is passed as-is to `stack build ...`, so
|
|
|
|
you can add your `--flag ...` parameters there.
|
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="notes"></a>
|
2014-03-22 05:26:09 +00:00
|
|
|
### Notes
|
|
|
|
|
|
|
|
- Make sure that all software is configured to use the `/usr` prefix.
|
2014-03-22 18:35:20 +00:00
|
|
|
|
2015-06-04 11:30:44 +00:00
|
|
|
- Binaries should always be installed at `/usr/bin`.
|
2014-03-22 18:35:20 +00:00
|
|
|
|
2014-09-18 08:38:09 +00:00
|
|
|
- Manual pages should always be installed at `/usr/share/man`.
|
2014-03-22 18:35:20 +00:00
|
|
|
|
2014-03-22 05:26:09 +00:00
|
|
|
- If a software provides **shared libraries** and headers, probably you should
|
|
|
|
create a `development package` that contains `headers`, `static libraries`
|
|
|
|
and other files required for development (not required at runtime).
|
|
|
|
|
2014-03-22 18:35:20 +00:00
|
|
|
- If you are updating a package please be careful with SONAME bumps, check
|
2014-04-28 09:43:17 +00:00
|
|
|
the installed files (`./xbps-src show-files pkg`) before pushing new updates.
|
2014-03-22 18:35:20 +00:00
|
|
|
|
2014-09-18 08:38:09 +00:00
|
|
|
- Make sure that binaries are not stripped by the software, let xbps-src do this;
|
|
|
|
otherwise the `debug` packages won't have debugging symbols.
|
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="contributing"></a>
|
2014-03-22 05:26:09 +00:00
|
|
|
### Contributing via git
|
|
|
|
|
2014-10-09 15:24:27 +00:00
|
|
|
Fork the voidlinux `void-packages` git repository on github and clone it:
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-10-09 15:24:27 +00:00
|
|
|
$ git clone git@github.com:<user>/void-packages.git
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-04-03 09:47:46 +00:00
|
|
|
You can now make your own commits to the `forked` repository:
|
2014-03-22 05:26:09 +00:00
|
|
|
|
2014-04-03 09:47:46 +00:00
|
|
|
$ git add ...
|
|
|
|
$ git commit ...
|
|
|
|
$ git push ...
|
|
|
|
|
|
|
|
To keep your forked repository always up to date, setup the `upstream` remote
|
|
|
|
to pull in new changes:
|
|
|
|
|
2014-10-09 15:24:27 +00:00
|
|
|
$ git remote add upstream git://github.com/voidlinux/void-packages.git
|
2014-04-03 09:47:46 +00:00
|
|
|
$ git pull upstream master
|
2014-03-22 05:26:09 +00:00
|
|
|
|
|
|
|
Once you've made changes to your `forked` repository you can submit
|
|
|
|
a github pull request; see https://help.github.com/articles/fork-a-repo for more information.
|
|
|
|
|
|
|
|
For commit messages please use the following rules:
|
|
|
|
|
2016-04-06 19:07:04 +00:00
|
|
|
- If you've imported a new package use `"New package: <pkgname>-<version>"`.
|
2016-02-01 13:22:34 +00:00
|
|
|
- If you've updated a package use `"<pkgname>: update to <version>."`.
|
2014-03-22 05:26:09 +00:00
|
|
|
- If you've removed a package use `"<pkgname>: removed ..."`.
|
|
|
|
- If you've modified a package use `"<pkgname>: ..."`.
|
|
|
|
|
2015-03-15 22:57:59 +00:00
|
|
|
<a id="help"></a>
|
2014-03-22 05:26:09 +00:00
|
|
|
## Help
|
|
|
|
|
|
|
|
If after reading this `manual` you still need some kind of help, please join
|
|
|
|
us at `#xbps` via IRC at `irc.freenode.net`.
|