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: 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-python3, 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 listed as an
443 [SPDX license expression](https://spdx.github.io/spdx-spec/v3.0/annexes/SPDX-license-expressions/)
444 (examples: `MIT OR Apache-2.0`, `MIT AND (LGPL-2.1-or-later OR BSD-3-Clause)`).
445 Usage of `AND`, `OR`, `WITH`, and `()` are supported by xlint. The legacy
446 comma-separated format should be converted when encountered (example:
447 `GPL-3.0-or-later, custom:Hugware`).
449 Empty meta-packages that don't include any files
450 and thus have and require no license should use
453 Note: `AGPL`, `MIT`, `BSD`, `ISC`, `X11`, and custom licenses
454 require the license file to be supplied with the binary package.
456 - `maintainer` A string in the form of `name <user@domain>`. The email for this field
457 must be a valid email that you can be reached at. Packages using
458 `users.noreply.github.com` emails will not be accepted.
460 - `pkgname` A string with the package name, matching `srcpkgs/<pkgname>`.
462 - `revision` A number that must be set to 1 when the `source package` is created, or
463 updated to a new `upstream version`. This should only be increased when
464 the generated `binary packages` have been modified.
466 - `short_desc` A string with a brief description for this package. Max 72 chars.
468 - `version` A string with the package version. Must not contain dashes or underscore
469 and at least one digit is required. Shell's variable substitution usage is not allowed.
471 `pkgname` and `version` are forbidden to contain special characters. Hence, they don't
472 need to be quoted, and by convention, they shouldn't be.
474 <a id="optional_vars"></a>
475 #### Optional variables
477 - `hostmakedepends` The list of `host` dependencies required to build the package, and
478 that 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: `hostmakedepends="foo blah"`.
482 - `makedepends` The list of `target` dependencies required to build the package, and that
483 will be installed to the master directory. There is no need to specify a version
484 because the current version in srcpkgs will always be required.
485 Example: `makedepends="foo blah"`.
487 - `checkdepends` The list of dependencies required to run the package checks, i.e.
488 the script or make rule specified in the template's `do_check()` function.
489 Example: `checkdepends="gtest"`.
491 - `depends` The list of dependencies required to run the package. These dependencies
492 are not installed to the master directory, rather are only checked if a binary package
493 in the local repository exists to satisfy the required version. Dependencies
494 can be specified with the following version comparators: `<`, `>`, `<=`, `>=`
495 or `foo-1.0_1` to match an exact version. If version comparator is not
496 defined (just a package name), the version comparator is automatically set to `>=0`.
497 Example: `depends="foo blah>=1.0"`. See the [Runtime dependencies](#deps_runtime) section
498 for more information.
500 - `bootstrap` If enabled the source package is considered to be part of the `bootstrap`
501 process and required to be able to build packages in the chroot. Only a
502 small number of packages must set this property.
504 - `conflicts` An optional list of packages conflicting with this package.
505 Conflicts can be specified with the following version comparators: `<`, `>`, `<=`, `>=`
506 or `foo-1.0_1` to match an exact version. If version comparator is not
507 defined (just a package name), the version comparator is automatically set to `>=0`.
508 Example: `conflicts="foo blah>=0.42.3"`.
510 - `distfiles` The full URL to the `upstream` source distribution files. Multiple files
511 can be separated by whitespaces. The files must end in `.tar.lzma`, `.tar.xz`,
512 `.txz`, `.tar.bz2`, `.tbz`, `.tar.gz`, `.tgz`, `.gz`, `.bz2`, `.tar` or
513 `.zip`. To define a target filename, append `>filename` to the URL.
515 distfiles="http://foo.org/foo-1.0.tar.gz http://foo.org/bar-1.0.tar.gz>bar.tar.gz"
517 To avoid repetition, several variables for common hosting sites
521 |------------------|-------------------------------------------------|
522 | CPAN_SITE | https://cpan.perl.org/modules/by-module |
523 | DEBIAN_SITE | http://ftp.debian.org/debian/pool |
524 | FREEDESKTOP_SITE | https://freedesktop.org/software |
525 | GNOME_SITE | https://ftp.gnome.org/pub/GNOME/sources |
526 | GNU_SITE | https://ftp.gnu.org/gnu |
527 | KERNEL_SITE | https://www.kernel.org/pub/linux |
528 | MOZILLA_SITE | https://ftp.mozilla.org/pub |
529 | NONGNU_SITE | https://download.savannah.nongnu.org/releases |
530 | PYPI_SITE | https://files.pythonhosted.org/packages/source |
531 | SOURCEFORGE_SITE | https://downloads.sourceforge.net/sourceforge |
532 | UBUNTU_SITE | http://archive.ubuntu.com/ubuntu/pool |
533 | XORG_SITE | https://www.x.org/releases/individual |
534 | KDE_SITE | https://download.kde.org/stable |
535 | VIDEOLAN_SITE | https://download.videolan.org/pub/videolan |
537 - `checksum` The `sha256` digests matching `${distfiles}`. Multiple files can be
538 separated by blanks. Please note that the order must be the same than
539 was used in `${distfiles}`. Example: `checksum="kkas00xjkjas"`
541 If a distfile changes its checksum for every download because it is packaged
542 on the fly on the server, like e.g. snapshot tarballs from any of the
543 `https://*.googlesource.com/` sites, the checksum of the `archive contents`
544 can be specified by prepending a commercial at (@).
545 For tarballs you can find the contents checksum by using the command
546 `tar xf <tarball.ext> --to-stdout | sha256sum`.
548 - `wrksrc` The directory name where the package sources are extracted, set to `${pkgname}-${version}`.
550 - `build_wrksrc` A directory relative to `${wrksrc}` that will be used when building the package.
552 - `create_wrksrc` Usually, after extracting, if there're multiple top-level
553 files and/or directories or when there're no directories at all, top-level files,
554 and directories will be wrapped inside one more layer of directory.
555 Set `create_wrksrc` to force this behaviour.
557 - `build_style` This specifies the `build method` for a package. Read below to know more
558 about the available package `build methods` or effect of leaving this not set.
560 - `build_helper` Whitespace-separated list of files in `common/build-helper` to be
561 sourced and its variables be made available on the template. i.e. `build_helper="rust"`.
563 - `configure_script` The name of the `configure` script to execute at the `configure` phase if
564 `${build_style}` is set to `configure` or `gnu-configure` build methods.
565 By default set to `./configure`.
567 - `configure_args` The arguments to be passed in to the `configure` script if `${build_style}`
568 is set to `configure` or `gnu-configure` build methods. By default, prefix
569 must be set to `/usr`. In `gnu-configure` packages, some options are already
570 set by default: `--prefix=/usr --sysconfdir=/etc --infodir=/usr/share/info --mandir=/usr/share/man --localstatedir=/var`.
572 - `make_cmd` The executable to run at the `build` phase if `${build_style}` is set to
573 `configure`, `gnu-configure` or `gnu-makefile` build methods.
574 By default set to `make`.
576 - `make_build_args` The arguments to be passed in to `${make_cmd}` at the build phase if
577 `${build_style}` is set to `configure`, `gnu-configure` or `gnu-makefile`
578 build methods. Unset by default.
580 - `make_check_args` The arguments to be passed in to `${make_cmd}` at the check phase if
581 `${build_style}` is set to `configure`, `gnu-configure` or `gnu-makefile`
582 build methods. Unset by default.
584 - `make_install_args` The arguments to be passed in to `${make_cmd}` at the `install`
585 phase if `${build_style}` is set to `configure`, `gnu-configure` or `gnu-makefile` build methods.
587 - `make_build_target` The build target. If `${build_style}` is set to `configure`, `gnu-configure`
588 or `gnu-makefile`, this is the target passed to `${make_cmd}` in the build phase;
589 when unset the default target is used.
590 If `${build_style}` is `python3-pep517`, this is the path of the package
591 directory that should be built as a Python wheel; when unset, defaults to `.` (the current
592 directory with respect to the build).
594 - `make_check_target` The target to be passed in to `${make_cmd}` at the check phase if
595 `${build_style}` is set to `configure`, `gnu-configure` or `gnu-makefile`
596 build methods. By default set to `check`.
598 - `make_install_target` The installation target. When `${build_style}` is set to `configure`,
599 `gnu-configure` or `gnu-makefile`, this is the target passed to `${make_command}` in the install
600 phase; when unset, it defaults to `install`. If `${build_style}` is `python3-pep517`, this is the
601 path of the Python wheel produced by the build phase that will be installed; when unset, the
602 `python3-pep517` build style will look for a wheel matching the package name and version in the
603 current directory with respect to the install.
605 - `make_check_pre` The expression in front of `${make_cmd}`. This can be used for wrapper commands
606 or for setting environment variables for the check command. By default empty.
608 - `patch_args` The arguments to be passed in to the `patch(1)` command when applying
609 patches to the package sources during `do_patch()`. Patches are stored in
610 `srcpkgs/<pkgname>/patches` and must be in `-p1` format. By default set to `-Np1`.
612 - `disable_parallel_build` If set the package won't be built 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 build in parallel, set `disable_parallel_build` and
615 use `XBPS_ORIG_MAKEJOBS` (which holds the original value of `XBPS_MAKEJOBS`) in the template.
617 - `disable_parallel_check` If set tests for the package won't be built and run in parallel
618 and `XBPS_MAKEJOBS` will be set to 1. If a package does not work well with `XBPS_MAKEJOBS`
619 but still has a mechanism to run checks in parallel, set `disable_parallel_check` and
620 use `XBPS_ORIG_MAKEJOBS` (which holds the original value of `XBPS_MAKEJOBS`) in the template.
622 - `make_check` Sets the cases in which the `check` phase is run.
623 This option has to be accompanied by a comment explaining why the tests fail.
625 - `yes` (the default) to run if `XBPS_CHECK_PKGS` is set.
626 - `extended` to run if `XBPS_CHECK_PKGS` is `full`.
627 - `ci-skip` to run locally if `XBPS_CHECK_PKGS` is set, but not as part of pull request checks.
631 - `keep_libtool_archives` If enabled the `GNU Libtool` archives won't be removed. By default those
632 files are always removed automatically.
634 - `skip_extraction` A list of filenames that should not be extracted in the `extract` phase.
635 This must match the basename of any url defined in `${distfiles}`.
636 Example: `skip_extraction="foo-${version}.tar.gz"`.
638 - `nodebug` If enabled -dbg packages won't be generated even if `XBPS_DEBUG_PKGS` is set.
640 - `conf_files` A list of configuration files the binary package owns; this expects full
641 paths, wildcards will be extended, and multiple entries can be separated by blanks.
642 Example: `conf_files="/etc/foo.conf /etc/foo2.conf /etc/foo/*.conf"`.
644 - `mutable_files` A list of files the binary package owns, with the expectation
645 that those files will be changed. These act a lot like `conf_files` but
646 without the assumption that a human will edit them.
648 - `make_dirs` A list of entries defining directories and permissions to be
649 created at install time. Each entry should be space separated, and will
650 itself contain spaces. `make_dirs="/dir 0750 user group"`. User and group and
651 mode are required on every line, even if they are `755 root root`. By
652 convention, there is only one entry of `dir perms user group` per line.
654 - `repository` Defines the repository in which the package will be placed. See
655 *Repositories* for a list of valid repositories.
657 - `nostrip` If set, the ELF binaries with debugging symbols won't be stripped. By
658 default all binaries are stripped.
660 - `nostrip_files` White-space separated list of ELF binaries that won't be stripped of
661 debugging symbols. Files can be given by full path or by filename.
663 - `noshlibprovides` If set, the ELF binaries won't be inspected to collect the provided
664 sonames in shared libraries.
666 - `noverifyrdeps` If set, the ELF binaries and shared libraries won't be inspected to collect
667 their reverse dependencies. You need to specify all dependencies in the `depends` when you
670 - `skiprdeps` White space separated list of filenames specified by their absolute path in
671 the `$DESTDIR` which will not be scanned for runtime dependencies. This may be useful to
672 skip files which are not meant to be run or loaded on the host but are to be sent to some
673 target device or emulation.
675 - `ignore_elf_files` White space separated list of machine code files
676 in /usr/share directory specified by absolute path, which are expected and allowed.
678 - `ignore_elf_dirs` White space separated list of directories in /usr/share directory
679 specified by absolute path, which are expected and allowed to contain machine code files.
681 - `nocross` If set, cross compilation won't be allowed and will exit immediately.
682 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.
684 - `restricted` If set, xbps-src will refuse to build the package unless
685 `etc/conf` has `XBPS_ALLOW_RESTRICTED=yes`. The primary builders for Void
686 Linux do not have this setting, so the primary repositories will not have any
687 restricted package. This is useful for packages where the license forbids
690 - `subpackages` A white space separated list of subpackages (matching `foo_package()`)
691 to override the guessed list. Only use this if a specific order of subpackages is required,
692 otherwise the default would work in most cases.
694 - `broken` If set, building the package won't be allowed because its state is currently broken.
695 This should be set to a string describing why it is broken, or a link to a buildlog demonstrating the failure.
697 - `shlib_provides` A white space separated list of additional sonames the package provides on.
698 This appends to the generated file rather than replacing it.
700 - `shlib_requires` A white space separated list of additional sonames the package requires.
701 This appends to the generated file rather than replacing it.
703 - `nopie` Only needs to be set to something to make active, disables building the package with hardening
704 features (PIE, relro, etc). Not necessary for most packages.
706 - `nopie_files` White-space separated list of ELF binaries that won't be checked
707 for PIE. Files must be given by full path.
709 - `reverts` xbps supports a unique feature which allows to downgrade from broken
710 packages automatically. In the `reverts` field one can define a list of broken
711 pkgver the resulting package should revert. This field *must* be defined before
712 `version` and `revision` fields in order to work as expected. The versions
713 defined in `reverts` must be bigger than the one defined in `version`.
717 reverts="2.0_1 2.0_2"
722 - `alternatives` A white space separated list of supported alternatives the package provides.
723 A list is composed of three components separated by a colon: group, symlink and target.
724 Example: `alternatives="vi:/usr/bin/vi:/usr/bin/nvi ex:/usr/bin/ex:/usr/bin/nvi-ex"`.
726 - `font_dirs` A white space separated list of directories specified by an absolute path where a
727 font package installs its fonts.
728 It is used in the `x11-fonts` xbps-trigger to rebuild the font cache during install/removal
730 Example: `font_dirs="/usr/share/fonts/TTF /usr/share/fonts/X11/misc"`
732 - `dkms_modules` A white space separated list of Dynamic Kernel Module Support (dkms) modules
733 that will be installed and removed by the `dkms` xbps-trigger with the install/removal of the
735 The format is a white space separated pair of strings that represent the name of the module,
736 most of the time `pkgname`, and the version of the module, most of the time `version`.
737 Example: `dkms_modules="$pkgname $version zfs 4.14"`
739 - `register_shell` A white space separated list of shells defined by absolute path to be
740 registered into the system shells database. It is used by the `register-shell` trigger.
741 Example: `register_shell="/bin/tcsh /bin/csh"`
743 - `tags` A white space separated list of tags (categories) that are registered into the
744 package metadata and can be queried with `xbps-query` by users.
745 Example for qutebrowser: `tags="browser chromium-based qt5 python3"`
747 - `perl_configure_dirs` A white space separate list of directories relative to `wrksrc`
748 that contain Makefile.PL files that need to be processes for the package to work. It is
749 used in the perl-module build_style and has no use outside of it.
750 Example: `perl_configure_dirs="blob/bob foo/blah"`
752 - `preserve` If set, files owned by the package in the system are not removed when
753 the package is updated, reinstalled or removed. This is mostly useful for kernel packages
754 that shouldn't remove the kernel files when they are removed in case it might break the
755 user's booting and module loading. Otherwise in the majority of cases it should not be
758 - `fetch_cmd` Executable to be used to fetch URLs in `distfiles` during the `do_fetch` phase.
760 - `changelog` An URL pointing to the upstream changelog. Raw text files are preferred.
762 - `archs` Whitespace separated list of architectures that a package can be
763 built for, available architectures can be found under `common/cross-profiles`.
764 In general, `archs` should only be set if the upstream software explicitly targets
765 certain architectures or there is a compelling reason why the software should not be
766 available on some supported architectures.
767 Prepending a pattern with a tilde means disallowing build on the indicated archs.
768 The first matching pattern is taken to allow/deny build. When no pattern matches,
769 the package is built if the last pattern includes a tilde.
773 # Build package only for musl architectures
775 # Build package for x86_64-musl and any non-musl architecture
776 archs="x86_64-musl ~*-musl"
777 # Default value (all arches)
780 A special value `noarch` used to be available, but has since been removed.
782 - `nocheckperms` If set, xbps-src will not fail on common permission errors (world writable files, etc.)
784 - `nofixperms` If set, xbps-src will not fix common permission errors (executable manpages, etc.)
786 - `no_generic_pkgconfig_link` If set, xbps-src will not create a symlink from `$XBPS_CROSS_TRIPLET-pkg-config`
787 to `$XBPS_WRAPPERDIR/pkg-config` before building the template.
789 <a id="explain_depends"></a>
790 #### About the many types of `depends` variables
792 So far, we have listed four types of `depends` variables: `hostmakedepends`,
793 `makedepends`, `checkdepends` and `depends`. These different kinds of variables
794 are necessary because `xbps-src` supports cross compilation and to avoid
795 installing unnecessary packages in the build environment.
797 During a build process, there are programs that must be _run_ on the host, such
798 as `yacc` or the C compiler. The packages that contain these programs should be
799 listed in `hostmakedepends`, and will be installed on the host when building the
800 target package. Some of these packages are dependencies of the `base-chroot`
801 package and don't need to be listed. It is possible that some of the programs
802 necessary to build a project are located in `-devel` packages.
804 The target package can also depend on other packages for libraries to link
805 against or header files. These packages should be listed in `makedepends` and
806 will match the target architecture, regardless of the architecture of the build
807 machine. Typically, `makedepends` will contain mainly `-devel` packages.
809 Furthermore, if `XBPS_CHECK_PKGS` is set or the `-Q` option is passed to
810 `xbps-src`, the target package might require specific dependencies or libraries
811 that are linked into its test binaries to run its test suite. These dependencies
812 should be listed in `checkdepends` and will be installed as if they were part of
813 `hostmakedepends`. Some dependencies that can be included in `checkdepends` are:
815 - `dejagnu`: used for some GNU projects
816 - `cmocka-devel`: linked into test binaries
817 - `dbus`: makes it possible to run `dbus-run-session <test-command>` to provide
818 a D-Bus session for applications that need it
819 - `git`: some test suites run the `git` command
821 <a id="deps_runtime"></a>
822 Lastly, a package may require certain dependencies at runtime, without which it
823 is unusable. These dependencies, when they aren't detected automatically by
824 XBPS, should be listed in `depends`.
826 Libraries linked by ELF objects are detected automatically by `xbps-src`, hence they
827 must not be specified in templates via `depends`. This variable should list:
829 - executables called as separate processes.
830 - ELF objects using dlopen(3).
831 - non-object code, e.g. C headers, perl/python/ruby/etc modules.
833 - overriding the minimal version specified in the `common/shlibs` file.
835 The runtime dependencies for ELF objects are detected by checking which SONAMEs
836 they require and then the SONAMEs are mapped to a binary package name with a minimal
837 required version. The `common/shlibs` file
838 sets up the `<SONAME> <pkgname>>=<version>` mappings.
840 For example the `foo-1.0_1` package provides the `libfoo.so.1` SONAME and
841 software requiring this library will link to `libfoo.so.1`; the resulting binary
842 package will have a run-time dependency on `foo>=1.0_1` package as specified in
848 libfoo.so.1 foo-1.0_1
852 - The first field specifies the SONAME.
853 - The second field specified the package name and minimal version required.
854 - A third optional field (usually set to `ignore`) can be used to skip checks in soname bumps.
856 Dependencies declared via `depends` are not installed to the master directory, rather they are
857 only checked if they exist as binary packages, and are built automatically by `xbps-src` if
858 the specified version is not in the local repository.
860 As a special case, `virtual` dependencies may be specified as runtime dependencies in the
861 `depends` template variable. Several different packages can provide common functionality by
862 declaring a virtual name and version in the `provides` template variable (e.g.
863 `provides="vpkg-0.1_1"`). Packages that rely on the common functionality without concern for the
864 specific provider can declare a dependency on the virtual package name with the prefix `virtual?`
865 (e.g., `depends="virtual?vpkg-0.1_1"`). When a package is built by `xbps-src`, providers for any
866 virtual packages will be confirmed to exist and will be built if necessary. A map from virtual
867 packages to their default providers is defined in `etc/defaults.virtual`. Individual mappings can be
868 overridden by local preferences in `etc/virtual`. Comments in `etc/defaults.virtual` provide more
869 information on this map.
871 Finally, as a general rule, if a package is built the exact same way whether or
872 not a particular package is present in `makedepends` or `hostmakedepends`, that
873 package shouldn't be added as a build time dependency.
875 <a id="repositories"></a>
878 <a id="repo_by_branch"></a>
879 #### Repositories defined by Branch
881 The global repository takes the name of
882 the current branch, except if the name of the branch is master. Then the resulting
883 repository will be at the global scope. The usage scenario is that the user can
884 update multiple packages in a second branch without polluting their local repository.
886 <a id="pkg_defined_repo"></a>
887 #### Package defined Repositories
889 The second way to define a repository is by setting the `repository` variable in
890 a template. This way the maintainer can define repositories for a specific
891 package or a group of packages. This is currently used to distinguish between
892 certain classes of packages.
894 The following repository names are valid:
896 * `bootstrap`: Repository for xbps-src-specific packages.
897 * `debug`: Repository for packages containing debug symbols. In almost all cases,
898 these packages are generated automatically.
899 * `nonfree`: Repository for packages that are closed source or have nonfree licenses.
902 ### Checking for new upstream releases
904 New upstream versions can be automatically checked using
905 `./xbps-src update-check <pkgname>`. In some cases you need to override
906 the sensible defaults by assigning the following variables in a `update`
907 file in the same directory as the relevant `template` file:
909 - `site` contains the URL where the version number is
910 mentioned. If unset, defaults to `homepage` and the directories where
913 - `pkgname` is the package name the default pattern checks for.
914 If unset, defaults to `pkgname` from the template.
916 - `pattern` is a perl-compatible regular expression
917 matching the version number. Anchor the version number using `\K`
918 and `(?=...)`. Example: `pattern='<b>\K[\d.]+(?=</b>)'`, this
919 matches a version number enclosed in `<b>...</b>` tags.
921 - `ignore` is a space-separated list of shell globs that match
922 version numbers which are not taken into account for checking newer
923 versions. Example: `ignore="*b*"`
925 - `version` is the version number used to compare against
926 upstream versions. Example: `version=${version//./_}`
928 - `single_directory` can be set to disable
929 detecting directory containing one version of sources in url,
930 then searching new version in adjacent directories.
932 - `vdprefix` is a perl-compatible regular expression matching
933 part that precedes numeric part of version directory
934 in url. Defaults to `(|v|$pkgname)[-_.]*`.
936 - `vdsuffix` is a perl-compatible regular expression matching
937 part that follows numeric part of version directory
938 in url. Defaults to `(|\.x)`.
940 - `disabled` can be set to disable update checking for the package,
941 in cases where checking for updates is impossible or does not make sense.
942 This should be set to a string describing why it is disabled.
947 Sometimes software needs to be patched, most commonly to fix bugs that have
948 been found or to fix compilation with new software.
950 To handle this, xbps-src has patching functionality. It will look for all files
951 that match the glob `srcpkgs/$pkgname/patches/*.{diff,patch}` and will
952 automatically apply all files it finds using `patch(1)` with `-Np1`. This happens
953 during the `do_patch()` phase. The variable `PATCHESDIR` is
954 available in the template, pointing to the `patches` directory.
956 The patching behaviour can be changed in the following ways:
958 - A file called `series` can be created in the `patches` directory with a newline
959 separated list of patches to be applied in the order presented. When present
960 xbps-src will only apply patches named in the `series` file.
962 - A file with the same name as one of the patches but with `.args` as extension can
963 be used to set the args passed to `patch(1)`. As an example, if `foo.patch` requires
964 special arguments to be passed to `patch(1)` that can't be used when applying other
965 patches, `foo.patch.args` can be created containing those args.
967 <a id="build_scripts"></a>
968 ### build style scripts
970 The `build_style` variable specifies the build method to build and install a
971 package. It expects the name of any available script in the
972 `void-packages/common/build-style` directory. Please note that required packages
973 to execute a `build_style` script must be defined via `$hostmakedepends`.
975 The current list of available `build_style` scripts is the following:
977 - If `build_style` is not set, the template must (at least) define
978 `do_install()` function and optionally more build phases such as
979 `do_configure()`, `do_build()`, etc., and may overwrite default `do_fetch()` and
980 `do_extract()` that fetch and extract files defined in `distfiles` variable.
982 - `cargo` For packages written in rust that use Cargo for building.
983 Configuration arguments (such as `--features`) can be defined in the variable
984 `configure_args` and are passed to cargo during `do_build`.
986 - `cmake` For packages that use the CMake build system, configuration arguments
987 can be passed in via `configure_args`. The `cmake_builddir` variable may be
988 defined to specify the directory for building under `build_wrksrc` instead of
991 - `configure` For packages that use non-GNU configure scripts, at least `--prefix=/usr`
992 should be passed in via `configure_args`.
994 - `fetch` For packages that only fetch files and are installed as is via `do_install()`.
996 - `gnu-configure` For packages that use GNU autotools-compatible configure scripts,
997 additional configuration arguments can be passed in via `configure_args`.
999 - `gnu-makefile` For packages that use GNU make, build arguments can be passed in via
1000 `make_build_args` and install arguments via `make_install_args`. The build
1001 target can be overridden via `make_build_target` and the install target
1002 via `make_install_target`. This build style tries to compensate for makefiles
1003 that do not respect environment variables, so well written makefiles, those
1004 that do such things as append (`+=`) to variables, should have `make_use_env`
1005 set in the body of the template.
1007 - `go` For programs written in Go that follow the standard package
1008 structure. The variable `go_import_path` must be set to the package's
1009 import path, e.g. `github.com/github/hub` for the `hub` program. This
1010 information can be found in the `go.mod` file for modern Go projects.
1011 It's expected that the distfile contains the package, but dependencies
1012 will be downloaded with `go get`.
1014 - `meta` For `meta-packages`, i.e packages that only install local files or simply
1015 depend on additional packages. This build style does not install
1016 dependencies to the root directory, and only checks if a binary package is
1017 available in repositories.
1019 - `R-cran` For packages that are available on The Comprehensive R Archive
1020 Network (CRAN). The build style requires the `pkgname` to start with
1021 `R-cran-` and any dashes (`-`) in the CRAN-given version to be replaced
1022 with the character `r` in the `version` variable. The `distfiles`
1023 location will automatically be set as well as the package made to depend
1026 - `gemspec` For packages that use
1027 [gemspec](https://guides.rubygems.org/specification-reference/) files for building a ruby
1028 gem and then installing it. The gem command can be overridden by `gem_cmd`. `configure_args`
1029 can be used to pass arguments during compilation. If your package does not make use of compiled
1030 extensions consider using the `gem` build style instead.
1032 - `gem` For packages that are installed using gems from [RubyGems](https://rubygems.org/).
1033 The gem command can be overridden by `gem_cmd`.
1034 `distfiles` is set by the build style if the template does not do so. If your gem
1035 provides extensions which must be compiled consider using the `gemspec` build style instead.
1037 - `ruby-module` For packages that are ruby modules and are installable via `ruby install.rb`.
1038 Additional install arguments can be specified via `make_install_args`.
1040 - `perl-ModuleBuild` For packages that use the Perl
1041 [Module::Build](https://metacpan.org/pod/Module::Build) method.
1043 - `perl-module` For packages that use the Perl
1044 [ExtUtils::MakeMaker](http://perldoc.perl.org/ExtUtils/MakeMaker.html) build method.
1046 - `raku-dist` For packages that use the Raku `raku-install-dist` build method with rakudo.
1048 - `waf3` For packages that use the Python3 `waf` build method with python3.
1050 - `slashpackage` For packages that use the /package hierarchy and package/compile to build,
1051 such as `daemontools` or any `djb` software.
1053 - `qmake` For packages that use Qt5/Qt6 qmake profiles (`*.pro`), qmake arguments
1054 for the configure phase can be passed in via `configure_args`, make build arguments can
1055 be passed in via `make_build_args` and install arguments via `make_install_args`. The build
1056 target can be overridden via `make_build_target` and the install target
1057 via `make_install_target`.
1059 - `meson` For packages that use the Meson Build system, configuration options can be passed
1060 via `configure_args`, the meson command can be overridden by `meson_cmd` and the location of
1061 the out of source build by `meson_builddir`
1063 - `void-cross` For cross-toolchain packages used to build Void systems. There are no
1064 mandatory variables (target triplet is inferred), but you can specify some optional
1065 ones - `cross_gcc_skip_go` can be specified to skip `gccgo`, individual subproject
1066 configure arguments can be specified via `cross_*_configure_args` where `*` is `binutils`,
1067 `gcc_bootstrap` (early gcc), `gcc` (final gcc), `glibc` (or `musl`), `configure_args` is
1068 additionally passed to both early and final `gcc`. You can also specify custom `CFLAGS`
1069 and `LDFLAGS` for the libc as `cross_(glibc|musl)_(cflags|ldflags)`.
1071 - `zig-build` For packages using [Zig](https://ziglang.org)'s build
1072 system. Additional arguments may be passed to the `zig build` invocation using
1075 For packages that use the Python module build method (`setup.py` or
1076 [PEP 517](https://www.python.org/dev/peps/pep-0517/)), you can choose one of the following:
1078 - `python3-module` to build Python 3.x modules
1080 - `python3-pep517` to build Python 3.x modules that provide a PEP 517 build description without
1083 Environment variables for a specific `build_style` can be declared in a filename
1084 matching the `build_style` name, Example:
1086 `common/environment/build-style/gnu-configure.sh`
1088 - `texmf` For texmf zip/tarballs that need to go into /usr/share/texmf-dist. Includes
1089 duplicates handling.
1091 <a id="build_helper"></a>
1092 ### build helper scripts
1094 The `build_helper` variable specifies shell snippets to be sourced that will create a
1095 suitable environment for working with certain sets of packages.
1097 The current list of available `build_helper` scripts is the following:
1099 - `cmake-wxWidgets-gtk3` sets the `WX_CONFIG` variable which is used by FindwxWidgets.cmake
1101 - `gir` specifies dependencies for native and cross builds to deal with
1102 GObject Introspection. The following variables may be set in the template to handle
1103 cross builds which require additional hinting or exhibit problems. `GIR_EXTRA_LIBS_PATH` defines
1104 additional paths to be searched when linking target binaries to be introspected.
1105 `GIR_EXTRA_OPTIONS` defines additional options for the `g-ir-scanner-qemuwrapper` calling
1106 `qemu-<target_arch>-static` when running the target binary. You can for example specify
1107 `GIR_EXTRA_OPTIONS="-strace"` to see a trace of what happens when running that binary.
1109 - `meson` creates a cross file, `${XBPS_WRAPPERDIR}/meson/xbps_meson.cross`, which configures
1110 meson for cross builds. This is particularly useful for building packages that wrap meson
1111 invocations (e.g., `python3-pep517` packages that use a meson backend) and is added by default
1112 for packages that use the `meson` build style.
1114 - `numpy` configures the environment for cross-compilation of python packages that provide
1115 compiled extensions linking to NumPy C libraries. If the `meson` build helper is also
1116 configured, a secondary cross file, `${XBPS_WRAPPERDIR}/meson/xbps_numpy.cross`, will be
1117 written to inform meson where common NumPy components may be found.
1119 - `python3` configures the cross-build environment to use Python libraries, header files, and
1120 interpreter configurations in the target root. The `python3` helper is added by default for
1121 packages that use the `python3-module` or `python3-pep517` build styles.
1123 - `qemu` sets additional variables for the `cmake` and `meson` build styles to allow
1124 executing cross-compiled binaries inside qemu.
1125 It sets `CMAKE_CROSSCOMPILING_EMULATOR` for cmake and `exe_wrapper` for meson
1126 to `qemu-<target_arch>-static` and `QEMU_LD_PREFIX` to `XBPS_CROSS_BASE`.
1127 It also creates the `vtargetrun` function to wrap commands in a call to
1128 `qemu-<target_arch>-static` for the target architecture.
1130 - `qmake` creates the `qt.conf` configuration file (cf. `qmake` `build_style`)
1131 needed for cross builds and a qmake-wrapper to make `qmake` use this configuration.
1132 This aims to fix cross-builds for when the build-style is mixed: e.g. when in a
1133 `gnu-configure` style the configure script calls `qmake` or a `Makefile` in
1134 `gnu-makefile` style, respectively. This is for Qt5 packages.
1136 - `qmake6` is like `qmake` but for Qt6.
1138 - `rust` specifies environment variables required for cross-compiling crates via cargo and
1139 for compiling cargo -sys crates.
1140 It also adds a `cargo` wrapper that detects and passes builds through `cargo-auditable`.
1141 This helper is added by default for packages that use the `cargo` build style.
1143 <a id="functions"></a>
1146 The following functions can be defined to change the behavior of how the
1147 package is downloaded, compiled and installed.
1149 - `pre_fetch()` Actions to execute before `do_fetch()`.
1151 - `do_fetch()` if defined and `distfiles` is not set, use it to fetch the required sources.
1153 - `post_fetch()` Actions to execute after `do_fetch()`.
1155 - `pre_extract()` Actions to execute after `post_fetch()`.
1157 - `do_extract()` if defined and `distfiles` is not set, use it to extract the required sources.
1159 - `post_extract()` Actions to execute after `do_extract()`.
1161 - `pre_patch()` Actions to execute after `post_extract()`.
1163 - `do_patch()` if defined use it to prepare the build environment and run hooks to apply patches.
1165 - `post_patch()` Actions to execute after `do_patch()`.
1167 - `pre_configure()` Actions to execute after `post_patch()`.
1169 - `do_configure()` Actions to execute to configure the package; `${configure_args}` should
1170 still be passed in if it's a GNU configure script.
1172 - `post_configure()` Actions to execute after `do_configure()`.
1174 - `pre_build()` Actions to execute after `post_configure()`.
1176 - `do_build()` Actions to execute to build the package.
1178 - `post_build()` Actions to execute after `do_build()`.
1180 - `pre_check()` Actions to execute after `post_build()`.
1182 - `do_check()` Actions to execute to run checks for the package.
1184 - `post_check()` Actions to execute after `do_check()`.
1186 - `pre_install()` Actions to execute after `post_check()`.
1188 - `do_install()` Actions to execute to install the package files into the `fake destdir`.
1190 - `post_install()` Actions to execute after `do_install()`.
1192 - `do_clean()` Actions to execute to clean up after a successful package phase.
1194 > A function defined in a template has preference over the same function
1195 defined by a `build_style` script.
1197 Current working directory for functions is set as follows:
1199 - For pre_fetch, pre_extract, do_clean: `<masterdir>`.
1201 - For do_fetch, post_fetch: `XBPS_BUILDDIR`.
1203 - For do_extract through do_patch: `wrksrc`.
1205 - For post_patch through post_install: `build_wrksrc`
1206 if it is defined, otherwise `wrksrc`.
1208 <a id="build_options"></a>
1211 Some packages might be built with different build options to enable/disable
1212 additional features; The XBPS source packages collection allows you to do this with some simple tweaks
1213 to the `template` file.
1215 The following variables may be set to allow package build options:
1217 - `build_options` Sets the build options supported by the source package.
1219 - `build_options_default` Sets the default build options to be used by the source package.
1221 - `desc_option_<option>` Sets the description for the build option `option`. This must match the
1222 keyword set in *build_options*. Note that if the build option is generic enough, its description
1223 should be added to `common/options.description` instead.
1225 After defining those required variables, you can check for the
1226 `build_option_<option>` variable to know if it has been set and adapt the source
1227 package accordingly. Additionally, the following functions are available:
1229 - *vopt_if()* `vopt_if <option> <if_true> [<if_false>]`
1231 Outputs `if_true` if `option` is set, or `if_false` if it isn't set.
1233 - *vopt_with()* `vopt_with <option> [<flag>]`
1235 Outputs `--with-<flag>` if the option is set, or `--without-<flag>`
1236 otherwise. If `flag` isn't set, it defaults to `option`.
1241 - `vopt_with xml xml2`
1243 - *vopt_enable()* `vopt_enable <option> [<flag>]`
1245 Same as `vopt_with`, but uses `--enable-<flag>` and
1246 `--disable-<flag>` respectively.
1248 - *vopt_conflict()* `vopt_conflict <option 1> <option 2>`
1250 Emits an error and exits if both options are set at the same time.
1252 - *vopt_bool()* `vopt_bool <option> <property>`
1254 Outputs `-D<property>=true` if the option is set, or
1255 `-D<property>=false` otherwise.
1257 - *vopt_feature()* `vopt_feature <option> <property>`
1259 Same as `vopt_bool`, but uses `-D<property>=enabled` and
1260 `-D<property>=disabled` respectively.
1262 The following example shows how to change a source package that uses GNU
1263 configure to enable a new build option to support PNG images:
1266 # Template file for 'foo'
1270 build_style=gnu-configure
1271 configure_args="... $(vopt_with png)"
1272 makedepends="... $(vopt_if png libpng-devel)"
1275 # Package build options
1277 desc_option_png="Enable support for PNG images"
1279 # To build the package by default with the `png` option:
1281 # build_options_default="png"
1287 The supported build options for a source package can be shown with `xbps-src`:
1289 $ ./xbps-src show-options foo
1291 Build options can be enabled with the `-o` flag of `xbps-src`:
1293 $ ./xbps-src -o option,option1 <cmd> foo
1295 Build options can be disabled by prefixing them with `~`:
1297 $ ./xbps-src -o ~option,~option1 <cmd> foo
1299 Both ways can be used together to enable and/or disable multiple options
1300 at the same time with `xbps-src`:
1302 $ ./xbps-src -o option,~option1,~option2 <cmd> foo
1304 The build options can also be shown for binary packages via `xbps-query(8)`:
1306 $ xbps-query -R --property=build-options foo
1308 Permanent global package build options can be set via `XBPS_PKG_OPTIONS` variable in the
1309 `etc/conf` configuration file. Per package build options can be set via
1310 `XBPS_PKG_OPTIONS_<pkgname>`.
1312 > NOTE: if `pkgname` contains `dashes`, those should be replaced by `underscores`
1313 Example: `XBPS_PKG_OPTIONS_xorg_server=opt`.
1315 The list of supported package build options and its description is defined in the
1316 `common/options.description` file.
1318 <a id="install_remove_files"></a>
1319 ### INSTALL and REMOVE files
1321 The INSTALL and REMOVE shell snippets can be used to execute certain actions at a specified
1322 stage when a binary package is installed, updated or removed. There are some variables
1323 that are always set by `xbps` when the scripts are executed:
1325 - `$ACTION`: to conditionalize its actions: `pre` or `post`.
1326 - `$PKGNAME`: the package name.
1327 - `$VERSION`: the package version.
1328 - `$UPDATE`: set to `yes` if package is being upgraded, `no` if package is being `installed` or `removed`.
1329 - `$CONF_FILE`: full path to `xbps.conf`.
1330 - `$ARCH`: the target architecture it is running on.
1332 An example of how an `INSTALL` or `REMOVE` script shall be created is shown below:
1338 # Actions to execute before the package files are unpacked.
1342 if [ "$UPDATE" = "yes" ]; then
1343 # actions to execute if package is being updated.
1346 # actions to execute if package is being installed.
1353 subpackages can also have their own `INSTALL` and `REMOVE` files, simply create them
1354 as `srcpkgs/<pkgname>/<subpkg>.INSTALL` or `srcpkgs/<pkgname>/<subpkg>.REMOVE` respectively.
1356 > NOTE: always use paths relative to the current working directory, otherwise if the scripts cannot
1357 be executed via `chroot(2)` won't work correctly.
1359 > NOTE: do not use INSTALL/REMOVE scripts to print messages, see the next section for
1362 <a id="install_remove_files_msg"></a>
1363 ### INSTALL.msg and REMOVE.msg files
1365 The `INSTALL.msg` and `REMOVE.msg` files can be used to print a message at post-install
1366 or pre-remove time, respectively.
1368 Ideally those files should not exceed 80 chars per line.
1370 subpackages can also have their own `INSTALL.msg` and `REMOVE.msg` files, simply create them
1371 as `srcpkgs/<pkgname>/<subpkg>.INSTALL.msg` or `srcpkgs/<pkgname>/<subpkg>.REMOVE.msg` respectively.
1373 This should only be used for critical messages, like warning users of breaking changes.
1375 <a id="runtime_account_creation"></a>
1376 ### Creating system accounts/groups at runtime
1378 There's a trigger along with some variables that are specifically to create
1379 **system users and groups** when the binary package is being configured.
1380 The following variables can be used for this purpose:
1382 - `system_groups` This specifies the names of the new *system groups* to be created, separated
1383 by blanks. Optionally the **gid** can be specified by delimiting it with a
1384 colon, i.e `system_groups="_mygroup:78"` or `system_groups="_foo _blah:8000"`.
1386 - `system_accounts` This specifies the names of the new **system users/groups** to be created,
1387 separated by blanks, i.e `system_accounts="_foo _blah:22"`. Optionally the **uid** and **gid**
1388 can be specified by delimiting it with a colon, i.e `system_accounts="_foo:48"`.
1389 Additional variables for the **system accounts** can be specified to change its behavior:
1391 - `<account>_homedir` the home directory for the user. If unset defaults to `/var/empty`.
1392 - `<account>_shell` the shell for the new user. If unset defaults to `/sbin/nologin`.
1393 - `<account>_descr` the description for the new user. If unset defaults to `<account> unprivileged user`.
1394 - `<account>_groups` additional groups to be added to for the new user.
1395 - `<account>_pgroup` to set the primary group, by default primary group is set to `<account>`.
1397 The **system user** is created by using a dynamically allocated **uid/gid** in your system
1398 and it's created as a `system account`, unless the **uid** is set. A new group will be created for the
1399 specified `system account` and used exclusively for this purpose.
1401 System accounts and groups must be prefixed with an underscore to prevent clashing with names of user
1404 > NOTE: The underscore policy does not apply to old packages, due to the inevitable breakage of
1405 > changing the username only new packages should follow it.
1407 <a id="writing_runit_services"></a>
1408 ### Writing runit services
1410 Void Linux uses [runit](http://smarden.org/runit/) for booting and supervision of services.
1412 Most information about how to write them can be found in their
1413 [FAQ](http://smarden.org/runit/faq.html#create). The following are guidelines specific to
1414 Void Linux on how to write services.
1416 If the service daemon supports CLI flags, consider adding support for changing it via the
1417 `OPTS` variable by reading a file called `conf` in the same directory as the daemon.
1421 [ -r conf ] && . ./conf
1422 exec daemon ${OPTS:- --flag-enabled-by-default}
1425 If the service requires the creation of a directory under `/run` or its link `/var/run`
1426 for storing runtime information (like Pidfiles) write it into the service file. It
1427 is advised to use `install` if you need to create it with specific permissions instead
1432 install -d -m0700 /run/foo
1438 install -d -m0700 -o bar -g bar /run/bar
1442 If the service requires directories in parts of the system that are not generally in
1443 temporary filesystems. Then use the `make_dirs` variable in the template to create
1444 those directories when the package is installed.
1446 If the package installs a systemd service file or other unit, leave it in place as a
1447 reference point so long as including it has no negative side effects.
1449 Examples of when *not* to install systemd units:
1451 1. When doing so changes runtime behavior of the packaged software.
1452 2. When it is done via a compile time flag that also changes build dependencies.
1454 <a id="32bit_pkgs"></a>
1457 32bit packages are built automatically when the builder is x86 (32bit), but
1458 there are some variables that can change the behavior:
1460 - `lib32depends` If this variable is set, dependencies listed here will be used rather than
1461 those detected automatically by `xbps-src` and **depends**. Please note that
1462 dependencies must be specified with version comparators, Example:
1463 `lib32depends="foo>=0 blah<2.0"`.
1465 - `lib32disabled` If this variable is set, no 32bit package will be built.
1467 - `lib32files` Additional files to be added to the **32bit** package. This expect absolute
1468 paths separated by blanks, Example: `lib32files="/usr/bin/blah /usr/include/blah."`.
1470 - `lib32symlinks` Makes a symlink of the target filename stored in the `lib32` directory.
1471 This expects the basename of the target file, Example: `lib32symlinks="foo"`.
1473 - `lib32mode` If unset, only shared/static libraries and pkg-config files will be copied to the
1474 **32bit** package. If set to `full` all files will be copied to the 32bit package, unmodified.
1476 <a id="pkgs_sub"></a>
1479 In the example shown above just a binary package is generated, but with some
1480 simple tweaks multiple binary packages can be generated from a single
1481 template/build, this is called `subpackages`.
1483 To create additional `subpackages` the `template` must define a new function
1484 with this naming: `<subpkgname>_package()`, Example:
1487 # Template file for 'foo'
1491 build_style=gnu-configure
1492 short_desc="A short description max 72 chars"
1493 maintainer="name <email>"
1494 license="GPL-3.0-or-later"
1495 homepage="http://www.foo.org"
1496 distfiles="http://www.foo.org/foo-${version}.tar.gz"
1497 checksum="fea0a94d4b605894f3e2d5572e3f96e4413bcad3a085aae7367c2cf07908b2ff"
1499 # foo-devel is a subpkg
1500 foo-devel_package() {
1501 short_desc+=" - development files"
1502 depends="${sourcepkg}>=${version}_${revision}"
1506 vmove "usr/lib/*.so"
1507 vmove usr/lib/pkgconfig
1512 All subpackages need an additional symlink to the `main` pkg, otherwise dependencies
1513 requiring those packages won't find its `template` Example:
1517 |- foo <- directory (main pkg)
1519 |- foo-devel <- symlink to `foo`
1522 The main package should specify all required `build dependencies` to be able to build
1523 all subpackages defined in the template.
1525 An important point of `subpackages` is that they are processed after the main
1526 package has run its `install` phase. The `pkg_install()` function specified on them
1527 commonly is used to move files from the `main` package destdir to the `subpackage` destdir.
1529 The helper functions `vinstall`, `vmkdir`, `vcopy` and `vmove` are just wrappers that simplify
1530 the process of creating, copying and moving files/directories between the `main` package
1531 destdir (`$DESTDIR`) to the `subpackage` destdir (`$PKGDESTDIR`).
1533 Subpackages are processed always in alphabetical order; To force a custom order,
1534 the `subpackages` variable can be declared with the wanted order.
1536 <a id="pkgs_classes"></a>
1537 ### Some package classes
1539 <a id="pkgs_development"></a>
1540 #### Development packages
1542 A development package, commonly generated as a subpackage, shall only contain
1543 files required for development, that is, headers, static libraries, shared
1544 library symlinks, pkg-config files, API documentation or any other script
1545 that is only useful when developing for the target software.
1547 A development package should depend on packages that are required to link
1548 against the provided shared libraries, i.e if `libfoo` provides the
1549 `libfoo.so.2` shared library and the linking needs `-lbar`, the package
1550 providing the `libbar` shared library should be added as a dependency;
1551 and most likely it shall depend on its development package.
1553 If a development package provides a `pkg-config` file, you should verify
1554 what dependencies the package needs for dynamic or static linking, and add
1555 the appropriate `development` packages as dependencies.
1557 Development packages for the C and C++ languages usually `vmove` the
1558 following subset of files from the main package:
1560 * Header files `usr/include`
1561 * Static libraries `usr/lib/*.a`
1562 * Shared library symbolic links `usr/lib/*.so`
1563 * Cmake rules `usr/lib/cmake` `usr/share/cmake`
1564 * Package config files `usr/lib/pkgconfig` `usr/share/pkgconfig`
1565 * Autoconf macros `usr/share/aclocal`
1566 * Gobject introspection XML files `usr/share/gir-1.0`
1567 * Vala bindings `usr/share/vala`
1569 <a id="pkgs_data"></a>
1572 Another common subpackage type is the `-data` subpackage. This subpackage
1573 type used to split architecture independent, big(ger) or huge amounts
1574 of data from a package's main and architecture dependent part. It is up
1575 to you to decide, if a `-data` subpackage makes sense for your package.
1576 This type is common for games (graphics, sound and music), part libraries (CAD)
1577 or card material (maps).
1578 The main package must then have `depends="${pkgname}-data-${version}_${revision}"`,
1579 possibly in addition to other, non-automatic depends.
1581 <a id="pkgs_documentation"></a>
1582 #### Documentation packages
1584 Packages intended for user interaction do not always unconditionally require
1585 their documentation part. A user who does not want to e.g. develop
1586 with Qt5 will not need to install the (huge) qt5-doc package.
1587 An expert may not need it or opt to use an online version.
1589 In general a `-doc` package is useful, if the main package can be used both with
1590 or without documentation and the size of the documentation isn't really small.
1591 The base package and the `-devel` subpackage should be kept small so that when
1592 building packages depending on a specific package there is no need to install large
1593 amounts of documentation for no reason. Thus the size of the documentation part should
1594 be your guidance to decide whether or not to split off a `-doc` subpackage.
1596 <a id="pkgs_python"></a>
1597 #### Python packages
1599 Python packages should be built with the `python3-module` build style, if possible.
1600 This sets some environment variables required to allow cross compilation. Support to allow
1601 building a python module for multiple versions from a single template is also possible.
1602 The `python3-pep517` build style provides means to build python packages that provide a build-system
1603 definition compliant with [PEP 517](https://www.python.org/dev/peps/pep-0517/) without a traditional
1604 `setup.py` script. The `python3-pep517` build style does not provide a specific build backend, so
1605 packages will need to add an appropriate backend provider to `hostmakedepends`.
1607 Python packages that rely on `python3-setuptools` should generally map `setup_requires`
1608 dependencies in `setup.py` to `hostmakedepends` in the template and `install_requires`
1609 dependencies to `depends` in the template; include `python3` in `depends` if there are no other
1610 python dependencies. If the package includes a compiled extension, the `python3-devel` packages
1611 should be added to `makedepends`, as should any python packages that also provide native libraries
1612 against which the extension will be linked (even if that package is also included in
1613 `hostmakedepends` to satisfy `setuptools`).
1615 **NB**: Python `setuptools` will attempt to use `pip` or `EasyInstall` to fetch any missing
1616 dependencies at build time. If you notice warnings about `EasyInstall` deprecation or python eggs
1617 present in `${wrksrc}/.eggs` after building the package, then those packages should be added to
1620 The following variables may influence how the python packages are built and configured
1621 at post-install time:
1623 - `pycompile_module`: By default, files and directories installed into
1624 `usr/lib/pythonX.Y/site-packages`, excluding `*-info` and `*.so`, are byte-compiled
1625 at install time as python modules. This variable expects subset of them that
1626 should be byte-compiled, if default is wrong. Multiple python modules may be specified separated
1627 by blanks, Example: `pycompile_module="foo blah"`. If a python module installs a file into
1628 `site-packages` rather than a directory, use the name of the file, Example:
1629 `pycompile_module="fnord.py"`.
1631 - `pycompile_dirs`: this variable expects the python directories that should be `byte-compiled`
1632 recursively by the target python version. This differs from `pycompile_module` in that any
1633 path may be specified, Example: `pycompile_dirs="usr/share/foo"`.
1635 - `python_version`: this variable expects the supported Python major version.
1636 In most cases version is inferred from shebang, install path or build style.
1637 Only required for some multi-language
1638 applications (e.g., the application is written in C while the command is
1639 written in Python) or just single Python file ones that live in `/usr/bin`.
1640 If `python_version` is set to `ignore`, python-containing shebangs will not be rewritten.
1641 Use this only if a package should not be using a system version of python.
1643 - `python_extras`: Python module extras to consider when verifying Python module dependencies.
1644 Can be used to ensure additional dependency sets are checked. Example: `python_extras="all"`.
1646 - `nopyprovides`: if set, don't create `provides` entries for Python modules in the package.
1648 - `noverifypydeps`: if set, don't verify Python module dependencies.
1650 Also, a set of useful variables are defined to use in the templates:
1652 | Variable | Value |
1653 |-------------|----------------------------------|
1655 | py2_lib | usr/lib/python2.X |
1656 | py2_sitelib | usr/lib/python2.X/site-packages |
1657 | py2_inc | usr/include/python2.X |
1659 | py3_lib | usr/lib/python3.X |
1660 | py3_sitelib | usr/lib/python3.X/site-packages |
1661 | py3_inc | usr/include/python3.Xm |
1663 > NOTE: it's expected that additional subpkgs must be generated to allow packaging for multiple
1666 <a id="pkgs_go"></a>
1669 Go packages should be built with the `go` build style, if possible.
1670 The `go` build style takes care of downloading Go dependencies and
1671 setting up cross compilation.
1673 The following template variables influence how Go packages are built:
1675 - `go_import_path`: The import path of the package included in the
1676 distfile, as it would be used with `go get`. For example, GitHub's
1677 `hub` program has the import path `github.com/github/hub`. This
1678 variable is required.
1679 - `go_package`: A space-separated list of import paths of the packages
1680 that should be built. Defaults to `go_import_path`.
1681 - `go_build_tags`: An optional, space-separated list of build tags to
1683 - `go_mod_mode`: The module download mode to use. May be `off` to ignore
1684 any go.mod files, `default` to use Go's default behavior, or anything
1685 accepted by `go build -mod MODE`. Defaults to `vendor` if there's
1686 a vendor directory, otherwise `default`.
1687 - `go_ldflags`: Arguments to pass to the linking steps of go tool.
1689 The following environment variables influence how Go packages are built:
1691 - `XBPS_MAKEJOBS`: Value passed to the `-p` flag of `go install`, to
1692 control the parallelism of the Go compiler.
1694 Occasionally it is necessary to perform operations from within the Go
1695 source tree. This is usually needed by programs using go-bindata or
1696 otherwise preping some assets. If possible do this in pre_build().
1697 The path to the package's source inside `$GOPATH` is available as
1700 <a id="pkgs_haskell"></a>
1701 #### Haskell packages
1703 We build Haskell package using `stack` from
1704 [Stackage](http://www.stackage.org/), generally the LTS versions.
1705 Haskell templates need to have host dependencies on `ghc` and `stack`,
1706 and set build style to `haskell-stack`.
1708 The following variables influence how Haskell packages are built:
1710 - `stackage`: The Stackage version used to build the package, e.g.
1711 `lts-3.5`. Alternatively:
1712 - You can prepare a `stack.yaml` configuration for the project and put it
1713 into `files/stack.yaml`.
1714 - If a `stack.yaml` file is present in the source files, it will be used
1715 - `make_build_args`: This is passed as-is to `stack build ...`, so
1716 you can add your `--flag ...` parameters there.
1718 <a id="pkgs_font"></a>
1721 Font packages are very straightforward to write, they are always set with the
1722 following variables:
1724 - `depends="font-util"`: because they are required for regenerating the font
1725 cache during the install/removal of the package
1726 - `font_dirs`: which should be set to the directory where the package
1729 <a id="pkg_rename"></a>
1730 ### Renaming a package
1732 - Create empty package of old name, depending on new package. This is
1733 necessary to provide updates to systems where old package is already
1734 installed. This should be a subpackage of new one, except when version
1735 number of new package decreased: then create a separate template using
1736 old version and increased revision.
1737 - Edit references to package in other templates and common/shlibs.
1738 - Don't set `replaces=`, it can result in removing both packages from
1741 <a id="pkg_remove"></a>
1742 ### Removing a package
1744 Follows a list of things that should be done to help guarantee that a
1745 package template removal and by extension its binary packages from
1746 Void Linux's repositories goes smoothly.
1748 Before removing a package template:
1750 - Guarantee that no package depends on it or any of its subpackages.
1751 For that you can search the templates for references to the package
1752 with `grep -r '\bpkg\b' srcpkgs/`.
1753 - Guarantee that no package depends on shlibs provided by it.
1755 When removing the package template:
1757 - Remove all symlinks that point to the package.
1758 `find srcpkgs/ -lname <pkg>` should be enough.
1759 - If the package provides shlibs make sure to remove them from
1761 - Some packages use patches and files from other packages using symlinks,
1762 generally those packages are the same but have been split as to avoid
1763 cyclic dependencies. Make sure that the package you're removing is not
1764 the source of those patches/files.
1765 - Remove package template.
1766 - Add `pkgname<=version_revision` to `replaces` variable of `removed-packages`
1767 template. All removed subpkgs should be added too.
1768 This will uninstall package from systems where it is installed.
1769 - Remove the package from the repository index
1770 or contact a team member that can do so.
1772 <a id="xbps_triggers"></a>
1775 XBPS triggers are a collection of snippets of code, provided by the `xbps-triggers`
1776 package, that are added to the INSTALL/REMOVE scripts of packages either manually
1777 by setting the `triggers` variable in the template, or automatically, when specific
1780 The following is a list of all available triggers, their current status, what each
1781 of them does and what conditions need to be for it to be included automatically on a
1784 This is not a complete overview of the package. It is recommended to read the variables
1785 referenced and the triggers themselves.
1787 <a id="triggers_appstream_cache"></a>
1788 #### appstream-cache
1790 The appstream-cache trigger is responsible for rebuilding the appstream metadata cache.
1792 During installation it executes `appstreamcli refresh-cache --verbose --force --datapath
1793 $APPSTREAM_PATHS --cachepath var/cache/app-info/gv`. By default APPSTREAM_PATHS are all the
1794 paths that appstreamcli will look into for metadata files.
1796 The directories searched by appstreamcli are:
1798 - `usr/share/appdata`
1799 - `usr/share/app-info`
1800 - `var/lib/app-info`
1801 - `var/cache/app-info`
1803 During removal of the `AppStream` package it will remove the `var/cache/app-info/gv`
1806 It is automatically added to packages that have XML files under one of the directories
1807 searched by appstreamcli.
1809 <a id="triggers_binfmts"></a>
1812 The binfmts trigger is responsible for registration and removal of arbitrary
1813 executable binary formats, know as binfmts.
1815 During installation/removal it uses `update-binfmts` from the `binfmt-support` package
1816 to register/remove entries from the arbitrary executable binary formats database.
1818 It is automatically added to packages that contain files in `usr/share/binfmts`.
1819 These files should be `update-binfmts` format files and will be imported with
1820 `update-binfmts --import`.
1822 While it is not preferred, the trigger can also be added by using the `binfmts` variable,
1823 which should contain lines defining binfmts to register:
1826 /path/to/interpreter [update-binfmts binary format specification arguments ...]
1830 See [`update-binfmts(8)`](https://man.voidlinux.org/man8/update-binfmts.8) for more details.
1832 <a id="triggers_dkms"></a>
1835 The dkms trigger is responsible for compiling and removing dynamic kernel modules of a
1838 During installation the trigger compiles and installs the dynamic module for all `linux`
1839 packages that have their corresponding linux-headers package installed. During removal
1840 the corresponding module will be removed
1842 To include the trigger use the `dkms_modules` variable, as the trigger won't do anything
1843 unless it is defined.
1845 <a id="triggers_gconf_schemas"></a>
1848 The gconf-schemas trigger is responsible for registering and removing .schemas and
1849 .entries files into the schemas database directory
1851 During installation it uses `gconftool-2` to install .schemas and .entries files into
1852 `usr/share/gconf/schemas`. During removal it uses `gconftool-2` to remove the entries
1853 and schemas belonging to the package that is being removed from the database.
1855 To include it add `gconf-schemas` to `triggers` and add the appropriate .schemas in
1856 the `gconf_schemas` variable and .entries in `gconf_entries`.
1858 It is automatically added to packages that have `/usr/share/gconf/schemas` present
1859 as a directory. All files with the schemas file extension under that directory
1860 are passed to the trigger.
1862 <a id="triggers_gdk_pixbuf_loaders"></a>
1863 #### gdk-pixbuf-loaders
1865 The gdk-pixbuf-loaders trigger is responsible for maintaining the GDK Pixbuf loaders cache.
1867 During installation it runs `gdk-pixbuf-query-loaders --update-cache` and also deletes
1868 the obsolete `etc/gtk-2.0/gdk-pixbuf.loaders` file if present. During removal of the
1869 gdk-pixbuf package it removes the cache file if present. Normally at
1870 `usr/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache`.
1872 It can be added by defining `gdk-pixbuf-loaders` in the `triggers` variable. It is also
1873 added automatically to any package that has the path `usr/lib/gdk-pixbuf-2.0/2.10.0/loaders`
1874 available as a directory.
1876 <a id="triggers_gio_modules"></a>
1879 The gio-modules trigger is responsible for updating the Glib GIO module cache with
1880 `gio-querymodules` from the `glib` package
1882 During install and removal it just runs `gio-querymodules` to update the cache file
1883 present under `usr/lib/gio/modules`.
1885 It is automatically added to packages that have `/usr/lib/gio/modules` present
1888 <a id="triggers_gsettings_schemas"></a>
1889 #### gsettings-schemas
1891 The gsettings-schemas trigger is responsible for compiling Glib's GSettings XML
1892 schema files during installation and removing the compiled files during removal.
1894 During installation it uses `glib-compile-schemas` from `glib` to compile the
1895 schemas into files with the suffix .compiled into `/usr/share/glib-2.0/schemas`.
1897 During removal of the glib package it deletes all files inside
1898 `/usr/share/glib-2.0/schemas` that end with .compiled.
1900 It is automatically added to packages that have `/usr/share/glib-2.0/schemas` present
1903 <a id="triggers_gtk_icon_cache"></a>
1906 The gtk-icon-cache trigger is responsible for updating the gtk+ icon cache.
1908 During installation it uses `gtk-update-icon-cache` to update the icon cache.
1910 During removal of the gtk+ package it deletes the `icon-theme.cache` file
1911 in the directories defined by the variable `gtk_iconcache_dirs`.
1913 It is automatically added on packages that have `/usr/share/icons` available
1914 as a directory, all directories under that directory have their absolute path
1915 passed to the trigger.
1917 <a id="triggers_gtk_immodules"></a>
1920 The gtk-immodules trigger is responsible for updating the IM (Input Method) modules
1923 During installation it uses `gtk-query-immodules-2.0 --update-cache` to update the
1924 cache file. It also removes the obsolete configuration file `etc/gtk-2.0/gtk.immodules`
1927 During removal of the `gtk+` package it removes the cache file which is located at
1928 `usr/lib/gtk-2.0/2.10.0/immodules.cache`.
1930 It is automatically added to packages that have `/usr/lib/gtk-2.0/2.10.0/immodules`
1931 present as a directory.
1933 <a id="triggers_gtk_pixbuf_loaders"></a>
1934 #### gtk-pixbuf-loaders
1936 gtk-pixbuf-loaders is the old name for the current `gdk-pixbuf-loaders` trigger and is
1937 in the process of being removed. It currently re-execs into `gdk-pixbuf-loaders` as a
1938 compatibility measure.
1940 For information about how it works refer to [gdk-pixbuf-loaders](#triggers_gdk_pixbuf_loaders).
1942 <a id="triggers_gtk3_immodules"></a>
1945 The gtk3-immodules trigger is responsible for updating the IM (Input Method) modules
1948 During installation it executes `gtk-query-immodules-3.0 --update-cache` to update the
1949 cache file. It also removes the obsolete configuration file `etc/gtk-3.0/gtk.immodules`
1952 During removal of the `gtk+3` package it removes the cache file which is located at
1953 `usr/lib/gtk-3.0/3.0.0/immodules.cache`.
1955 It is automatically added to packages that have `/usr/lib/gtk-3.0/3.0.0/immodules`
1956 present as a directory.
1958 <a id="triggers_hwdb.d_dir"></a>
1961 The hwdb.d-dir trigger is responsible for updating the hardware database.
1963 During installation and removal it runs `usr/bin/udevadm hwdb --root=. --update`.
1965 It is automatically added to packages that have `/usr/lib/udev/hwdb.d` present
1968 <a id="triggers_info_files"></a>
1971 The info-files trigger is responsible for registering and unregistering the GNU info
1974 It checks the existence of the info files presented to it and if it is running under
1975 another architecture.
1977 During installation it uses `install-info` to register info files into
1980 During removal it uses `install-info --delete` to remove the info files from the
1981 registry located at `usr/share/info`.
1983 If it is running under another architecture it tries to use the host's `install-info`
1986 <a id="triggers_initramfs_regenerate"></a>
1987 #### initramfs-regenerate
1989 The initramfs-regenerate trigger will trigger the regeneration of all kernel
1990 initramfs images after package installation or removal. The trigger must be
1993 This hook is probably most useful for DKMS packages because it will provide a
1994 means to include newly compiled kernel modules in initramfs images for all
1995 currently available kernels. When used in a DKMS package, it is recommended to
1996 manually include the `dkms` trigger *before* the `initramfs-regenerate` trigger
2000 triggers="dkms initramfs-regenerate"
2003 Although `xbps-src` will automatically include the `dkms` trigger whenever
2004 `dkms_modules` is installed, the automatic addition will come *after*
2005 `initramfs-regenerate`, which will cause initramfs images to be recreated
2006 before the modules are compiled.
2008 By default, the trigger uses `dracut --regenerate-all` to recreate initramfs
2009 images. If `/etc/default/initramfs-regenerate` exists and defines
2010 `INITRAMFS_GENERATOR=mkinitcpio`, the trigger will instead use `mkinitcpio` and
2011 loop over all kernel versions for which modules appear to be installed.
2012 Alternatively, setting `INITRAMFS_GENERATOR=none` will disable image
2013 regeneration entirely.
2015 <a id="triggers_kernel_hooks"></a>
2018 The kernel-hooks trigger is responsible for running scripts during installation/removal
2021 The available targets are pre-install, pre-remove, post-install and post-remove.
2023 When run it will try to run all executables found under `etc/kernel.d/$TARGET`. The
2024 `TARGET` variable is one of the 4 targets available for the trigger. It will also
2025 create the directory if it isn't present.
2027 During updates it won't try to run any executables when running with the pre-remove
2030 It is automatically added if the helper variable `kernel_hooks_version` is defined.
2031 However it is not obligatory to have it defined.
2033 <a id="triggers_mimedb"></a>
2036 The mimedb trigger is responsible for updating the shared-mime-info database.
2038 In all runs it will just execute `update-mime-database -n usr/share/mime`.
2040 It is automatically added to packages that have `/usr/share/mime` available as
2043 <a id="triggers_mkdirs"></a>
2046 The mkdirs trigger is responsible for creating and removing directories dictated
2047 by the `make_dirs` variable.
2049 During installation it takes the `make_dirs` variable and splits it into groups of
2052 - dir = full path to the directory
2053 - mode = Unix permissions for the directory
2054 - uid = name of the owning user
2055 - gid = name of the owning group
2057 It will continue to split the values of `make_dirs` into groups of 4 until the values
2060 During installation it will create a directory with `dir` then set mode with `mode`
2061 and permission with `uid:gid`.
2063 During removal it will delete the directory using `rmdir`.
2065 To include this trigger use the `make_dirs` variable, as the trigger won't do anything
2066 unless it is defined.
2068 <a id="triggers_pango_module"></a>
2071 The pango-modules trigger is currently being removed since upstream has removed the
2072 code responsible for it.
2074 It used to update the pango modules file with `pango-modulesquery` during installation
2077 Currently it removes `etc/pango/pango.modules` file during removal of the pango package.
2079 It can be added by defining `pango-modules` in the `triggers` variable and has no way to get
2080 added automatically to a package.
2082 <a id="triggers_pycompile"></a>
2085 The pycompile trigger is responsible for compiling python code into native
2086 bytecode and removing generated bytecode.
2088 During installation it will compile all python code under the paths it is given by
2089 `pycompile_dirs` and all modules described in `pycompile_module` into native bytecode and
2090 update the ldconfig(8) cache.
2092 During removal it will remove all the native bytecode and update the ldconfig(8) cache.
2094 To include this trigger use the variables `pycompile_dirs` and `pycompile_module`. The
2095 trigger won't do anything unless at least one of those variables is defined.
2097 A `python_version` variable can be set to direct behaviour of the trigger.
2099 <a id="triggers_register_shell"></a>
2102 The register-shell trigger is responsible for registering and removing shell entries
2105 During installation it will append the `etc/shells` file with the new shell and also
2106 change the permissions to `644` on the file.
2108 During removal it will use `sed` to delete the shell from the file.
2110 To include this trigger use the `register_shell` variable, as the trigger won't do
2111 anything unless it is defined.
2113 <a id="triggers_system_accounts"></a>
2114 #### system-accounts
2116 The system-accounts trigger is responsible for creating and disabling system accounts
2119 During removal it will disable the account by setting the Shell to /bin/false,
2120 Home to /var/empty, and appending ' - for uninstalled package $pkgname' to the
2122 Example: `transmission unprivileged user - for uninstalled package transmission`
2124 This trigger can only be used by using the `system_accounts` variable.
2126 <a id="triggers_texmf_dist"></a>
2129 The texmf-dist trigger is responsible for regenerating TeXLive's texmf databases.
2131 During both installation and removal, it regenerates both the texhash and format
2132 databases using `texhash` and `fmtutil-sys`, to add or remove any new hashes or
2135 It runs on every package that changes /usr/share/texmf-dist. This is likely overkill,
2136 but it is much cleaner rather than checking each format directory and each directory
2137 that is hashed. In addition, it is very likely any package touching /usr/share/texmf-dist
2138 requires one of these triggers anyway.
2140 <a id="triggers_update_desktopdb"></a>
2141 #### update-desktopdb
2143 The update-desktopdb trigger is responsible for updating the system's MIME database.
2145 During installation it will execute `update-desktop-database usr/share/applications`
2146 which will result in a cache file being created at `usr/share/applications/mimeinfo.cache`.
2148 During removal of the `desktop-file-utils` package it will remove the cache file that
2149 was created during installation.
2151 It is automatically added to packages that have `/usr/share/applications` available as
2154 <a id="triggers_x11_fonts"></a>
2157 The x11-fonts trigger is responsible for rebuilding the fonts.dir and fonts.scale files
2158 for packages that install X11 fonts, and update fontconfig's cache for these fonts.
2160 During installation and removal it executes `mkfontdir`, `mkfontscale` and `fc-cache` for
2161 all font directories it was given via the `font_dirs` variable.
2163 To include this trigger use the `font_dirs` variable, as the trigger won't do anything
2164 unless it is defined.
2166 <a id="triggers_xml_catalog"></a>
2169 The xml-catalog trigger is responsible for registering and removing SGML/XML catalog entries.
2171 During installation it uses `xmlcatmgr` to register all catalogs, passed to it by the
2172 `sgml_entries` and `xml_entries` variables, in `usr/share/sgml/catalog` and
2173 `usr/share/xml/catalog` respectively.
2175 During removal it uses `xmlcatmgr` to remove all catalogs passed to it by the
2176 `sgml_entries` and `xml_entries` variables, in `usr/share/sgml/catalog` and
2177 `usr/share/xml/catalog` respectively.
2179 To include this trigger use the `sgml_entries` variable or/and the `xml_entries` variable,
2180 as the trigger won't do anything unless either of them are defined.
2182 <a id="documentation"></a>
2183 ### Void specific documentation
2185 When you want document details of package's configuration and usage specific to Void Linux,
2186 not covered by upstream documentation, put notes into
2187 `srcpkgs/<pkgname>/files/README.voidlinux` and install with
2188 `vdoc "${FILESDIR}/README.voidlinux"`.
2193 - Make sure that all software is configured to use the `/usr` prefix.
2195 - Binaries should always be installed at `/usr/bin`.
2197 - Manual pages should always be installed at `/usr/share/man`.
2199 - If a software provides **shared libraries** and headers, probably you should
2200 create a `development package` that contains `headers`, `static libraries`
2201 and other files required for development (not required at runtime).
2203 - If you are updating a package please be careful with SONAME bumps, check
2204 the installed files (`./xbps-src show-files pkg`) before pushing new updates.
2206 - Make sure that binaries are not stripped by the software, let xbps-src do this;
2207 otherwise the `debug` packages won't have debugging symbols.
2209 <a id="contributing"></a>
2210 ### Contributing via git
2212 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:
2214 $ git clone git@github.com:<user>/void-packages.git
2216 See [CONTRIBUTING.md](./CONTRIBUTING.md) for information on how to format your
2217 commits and other tips for contributing.
2219 Once you've made changes to your `forked` repository, submit
2220 a github pull request.
2222 To keep your forked repository always up to date, setup the `upstream` remote
2223 to pull in new changes:
2225 $ git remote add upstream https://github.com/void-linux/void-packages.git
2226 $ git pull --rebase upstream master
2231 If after reading this `manual` you still need some kind of help, please join
2232 us at `#xbps` via IRC at `irc.libera.chat`.