| 1 |
'\" t |
| 2 |
.\" Title: makepkg-template |
| 3 |
.\" Author: [see the "Authors" section] |
| 4 |
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> |
| 5 |
.\" Date: 11-11-1111 |
| 6 |
.\" Manual: Pacman Manual |
| 7 |
.\" Source: Pacman 7.1.0 |
| 8 |
.\" Language: English |
| 9 |
.\" |
| 10 |
.TH "MAKEPKG\-TEMPLATE" "1" "11\-11\-1111" "Pacman 7\&.1\&.0" "Pacman Manual" |
| 11 |
.\" ----------------------------------------------------------------- |
| 12 |
.\" * Define some portability stuff |
| 13 |
.\" ----------------------------------------------------------------- |
| 14 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 15 |
.\" http://bugs.debian.org/507673 |
| 16 |
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html |
| 17 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 18 |
.ie \n(.g .ds Aq \(aq |
| 19 |
.el .ds Aq ' |
| 20 |
.\" ----------------------------------------------------------------- |
| 21 |
.\" * set default formatting |
| 22 |
.\" ----------------------------------------------------------------- |
| 23 |
.\" disable hyphenation |
| 24 |
.nh |
| 25 |
.\" disable justification (adjust text to left margin only) |
| 26 |
.ad l |
| 27 |
.\" ----------------------------------------------------------------- |
| 28 |
.\" * MAIN CONTENT STARTS HERE * |
| 29 |
.\" ----------------------------------------------------------------- |
| 30 |
.SH "NAME" |
| 31 |
makepkg-template \- package build templating utility |
| 32 |
.SH "SYNOPSIS" |
| 33 |
.sp |
| 34 |
\fImakepkg\-template\fR [options] |
| 35 |
.SH "DESCRIPTION" |
| 36 |
.sp |
| 37 |
\fImakepkg\-template\fR 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\&. |
| 38 |
.sp |
| 39 |
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 \fImakepkg\-template\fR so you do not depend on the template file when building the package\&. |
| 40 |
.sp |
| 41 |
Markers are bash comments in the form of: |
| 42 |
.sp |
| 43 |
.if n \{\ |
| 44 |
.RS 4 |
| 45 |
.\} |
| 46 |
.nf |
| 47 |
# template start; key=value; key2=value2; \&.\&.\&. |
| 48 |
.fi |
| 49 |
.if n \{\ |
| 50 |
.RE |
| 51 |
.\} |
| 52 |
.sp |
| 53 |
and |
| 54 |
.sp |
| 55 |
.if n \{\ |
| 56 |
.RS 4 |
| 57 |
.\} |
| 58 |
.nf |
| 59 |
# template end; |
| 60 |
.fi |
| 61 |
.if n \{\ |
| 62 |
.RE |
| 63 |
.\} |
| 64 |
.sp |
| 65 |
Currently used keys are: name (mandatory) and version\&. Template names are limited to alphanumerics, "@", "+", "\&.", "\-", and "_"\&. Versions are limited to numbers and "\&."\&. |
| 66 |
.sp |
| 67 |
For initial creation there is a one line short cut which does not need an end marker: |
| 68 |
.sp |
| 69 |
.if n \{\ |
| 70 |
.RS 4 |
| 71 |
.\} |
| 72 |
.nf |
| 73 |
# template input; key=value; |
| 74 |
.fi |
| 75 |
.if n \{\ |
| 76 |
.RE |
| 77 |
.\} |
| 78 |
.sp |
| 79 |
Using this short\-cut will result in \fImakepkg\-template\fR replacing it with start and end markers and the template code on the first run\&. |
| 80 |
.sp |
| 81 |
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, \fImakepkg\-template\fR 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: |
| 82 |
.sp |
| 83 |
.if n \{\ |
| 84 |
.RS 4 |
| 85 |
.\} |
| 86 |
.nf |
| 87 |
diff \-u <(makepkg\-template \-o \-) PKGBUILD |
| 88 |
.fi |
| 89 |
.if n \{\ |
| 90 |
.RE |
| 91 |
.\} |
| 92 |
.sp |
| 93 |
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\&. |
| 94 |
.SH "OPTIONS" |
| 95 |
.PP |
| 96 |
\fB\-p, \-\-input\fR <build script> |
| 97 |
.RS 4 |
| 98 |
Read the package script |
| 99 |
build script |
| 100 |
instead of the default\&. |
| 101 |
.RE |
| 102 |
.PP |
| 103 |
\fB\-o, \-\-output\fR <build script> |
| 104 |
.RS 4 |
| 105 |
Write the updated file to |
| 106 |
build script |
| 107 |
instead of overwriting the input file\&. |
| 108 |
.RE |
| 109 |
.PP |
| 110 |
\fB\-n, \-\-newest\fR |
| 111 |
.RS 4 |
| 112 |
Always use the newest available template file\&. |
| 113 |
.RE |
| 114 |
.PP |
| 115 |
\fB\-\-template\-dir\fR <dir> |
| 116 |
.RS 4 |
| 117 |
Change the dir where we are looking for template files\&. This option may be given multiple times in which case files found in directory given last will take precedence\&. |
| 118 |
.RE |
| 119 |
.SH "EXAMPLE PKGBUILD" |
| 120 |
.sp |
| 121 |
.if n \{\ |
| 122 |
.RS 4 |
| 123 |
.\} |
| 124 |
.nf |
| 125 |
pkgname=perl\-config\-simple |
| 126 |
pkgver=4\&.58 |
| 127 |
pkgrel=1 |
| 128 |
pkgdesc="simple configuration file class" |
| 129 |
arch=(\*(Aqany\*(Aq) |
| 130 |
license=(\*(AqPerlArtistic\*(Aq \*(AqGPL\*(Aq) |
| 131 |
depends=(\*(Aqperl\*(Aq) |
| 132 |
source=("http://search\&.cpan\&.org/CPAN/authors/id/S/SH/SHERZODR/Config\-Simple\-${pkgver}\&.tar\&.gz") |
| 133 |
sha256sums=(\*(Aqdd9995706f0f9384a15ccffe116c3b6e22f42ba2e58d8f24ed03c4a0e386edb4\*(Aq) |
| 134 |
_distname="Config\-Simple" |
| 135 |
.fi |
| 136 |
.if n \{\ |
| 137 |
.RE |
| 138 |
.\} |
| 139 |
.sp |
| 140 |
.if n \{\ |
| 141 |
.RS 4 |
| 142 |
.\} |
| 143 |
.nf |
| 144 |
# template start; name=perl\-module; version=1\&.0; |
| 145 |
_distdir="${_distname}\-${pkgver}" |
| 146 |
url="https://metacpan\&.org/release/${_distname}" |
| 147 |
options+=(\*(Aq!emptydirs\*(Aq) |
| 148 |
.fi |
| 149 |
.if n \{\ |
| 150 |
.RE |
| 151 |
.\} |
| 152 |
.sp |
| 153 |
.if n \{\ |
| 154 |
.RS 4 |
| 155 |
.\} |
| 156 |
.nf |
| 157 |
build() { |
| 158 |
cd "$srcdir/$_distdir" |
| 159 |
perl Makefile\&.PL INSTALLDIRS=vendor |
| 160 |
make |
| 161 |
} |
| 162 |
.fi |
| 163 |
.if n \{\ |
| 164 |
.RE |
| 165 |
.\} |
| 166 |
.sp |
| 167 |
.if n \{\ |
| 168 |
.RS 4 |
| 169 |
.\} |
| 170 |
.nf |
| 171 |
check() { |
| 172 |
cd "$srcdir/$_distdir" |
| 173 |
make test |
| 174 |
} |
| 175 |
.fi |
| 176 |
.if n \{\ |
| 177 |
.RE |
| 178 |
.\} |
| 179 |
.sp |
| 180 |
.if n \{\ |
| 181 |
.RS 4 |
| 182 |
.\} |
| 183 |
.nf |
| 184 |
package() { |
| 185 |
cd "$srcdir/$_distdir" |
| 186 |
make DESTDIR="$pkgdir" install |
| 187 |
} |
| 188 |
# template end; |
| 189 |
.fi |
| 190 |
.if n \{\ |
| 191 |
.RE |
| 192 |
.\} |
| 193 |
.SH "SEE ALSO" |
| 194 |
.sp |
| 195 |
\fBmakepkg\fR(8), \fBPKGBUILD\fR(5) |
| 196 |
.sp |
| 197 |
See the pacman website at https://archlinux\&.org/pacman/ for current information on pacman and its related tools\&. |
| 198 |
.SH "BUGS" |
| 199 |
.sp |
| 200 |
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\&. |
| 201 |
.SH "AUTHORS" |
| 202 |
.sp |
| 203 |
Current maintainers: |
| 204 |
.sp |
| 205 |
.RS 4 |
| 206 |
.ie n \{\ |
| 207 |
\h'-04'\(bu\h'+03'\c |
| 208 |
.\} |
| 209 |
.el \{\ |
| 210 |
.sp -1 |
| 211 |
.IP \(bu 2.3 |
| 212 |
.\} |
| 213 |
Allan McRae <allan@archlinux\&.org> |
| 214 |
.RE |
| 215 |
.sp |
| 216 |
.RS 4 |
| 217 |
.ie n \{\ |
| 218 |
\h'-04'\(bu\h'+03'\c |
| 219 |
.\} |
| 220 |
.el \{\ |
| 221 |
.sp -1 |
| 222 |
.IP \(bu 2.3 |
| 223 |
.\} |
| 224 |
Andrew Gregory <andrew\&.gregory\&.8@gmail\&.com> |
| 225 |
.RE |
| 226 |
.sp |
| 227 |
.RS 4 |
| 228 |
.ie n \{\ |
| 229 |
\h'-04'\(bu\h'+03'\c |
| 230 |
.\} |
| 231 |
.el \{\ |
| 232 |
.sp -1 |
| 233 |
.IP \(bu 2.3 |
| 234 |
.\} |
| 235 |
Morgan Adamiec <morganamilo@archlinux\&.org> |
| 236 |
.RE |
| 237 |
.sp |
| 238 |
Past major contributors: |
| 239 |
.sp |
| 240 |
.RS 4 |
| 241 |
.ie n \{\ |
| 242 |
\h'-04'\(bu\h'+03'\c |
| 243 |
.\} |
| 244 |
.el \{\ |
| 245 |
.sp -1 |
| 246 |
.IP \(bu 2.3 |
| 247 |
.\} |
| 248 |
Judd Vinet <jvinet@zeroflux\&.org> |
| 249 |
.RE |
| 250 |
.sp |
| 251 |
.RS 4 |
| 252 |
.ie n \{\ |
| 253 |
\h'-04'\(bu\h'+03'\c |
| 254 |
.\} |
| 255 |
.el \{\ |
| 256 |
.sp -1 |
| 257 |
.IP \(bu 2.3 |
| 258 |
.\} |
| 259 |
Aurelien Foret <aurelien@archlinux\&.org> |
| 260 |
.RE |
| 261 |
.sp |
| 262 |
.RS 4 |
| 263 |
.ie n \{\ |
| 264 |
\h'-04'\(bu\h'+03'\c |
| 265 |
.\} |
| 266 |
.el \{\ |
| 267 |
.sp -1 |
| 268 |
.IP \(bu 2.3 |
| 269 |
.\} |
| 270 |
Aaron Griffin <aaron@archlinux\&.org> |
| 271 |
.RE |
| 272 |
.sp |
| 273 |
.RS 4 |
| 274 |
.ie n \{\ |
| 275 |
\h'-04'\(bu\h'+03'\c |
| 276 |
.\} |
| 277 |
.el \{\ |
| 278 |
.sp -1 |
| 279 |
.IP \(bu 2.3 |
| 280 |
.\} |
| 281 |
Dan McGee <dan@archlinux\&.org> |
| 282 |
.RE |
| 283 |
.sp |
| 284 |
.RS 4 |
| 285 |
.ie n \{\ |
| 286 |
\h'-04'\(bu\h'+03'\c |
| 287 |
.\} |
| 288 |
.el \{\ |
| 289 |
.sp -1 |
| 290 |
.IP \(bu 2.3 |
| 291 |
.\} |
| 292 |
Xavier Chantry <shiningxc@gmail\&.com> |
| 293 |
.RE |
| 294 |
.sp |
| 295 |
.RS 4 |
| 296 |
.ie n \{\ |
| 297 |
\h'-04'\(bu\h'+03'\c |
| 298 |
.\} |
| 299 |
.el \{\ |
| 300 |
.sp -1 |
| 301 |
.IP \(bu 2.3 |
| 302 |
.\} |
| 303 |
Nagy Gabor <ngaba@bibl\&.u\-szeged\&.hu> |
| 304 |
.RE |
| 305 |
.sp |
| 306 |
.RS 4 |
| 307 |
.ie n \{\ |
| 308 |
\h'-04'\(bu\h'+03'\c |
| 309 |
.\} |
| 310 |
.el \{\ |
| 311 |
.sp -1 |
| 312 |
.IP \(bu 2.3 |
| 313 |
.\} |
| 314 |
Dave Reisner <dreisner@archlinux\&.org> |
| 315 |
.RE |
| 316 |
.sp |
| 317 |
.RS 4 |
| 318 |
.ie n \{\ |
| 319 |
\h'-04'\(bu\h'+03'\c |
| 320 |
.\} |
| 321 |
.el \{\ |
| 322 |
.sp -1 |
| 323 |
.IP \(bu 2.3 |
| 324 |
.\} |
| 325 |
Eli Schwartz <eschwartz@archlinux\&.org> |
| 326 |
.RE |
| 327 |
.sp |
| 328 |
For additional contributors, use git shortlog \-s on the pacman\&.git repository\&. |