1 # The XBPS source packages manual
3 This article contains an exhaustive manual of how to create new source
4 packages for XBPS, the `Void Linux` native packaging system.
8 * The XBPS source packages manual
9 * [Introduction](#Introduction)
10 * [Package build phases](#buildphase)
11 * [Package naming conventions](#namingconventions)
13 * [Language Modules](#language_modules)
14 * [Language Bindings](#language_bindings)
15 * [Programs](#programs)
16 * [Global functions](#global_funcs)
17 * [Global variables](#global_vars)
18 * [Available variables](#available_vars)
19 * [Mandatory variables](#mandatory_vars)
20 * [Optional variables](#optional_vars)
21 * [About the depends variables](#explain_depends)
22 * [Repositories](#repositories)
23 * [Repositories defined by Branch](#repo_by_branch)
24 * [Package defined repositories](#pkg_defined_repo)
25 * [Checking for new upstream releases](#updates)
26 * [Handling patches](#patches)
27 * [Build style scripts](#build_scripts)
28 * [Build helper scripts](#build_helper)
29 * [Functions](#functions)
30 * [Build options](#build_options)
31 * [INSTALL and REMOVE files](#install_remove_files)
32 * [INSTALL.msg and REMOVE.msg files](#install_remove_files_msg)
33 * [Creating system accounts/groups at runtime](#runtime_account_creation)
34 * [Writing runit services](#writing_runit_services)
35 * [32bit packages](#32bit_pkgs)
36 * [Subpackages](#pkgs_sub)
37 * [Some package classes](#pkgs_classes)
38 * [Development packages](#pkgs_development)
39 * [Data packages](#pkgs_data)
40 * [Documentation packages](#pkgs_documentation)
41 * [Python packages](#pkgs_python)
42 * [Go packages](#pkgs_go)
43 * [Haskell packages](#pkgs_haskell)
44 * [Font packages](#pkgs_font)
45 * [Renaming a package](#pkg_rename)
46 * [Removing a package](#pkg_remove)
47 * [XBPS Triggers](#xbps_triggers)
48 * [appstream-cache](#triggers_appstream_cache)
49 * [binfmts](#triggers_binfmts)
50 * [dkms](#triggers_dkms)
51 * [gconf-schemas](#triggers_gconf_schemas)
52 * [gdk-pixbuf-loaders](#triggers_gdk_pixbuf_loaders)
53 * [gio-modules](#triggers_gio_modules)
54 * [gettings-schemas](#triggers_gsettings_schemas)
55 * [gtk-icon-cache](#triggers_gtk_icon_cache)
56 * [gtk-immodules](#triggers_gtk_immodules)
57 * [gtk-pixbuf-loaders](#triggers_gtk_pixbuf_loaders)
58 * [gtk3-immodules](#triggers_gtk3_immodules)
59 * [hwdb.d-dir](#triggers_hwdb.d_dir)
60 * [info-files](#triggers_info_files)
61 * [initramfs-regenerate](#triggers_initramfs_regenerate)
62 * [kernel-hooks](#triggers_kernel_hooks)
63 * [mimedb](#triggers_mimedb)
64 * [mkdirs](#triggers_mkdirs)
65 * [pango-modules](#triggers_pango_module)
66 * [pycompile](#triggers_pycompile)
67 * [register-shell](#triggers_register_shell)
68 * [system-accounts](#triggers_system_accounts)
69 * [texmf-dist](#triggers_texmf_dist)
70 * [update-desktopdb](#triggers_update_desktopdb)
71 * [x11-fonts](#triggers_x11_fonts)
72 * [xml-catalog](#triggers_xml_catalog)
73 * [Void specific documentation](#documentation)
75 * [Contributing via git](#contributing)
78 <a id="Introduction"></a>
81 The `void-packages` repository contains all the
82 recipes to download, compile and build binary packages for Void Linux.
83 These `source` package files are called `templates`.
85 The `template` files are shell scripts that define `variables` and `functions`
86 to be processed by `xbps-src`, the package builder, to generate binary packages.
87 The shell used by `xbps-src` is GNU bash; `xbps-src` doesn't aim to be
88 compatible with POSIX `sh`.
90 By convention, all templates start with a comment saying that it is a
91 `template file` for a certain package. Most of the lines should be kept under 80
92 columns; variables that list many values can be split into new lines, with the
93 continuation in the next line indented by one space.
95 A simple `template` example is as follows:
98 # Template file for 'foo'
102 build_style=gnu-configure
103 short_desc="A short description max 72 chars"
104 maintainer="name <email>"
105 license="GPL-3.0-or-later"
106 homepage="http://www.foo.org"
107 distfiles="http://www.foo.org/foo-${version}.tar.gz"
108 checksum="fea0a94d4b605894f3e2d5572e3f96e4413bcad3a085aae7367c2cf07908b2ff"
111 The template file contains definitions to download, build and install the
112 package files to a `fake destdir`, and after this a binary package can be
113 generated with the definitions specified on it.
115 Don't worry if anything is not clear as it should be. The reserved `variables`
116 and `functions` will be explained later. This `template` file should be created
117 in a directory matching `$pkgname`, Example: `void-packages/srcpkgs/foo/template`.
119 If everything went fine after running
121 $ ./xbps-src pkg <pkgname>
123 a binary package named `foo-1.0_1.<arch>.xbps` will be generated in the local repository
126 <a id="buildphase"></a>
127 ### Package build phases
129 Building a package consist of the following phases:
131 - `setup` This phase prepares the environment for building a package.
133 - `fetch` This phase downloads required sources for a `source package`, as defined by
134 the `distfiles` variable or `do_fetch()` function.
136 - `extract` This phase extracts the `distfiles` files into `$wrksrc` or executes the `do_extract()`
137 function, which is the directory to be used to compile the `source package`.
139 - `patch` This phase applies all patches in the patches directory of the package and
140 can be used to perform other operations before configuring the package.
142 - `configure` This phase executes the `configuration` of a `source package`, i.e `GNU configure scripts`.
144 - `build` This phase compiles/prepares the `source files` via `make` or any other compatible method.
146 - `check` This optional phase checks the result of the `build` phase by running the testsuite provided by the package.
147 If the default `do_check` function provided by the build style doesn't do anything, the template should set
148 `make_check_target` and/or `make_check_args` appropriately or define its own `do_check` function. If tests take too long
149 or can't run in all environments, `make_check` should be set to fitting value or
150 `do_check` should be customized to limit testsuite unless `XBPS_CHECK_PKGS` is `full`.
152 - `install` This phase installs the `package files` into the package destdir `<masterdir>/destdir/<pkgname>-<version>`,
153 via `make install` or any other compatible method.
155 - `pkg` This phase builds the `binary packages` with files stored in the
156 `package destdir` and registers them into the local repository.
158 - `clean` This phase cleans up the package (if defined).
160 `xbps-src` supports running just the specified phase, and if it ran
161 successfully, the phase will be skipped later (unless its work directory
162 `${wrksrc}` is removed with `xbps-src clean`).
164 <a id="namingconventions"></a>
165 ### Package naming conventions
170 Libraries are packages which provide shared objects (\*.so) in /usr/lib.
171 They should be named like their upstream package name with the following
174 - The package is a subpackage of a front end application and provides
175 shared objects used by the base package and other third party libraries. In that
176 case it should be prefixed with 'lib'. An exception from that rule is: If an
177 executable is only used for building that package, it moves to the -devel
180 Example: wireshark -> subpkg libwireshark
182 Libraries have to be split into two sub packages: `<name>` and `<name>-devel`.
184 - `<name>` should only contain those parts of a package which are needed to run
187 - `<name>-devel` should contain all files which are needed to compile a package
188 against this package. If the library is a sub package, its corresponding
189 development package should be named `lib<name>-devel`
191 <a id="language_modules"></a>
192 #### Language Modules
194 Language modules are extensions to script or compiled languages. Those packages
195 do not provide any executables themselves, but can be used by other packages
196 written in the same language.
198 The naming convention to those packages is:
204 If a package provides both, a module and a executable, it should be split into
205 a package providing the executable named `<name>` and the module named
206 `<language>-<name>`. If a package starts with the languages name itself, the
207 language prefix can be dropped. Short names for languages are no valid substitute
208 for the language prefix.
210 Example: python-pam, perl-URI, python3-pyside2
212 <a id="language_bindings"></a>
213 #### Language Bindings
215 Language Bindings are packages which allow programs or libraries to have
216 extensions or plugins written in a certain language.
218 The naming convention to those packages is:
223 Example: gimp-python, irssi-perl
225 <a id="programs"></a>
228 Programs put executables under /usr/bin (or in very special cases in other
231 For those packages the upstream packages name should be used. Remember that
232 in contrast to many other distributions, void doesn't lowercase package names.
233 As a rule of thumb, if the tar.gz of a package contains uppercase letter, then
234 the package name should contain them too; if it doesn't, the package name
237 Programs can be split into program packages and library packages. The program
238 package should be named as described above. The library package should be
239 prefixed with "lib" (see section `Libraries`)
241 <a id="global_funcs"></a>
244 The following functions are defined by `xbps-src` and can be used on any template:
246 - *vinstall()* `vinstall <file> <mode> <targetdir> [<name>]`
248 Installs `file` with the specified `mode` into `targetdir` in the pkg `$DESTDIR`.
249 The optional 4th argument can be used to change the `file name`.
251 - *vcopy()* `vcopy <pattern> <targetdir>`
253 Copies recursively all files in `pattern` to `targetdir` in the pkg `$DESTDIR`.
255 - *vmove()* `vmove <pattern>`
257 Moves `pattern` to the specified directory in the pkg `$DESTDIR`.
259 - *vmkdir()* `vmkdir <directory> [<mode>]`
261 Creates a directory in the pkg `$DESTDIR`. The 2nd optional argument sets the mode of the directory.
263 - *vbin()* `vbin <file> [<name>]`
265 Installs `file` into `usr/bin` in the pkg `$DESTDIR` with the
266 permissions 0755. The optional 2nd argument can be used to change
269 - *vman()* `vman <file> [<name>]`
271 Installs `file` as a man page. `vman()` parses the name and
272 determines the section as well as localization. Also transparently
273 converts gzipped (.gz) and bzipped (.bz2) manpages into plaintext.
276 - `foo.1` -> `${DESTDIR}/usr/share/man/man1/foo.1`
277 - `foo.fr.1` -> `${DESTDIR}/usr/share/man/fr/man1/foo.1`
278 - `foo.1p` -> `${DESTDIR}/usr/share/man/man1/foo.1p`
279 - `foo.1.gz` -> `${DESTDIR}/usr/share/man/man1/foo.1`
280 - `foo.1.bz2` -> `${DESTDIR}/usr/share/man/man1/foo.1`
282 - *vdoc()* `vdoc <file> [<name>]`
284 Installs `file` into `usr/share/doc/<pkgname>` in the pkg
285 `$DESTDIR`. The optional 2nd argument can be used to change the
288 - *vconf()* `vconf <file> [<name>]`
290 Installs `file` into `etc` in the pkg
291 `$DESTDIR`. The optional 2nd argument can be used to change the
294 - *vsconf()* `vsconf <file> [<name>]`
296 Installs `file` into `usr/share/examples/<pkgname>` in the pkg
297 `$DESTDIR`. The optional 2nd argument can be used to change the
300 - <a id="vlicense"></a>
301 *vlicense()* `vlicense <file> [<name>]`
303 Installs `file` into `usr/share/licenses/<pkgname>` in the pkg
304 `$DESTDIR`. The optional 2nd argument can be used to change the
305 `file name`. See [license](#var_license) for when to use it.
307 - *vsv()* `vsv <service> [<facility>]`
309 Installs `service` from `${FILESDIR}` to /etc/sv. The service must
310 be a directory containing at least a run script. Note the `supervise`
311 symlink will be created automatically by `vsv` and that the run script
312 is automatically made executable by this function.
313 For further information on how to create a new service directory see
314 [The corresponding section the FAQ](http://smarden.org/runit/faq.html#create).
315 A `log` sub-service will be automatically created if one does not exist in
316 `${FILESDIR}/$service`, containing `exec vlogger -t $service -p $facility`.
317 if a second argument is not specified, the `daemon` facility is used.
318 For more information about `vlogger` and available values for the facility,
319 see [vlogger(8)](https://man.voidlinux.org/vlogger.8).
321 - *vsed()* `vsed -i <file> -e <regex>`
323 Wrapper around sed that checks sha256sum of a file before and after running
324 the sed command to detect cases in which the sed call didn't change anything.
325 Takes any arbitrary amount of files and regexes by calling `-i file` and
326 `-e regex` repeatedly, at least one file and one regex must be specified.
328 Note that vsed will call the sed command for every regex specified against
329 every file specified, in the order that they are given.
331 - *vcompletion()* `<file> <shell> [<command>]`
333 Installs shell completion from `file` for `command`, in the correct location
334 and with the appropriate filename for `shell`. If `command` isn't specified,
335 it will default to `pkgname`. The `shell` argument can be one of `bash`,
338 - *vextract()* `[-C <target directory>] [--no-strip-components|--strip-components=<n>] <file>`
340 Extracts `file` to `target directory` with `n` directory components stripped. If
341 `target directory` not specified, defaults to the working directory. If
342 `--strip-components` or `--no-strip-components` is not specified, defaults to
343 `--strip-components=1`.
345 - *vsrcextract()* `[-C <target directory>] [--no-strip-components|--strip-components=<n>] <file>`
347 Extracts `$XBPS_SRCDISTDIR/$pkgname-$version/<file>` to `target directory`
348 with `n` directory components stripped. If `target directory` not specified,
349 defaults to the working directory. If `--strip-components` or `--no-strip-components`
350 is not specified, defaults to `--strip-components=1`.
352 This is useful when used in conjunction with `skip_extraction` and for submodule distfiles.
354 - *vsrccopy()* `<file>... <target>`
356 Copies `file`s from `$XBPS_SRCDISTDIR/$pkgname-$version/` into the `target` directory,
357 creating `target` if it does not exist.
359 This is useful when used in conjunction with `skip_extraction`.
361 > Shell wildcards must be properly quoted, Example: `vmove "usr/lib/*.a"`.
363 <a id="global_vars"></a>
366 The following variables are defined by `xbps-src` and can be used on any template:
368 - `makejobs` Set to `-jX` if `XBPS_MAKEJOBS` is defined, to allow parallel jobs with `GNU make`.
370 - `sourcepkg` Set to the to main package name, can be used to match the main package
371 rather than additional binary package names.
373 - `CHROOT_READY` Set if the target chroot (masterdir) is ready for chroot builds.
375 - `CROSS_BUILD` Set if `xbps-src` is cross compiling a package.
377 - `XBPS_CHECK_PKGS` Set if `xbps-src` is going to run tests for a package.
378 Longer testsuites should only be run in `do_check()` if it is set to `full`.
380 - `DESTDIR` Full path to the fake destdir used by the source pkg, set to
381 `<masterdir>/destdir/${sourcepkg}-${version}`.
383 - `FILESDIR` Full path to the `files` package directory, i.e `srcpkgs/foo/files`.
384 The `files` directory can be used to store additional files to be installed
385 as part of the source package.
387 - `PKGDESTDIR` Full path to the fake destdir used by the `pkg_install()` function in
388 `subpackages`, set to `<masterdir>/destdir/${pkgname}-${version}`.
390 - `XBPS_BUILDDIR` Directory to store the `source code` of the source package being processed,
391 set to `<masterdir>/builddir`. The package `wrksrc` is always stored
392 in this directory such as `${XBPS_BUILDDIR}/${wrksrc}`.
394 - `XBPS_MACHINE` The machine architecture as returned by `xbps-uhelper arch`.
396 - `XBPS_ENDIAN` The machine's endianness ("le" or "be").
398 - `XBPS_LIBC` The machine's C library ("glibc" or "musl").
400 - `XBPS_WORDSIZE` The machine's word size in bits (32 or 64).
402 - `XBPS_NO_ATOMIC8` The machine lacks native 64-bit atomics (needs libatomic emulation).
404 - `XBPS_SRCDISTDIR` Full path to where the `source distfiles` are stored, i.e `$XBPS_HOSTDIR/sources`.
406 - `XBPS_SRCPKGDIR` Full path to the `srcpkgs` directory.
408 - `XBPS_TARGET_MACHINE` The target machine architecture when cross compiling a package.
410 - `XBPS_TARGET_ENDIAN` The target machine's endianness ("le" or "be").
412 - `XBPS_TARGET_LIBC` The target machine's C library ("glibc" or "musl").
414 - `XBPS_TARGET_WORDSIZE` The target machine's word size in bits (32 or 64).
416 - `XBPS_TARGET_NO_ATOMIC8` The target machine lacks native 64-bit atomics (needs libatomic emulation).
418 - `XBPS_FETCH_CMD` The utility to fetch files from `ftp`, `http` of `https` servers.
420 - `XBPS_WRAPPERDIR` Full path to where xbps-src's wrappers for utilities are stored.
422 - `XBPS_CROSS_BASE` Full path to where cross-compile dependencies are installed, varies according to the target architecture triplet. i.e `aarch64` -> `/usr/aarch64-linux-gnu`.
424 - `XBPS_RUST_TARGET` The target architecture triplet used by `rustc` and `cargo`.
426 - `XBPS_BUILD_ENVIRONMENT` Enables continuous-integration-specific operations. Set to `void-packages-ci` if in continuous integration.
428 <a id="available_vars"></a>
429 ### Available variables
431 <a id="mandatory_vars"></a>
432 #### Mandatory variables
434 The list of mandatory variables for a template:
436 - `homepage` An URL pointing to the upstream homepage.
439 - <a id="var_license"></a>
440 `license` A string matching the license's [SPDX Short identifier](https://spdx.org/licenses),
441 `Public Domain`, or string prefixed with `custom:` for other licenses.
442 Multiple licenses should be separated by commas, Example: `GPL-3.0-or-later, custom:Hugware`.
444 Empty meta-packages that don't include any files
445 and thus have and require no license should use
448 Note: `AGPL`, `MIT`, `BSD`, `ISC`, `X11`, and custom licenses
449 require the license file to be supplied with the binary package.
451 - `maintainer` A string in the form of `name <user@domain>`. The email for this field
452 must be a valid email that you can be reached at. Packages using
453 `users.noreply.github.com` emails will not be accepted.
455 - `pkgname` A string with the package name, matching `srcpkgs/<pkgname>`.
457 - `revision` A number that must be set to 1 when the `source package` is created, or
458 updated to a new `upstream version`. This should only be increased when
459 the generated `binary packages` have been modified.
461 - `short_desc` A string with a brief description for this package. Max 72 chars.
463 - `version` A string with the package version. Must not contain dashes or underscore
464 and at least one digit is required. Shell's variable substitution usage is not allowed.
466 `pkgname` and `version` are forbidden to contain special characters. Hence, they don't
467 need to be quoted, and by convention, they shouldn't be.
469 <a id="optional_vars"></a>
470 #### Optional variables
472 - `hostmakedepends` The list of `host` dependencies required to build the package, and
473 that will be installed to the master directory. There is no need to specify a version
474 because the current version in srcpkgs will always be required.
475 Example: `hostmakedepends="foo blah"`.
477 - `makedepends` The list of `target` dependencies required to build the package, and that
478 will be installed to the master directory. There is no need to specify a version
479 because the current version in srcpkgs will always be required.
480 Example: `makedepends="foo blah"`.
482 - `checkdepends` The list of dependencies required to run the package checks, i.e.
483 the script or make rule specified in the template's `do_check()` function.
484 Example: `checkdepends="gtest"`.
486 - `depends` The list of dependencies required to run the package. These dependencies
487 are not installed to the master directory, rather are only checked if a binary package
488 in the local repository exists to satisfy the required version. Dependencies
489 can be specified with the following version comparators: `<`, `>`, `<=`, `>=`
490 or `foo-1.0_1` to match an exact version. If version comparator is not
491 defined (just a package name), the version comparator is automatically set to `>=0`.
492 Example: `depends="foo blah>=1.0"`. See the [Runtime dependencies](#deps_runtime) section
493 for more information.
495 - `bootstrap` If enabled the source package is considered to be part of the `bootstrap`
496 process and required to be able to build packages in the chroot. Only a
497 small number of packages must set this property.
499 - `conflicts` An optional list of packages conflicting with this package.
500 Conflicts can be specified with the following version comparators: `<`, `>`, `<=`, `>=`
501 or `foo-1.0_1` to match an exact version. If version comparator is not
502 defined (just a package name), the version comparator is automatically set to `>=0`.
503 Example: `conflicts="foo blah>=0.42.3"`.
505 - `distfiles` The full URL to the `upstream` source distribution files. Multiple files
506 can be separated by whitespaces. The files must end in `.tar.lzma`, `.tar.xz`,
507 `.txz`, `.tar.bz2`, `.tbz`, `.tar.gz`, `.tgz`, `.gz`, `.bz2`, `.tar` or
508 `.zip`. To define a target filename, append `>filename` to the URL.
510 distfiles="http://foo.org/foo-1.0.tar.gz http://foo.org/bar-1.0.tar.gz>bar.tar.gz"
512 To avoid repetition, several variables for common hosting sites
516 |------------------|-------------------------------------------------|
517 | CPAN_SITE | https://cpan.perl.org/modules/by-module |
518 | DEBIAN_SITE | http://ftp.debian.org/debian/pool |
519 | FREEDESKTOP_SITE | https://freedesktop.org/software |
520 | GNOME_SITE | https://ftp.gnome.org/pub/GNOME/sources |
521 | GNU_SITE | https://ftp.gnu.org/gnu |
522 | KERNEL_SITE | https://www.kernel.org/pub/linux |
523 | MOZILLA_SITE | https://ftp.mozilla.org/pub |
524 | NONGNU_SITE | https://download.savannah.nongnu.org/releases |
525 | PYPI_SITE | https://files.pythonhosted.org/packages/source |
526 | SOURCEFORGE_SITE | https://downloads.sourceforge.net/sourceforge |
527 | UBUNTU_SITE | http://archive.ubuntu.com/ubuntu/pool |
528 | XORG_SITE | https://www.x.org/releases/individual |
529 | KDE_SITE | https://download.kde.org/stable |
530 | VIDEOLAN_SITE | https://download.videolan.org/pub/videolan |
532 - `checksum` The `sha256` digests matching `${distfiles}`. Multiple files can be
533 separated by blanks. Please note that the order must be the same than
534 was used in `${distfiles}`. Example: `checksum="kkas00xjkjas"`
536 If a distfile changes its checksum for every download because it is packaged
537 on the fly on the server, like e.g. snapshot tarballs from any of the
538 `https://*.googlesource.com/` sites, the checksum of the `archive contents`
539 can be specified by prepending a commercial at (@).
540 For tarballs you can find the contents checksum by using the command
541 `tar xf <tarball.ext> --to-stdout | sha256sum`.
543 - `wrksrc` The directory name where the package sources are extracted, set to `${pkgname}-${version}`.
545 - `build_wrksrc` A directory relative to `${wrksrc}` that will be used when building the package.
547 - `create_wrksrc` Usually, after extracting, if there're multiple top-level
548 files and/or directories or when there're no directories at all, top-level files,
549 and directories will be wrapped inside one more layer of directory.
550 Set `create_wrksrc` to force this behaviour.
552 - `build_style` This specifies the `build method` for a package. Read below to know more
553 about the available package `build methods` or effect of leaving this not set.
555 - `build_helper` Whitespace-separated list of files in `common/build-helper` to be
556 sourced and its variables be made available on the template. i.e. `build_helper="rust"`.
558 - `configure_script` The name of the `configure` script to execute at the `configure` phase if
559 `${build_style}` is set to `configure` or `gnu-configure` build methods.
560 By default set to `./configure`.
562 - `configure_args` The arguments to be passed in to the `configure` script if `${build_style}`
563 is set to `configure` or `gnu-configure` build methods. By default, prefix
564 must be set to `/usr`. In `gnu-configure` packages, some options are already
565 set by default: `--prefix=/usr --sysconfdir=/etc --infodir=/usr/share/info --mandir=/usr/share/man --localstatedir=/var`.
567 - `make_cmd` The executable to run at the `build` phase if `${build_style}` is set to
568 `configure`, `gnu-configure` or `gnu-makefile` build methods.
569 By default set to `make`.
571 - `make_build_args` The arguments to be passed in to `${make_cmd}` at the build phase if
572 `${build_style}` is set to `configure`, `gnu-configure` or `gnu-makefile`
573 build methods. Unset by default.
575 - `make_check_args` The arguments to be passed in to `${make_cmd}` at the check phase if
576 `${build_style}` is set to `configure`, `gnu-configure` or `gnu-makefile`
577 build methods. Unset by default.
579 - `make_install_args` The arguments to be passed in to `${make_cmd}` at the `install`
580 phase if `${build_style}` is set to `configure`, `gnu-configure` or `gnu-makefile` build methods.
582 - `make_build_target` The build target. If `${build_style}` is set to `configure`, `gnu-configure`
583 or `gnu-makefile`, this is the target passed to `${make_cmd}` in the build phase;
584 when unset the default target is used.
585 If `${build_style}` is `python3-pep517`, this is the path of the package
586 directory that should be built as a Python wheel; when unset, defaults to `.` (the current
587 directory with respect to the build).
589 - `make_check_target` The target to be passed in to `${make_cmd}` at the check phase if
590 `${build_style}` is set to `configure`, `gnu-configure` or `gnu-makefile`
591 build methods. By default set to `check`.
593 - `make_install_target` The installation target. When `${build_style}` is set to `configure`,
594 `gnu-configure` or `gnu-makefile`, this is the target passed to `${make_command}` in the install
595 phase; when unset, it defaults to `install`. If `${build_style}` is `python-pep517`, this is the
596 path of the Python wheel produced by the build phase that will be installed; when unset, the
597 `python-pep517` build style will look for a wheel matching the package name and version in the
598 current directory with respect to the install.
600 - `make_check_pre` The expression in front of `${make_cmd}`. This can be used for wrapper commands
601 or for setting environment variables for the check command. By default empty.
603 - `patch_args` The arguments to be passed in to the `patch(1)` command when applying
604 patches to the package sources during `do_patch()`. Patches are stored in
605 `srcpkgs/<pkgname>/patches` and must be in `-p1` format. By default set to `-Np1`.
607 - `disable_parallel_build` If set the package won't be built in parallel
608 and `XBPS_MAKEJOBS` will be set to 1. If a package does not work well with `XBPS_MAKEJOBS`
609 but still has a mechanism to build in parallel, set `disable_parallel_build` and
610 use `XBPS_ORIG_MAKEJOBS` (which holds the original value of `XBPS_MAKEJOBS`) in the template.
612 - `disable_parallel_check` If set tests for the package won't be built and run in parallel
613 and `XBPS_MAKEJOBS` will be set to 1. If a package does not work well with `XBPS_MAKEJOBS`
614 but still has a mechanism to run checks in parallel, set `disable_parallel_check` and
615 use `XBPS_ORIG_MAKEJOBS` (which holds the original value of `XBPS_MAKEJOBS`) in the template.
617 - `make_check` Sets the cases in which the `check` phase is run.
618 This option has to be accompanied by a comment explaining why the tests fail.
620 - `yes` (the default) to run if `XBPS_CHECK_PKGS` is set.
621 - `extended` to run if `XBPS_CHECK_PKGS` is `full`.
622 - `ci-skip` to run locally if `XBPS_CHECK_PKGS` is set, but not as part of pull request checks.
626 - `keep_libtool_archives` If enabled the `GNU Libtool` archives won't be removed. By default those
627 files are always removed automatically.
629 - `skip_extraction` A list of filenames that should not be extracted in the `extract` phase.
630 This must match the basename of any url defined in `${distfiles}`.
631 Example: `skip_extraction="foo-${version}.tar.gz"`.
633 - `nodebug` If enabled -dbg packages won't be generated even if `XBPS_DEBUG_PKGS` is set.
635 - `conf_files` A list of configuration files the binary package owns; this expects full
636 paths, wildcards will be extended, and multiple entries can be separated by blanks.
637 Example: `conf_files="/etc/foo.conf /etc/foo2.conf /etc/foo/*.conf"`.
639 - `mutable_files` A list of files the binary package owns, with the expectation
640 that those files will be changed. These act a lot like `conf_files` but
641 without the assumption that a human will edit them.
643 - `make_dirs` A list of entries defining directories and permissions to be
644 created at install time. Each entry should be space separated, and will
645 itself contain spaces. `make_dirs="/dir 0750 user group"`. User and group and
646 mode are required on every line, even if they are `755 root root`. By
647 convention, there is only one entry of `dir perms user group` per line.
649 - `repository` Defines the repository in which the package will be placed. See
650 *Repositories* for a list of valid repositories.
652 - `nostrip` If set, the ELF binaries with debugging symbols won't be stripped. By
653 default all binaries are stripped.
655 - `nostrip_files` White-space separated list of ELF binaries that won't be stripped of
656 debugging symbols. Files can be given by full path or by filename.
658 - `noshlibprovides` If set, the ELF binaries won't be inspected to collect the provided
659 sonames in shared libraries.
661 - `noverifyrdeps` If set, the ELF binaries and shared libraries won't be inspected to collect
662 their reverse dependencies. You need to specify all dependencies in the `depends` when you
665 - `skiprdeps` White space separated list of filenames specified by their absolute path in
666 the `$DESTDIR` which will not be scanned for runtime dependencies. This may be useful to
667 skip files which are not meant to be run or loaded on the host but are to be sent to some
668 target device or emulation.
670 - `ignore_elf_files` White space separated list of machine code files
671 in /usr/share directory specified by absolute path, which are expected and allowed.
673 - `ignore_elf_dirs` White space separated list of directories in /usr/share directory
674 specified by absolute path, which are expected and allowed to contain machine code files.
676 - `nocross` If set, cross compilation won't be allowed and will exit immediately.
677 This should be set to a string describing why it fails, or a link to a buildlog (from the official builders, CI buildlogs can vanish) demonstrating the failure.
679 - `restricted` If set, xbps-src will refuse to build the package unless
680 `etc/conf` has `XBPS_ALLOW_RESTRICTED=yes`. The primary builders for Void
681 Linux do not have this setting, so the primary repositories will not have any
682 restricted package. This is useful for packages where the license forbids
685 - `subpackages` A white space separated list of subpackages (matching `foo_package()`)
686 to override the guessed list. Only use this if a specific order of subpackages is required,
687 otherwise the default would work in most cases.
689 - `broken` If set, building the package won't be allowed because its state is currently broken.
690 This should be set to a string describing why it is broken, or a link to a buildlog demonstrating the failure.
692 - `shlib_provides` A white space separated list of additional sonames the package provides on.
693 This appends to the generated file rather than replacing it.
695 - `shlib_requires` A white space separated list of additional sonames the package requires.
696 This appends to the generated file rather than replacing it.
698 - `nopie` Only needs to be set to something to make active, disables building the package with hardening
699 features (PIE, relro, etc). Not necessary for most packages.
701 - `nopie_files` White-space separated list of ELF binaries that won't be checked
702 for PIE. Files must be given by full path.
704 - `reverts` xbps supports a unique feature which allows to downgrade from broken
705 packages automatically. In the `reverts` field one can define a list of broken
706 pkgver the resulting package should revert. This field *must* be defined before
707 `version` and `revision` fields in order to work as expected. The versions
708 defined in `reverts` must be bigger than the one defined in `version`.
712 reverts="2.0_1 2.0_2"
717 - `alternatives` A white space separated list of supported alternatives the package provides.
718 A list is composed of three components separated by a colon: group, symlink and target.
719 Example: `alternatives="vi:/usr/bin/vi:/usr/bin/nvi ex:/usr/bin/ex:/usr/bin/nvi-ex"`.
721 - `font_dirs` A white space separated list of directories specified by an absolute path where a
722 font package installs its fonts.
723 It is used in the `x11-fonts` xbps-trigger to rebuild the font cache during install/removal
725 Example: `font_dirs="/usr/share/fonts/TTF /usr/share/fonts/X11/misc"`
727 - `dkms_modules` A white space separated list of Dynamic Kernel Module Support (dkms) modules
728 that will be installed and removed by the `dkms` xbps-trigger with the install/removal of the
730 The format is a white space separated pair of strings that represent the name of the module,
731 most of the time `pkgname`, and the version of the module, most of the time `version`.
732 Example: `dkms_modules="$pkgname $version zfs 4.14"`
734 - `register_shell` A white space separated list of shells defined by absolute path to be
735 registered into the system shells database. It is used by the `register-shell` trigger.
736 Example: `register_shell="/bin/tcsh /bin/csh"`
738 - `tags` A white space separated list of tags (categories) that are registered into the
739 package metadata and can be queried with `xbps-query` by users.
740 Example for qutebrowser: `tags="browser chromium-based qt5 python3"`
742 - `perl_configure_dirs` A white space separate list of directories relative to `wrksrc`
743 that contain Makefile.PL files that need to be processes for the package to work. It is
744 used in the perl-module build_style and has no use outside of it.
745 Example: `perl_configure_dirs="blob/bob foo/blah"`
747 - `preserve` If set, files owned by the package in the system are not removed when
748 the package is updated, reinstalled or removed. This is mostly useful for kernel packages
749 that shouldn't remove the kernel files when they are removed in case it might break the
750 user's booting and module loading. Otherwise in the majority of cases it should not be
753 - `fetch_cmd` Executable to be used to fetch URLs in `distfiles` during the `do_fetch` phase.
755 - `changelog` An URL pointing to the upstream changelog. Raw text files are preferred.
757 - `archs` Whitespace separated list of architectures that a package can be
758 built for, available architectures can be found under `common/cross-profiles`.
759 In general, `archs` should only be set if the upstream software explicitly targets
760 certain architectures or there is a compelling reason why the software should not be
761 available on some supported architectures.
762 Prepending a pattern with a tilde means disallowing build on the indicated archs.
763 The first matching pattern is taken to allow/deny build. When no pattern matches,
764 the package is built if the last pattern includes a tilde.
768 # Build package only for musl architectures
770 # Build package for x86_64-musl and any non-musl architecture
771 archs="x86_64-musl ~*-musl"
772 # Default value (all arches)
775 A special value `noarch` used to be available, but has since been removed.
777 - `nocheckperms` If set, xbps-src will not fail on common permission errors (world writable files, etc.)
779 - `nofixperms` If set, xbps-src will not fix common permission errors (executable manpages, etc.)
781 <a id="explain_depends"></a>
782 #### About the many types of `depends` variables
784 So far, we have listed four types of `depends` variables: `hostmakedepends`,
785 `makedepends`, `checkdepends` and `depends`. These different kinds of variables
786 are necessary because `xbps-src` supports cross compilation and to avoid
787 installing unnecessary packages in the build environment.
789 During a build process, there are programs that must be _run_ on the host, such
790 as `yacc` or the C compiler. The packages that contain these programs should be
791 listed in `hostmakedepends`, and will be installed on the host when building the
792 target package. Some of these packages are dependencies of the `base-chroot`
793 package and don't need to be listed. It is possible that some of the programs
794 necessary to build a project are located in `-devel` packages.
796 The target package can also depend on other packages for libraries to link
797 against or header files. These packages should be listed in `makedepends` and
798 will match the target architecture, regardless of the architecture of the build
799 machine. Typically, `makedepends` will contain mainly `-devel` packages.
801 Furthermore, if `XBPS_CHECK_PKGS` is set or the `-Q` option is passed to
802 `xbps-src`, the target package might require specific dependencies or libraries
803 that are linked into its test binaries to run its test suite. These dependencies
804 should be listed in `checkdepends` and will be installed as if they were part of
805 `hostmakedepends`. Some dependencies that can be included in `checkdepends` are:
807 - `dejagnu`: used for some GNU projects
808 - `cmocka-devel`: linked into test binaries
809 - `dbus`: makes it possible to run `dbus-run-session <test-command>` to provide
810 a D-Bus session for applications that need it
811 - `git`: some test suites run the `git` command
813 <a id="deps_runtime"></a>
814 Lastly, a package may require certain dependencies at runtime, without which it
815 is unusable. These dependencies, when they aren't detected automatically by
816 XBPS, should be listed in `depends`.
818 Libraries linked by ELF objects are detected automatically by `xbps-src`, hence they
819 must not be specified in templates via `depends`. This variable should list:
821 - executables called as separate processes.
822 - ELF objects using dlopen(3).
823 - non-object code, e.g. C headers, perl/python/ruby/etc modules.
825 - overriding the minimal version specified in the `common/shlibs` file.
827 The runtime dependencies for ELF objects are detected by checking which SONAMEs
828 they require and then the SONAMEs are mapped to a binary package name with a minimal
829 required version. The `common/shlibs` file
830 sets up the `<SONAME> <pkgname>>=<version>` mappings.
832 For example the `foo-1.0_1` package provides the `libfoo.so.1` SONAME and
833 software requiring this library will link to `libfoo.so.1`; the resulting binary
834 package will have a run-time dependency on `foo>=1.0_1` package as specified in
840 libfoo.so.1 foo-1.0_1
844 - The first field specifies the SONAME.
845 - The second field specified the package name and minimal version required.
846 - A third optional field (usually set to `ignore`) can be used to skip checks in soname bumps.
848 Dependencies declared via `depends` are not installed to the master directory, rather they are
849 only checked if they exist as binary packages, and are built automatically by `xbps-src` if
850 the specified version is not in the local repository.
852 As a special case, `virtual` dependencies may be specified as runtime dependencies in the
853 `depends` template variable. Several different packages can provide common functionality by
854 declaring a virtual name and version in the `provides` template variable (e.g.
855 `provides="vpkg-0.1_1"`). Packages that rely on the common functionality without concern for the
856 specific provider can declare a dependency on the virtual package name with the prefix `virtual?`
857 (e.g., `depends="virtual?vpkg-0.1_1"`). When a package is built by `xbps-src`, providers for any
858 virtual packages will be confirmed to exist and will be built if necessary. A map from virtual
859 packages to their default providers is defined in `etc/defaults.virtual`. Individual mappings can be
860 overridden by local preferences in `etc/virtual`. Comments in `etc/defaults.virtual` provide more
861 information on this map.
863 Finally, as a general rule, if a package is built the exact same way whether or
864 not a particular package is present in `makedepends` or `hostmakedepends`, that
865 package shouldn't be added as a build time dependency.
867 <a id="repositories"></a>
870 <a id="repo_by_branch"></a>
871 #### Repositories defined by Branch
873 The global repository takes the name of
874 the current branch, except if the name of the branch is master. Then the resulting
875 repository will be at the global scope. The usage scenario is that the user can
876 update multiple packages in a second branch without polluting his local repository.
878 <a id="pkg_defined_repo"></a>
879 #### Package defined Repositories
881 The second way to define a repository is by setting the `repository` variable in
882 a template. This way the maintainer can define repositories for a specific
883 package or a group of packages. This is currently used to distinguish between
884 certain classes of packages.
886 The following repository names are valid:
888 * `bootstrap`: Repository for xbps-src-specific packages.
889 * `debug`: Repository for packages containing debug symbols. In almost all cases,
890 these packages are generated automatically.
891 * `nonfree`: Repository for packages that are closed source or have nonfree licenses.
894 ### Checking for new upstream releases
896 New upstream versions can be automatically checked using
897 `./xbps-src update-check <pkgname>`. In some cases you need to override
898 the sensible defaults by assigning the following variables in a `update`
899 file in the same directory as the relevant `template` file:
901 - `site` contains the URL where the version number is
902 mentioned. If unset, defaults to `homepage` and the directories where
905 - `pkgname` is the package name the default pattern checks for.
906 If unset, defaults to `pkgname` from the template.
908 - `pattern` is a perl-compatible regular expression
909 matching the version number. Anchor the version number using `\K`
910 and `(?=...)`. Example: `pattern='<b>\K[\d.]+(?=</b>)'`, this
911 matches a version number enclosed in `<b>...</b>` tags.
913 - `ignore` is a space-separated list of shell globs that match
914 version numbers which are not taken into account for checking newer
915 versions. Example: `ignore="*b*"`
917 - `version` is the version number used to compare against
918 upstream versions. Example: `version=${version//./_}`
920 - `single_directory` can be set to disable
921 detecting directory containing one version of sources in url,
922 then searching new version in adjacent directories.
924 - `vdprefix` is a perl-compatible regular expression matching
925 part that precedes numeric part of version directory
926 in url. Defaults to `(|v|$pkgname)[-_.]*`.
928 - `vdsuffix` is a perl-compatible regular expression matching
929 part that follows numeric part of version directory
930 in url. Defaults to `(|\.x)`.
932 - `disabled` can be set to disable update checking for the package,
933 in cases where checking for updates is impossible or does not make sense.
934 This should be set to a string describing why it is disabled.
939 Sometimes software needs to be patched, most commonly to fix bugs that have
940 been found or to fix compilation with new software.
942 To handle this, xbps-src has patching functionality. It will look for all files
943 that match the glob `srcpkgs/$pkgname/patches/*.{diff,patch}` and will
944 automatically apply all files it finds using `patch(1)` with `-Np1`. This happens
945 during the `do_patch()` phase. The variable `PATCHESDIR` is
946 available in the template, pointing to the `patches` directory.
948 The patching behaviour can be changed in the following ways:
950 - A file called `series` can be created in the `patches` directory with a newline
951 separated list of patches to be applied in the order presented. When present
952 xbps-src will only apply patches named in the `series` file.
954 - A file with the same name as one of the patches but with `.args` as extension can
955 be used to set the args passed to `patch(1)`. As an example, if `foo.patch` requires
956 special arguments to be passed to `patch(1)` that can't be used when applying other
957 patches, `foo.patch.args` can be created containing those args.
959 <a id="build_scripts"></a>
960 ### build style scripts
962 The `build_style` variable specifies the build method to build and install a
963 package. It expects the name of any available script in the
964 `void-packages/common/build-style` directory. Please note that required packages
965 to execute a `build_style` script must be defined via `$hostmakedepends`.
967 The current list of available `build_style` scripts is the following:
969 - If `build_style` is not set, the template must (at least) define
970 `do_install()` function and optionally more build phases such as
971 `do_configure()`, `do_build()`, etc., and may overwrite default `do_fetch()` and
972 `do_extract()` that fetch and extract files defined in `distfiles` variable.
974 - `cargo` For packages written in rust that use Cargo for building.
975 Configuration arguments (such as `--features`) can be defined in the variable
976 `configure_args` and are passed to cargo during `do_build`.
978 - `cmake` For packages that use the CMake build system, configuration arguments
979 can be passed in via `configure_args`. The `cmake_builddir` variable may be
980 defined to specify the directory for building under `build_wrksrc` instead of
983 - `configure` For packages that use non-GNU configure scripts, at least `--prefix=/usr`
984 should be passed in via `configure_args`.
986 - `fetch` For packages that only fetch files and are installed as is via `do_install()`.
988 - `gnu-configure` For packages that use GNU autotools-compatible configure scripts,
989 additional configuration arguments can be passed in via `configure_args`.
991 - `gnu-makefile` For packages that use GNU make, build arguments can be passed in via
992 `make_build_args` and install arguments via `make_install_args`. The build
993 target can be overridden via `make_build_target` and the install target
994 via `make_install_target`. This build style tries to compensate for makefiles
995 that do not respect environment variables, so well written makefiles, those
996 that do such things as append (`+=`) to variables, should have `make_use_env`
997 set in the body of the template.
999 - `go` For programs written in Go that follow the standard package
1000 structure. The variable `go_import_path` must be set to the package's
1001 import path, e.g. `github.com/github/hub` for the `hub` program. This
1002 information can be found in the `go.mod` file for modern Go projects.
1003 It's expected that the distfile contains the package, but dependencies
1004 will be downloaded with `go get`.
1006 - `meta` For `meta-packages`, i.e packages that only install local files or simply
1007 depend on additional packages. This build style does not install
1008 dependencies to the root directory, and only checks if a binary package is
1009 available in repositories.
1011 - `R-cran` For packages that are available on The Comprehensive R Archive
1012 Network (CRAN). The build style requires the `pkgname` to start with
1013 `R-cran-` and any dashes (`-`) in the CRAN-given version to be replaced
1014 with the character `r` in the `version` variable. The `distfiles`
1015 location will automatically be set as well as the package made to depend
1018 - `gemspec` For packages that use
1019 [gemspec](https://guides.rubygems.org/specification-reference/) files for building a ruby
1020 gem and then installing it. The gem command can be overridden by `gem_cmd`. `configure_args`
1021 can be used to pass arguments during compilation. If your package does not make use of compiled
1022 extensions consider using the `gem` build style instead.
1024 - `gem` For packages that are installed using gems from [RubyGems](https://rubygems.org/).
1025 The gem command can be overridden by `gem_cmd`.
1026 `distfiles` is set by the build style if the template does not do so. If your gem
1027 provides extensions which must be compiled consider using the `gemspec` build style instead.
1029 - `ruby-module` For packages that are ruby modules and are installable via `ruby install.rb`.
1030 Additional install arguments can be specified via `make_install_args`.
1032 - `perl-ModuleBuild` For packages that use the Perl
1033 [Module::Build](https://metacpan.org/pod/Module::Build) method.
1035 - `perl-module` For packages that use the Perl
1036 [ExtUtils::MakeMaker](http://perldoc.perl.org/ExtUtils/MakeMaker.html) build method.
1038 - `raku-dist` For packages that use the Raku `raku-install-dist` build method with rakudo.
1040 - `waf3` For packages that use the Python3 `waf` build method with python3.
1042 - `waf` For packages that use the Python `waf` method with python2.
1044 - `slashpackage` For packages that use the /package hierarchy and package/compile to build,
1045 such as `daemontools` or any `djb` software.
1047 - `qmake` For packages that use Qt4/Qt5 qmake profiles (`*.pro`), qmake arguments
1048 for the configure phase can be passed in via `configure_args`, make build arguments can
1049 be passed in via `make_build_args` and install arguments via `make_install_args`. The build
1050 target can be overridden via `make_build_target` and the install target
1051 via `make_install_target`.
1053 - `meson` For packages that use the Meson Build system, configuration options can be passed
1054 via `configure_args`, the meson command can be overridden by `meson_cmd` and the location of
1055 the out of source build by `meson_builddir`
1057 - `void-cross` For cross-toolchain packages used to build Void systems. There are no
1058 mandatory variables (target triplet is inferred), but you can specify some optional
1059 ones - `cross_gcc_skip_go` can be specified to skip `gccgo`, individual subproject
1060 configure arguments can be specified via `cross_*_configure_args` where `*` is `binutils`,
1061 `gcc_bootstrap` (early gcc), `gcc` (final gcc), `glibc` (or `musl`), `configure_args` is
1062 additionally passed to both early and final `gcc`. You can also specify custom `CFLAGS`
1063 and `LDFLAGS` for the libc as `cross_(glibc|musl)_(cflags|ldflags)`.
1065 - `zig-build` For packages using [Zig](https://ziglang.org)'s build
1066 system. Additional arguments may be passed to the `zig build` invocation using
1069 For packages that use the Python module build method (`setup.py` or
1070 [PEP 517](https://www.python.org/dev/peps/pep-0517/)), you can choose one of the following:
1072 - `python2-module` to build Python 2.x modules
1074 - `python3-module` to build Python 3.x modules
1076 - `python3-pep517` to build Python 3.x modules that provide a PEP 517 build description without
1079 Environment variables for a specific `build_style` can be declared in a filename
1080 matching the `build_style` name, Example:
1082 `common/environment/build-style/gnu-configure.sh`
1084 - `texmf` For texmf zip/tarballs that need to go into /usr/share/texmf-dist. Includes
1085 duplicates handling.
1087 <a id="build_helper"></a>
1088 ### build helper scripts
1090 The `build_helper` variable specifies shell snippets to be sourced that will create a
1091 suitable environment for working with certain sets of packages.
1093 The current list of available `build_helper` scripts is the following:
1095 - `cmake-wxWidgets-gtk3` sets the `WX_CONFIG` variable which is used by FindwxWidgets.cmake
1097 - `gir` specifies dependencies for native and cross builds to deal with
1098 GObject Introspection. The following variables may be set in the template to handle
1099 cross builds which require additional hinting or exhibit problems. `GIR_EXTRA_LIBS_PATH` defines
1100 additional paths to be searched when linking target binaries to be introspected.
1101 `GIR_EXTRA_OPTIONS` defines additional options for the `g-ir-scanner-qemuwrapper` calling
1102 `qemu-<target_arch>-static` when running the target binary. You can for example specify
1103 `GIR_EXTRA_OPTIONS="-strace"` to see a trace of what happens when running that binary.
1105 - `meson` creates a cross file, `${XBPS_WRAPPERDIR}/meson/xbps_meson.cross`, which configures
1106 meson for cross builds. This is particularly useful for building packages that wrap meson
1107 invocations (e.g., `python3-pep517` packages that use a meson backend) and is added by default
1108 for packages that use the `meson` build style.
1110 - `numpy` configures the environment for cross-compilation of python packages that provide
1111 compiled extensions linking to NumPy C libraries. If the `meson` build helper is also
1112 configured, a secondary cross file, `${XBPS_WRAPPERDIR}/meson/xbps_numpy.cross`, will be
1113 written to inform meson where common NumPy components may be found.
1115 - `python3` configures the cross-build environment to use Python libraries, header files, and
1116 interpreter configurations in the target root. The `python3` helper is added by default for
1117 packages that use the `python3-module` or `python3-pep517` build styles.
1119 - `qemu` sets additional variables for the `cmake` and `meson` build styles to allow
1120 executing cross-compiled binaries inside qemu.
1121 It sets `CMAKE_CROSSCOMPILING_EMULATOR` for cmake and `exe_wrapper` for meson
1122 to `qemu-<target_arch>-static` and `QEMU_LD_PREFIX` to `XBPS_CROSS_BASE`.
1123 It also creates the `vtargetrun` function to wrap commands in a call to
1124 `qemu-<target_arch>-static` for the target architecture.
1126 - `qmake` creates the `qt.conf` configuration file (cf. `qmake` `build_style`)
1127 needed for cross builds and a qmake-wrapper to make `qmake` use this configuration.
1128 This aims to fix cross-builds for when the build-style is mixed: e.g. when in a
1129 `gnu-configure` style the configure script calls `qmake` or a `Makefile` in
1130 `gnu-makefile` style, respectively.
1132 - `rust` specifies environment variables required for cross-compiling crates via cargo and
1133 for compiling cargo -sys crates. This helper is added by default for packages that use the
1134 `cargo` build style.
1136 <a id="functions"></a>
1139 The following functions can be defined to change the behavior of how the
1140 package is downloaded, compiled and installed.
1142 - `pre_fetch()` Actions to execute before `do_fetch()`.
1144 - `do_fetch()` if defined and `distfiles` is not set, use it to fetch the required sources.
1146 - `post_fetch()` Actions to execute after `do_fetch()`.
1148 - `pre_extract()` Actions to execute after `post_fetch()`.
1150 - `do_extract()` if defined and `distfiles` is not set, use it to extract the required sources.
1152 - `post_extract()` Actions to execute after `do_extract()`.
1154 - `pre_patch()` Actions to execute after `post_extract()`.
1156 - `do_patch()` if defined use it to prepare the build environment and run hooks to apply patches.
1158 - `post_patch()` Actions to execute after `do_patch()`.
1160 - `pre_configure()` Actions to execute after `post_patch()`.
1162 - `do_configure()` Actions to execute to configure the package; `${configure_args}` should
1163 still be passed in if it's a GNU configure script.
1165 - `post_configure()` Actions to execute after `do_configure()`.
1167 - `pre_build()` Actions to execute after `post_configure()`.
1169 - `do_build()` Actions to execute to build the package.
1171 - `post_build()` Actions to execute after `do_build()`.
1173 - `pre_check()` Actions to execute after `post_build()`.
1175 - `do_check()` Actions to execute to run checks for the package.
1177 - `post_check()` Actions to execute after `do_check()`.
1179 - `pre_install()` Actions to execute after `post_check()`.
1181 - `do_install()` Actions to execute to install the package files into the `fake destdir`.
1183 - `post_install()` Actions to execute after `do_install()`.
1185 - `do_clean()` Actions to execute to clean up after a successful package phase.
1187 > A function defined in a template has preference over the same function
1188 defined by a `build_style` script.
1190 Current working directory for functions is set as follows:
1192 - For pre_fetch, pre_extract, do_clean: `<masterdir>`.
1194 - For do_fetch, post_fetch: `XBPS_BUILDDIR`.
1196 - For do_extract through do_patch: `wrksrc`.
1198 - For post_patch through post_install: `build_wrksrc`
1199 if it is defined, otherwise `wrksrc`.
1201 <a id="build_options"></a>
1204 Some packages might be built with different build options to enable/disable
1205 additional features; The XBPS source packages collection allows you to do this with some simple tweaks
1206 to the `template` file.
1208 The following variables may be set to allow package build options:
1210 - `build_options` Sets the build options supported by the source package.
1212 - `build_options_default` Sets the default build options to be used by the source package.
1214 - `desc_option_<option>` Sets the description for the build option `option`. This must match the
1215 keyword set in *build_options*. Note that if the build option is generic enough, its description
1216 should be added to `common/options.description` instead.
1218 After defining those required variables, you can check for the
1219 `build_option_<option>` variable to know if it has been set and adapt the source
1220 package accordingly. Additionally, the following functions are available:
1222 - *vopt_if()* `vopt_if <option> <if_true> [<if_false>]`
1224 Outputs `if_true` if `option` is set, or `if_false` if it isn't set.
1226 - *vopt_with()* `vopt_with <option> [<flag>]`
1228 Outputs `--with-<flag>` if the option is set, or `--without-<flag>`
1229 otherwise. If `flag` isn't set, it defaults to `option`.
1234 - `vopt_with xml xml2`
1236 - *vopt_enable()* `vopt_enable <option> [<flag>]`
1238 Same as `vopt_with`, but uses `--enable-<flag>` and
1239 `--disable-<flag>` respectively.
1241 - *vopt_conflict()* `vopt_conflict <option 1> <option 2>`
1243 Emits an error and exits if both options are set at the same time.
1245 - *vopt_bool()* `vopt_bool <option> <property>`
1247 Outputs `-D<property>=true` if the option is set, or
1248 `-D<property>=false` otherwise.
1250 - *vopt_feature()* `vopt_feature <option> <property>`
1252 Same as `vopt_bool`, but uses `-D<property=enabled` and
1253 `-D<property>=disabled` respectively.
1255 The following example shows how to change a source package that uses GNU
1256 configure to enable a new build option to support PNG images:
1259 # Template file for 'foo'
1263 build_style=gnu-configure
1264 configure_args="... $(vopt_with png)"
1265 makedepends="... $(vopt_if png libpng-devel)"
1268 # Package build options
1270 desc_option_png="Enable support for PNG images"
1272 # To build the package by default with the `png` option:
1274 # build_options_default="png"
1280 The supported build options for a source package can be shown with `xbps-src`:
1282 $ ./xbps-src show-options foo
1284 Build options can be enabled with the `-o` flag of `xbps-src`:
1286 $ ./xbps-src -o option,option1 <cmd> foo
1288 Build options can be disabled by prefixing them with `~`:
1290 $ ./xbps-src -o ~option,~option1 <cmd> foo
1292 Both ways can be used together to enable and/or disable multiple options
1293 at the same time with `xbps-src`:
1295 $ ./xbps-src -o option,~option1,~option2 <cmd> foo
1297 The build options can also be shown for binary packages via `xbps-query(8)`:
1299 $ xbps-query -R --property=build-options foo
1301 Permanent global package build options can be set via `XBPS_PKG_OPTIONS` variable in the
1302 `etc/conf` configuration file. Per package build options can be set via
1303 `XBPS_PKG_OPTIONS_<pkgname>`.
1305 > NOTE: if `pkgname` contains `dashes`, those should be replaced by `underscores`
1306 Example: `XBPS_PKG_OPTIONS_xorg_server=opt`.
1308 The list of supported package build options and its description is defined in the
1309 `common/options.description` file.
1311 <a id="install_remove_files"></a>
1312 ### INSTALL and REMOVE files
1314 The INSTALL and REMOVE shell snippets can be used to execute certain actions at a specified
1315 stage when a binary package is installed, updated or removed. There are some variables
1316 that are always set by `xbps` when the scripts are executed:
1318 - `$ACTION`: to conditionalize its actions: `pre` or `post`.
1319 - `$PKGNAME`: the package name.
1320 - `$VERSION`: the package version.
1321 - `$UPDATE`: set to `yes` if package is being upgraded, `no` if package is being `installed` or `removed`.
1322 - `$CONF_FILE`: full path to `xbps.conf`.
1323 - `$ARCH`: the target architecture it is running on.
1325 An example of how an `INSTALL` or `REMOVE` script shall be created is shown below:
1331 # Actions to execute before the package files are unpacked.
1335 if [ "$UPDATE" = "yes" ]; then
1336 # actions to execute if package is being updated.
1339 # actions to execute if package is being installed.
1346 subpackages can also have their own `INSTALL` and `REMOVE` files, simply create them
1347 as `srcpkgs/<pkgname>/<subpkg>.INSTALL` or `srcpkgs/<pkgname>/<subpkg>.REMOVE` respectively.
1349 > NOTE: always use paths relative to the current working directory, otherwise if the scripts cannot
1350 be executed via `chroot(2)` won't work correctly.
1352 > NOTE: do not use INSTALL/REMOVE scripts to print messages, see the next section for
1355 <a id="install_remove_files_msg"></a>
1356 ### INSTALL.msg and REMOVE.msg files
1358 The `INSTALL.msg` and `REMOVE.msg` files can be used to print a message at post-install
1359 or pre-remove time, respectively.
1361 Ideally those files should not exceed 80 chars per line.
1363 subpackages can also have their own `INSTALL.msg` and `REMOVE.msg` files, simply create them
1364 as `srcpkgs/<pkgname>/<subpkg>.INSTALL.msg` or `srcpkgs/<pkgname>/<subpkg>.REMOVE.msg` respectively.
1366 This should only be used for critical messages, like warning users of breaking changes.
1368 <a id="runtime_account_creation"></a>
1369 ### Creating system accounts/groups at runtime
1371 There's a trigger along with some variables that are specifically to create
1372 **system users and groups** when the binary package is being configured.
1373 The following variables can be used for this purpose:
1375 - `system_groups` This specifies the names of the new *system groups* to be created, separated
1376 by blanks. Optionally the **gid** can be specified by delimiting it with a
1377 colon, i.e `system_groups="_mygroup:78"` or `system_groups="_foo _blah:8000"`.
1379 - `system_accounts` This specifies the names of the new **system users/groups** to be created,
1380 separated by blanks, i.e `system_accounts="_foo _blah:22"`. Optionally the **uid** and **gid**
1381 can be specified by delimiting it with a colon, i.e `system_accounts="_foo:48"`.
1382 Additional variables for the **system accounts** can be specified to change its behavior:
1384 - `<account>_homedir` the home directory for the user. If unset defaults to `/var/empty`.
1385 - `<account>_shell` the shell for the new user. If unset defaults to `/sbin/nologin`.
1386 - `<account>_descr` the description for the new user. If unset defaults to `<account> unprivileged user`.
1387 - `<account>_groups` additional groups to be added to for the new user.
1388 - `<account>_pgroup` to set the primary group, by default primary group is set to `<account>`.
1390 The **system user** is created by using a dynamically allocated **uid/gid** in your system
1391 and it's created as a `system account`, unless the **uid** is set. A new group will be created for the
1392 specified `system account` and used exclusively for this purpose.
1394 System accounts and groups must be prefixed with an underscore to prevent clashing with names of user
1397 > NOTE: The underscore policy does not apply to old packages, due to the inevitable breakage of
1398 > changing the username only new packages should follow it.
1400 <a id="writing_runit_services"></a>
1401 ### Writing runit services
1403 Void Linux uses [runit](http://smarden.org/runit/) for booting and supervision of services.
1405 Most information about how to write them can be found in their
1406 [FAQ](http://smarden.org/runit/faq.html#create). The following are guidelines specific to
1407 Void Linux on how to write services.
1409 If the service daemon supports CLI flags, consider adding support for changing it via the
1410 `OPTS` variable by reading a file called `conf` in the same directory as the daemon.
1414 [ -r conf ] && . ./conf
1415 exec daemon ${OPTS:- --flag-enabled-by-default}
1418 If the service requires the creation of a directory under `/run` or its link `/var/run`
1419 for storing runtime information (like Pidfiles) write it into the service file. It
1420 is advised to use `install` if you need to create it with specific permissions instead
1425 install -d -m0700 /run/foo
1431 install -d -m0700 -o bar -g bar /run/bar
1435 If the service requires directories in parts of the system that are not generally in
1436 temporary filesystems. Then use the `make_dirs` variable in the template to create
1437 those directories when the package is installed.
1439 If the package installs a systemd service file or other unit, leave it in place as a
1440 reference point so long as including it has no negative side effects.
1442 Examples of when *not* to install systemd units:
1444 1. When doing so changes runtime behavior of the packaged software.
1445 2. When it is done via a compile time flag that also changes build dependencies.
1447 <a id="32bit_pkgs"></a>
1450 32bit packages are built automatically when the builder is x86 (32bit), but
1451 there are some variables that can change the behavior:
1453 - `lib32depends` If this variable is set, dependencies listed here will be used rather than
1454 those detected automatically by `xbps-src` and **depends**. Please note that
1455 dependencies must be specified with version comparators, Example:
1456 `lib32depends="foo>=0 blah<2.0"`.
1458 - `lib32disabled` If this variable is set, no 32bit package will be built.
1460 - `lib32files` Additional files to be added to the **32bit** package. This expect absolute
1461 paths separated by blanks, Example: `lib32files="/usr/bin/blah /usr/include/blah."`.
1463 - `lib32symlinks` Makes a symlink of the target filename stored in the `lib32` directory.
1464 This expects the basename of the target file, Example: `lib32symlinks="foo"`.
1466 - `lib32mode` If unset, only shared/static libraries and pkg-config files will be copied to the
1467 **32bit** package. If set to `full` all files will be copied to the 32bit package, unmodified.
1469 <a id="pkgs_sub"></a>
1472 In the example shown above just a binary package is generated, but with some
1473 simple tweaks multiple binary packages can be generated from a single
1474 template/build, this is called `subpackages`.
1476 To create additional `subpackages` the `template` must define a new function
1477 with this naming: `<subpkgname>_package()`, Example:
1480 # Template file for 'foo'
1484 build_style=gnu-configure
1485 short_desc="A short description max 72 chars"
1486 maintainer="name <email>"
1487 license="GPL-3.0-or-later"
1488 homepage="http://www.foo.org"
1489 distfiles="http://www.foo.org/foo-${version}.tar.gz"
1490 checksum="fea0a94d4b605894f3e2d5572e3f96e4413bcad3a085aae7367c2cf07908b2ff"
1492 # foo-devel is a subpkg
1493 foo-devel_package() {
1494 short_desc+=" - development files"
1495 depends="${sourcepkg}>=${version}_${revision}"
1499 vmove "usr/lib/*.so"
1500 vmove usr/lib/pkgconfig
1505 All subpackages need an additional symlink to the `main` pkg, otherwise dependencies
1506 requiring those packages won't find its `template` Example:
1510 |- foo <- directory (main pkg)
1512 |- foo-devel <- symlink to `foo`
1515 The main package should specify all required `build dependencies` to be able to build
1516 all subpackages defined in the template.
1518 An important point of `subpackages` is that they are processed after the main
1519 package has run its `install` phase. The `pkg_install()` function specified on them
1520 commonly is used to move files from the `main` package destdir to the `subpackage` destdir.
1522 The helper functions `vinstall`, `vmkdir`, `vcopy` and `vmove` are just wrappers that simplify
1523 the process of creating, copying and moving files/directories between the `main` package
1524 destdir (`$DESTDIR`) to the `subpackage` destdir (`$PKGDESTDIR`).
1526 Subpackages are processed always in alphabetical order; To force a custom order,
1527 the `subpackages` variable can be declared with the wanted order.
1529 <a id="pkgs_classes"></a>
1530 ### Some package classes
1532 <a id="pkgs_development"></a>
1533 #### Development packages
1535 A development package, commonly generated as a subpackage, shall only contain
1536 files required for development, that is, headers, static libraries, shared
1537 library symlinks, pkg-config files, API documentation or any other script
1538 that is only useful when developing for the target software.
1540 A development package should depend on packages that are required to link
1541 against the provided shared libraries, i.e if `libfoo` provides the
1542 `libfoo.so.2` shared library and the linking needs `-lbar`, the package
1543 providing the `libbar` shared library should be added as a dependency;
1544 and most likely it shall depend on its development package.
1546 If a development package provides a `pkg-config` file, you should verify
1547 what dependencies the package needs for dynamic or static linking, and add
1548 the appropriate `development` packages as dependencies.
1550 Development packages for the C and C++ languages usually `vmove` the
1551 following subset of files from the main package:
1553 * Header files `usr/include`
1554 * Static libraries `usr/lib/*.a`
1555 * Shared library symbolic links `usr/lib/*.so`
1556 * Cmake rules `usr/lib/cmake` `usr/share/cmake`
1557 * Package config files `usr/lib/pkgconfig` `usr/share/pkgconfig`
1558 * Autoconf macros `usr/share/aclocal`
1559 * Gobject introspection XML files `usr/share/gir-1.0`
1560 * Vala bindings `usr/share/vala`
1562 <a id="pkgs_data"></a>
1565 Another common subpackage type is the `-data` subpackage. This subpackage
1566 type used to split architecture independent, big(ger) or huge amounts
1567 of data from a package's main and architecture dependent part. It is up
1568 to you to decide, if a `-data` subpackage makes sense for your package.
1569 This type is common for games (graphics, sound and music), part libraries (CAD)
1570 or card material (maps).
1571 The main package must then have `depends="${pkgname}-data-${version}_${revision}"`,
1572 possibly in addition to other, non-automatic depends.
1574 <a id="pkgs_documentation"></a>
1575 #### Documentation packages
1577 Packages intended for user interaction do not always unconditionally require
1578 their documentation part. A user who does not want to e.g. develop
1579 with Qt5 will not need to install the (huge) qt5-doc package.
1580 An expert may not need it or opt to use an online version.
1582 In general a `-doc` package is useful, if the main package can be used both with
1583 or without documentation and the size of the documentation isn't really small.
1584 The base package and the `-devel` subpackage should be kept small so that when
1585 building packages depending on a specific package there is no need to install large
1586 amounts of documentation for no reason. Thus the size of the documentation part should
1587 be your guidance to decide whether or not to split off a `-doc` subpackage.
1589 <a id="pkgs_python"></a>
1590 #### Python packages
1592 Python packages should be built with the `python{,2,3}-module` build style, if possible.
1593 This sets some environment variables required to allow cross compilation. Support to allow
1594 building a python module for multiple versions from a single template is also possible.
1595 The `python3-pep517` build style provides means to build python packages that provide a build-system
1596 definition compliant with [PEP 517](https://www.python.org/dev/peps/pep-0517/) without a traditional
1597 `setup.py` script. The `python3-pep517` build style does not provide a specific build backend, so
1598 packages will need to add an appropriate backend provider to `hostmakedepends`.
1600 Python packages that rely on `python3-setuptools` should generally map `setup_requires`
1601 dependencies in `setup.py` to `hostmakedepends` in the template and `install_requires`
1602 dependencies to `depends` in the template; include `python3` in `depends` if there are no other
1603 python dependencies. If the package includes a compiled extension, the `python3-devel` packages
1604 should be added to `makedepends`, as should any python packages that also provide native libraries
1605 against which the extension will be linked (even if that package is also included in
1606 `hostmakedepends` to satisfy `setuptools`).
1608 **NB**: Python `setuptools` will attempt to use `pip` or `EasyInstall` to fetch any missing
1609 dependencies at build time. If you notice warnings about `EasyInstall` deprecation or python eggs
1610 present in `${wrksrc}/.eggs` after building the package, then those packages should be added to
1613 The following variables may influence how the python packages are built and configured
1614 at post-install time:
1616 - `pycompile_module`: By default, files and directories installed into
1617 `usr/lib/pythonX.X/site-packages`, excluding `*-info` and `*.so`, are byte-compiled
1618 at install time as python modules. This variable expects subset of them that
1619 should be byte-compiled, if default is wrong. Multiple python modules may be specified separated
1620 by blanks, Example: `pycompile_module="foo blah"`. If a python module installs a file into
1621 `site-packages` rather than a directory, use the name of the file, Example:
1622 `pycompile_module="fnord.py"`.
1624 - `pycompile_dirs`: this variable expects the python directories that should be `byte-compiled`
1625 recursively by the target python version. This differs from `pycompile_module` in that any
1626 path may be specified, Example: `pycompile_dirs="usr/share/foo"`.
1628 - `python_version`: this variable expects the supported Python major version.
1629 In most cases version is inferred from shebang, install path or build style.
1630 Only required for some multi-language
1631 applications (e.g., the application is written in C while the command is
1632 written in Python) or just single Python file ones that live in `/usr/bin`.
1633 If `python_version` is set to `ignore`, python-containing shebangs will not be rewritten.
1634 Use this only if a package should not be using a system version of python.
1636 Also, a set of useful variables are defined to use in the templates:
1638 | Variable | Value |
1639 |-------------|----------------------------------|
1641 | py2_lib | usr/lib/python2.X |
1642 | py2_sitelib | usr/lib/python2.X/site-packages |
1643 | py2_inc | usr/include/python2.X |
1645 | py3_lib | usr/lib/python3.X |
1646 | py3_sitelib | usr/lib/python3.X/site-packages |
1647 | py3_inc | usr/include/python3.Xm |
1649 > NOTE: it's expected that additional subpkgs must be generated to allow packaging for multiple
1652 <a id="pkgs_go"></a>
1655 Go packages should be built with the `go` build style, if possible.
1656 The `go` build style takes care of downloading Go dependencies and
1657 setting up cross compilation.
1659 The following template variables influence how Go packages are built:
1661 - `go_import_path`: The import path of the package included in the
1662 distfile, as it would be used with `go get`. For example, GitHub's
1663 `hub` program has the import path `github.com/github/hub`. This
1664 variable is required.
1665 - `go_package`: A space-separated list of import paths of the packages
1666 that should be built. Defaults to `go_import_path`.
1667 - `go_build_tags`: An optional, space-separated list of build tags to
1669 - `go_mod_mode`: The module download mode to use. May be `off` to ignore
1670 any go.mod files, `default` to use Go's default behavior, or anything
1671 accepted by `go build -mod MODE`. Defaults to `vendor` if there's
1672 a vendor directory, otherwise `default`.
1673 - `go_ldflags`: Arguments to pass to the linking steps of go tool.
1675 The following environment variables influence how Go packages are built:
1677 - `XBPS_MAKEJOBS`: Value passed to the `-p` flag of `go install`, to
1678 control the parallelism of the Go compiler.
1680 Occasionally it is necessary to perform operations from within the Go
1681 source tree. This is usually needed by programs using go-bindata or
1682 otherwise preping some assets. If possible do this in pre_build().
1683 The path to the package's source inside `$GOPATH` is available as
1686 <a id="pkgs_haskell"></a>
1687 #### Haskell packages
1689 We build Haskell package using `stack` from
1690 [Stackage](http://www.stackage.org/), generally the LTS versions.
1691 Haskell templates need to have host dependencies on `ghc` and `stack`,
1692 and set build style to `haskell-stack`.
1694 The following variables influence how Haskell packages are built:
1696 - `stackage`: The Stackage version used to build the package, e.g.
1697 `lts-3.5`. Alternatively:
1698 - You can prepare a `stack.yaml` configuration for the project and put it
1699 into `files/stack.yaml`.
1700 - If a `stack.yaml` file is present in the source files, it will be used
1701 - `make_build_args`: This is passed as-is to `stack build ...`, so
1702 you can add your `--flag ...` parameters there.
1704 <a id="pkgs_font"></a>
1707 Font packages are very straightforward to write, they are always set with the
1708 following variables:
1710 - `depends="font-util"`: because they are required for regenerating the font
1711 cache during the install/removal of the package
1712 - `font_dirs`: which should be set to the directory where the package
1715 <a id="pkg_rename"></a>
1716 ### Renaming a package
1718 - Create empty package of old name, depending on new package. This is
1719 necessary to provide updates to systems where old package is already
1720 installed. This should be a subpackage of new one, except when version
1721 number of new package decreased: then create a separate template using
1722 old version and increased revision.
1723 - Edit references to package in other templates and common/shlibs.
1724 - Don't set `replaces=`, it can result in removing both packages from
1727 <a id="pkg_remove"></a>
1728 ### Removing a package
1730 Follows a list of things that should be done to help guarantee that a
1731 package template removal and by extension its binary packages from
1732 Void Linux's repositories goes smoothly.
1734 Before removing a package template:
1736 - Guarantee that no package depends on it or any of its subpackages.
1737 For that you can search the templates for references to the package
1738 with `grep -r '\bpkg\b' srcpkgs/`.
1739 - Guarantee that no package depends on shlibs provided by it.
1741 When removing the package template:
1743 - Remove all symlinks that point to the package.
1744 `find srcpkgs/ -lname <pkg>` should be enough.
1745 - If the package provides shlibs make sure to remove them from
1747 - Some packages use patches and files from other packages using symlinks,
1748 generally those packages are the same but have been split as to avoid
1749 cyclic dependencies. Make sure that the package you're removing is not
1750 the source of those patches/files.
1751 - Remove package template.
1752 - Add `pkgname<=version_revision` to `replaces` variable of `removed-packages`
1753 template. All removed subpkgs should be added too.
1754 This will uninstall package from systems where it is installed.
1755 - Remove the package from the repository index
1756 or contact a team member that can do so.
1758 <a id="xbps_triggers"></a>
1761 XBPS triggers are a collection of snippets of code, provided by the `xbps-triggers`
1762 package, that are added to the INSTALL/REMOVE scripts of packages either manually
1763 by setting the `triggers` variable in the template, or automatically, when specific
1766 The following is a list of all available triggers, their current status, what each
1767 of them does and what conditions need to be for it to be included automatically on a
1770 This is not a complete overview of the package. It is recommended to read the variables
1771 referenced and the triggers themselves.
1773 <a id="triggers_appstream_cache"></a>
1774 #### appstream-cache
1776 The appstream-cache trigger is responsible for rebuilding the appstream metadata cache.
1778 During installation it executes `appstreamcli refresh-cache --verbose --force --datapath
1779 $APPSTREAM_PATHS --cachepath var/cache/app-info/gv`. By default APPSTREAM_PATHS are all the
1780 paths that appstreamcli will look into for metadata files.
1782 The directories searched by appstreamcli are:
1784 - `usr/share/appdata`
1785 - `usr/share/app-info`
1786 - `var/lib/app-info`
1787 - `var/cache/app-info`
1789 During removal of the `AppStream` package it will remove the `var/cache/app-info/gv`
1792 It is automatically added to packages that have XML files under one of the directories
1793 searched by appstreamcli.
1795 <a id="triggers_binfmts"></a>
1798 The binfmts trigger is responsible for registration and removal of arbitrary
1799 executable binary formats, know as binfmts.
1801 During installation/removal it uses `update-binfmts` from the `binfmt-support` package
1802 to register/remove entries from the arbitrary executable binary formats database.
1804 To include the trigger use the `binfmts` variable, as the trigger won't do anything unless
1807 <a id="triggers_dkms"></a>
1810 The dkms trigger is responsible for compiling and removing dynamic kernel modules of a
1813 During installation the trigger compiles and installs the dynamic module for all `linux`
1814 packages that have their corresponding linux-headers package installed. During removal
1815 the corresponding module will be removed
1817 To include the trigger use the `dkms_modules` variable, as the trigger won't do anything
1818 unless it is defined.
1820 <a id="triggers_gconf_schemas"></a>
1823 The gconf-schemas trigger is responsible for registering and removing .schemas and
1824 .entries files into the schemas database directory
1826 During installation it uses `gconftool-2` to install .schemas and .entries files into
1827 `usr/share/gconf/schemas`. During removal it uses `gconftool-2` to remove the entries
1828 and schemas belonging to the package that is being removed from the database.
1830 To include it add `gconf-schemas` to `triggers` and add the appropriate .schemas in
1831 the `gconf_schemas` variable and .entries in `gconf_entries`.
1833 It is automatically added to packages that have `/usr/share/gconf/schemas` present
1834 as a directory. All files with the schemas file extension under that directory
1835 are passed to the trigger.
1837 <a id="triggers_gdk_pixbuf_loaders"></a>
1838 #### gdk-pixbuf-loaders
1840 The gdk-pixbuf-loaders trigger is responsible for maintaining the GDK Pixbuf loaders cache.
1842 During installation it runs `gdk-pixbuf-query-loaders --update-cache` and also deletes
1843 the obsolete `etc/gtk-2.0/gdk-pixbuf.loaders` file if present. During removal of the
1844 gdk-pixbuf package it removes the cache file if present. Normally at
1845 `usr/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache`.
1847 It can be added by defining `gdk-pixbuf-loaders` in the `triggers` variable. It is also
1848 added automatically to any package that has the path `usr/lib/gdk-pixbuf-2.0/2.10.0/loaders`
1849 available as a directory.
1851 <a id="triggers_gio_modules"></a>
1854 The gio-modules trigger is responsible for updating the Glib GIO module cache with
1855 `gio-querymodules` from the `glib` package
1857 During install and removal it just runs `gio-querymodules` to update the cache file
1858 present under `usr/lib/gio/modules`.
1860 It is automatically added to packages that have `/usr/lib/gio/modules` present
1863 <a id="triggers_gsettings_schemas"></a>
1864 #### gsettings-schemas
1866 The gsettings-schemas trigger is responsible for compiling Glib's GSettings XML
1867 schema files during installation and removing the compiled files during removal.
1869 During installation it uses `glib-compile-schemas` from `glib` to compile the
1870 schemas into files with the suffix .compiled into `/usr/share/glib-2.0/schemas`.
1872 During removal of the glib package it deletes all files inside
1873 `/usr/share/glib-2.0/schemas` that end with .compiled.
1875 It is automatically added to packages that have `/usr/share/glib-2.0/schemas` present
1878 <a id="triggers_gtk_icon_cache"></a>
1881 The gtk-icon-cache trigger is responsible for updating the gtk+ icon cache.
1883 During installation it uses `gtk-update-icon-cache` to update the icon cache.
1885 During removal of the gtk+ package it deletes the `icon-theme.cache` file
1886 in the directories defined by the variable `gtk_iconcache_dirs`.
1888 It is automatically added on packages that have `/usr/share/icons` available
1889 as a directory, all directories under that directory have their absolute path
1890 passed to the trigger.
1892 <a id="triggers_gtk_immodules"></a>
1895 The gtk-immodules trigger is responsible for updating the IM (Input Method) modules
1898 During installation it uses `gtk-query-immodules-2.0 --update-cache` to update the
1899 cache file. It also removes the obsolete configuration file `etc/gtk-2.0/gtk.immodules`
1902 During removal of the `gtk+` package it removes the cache file which is located at
1903 `usr/lib/gtk-2.0/2.10.0/immodules.cache`.
1905 It is automatically added to packages that have `/usr/lib/gtk-2.0/2.10.0/immodules`
1906 present as a directory.
1908 <a id="triggers_gtk_pixbuf_loaders"></a>
1909 #### gtk-pixbuf-loaders
1911 gtk-pixbuf-loaders is the old name for the current `gdk-pixbuf-loaders` trigger and is
1912 in the process of being removed. It currently re-execs into `gdk-pixbuf-loaders` as a
1913 compatibility measure.
1915 For information about how it works refer to [gdk-pixbuf-loaders](#triggers_gdk_pixbuf_loaders).
1917 <a id="triggers_gtk3_immodules"></a>
1920 The gtk3-immodules trigger is responsible for updating the IM (Input Method) modules
1923 During installation it executes `gtk-query-immodules-3.0 --update-cache` to update the
1924 cache file. It also removes the obsolete configuration file `etc/gtk-3.0/gtk.immodules`
1927 During removal of the `gtk+3` package it removes the cache file which is located at
1928 `usr/lib/gtk-3.0/3.0.0/immodules.cache`.
1930 It is automatically added to packages that have `/usr/lib/gtk-3.0/3.0.0/immodules`
1931 present as a directory.
1933 <a id="triggers_hwdb.d_dir"></a>
1936 The hwdb.d-dir trigger is responsible for updating the hardware database.
1938 During installation and removal it runs `usr/bin/udevadm hwdb --root=. --update`.
1940 It is automatically added to packages that have `/usr/lib/udev/hwdb.d` present
1943 <a id="triggers_info_files"></a>
1946 The info-files trigger is responsible for registering and unregistering the GNU info
1949 It checks the existence of the info files presented to it and if it is running under
1950 another architecture.
1952 During installation it uses `install-info` to register info files into
1955 During removal it uses `install-info --delete` to remove the info files from the
1956 registry located at `usr/share/info`.
1958 If it is running under another architecture it tries to use the host's `install-info`
1961 <a id="triggers_initramfs_regenerate"></a>
1962 #### initramfs-regenerate
1964 The initramfs-regenerate trigger will trigger the regeneration of all kernel
1965 initramfs images after package installation or removal. The trigger must be
1968 This hook is probably most useful for DKMS packages because it will provide a
1969 means to include newly compiled kernel modules in initramfs images for all
1970 currently available kernels. When used in a DKMS package, it is recommended to
1971 manually include the `dkms` trigger *before* the `initramfs-regenerate` trigger
1975 triggers="dkms initramfs-regenerate"
1978 Although `xbps-src` will automatically include the `dkms` trigger whenever
1979 `dkms_modules` is installed, the automatic addition will come *after*
1980 `initramfs-regenerate`, which will cause initramfs images to be recreated
1981 before the modules are compiled.
1983 By default, the trigger uses `dracut --regenerate-all` to recreate initramfs
1984 images. If `/etc/default/initramfs-regenerate` exists and defines
1985 `INITRAMFS_GENERATOR=mkinitcpio`, the trigger will instead use `mkinitcpio` and
1986 loop over all kernel versions for which modules appear to be installed.
1987 Alternatively, setting `INITRAMFS_GENERATOR=none` will disable image
1988 regeneration entirely.
1990 <a id="triggers_kernel_hooks"></a>
1993 The kernel-hooks trigger is responsible for running scripts during installation/removal
1996 The available targets are pre-install, pre-remove, post-install and post-remove.
1998 When run it will try to run all executables found under `etc/kernel.d/$TARGET`. The
1999 `TARGET` variable is one of the 4 targets available for the trigger. It will also
2000 create the directory if it isn't present.
2002 During updates it won't try to run any executables when running with the pre-remove
2005 It is automatically added if the helper variable `kernel_hooks_version` is defined.
2006 However it is not obligatory to have it defined.
2008 <a id="triggers_mimedb"></a>
2011 The mimedb trigger is responsible for updating the shared-mime-info database.
2013 In all runs it will just execute `update-mime-database -n usr/share/mime`.
2015 It is automatically added to packages that have `/usr/share/mime` available as
2018 <a id="triggers_mkdirs"></a>
2021 The mkdirs trigger is responsible for creating and removing directories dictated
2022 by the `make_dirs` variable.
2024 During installation it takes the `make_dirs` variable and splits it into groups of
2027 - dir = full path to the directory
2028 - mode = Unix permissions for the directory
2029 - uid = name of the owning user
2030 - gid = name of the owning group
2032 It will continue to split the values of `make_dirs` into groups of 4 until the values
2035 During installation it will create a directory with `dir` then set mode with `mode`
2036 and permission with `uid:gid`.
2038 During removal it will delete the directory using `rmdir`.
2040 To include this trigger use the `make_dirs` variable, as the trigger won't do anything
2041 unless it is defined.
2043 <a id="triggers_pango_module"></a>
2046 The pango-modules trigger is currently being removed since upstream has removed the
2047 code responsible for it.
2049 It used to update the pango modules file with `pango-modulesquery` during installation
2052 Currently it removes `etc/pango/pango.modules` file during removal of the pango package.
2054 It can be added by defining `pango-modules` in the `triggers` variable and has no way to get
2055 added automatically to a package.
2057 <a id="triggers_pycompile"></a>
2060 The pycompile trigger is responsible for compiling python code into native
2061 bytecode and removing generated bytecode.
2063 During installation it will compile all python code under the paths it is given by
2064 `pycompile_dirs` and all modules described in `pycompile_module` into native bytecode and
2065 update the ldconfig(8) cache.
2067 During removal it will remove all the native bytecode and update the ldconfig(8) cache.
2069 To include this trigger use the variables `pycompile_dirs` and `pycompile_module`. The
2070 trigger won't do anything unless at least one of those variables is defined.
2072 A `python_version` variable can be set to direct behaviour of the trigger.
2074 <a id="triggers_register_shell"></a>
2077 The register-shell trigger is responsible for registering and removing shell entries
2080 During installation it will append the `etc/shells` file with the new shell and also
2081 change the permissions to `644` on the file.
2083 During removal it will use `sed` to delete the shell from the file.
2085 To include this trigger use the `register_shell` variable, as the trigger won't do
2086 anything unless it is defined.
2088 <a id="triggers_system_accounts"></a>
2089 #### system-accounts
2091 The system-accounts trigger is responsible for creating and disabling system accounts
2094 During removal it will disable the account by setting the Shell to /bin/false,
2095 Home to /var/empty, and appending ' - for uninstalled package $pkgname' to the
2097 Example: `transmission unprivileged user - for uninstalled package transmission`
2099 This trigger can only be used by using the `system_accounts` variable.
2101 <a id="triggers_texmf_dist"></a>
2104 The texmf-dist trigger is responsible for regenerating TeXLive's texmf databases.
2106 During both installation and removal, it regenerates both the texhash and format
2107 databases using `texhash` and `fmtutil-sys`, to add or remove any new hashes or
2110 It runs on every package that changes /usr/share/texmf-dist. This is likely overkill,
2111 but it is much cleaner rather than checking each format directory and each directory
2112 that is hashed. In addition, it is very likely any package touching /usr/share/texmf-dist
2113 requires one of these triggers anyway.
2115 <a id="triggers_update_desktopdb"></a>
2116 #### update-desktopdb
2118 The update-desktopdb trigger is responsible for updating the system's MIME database.
2120 During installation it will execute `update-desktop-database usr/share/applications`
2121 which will result in a cache file being created at `usr/share/applications/mimeinfo.cache`.
2123 During removal of the `desktop-file-utils` package it will remove the cache file that
2124 was created during installation.
2126 It is automatically added to packages that have `/usr/share/applications` available as
2129 <a id="triggers_x11_fonts"></a>
2132 The x11-fonts trigger is responsible for rebuilding the fonts.dir and fonts.scale files
2133 for packages that install X11 fonts, and update fontconfig's cache for these fonts.
2135 During installation and removal it executes `mkfontdir`, `mkfontscale` and `fc-cache` for
2136 all font directories it was given via the `font_dirs` variable.
2138 To include this trigger use the `font_dirs` variable, as the trigger won't do anything
2139 unless it is defined.
2141 <a id="triggers_xml_catalog"></a>
2144 The xml-catalog trigger is responsible for registering and removing SGML/XML catalog entries.
2146 During installation it uses `xmlcatmgr` to register all catalogs, passed to it by the
2147 `sgml_entries` and `xml_entries` variables, in `usr/share/sgml/catalog` and
2148 `usr/share/xml/catalog` respectively.
2150 During removal it uses `xmlcatmgr` to remove all catalogs passed to it by the
2151 `sgml_entries` and `xml_entries` variables, in `usr/share/sgml/catalog` and
2152 `usr/share/xml/catalog` respectively.
2154 To include this trigger use the `sgml_entries` variable or/and the `xml_entries` variable,
2155 as the trigger won't do anything unless either of them are defined.
2157 <a id="documentation"></a>
2158 ### Void specific documentation
2160 When you want document details of package's configuration and usage specific to Void Linux,
2161 not covered by upstream documentation, put notes into
2162 `srcpkgs/<pkgname>/files/README.voidlinux` and install with
2163 `vdoc "${FILESDIR}/README.voidlinux"`.
2168 - Make sure that all software is configured to use the `/usr` prefix.
2170 - Binaries should always be installed at `/usr/bin`.
2172 - Manual pages should always be installed at `/usr/share/man`.
2174 - If a software provides **shared libraries** and headers, probably you should
2175 create a `development package` that contains `headers`, `static libraries`
2176 and other files required for development (not required at runtime).
2178 - If you are updating a package please be careful with SONAME bumps, check
2179 the installed files (`./xbps-src show-files pkg`) before pushing new updates.
2181 - Make sure that binaries are not stripped by the software, let xbps-src do this;
2182 otherwise the `debug` packages won't have debugging symbols.
2184 <a id="contributing"></a>
2185 ### Contributing via git
2187 To get started, [fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo) the void-linux `void-packages` git repository on GitHub and clone it:
2189 $ git clone git@github.com:<user>/void-packages.git
2191 See [CONTRIBUTING.md](./CONTRIBUTING.md) for information on how to format your
2192 commits and other tips for contributing.
2194 Once you've made changes to your `forked` repository, submit
2195 a github pull request.
2197 To keep your forked repository always up to date, setup the `upstream` remote
2198 to pull in new changes:
2200 $ git remote add upstream https://github.com/void-linux/void-packages.git
2201 $ git pull --rebase upstream master
2206 If after reading this `manual` you still need some kind of help, please join
2207 us at `#xbps` via IRC at `irc.libera.chat`.