1MAKEPKG-TEMPLATE(1) Pacman Manual MAKEPKG-TEMPLATE(1)
2
3
4
6 makepkg-template - package build templating utility
7
9 makepkg-template [options]
10
12 makepkg-template is a script to ease the work of maintaining multiple
13 similar PKGBUILDs. It allows you to move most of the code from the
14 PKGBUILD into a template file and uses markers to allow in-place
15 updating of existing PKGBUILDs if the template has been changed.
16
17 Template files can contain any code allowed in a PKGBUILD. You can
18 think of them like external files included with "." or "source", but
19 they will be inlined into the PKGBUILD by makepkg-template so you do
20 not depend on the template file when building the package.
21
22 Markers are bash comments in the form of:
23
24 # template start; key=value; key2=value2; ...
25
26 and
27
28 # template end;
29
30 Currently used keys are: name (mandatory) and version. Template names
31 are limited to alphanumerics, "@", "+", ".", "-", and "_". Versions are
32 limited to numbers and ".".
33
34 For initial creation there is a one line short cut which does not need
35 an end marker:
36
37 # template input; key=value;
38
39 Using this short-cut will result in makepkg-template replacing it with
40 start and end markers and the template code on the first run.
41
42 Template files should be stored in one directory and filenames should
43 be "$template_name-$version.template" with a symlink
44 "$template_name.template" pointing to the most recent template. If the
45 version is not set in the marker, makepkg-template will automatically
46 use the target of "$template_name.template", otherwise the specified
47 version will be used. This allows for easier verification of untrusted
48 PKGBUILDs if the template is trusted. You verify the non-template code
49 and then use a command similar to this:
50
51 diff -u <(makepkg-template -o -) PKGBUILD
52
53 Template files may also contain markers leading to nested templates in
54 the resulting PKGBUILD. If you use markers in a template, please set
55 the version you used/tested with in the start/input marker so other
56 people can properly recreate from templates.
57
59 -p, --input <build script>
60 Read the package script build script instead of the default.
61
62 -o, --output <build script>
63 Write the updated file to build script instead of overwriting the
64 input file.
65
66 -n, --newest
67 Always use the newest available template file.
68
69 --template-dir <dir>
70 Change the dir where we are looking for template files. This option
71 may be given multiple times in which case files found in directory
72 given last will take precedence.
73
75 pkgname=perl-config-simple
76 pkgver=4.58
77 pkgrel=1
78 pkgdesc="simple configuration file class"
79 arch=('any')
80 license=('PerlArtistic' 'GPL')
81 depends=('perl')
82 source=("http://search.cpan.org/CPAN/authors/id/S/SH/SHERZODR/Config-Simple-${pkgver}.tar.gz")
83 md5sums=('f014aec54f0a1e2e880d317180fce502')
84 _distname="Config-Simple"
85
86 # template start; name=perl-module; version=1.0;
87 _distdir="${_distname}-${pkgver}"
88 url="https://metacpan.org/release/${_distname}"
89 options+=('!emptydirs')
90
91 build() {
92 cd "$srcdir/$_distdir"
93 perl Makefile.PL INSTALLDIRS=vendor
94 make
95 }
96
97 check() {
98 cd "$srcdir/$_distdir"
99 make test
100 }
101
102 package() {
103 cd "$srcdir/$_distdir"
104 make DESTDIR="$pkgdir" install
105 }
106 # template end;
107
109 makepkg(8), PKGBUILD(5)
110
111 See the pacman website at https://archlinux.org/pacman/ for current
112 information on pacman and its related tools.
113
115 Bugs? You must be kidding; there are no bugs in this software. But if
116 we happen to be wrong, submit a bug report with as much detail as
117 possible at the Arch Linux Bug Tracker in the Pacman section.
118
120 Current maintainers:
121
122 • Allan McRae <allan@archlinux.org>
123
124 • Andrew Gregory <andrew.gregory.8@gmail.com>
125
126 • Eli Schwartz <eschwartz@archlinux.org>
127
128 • Morgan Adamiec <morganamilo@archlinux.org>
129
130 Past major contributors:
131
132 • Judd Vinet <jvinet@zeroflux.org>
133
134 • Aurelien Foret <aurelien@archlinux.org>
135
136 • Aaron Griffin <aaron@archlinux.org>
137
138 • Dan McGee <dan@archlinux.org>
139
140 • Xavier Chantry <shiningxc@gmail.com>
141
142 • Nagy Gabor <ngaba@bibl.u-szeged.hu>
143
144 • Dave Reisner <dreisner@archlinux.org>
145
146 For additional contributors, use git shortlog -s on the pacman.git
147 repository.
148
149
150
151Pacman 6.0.1 2021-09-04 MAKEPKG-TEMPLATE(1)