MAKEPKG-TEMPLATE(1) | Pacman Manual | MAKEPKG-TEMPLATE(1) |
NAME
makepkg-template - package build templating utility
SYNOPSIS
makepkg-template [options]
DESCRIPTION
makepkg-template is a script to ease the work of maintaining multiple similar PKGBUILDs. It allows you to move most of the code from the PKGBUILD into a template file and uses markers to allow in-place updating of existing PKGBUILDs if the template has been changed.
Template files can contain any code allowed in a PKGBUILD. You can think of them like external files included with "." or "source", but they will be inlined into the PKGBUILD by makepkg-template so you do not depend on the template file when building the package.
Markers are bash comments in the form of:
# template start; key=value; key2=value2; ...
and
# template end;
Currently used keys are: name (mandatory) and version. Template names are limited to alphanumerics, "@", "+", ".", "-", and "_". Versions are limited to numbers and ".".
For initial creation there is a one line short cut which does not need an end marker:
# template input; key=value;
Using this short-cut will result in makepkg-template replacing it with start and end markers and the template code on the first run.
Template files should be stored in one directory and filenames should be "$template_name-$version.template" with a symlink "$template_name.template" pointing to the most recent template. If the version is not set in the marker, makepkg-template will automatically use the target of "$template_name.template", otherwise the specified version will be used. This allows for easier verification of untrusted PKGBUILDs if the template is trusted. You verify the non-template code and then use a command similar to this:
diff -u <(makepkg-template -o -) PKGBUILD
Template files may also contain markers leading to nested templates in the resulting PKGBUILD. If you use markers in a template, please set the version you used/tested with in the start/input marker so other people can properly recreate from templates.
OPTIONS
-p, --input <build script>
-o, --output <build script>
-n, --newest
--template-dir <dir>
EXAMPLE PKGBUILD
pkgname=perl-config-simple pkgver=4.58 pkgrel=1 pkgdesc="simple configuration file class" arch=('any') license=('PerlArtistic' 'GPL') depends=('perl') source=("http://search.cpan.org/CPAN/authors/id/S/SH/SHERZODR/Config-Simple-${pkgver}.tar.gz") sha256sums=('dd9995706f0f9384a15ccffe116c3b6e22f42ba2e58d8f24ed03c4a0e386edb4') _distname="Config-Simple"
# template start; name=perl-module; version=1.0; _distdir="${_distname}-${pkgver}" url="https://metacpan.org/release/${_distname}" options+=('!emptydirs')
build() { cd "$srcdir/$_distdir" perl Makefile.PL INSTALLDIRS=vendor make }
check() { cd "$srcdir/$_distdir" make test }
package() { cd "$srcdir/$_distdir" make DESTDIR="$pkgdir" install } # template end;
SEE ALSO
See the pacman website at https://archlinux.org/pacman/ for current information on pacman and its related tools.
BUGS
Bugs? You must be kidding; there are no bugs in this software. But if we happen to be wrong, please report them to the issue tracker at https://gitlab.archlinux.org/pacman/pacman/-/issues with specific information such as your command-line, the nature of the bug, and even the package database if it helps.
AUTHORS
Current maintainers:
Past major contributors:
For additional contributors, use git shortlog -s on the pacman.git repository.
2024-11-27 | Pacman 7.0.0 |