Debian Codegraph @

upstream/debian-unstable/man5/PKGBUILD.5

raw
1 '\" t
2 .\" Title: pkgbuild
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 "PKGBUILD" "5" "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 PKGBUILD \- Package build description file
32 .SH "SYNOPSIS"
33 .sp
34 PKGBUILD
35 .SH "DESCRIPTION"
36 .sp
37 This manual page describes general rules about PKGBUILDs\&. Once a PKGBUILD is written, the actual package is built using makepkg and installed with pacman\&.
38 .if n \{\
39 .sp
40 .\}
41 .RS 4
42 .it 1 an-trap
43 .nr an-no-space-flag 1
44 .nr an-break-flag 1
45 .br
46 .ps +1
47 \fBNote\fR
48 .ps -1
49 .br
50 .sp
51 An example PKGBUILD, useful for reference, is located in \fI/usr/share/pacman\fR along with other example files such as an install script\&. You can copy the provided PKGBUILD\&.proto file to a new package build directory and make customizations to suit your needs\&.
52 .sp .5v
53 .RE
54 .SH "OPTIONS AND DIRECTIVES"
55 .sp
56 The following is a list of standard options and directives available for use in a PKGBUILD\&. These are all understood and interpreted by makepkg, and most of them will be directly transferred to the built package\&. The mandatory fields for a minimally functional PKGBUILD are \fBpkgname\fR, \fBpkgver\fR, \fBpkgrel\fR and \fBarch\fR\&.
57 .sp
58 If you need to create any custom variables for use in your build process, it is recommended to prefix their name with an \fI_\fR (underscore)\&. This will prevent any possible name clashes with internal makepkg variables\&. For example, to store the base kernel version in a variable, use something similar to $_basekernver\&.
59 .PP
60 \fBpkgname (array)\fR
61 .RS 4
62 Either the name of the package or an array of names for split packages\&. Valid characters for members of this array are alphanumerics, and any of the following characters: \(lq@ \&. _ + \-\(rq\&. Additionally, names are not allowed to start with hyphens or dots\&.
63 .RE
64 .PP
65 \fBpkgver\fR
66 .RS 4
67 The version of the software as released from the author (e\&.g\&.,
68 \fI2\&.7\&.1\fR)\&. The variable is not allowed to contain colons, forward slashes, hyphens or whitespace\&.
69 .sp
70 The
71 pkgver
72 variable can be automatically updated by providing a
73 pkgver()
74 function in the PKGBUILD that outputs the new package version\&. This is run after downloading and extracting the sources and running the
75 prepare()
76 function (if present), so it can use those files in determining the new
77 pkgver\&. This is most useful when used with sources from version control systems (see below)\&.
78 .RE
79 .PP
80 \fBpkgrel\fR
81 .RS 4
82 This is the release number specific to the distribution\&. This allows package maintainers to make updates to the package\(cqs configure flags, for example\&. This is typically set to
83 \fI1\fR
84 for each new upstream software release and incremented for intermediate PKGBUILD updates\&. The variable is a positive integer, with an optional subrelease level specified by adding another positive integer separated by a period (i\&.e\&. in the form x\&.y)\&.
85 .RE
86 .PP
87 \fBepoch\fR
88 .RS 4
89 Used to force the package to be seen as newer than any previous versions with a lower epoch, even if the version number would normally not trigger such an upgrade\&. This value is required to be a positive integer; the default value if left unspecified is
90 \fI0\fR\&. This is useful when the version numbering scheme of a package changes (or is alphanumeric), breaking normal version comparison logic\&. See
91 \fBpacman\fR(8)
92 for more information on version comparisons\&.
93 .RE
94 .PP
95 \fBpkgdesc\fR
96 .RS 4
97 This should be a brief description of the package and its functionality\&. Try to keep the description to one line of text and to not use the package\(cqs name\&.
98 .RE
99 .PP
100 \fBurl\fR
101 .RS 4
102 This field contains a URL that is associated with the software being packaged\&. This is typically the project\(cqs web site\&.
103 .RE
104 .PP
105 \fBlicense (array)\fR
106 .RS 4
107 This field specifies the license(s) that apply to the package\&. If multiple licenses are applicable, list all of them:
108 license=(\*(AqGPL\*(Aq \*(AqFDL\*(Aq)\&.
109 .RE
110 .PP
111 \fBinstall\fR
112 .RS 4
113 Specifies a special install script that is to be included in the package\&. This file should reside in the same directory as the PKGBUILD and will be copied into the package by makepkg\&. It does not need to be included in the source array (e\&.g\&.,
114 install=$pkgname\&.install)\&.
115 .RE
116 .PP
117 \fBchangelog\fR
118 .RS 4
119 Specifies a changelog file that is to be included in the package\&. The changelog file should end in a single newline\&. This file should reside in the same directory as the PKGBUILD and will be copied into the package by makepkg\&. It does not need to be included in the source array (e\&.g\&.,
120 changelog=$pkgname\&.changelog)\&.
121 .RE
122 .PP
123 \fBsource (array)\fR
124 .RS 4
125 An array of source files required to build the package\&. Source files must either reside in the same directory as the PKGBUILD, or be a fully\-qualified URL that makepkg can use to download the file\&. To simplify the maintenance of PKGBUILDs, use the
126 $pkgname
127 and
128 $pkgver
129 variables when specifying the download location, if possible\&. Compressed files will be extracted automatically unless found in the noextract array described below\&.
130 .sp
131 Additional architecture\-specific sources can be added by appending an underscore and the architecture name e\&.g\&.,
132 \fIsource_x86_64=()\fR\&. There must be a corresponding integrity array with checksums, e\&.g\&.
133 \fIcksums_x86_64=()\fR\&.
134 .sp
135 It is also possible to change the name of the downloaded file, which is helpful with weird URLs and for handling multiple source files with the same name\&. The syntax is:
136 source=(\*(Aqfilename::url\*(Aq)\&.
137 .sp
138 makepkg also supports building developmental versions of packages using sources downloaded from version control systems (VCS)\&. For more information, see
139 Using VCS Sources
140 below\&.
141 .sp
142 Files in the source array with extensions
143 \&.sig,
144 \&.sign
145 or,
146 \&.asc
147 are recognized by makepkg as PGP signatures and will be automatically used to verify the integrity of the corresponding source file\&.
148 .RE
149 .PP
150 \fBvalidpgpkeys (array)\fR
151 .RS 4
152 An array of PGP fingerprints\&. If this array is non\-empty, makepkg will only accept signatures from the keys listed here and will ignore the trust values from the keyring\&. If the source file was signed with a subkey, makepkg will still use the primary key for comparison\&.
153 .sp
154 Only full fingerprints are accepted\&. They must be uppercase and must not contain whitespace characters\&.
155 .RE
156 .PP
157 \fBnoextract (array)\fR
158 .RS 4
159 An array of file names corresponding to those from the source array\&. Files listed here will not be extracted with the rest of the source files\&. This is useful for packages that use compressed data directly\&.
160 .RE
161 .PP
162 \fBcksums (array)\fR
163 .RS 4
164 This array contains CRC checksums for every source file specified in the source array (in the same order)\&. makepkg will use this to verify source file integrity during subsequent builds\&. If
165 \fISKIP\fR
166 is put in the array in place of a normal hash, the integrity check for that source file will be skipped\&. To easily generate cksums, run \(lqmakepkg \-g >> PKGBUILD\(rq\&. If desired, move the cksums line to an appropriate location\&. Note that checksums generated by "makepkg \-g" should be verified using checksum values provided by the software developer\&.
167 .RE
168 .PP
169 \fBmd5sums, sha1sums, sha224sums, sha256sums, sha384sums, sha512sums, b2sums (arrays)\fR
170 .RS 4
171 Alternative integrity checks that makepkg supports; these all behave similar to the cksums option described above\&. To enable use and generation of these checksums, be sure to set up the
172 INTEGRITY_CHECK
173 option in
174 \fBmakepkg.conf\fR(5)\&.
175 .RE
176 .PP
177 \fBgroups (array)\fR
178 .RS 4
179 An array of symbolic names that represent groups of packages, allowing you to install multiple packages by requesting a single target\&. For example, one could install all KDE packages by installing the
180 \fIkde\fR
181 group\&.
182 .RE
183 .PP
184 \fBarch (array)\fR
185 .RS 4
186 Defines on which architectures the given package is available (e\&.g\&.,
187 arch=(\*(Aqi686\*(Aq \*(Aqx86_64\*(Aq))\&. Packages that contain no architecture specific files should use
188 arch=(\*(Aqany\*(Aq)\&. Valid characters for members of this array are alphanumerics and \(lq_\(rq\&.
189 .RE
190 .PP
191 \fBbackup (array)\fR
192 .RS 4
193 An array of file names, without preceding slashes, that should be backed up if the package is removed or upgraded\&. This is commonly used for packages placing configuration files in
194 \fI/etc\fR\&. See
195 "Handling Config Files"
196 in
197 \fBpacman\fR(8)
198 for more information\&.
199 .RE
200 .PP
201 \fBdepends (array)\fR
202 .RS 4
203 An array of packages this package depends on to run\&. Entries in this list should be surrounded with single quotes and contain at least the package name\&. Entries can also include a version requirement of the form
204 \fIname<>version\fR, where
205 <>
206 is one of five comparisons:
207 >=
208 (greater than or equal to),
209 <=
210 (less than or equal to),
211 =
212 (equal to),
213 >
214 (greater than), or
215 <
216 (less than)\&.
217 .sp
218 Additional architecture\-specific depends can be added by appending an underscore and the architecture name e\&.g\&.,
219 \fIdepends_x86_64=()\fR\&.
220 .RE
221 .PP
222 \fBmakedepends (array)\fR
223 .RS 4
224 An array of packages this package depends on to build but are not needed at runtime\&. Packages in this list follow the same format as depends\&.
225 .sp
226 Additional architecture\-specific makedepends can be added by appending an underscore and the architecture name e\&.g\&.,
227 \fImakedepends_x86_64=()\fR\&.
228 .RE
229 .PP
230 \fBcheckdepends (array)\fR
231 .RS 4
232 An array of packages this package depends on to run its test suite but are not needed at runtime\&. Packages in this list follow the same format as depends\&. These dependencies are only considered when the check() function is present and is to be run by makepkg\&.
233 .sp
234 Additional architecture\-specific checkdepends can be added by appending an underscore and the architecture name e\&.g\&.,
235 \fIcheckdepends_x86_64=()\fR\&.
236 .RE
237 .PP
238 \fBoptdepends (array)\fR
239 .RS 4
240 An array of packages (and accompanying reasons) that are not essential for base functionality, but may be necessary to make full use of the contents of this package\&. optdepends are currently for informational purposes only and are not utilized by pacman during dependency resolution\&. Packages in this list follow the same format as depends, with an optional description appended\&. The format for specifying optdepends descriptions is:
241 .sp
242 .if n \{\
243 .RS 4
244 .\}
245 .nf
246 optdepends=(\*(Aqpython: for library bindings\*(Aq)
247 .fi
248 .if n \{\
249 .RE
250 .\}
251 .sp
252 Additional architecture\-specific optdepends can be added by appending an underscore and the architecture name e\&.g\&.,
253 \fIoptdepends_x86_64=()\fR\&.
254 .RE
255 .PP
256 \fBconflicts (array)\fR
257 .RS 4
258 An array of packages that will conflict with this package (i\&.e\&. they cannot both be installed at the same time)\&. This directive follows the same format as depends\&. Versioned conflicts are supported using the operators as described in
259 depends\&.
260 .sp
261 Additional architecture\-specific conflicts can be added by appending an underscore and the architecture name e\&.g\&.,
262 \fIconflicts_x86_64=()\fR\&.
263 .RE
264 .PP
265 \fBprovides (array)\fR
266 .RS 4
267 An array of \(lqvirtual provisions\(rq this package provides\&. This allows a package to provide dependencies other than its own package name\&. For example, the dcron package can provide
268 \fIcron\fR, which allows packages to depend on
269 \fIcron\fR
270 rather than
271 \fIdcron OR fcron\fR\&.
272 .sp
273 Versioned provisions are also possible, in the
274 \fIname=version\fR
275 format\&. For example, dcron can provide
276 \fIcron=2\&.0\fR
277 to satisfy the
278 \fIcron>=2\&.0\fR
279 dependency of other packages\&. Provisions involving the
280 >
281 and
282 <
283 operators are invalid as only specific versions of a package may be provided\&.
284 .sp
285 Additional architecture\-specific provides can be added by appending an underscore and the architecture name e\&.g\&.,
286 \fIprovides_x86_64=()\fR\&.
287 .RE
288 .PP
289 \fBreplaces (array)\fR
290 .RS 4
291 An array of packages this package should replace\&. This can be used to handle renamed/combined packages\&. For example, if the
292 \fIj2re\fR
293 package is renamed to
294 \fIjre\fR, this directive allows future upgrades to continue as expected even though the package has moved\&. Versioned replaces are supported using the operators as described in
295 depends\&.
296 .sp
297 Sysupgrade is currently the only pacman operation that utilizes this field\&. A normal sync or upgrade will not use its value\&.
298 .sp
299 Additional architecture\-specific replaces can be added by appending an underscore and the architecture name e\&.g\&.,
300 \fIreplaces_x86_64=()\fR\&.
301 .RE
302 .PP
303 \fBoptions (array)\fR
304 .RS 4
305 This array allows you to override some of makepkg\(cqs default behavior when building packages\&. To set an option, just include the option name in the options array\&. To reverse the default behavior, place an \(lq!\(rq at the front of the option\&. Only specify the options you specifically want to override, the rest will be taken from
306 \fBmakepkg.conf\fR(5)\&.
307 \fBNOTE:\fR
308 \fIforce\fR
309 is a now\-removed option in favor of the top level
310 \fIepoch\fR
311 variable\&.
312 .PP
313 \fBstrip\fR
314 .RS 4
315 Strip symbols from binaries and libraries\&. If you frequently use a debugger on programs or libraries, it may be helpful to disable this option\&.
316 .RE
317 .PP
318 \fBdocs\fR
319 .RS 4
320 Save doc directories\&. If you wish to delete doc directories, specify
321 !docs
322 in the array\&.
323 .RE
324 .PP
325 \fBlibtool\fR
326 .RS 4
327 Leave libtool (\&.la) files in packages\&. Specify
328 !libtool
329 to remove them\&.
330 .RE
331 .PP
332 \fBstaticlibs\fR
333 .RS 4
334 Leave static library (\&.a) files in packages\&. Specify
335 !staticlibs
336 to remove them (if they have a shared counterpart)\&.
337 .RE
338 .PP
339 \fBemptydirs\fR
340 .RS 4
341 Leave empty directories in packages\&.
342 .RE
343 .PP
344 \fBzipman\fR
345 .RS 4
346 Compress man and info pages with gzip\&.
347 .RE
348 .PP
349 \fBccache\fR
350 .RS 4
351 Allow the use of ccache during
352 build()\&. More useful in its negative form
353 !ccache
354 with select packages that have problems building with ccache\&.
355 .RE
356 .PP
357 \fBdistcc\fR
358 .RS 4
359 Allow the use of distcc during
360 build()\&. More useful in its negative form
361 !distcc
362 with select packages that have problems building with distcc\&.
363 .RE
364 .PP
365 \fBbuildflags\fR
366 .RS 4
367 Allow the use of user\-specific buildflags (CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS) during
368 build()
369 as specified in
370 \fBmakepkg.conf\fR(5)\&. More useful in its negative form
371 !buildflags
372 with select packages that have problems building with custom buildflags\&.
373 .RE
374 .PP
375 \fBmakeflags\fR
376 .RS 4
377 Allow the use of user\-specific makeflags during
378 build()
379 as specified in
380 \fBmakepkg.conf\fR(5)\&. More useful in its negative form
381 !makeflags
382 with select packages that have problems building with custom makeflags such as
383 \-j2
384 (or higher)\&.
385 .RE
386 .PP
387 \fBdebug\fR
388 .RS 4
389 Add the user\-specified debug flags (DEBUG_CFLAGS, DEBUG_CXXFLAGS) to their counterpart buildflags as specified in
390 \fBmakepkg.conf\fR(5)\&. When used in combination with the \(oqstrip\(cq option, a separate package containing the debug symbols is created\&.
391 .RE
392 .PP
393 \fBlto\fR
394 .RS 4
395 Enable building packages using link time optimization\&. Adds
396 \fI\-flto\fR
397 to both CFLAGS and CXXFLAGS\&.
398 .RE
399 .RE
400 .sp
401 Additional architecture\-specific options can be added by appending an underscore and the architecture name e\&.g\&., \fIoptions_x86_64=()\fR\&.
402 .PP
403 \fBxdata (array)\fR
404 .RS 4
405 This array allows you to add additional metadata to the package\&. This data is neither used by pacman nor by makepkg; It has purely informational purpose, or may be interpreted by third\-party tools\&.
406 .sp
407 All entries in that array must have the form
408 \fIkey=value\fR, where
409 \fIkey\fR
410 is an arbitrary non\-empty string and
411 \fIvalue\fR
412 must not contain an equal sign\&. Furthermore, the key \(lqpkgtype\(rq is reserved for the makepkg program\&.
413 .RE
414 .SH "PACKAGING FUNCTIONS"
415 .sp
416 In addition to the above directives, PKGBUILDs require a set of functions that provide instructions to build and install the package\&. As a minimum, the PKGBUILD must contain a package() function which installs all the package\(cqs files into the packaging directory, with optional prepare(), build(), and check() functions being used to create those files from source\&.
417 .sp
418 This is directly sourced and executed by makepkg, so anything that Bash or the system has available is available for use here\&. Be sure any exotic commands used are covered by the makedepends array\&.
419 .sp
420 If you create any variables of your own in any of these functions, it is recommended to use the Bash local keyword to scope the variable to inside the function\&.
421 .PP
422 \fBpackage() Function\fR
423 .RS 4
424 The
425 package()
426 function is used to install files into the directory that will become the root directory of the built package and is run after all the optional functions listed below\&. The packaging stage is run using fakeroot to ensure correct file permissions in the resulting package\&. All other functions will be run as the user calling makepkg\&. This function is run inside
427 $srcdir\&.
428 .RE
429 .PP
430 \fBverify() Function\fR
431 .RS 4
432 An optional
433 verify()
434 function can be specified to implement arbitrary source authentication\&. The function should return a non\-zero exit code when verification fails\&. This function is run before sources are extracted\&. This function is run inside
435 $startdir\&.
436 .RE
437 .PP
438 \fBprepare() Function\fR
439 .RS 4
440 An optional
441 prepare()
442 function can be specified in which operations to prepare the sources for building, such as patching, are performed\&. This function is run after the source extraction and before the
443 build()
444 function\&. The
445 prepare()
446 function is skipped when source extraction is skipped\&. This function is run inside
447 $srcdir\&.
448 .RE
449 .PP
450 \fBbuild() Function\fR
451 .RS 4
452 The optional
453 build()
454 function is used to compile and/or adjust the source files in preparation to be installed by the
455 package()
456 function\&. This function is run inside
457 $srcdir\&.
458 .RE
459 .PP
460 \fBcheck() Function\fR
461 .RS 4
462 An optional
463 check()
464 function can be specified in which a package\(cqs test\-suite may be run\&. This function is run between the
465 build()
466 and
467 package()
468 functions\&. Be sure any exotic commands used are covered by the
469 checkdepends
470 array\&. This function is run inside
471 $srcdir\&.
472 .RE
473 .sp
474 All of the above variables such as $pkgname and $pkgver are available for use in the packaging functions\&. In addition, makepkg defines the following variables:
475 .PP
476 \fBsrcdir\fR
477 .RS 4
478 This contains the directory where makepkg extracts, or copies, all source files\&.
479 .RE
480 .PP
481 \fBpkgdir\fR
482 .RS 4
483 This contains the directory where makepkg bundles the installed package\&. This directory will become the root directory of your built package\&. This variable should only be used in the
484 package()
485 function\&.
486 .RE
487 .PP
488 \fBstartdir\fR
489 .RS 4
490 This contains the absolute path to the directory where the PKGBUILD is located, which is usually the output of
491 $(pwd)
492 when makepkg is started\&. Use of this variable is deprecated and strongly discouraged\&.
493 .RE
494 .SH "PACKAGE SPLITTING"
495 .sp
496 makepkg supports building multiple packages from a single PKGBUILD\&. This is achieved by assigning an array of package names to the pkgname directive\&. Each split package uses a corresponding packaging function with name package_foo(), where foo is the name of the split package\&.
497 .sp
498 All options and directives for the split packages default to the global values given in the PKGBUILD\&. Nevertheless, the following ones can be overridden within each split package\(cqs packaging function: pkgdesc, arch, url, license, groups, depends, optdepends, provides, conflicts, replaces, backup, options, install, and changelog\&.
499 .sp
500 Note that makepkg does not consider split package depends when checking if dependencies are installed before package building and with \-\-syncdeps\&. All packages required to make the package are required to be specified in the global depends and makedepends arrays\&.
501 .sp
502 An optional global directive is available when building a split package:
503 .PP
504 \fBpkgbase\fR
505 .RS 4
506 The name used to refer to the group of packages in the output of makepkg and in the naming of source\-only tarballs\&. If not specified, the first element in the
507 pkgname
508 array is used\&. Valid characters for this variable are alphanumerics, and any of the following characters: \(lq@ \&. _ + \-\(rq\&. Additionally, the variable is not allowed to start with hyphens or dots\&.
509 .RE
510 .SH "INSTALL/UPGRADE/REMOVE SCRIPTING"
511 .sp
512 Pacman has the ability to store and execute a package\-specific script when it installs, removes, or upgrades a package\&. This allows a package to configure itself after installation and perform an opposite action upon removal\&.
513 .sp
514 The exact time the script is run varies with each operation, and should be self\-explanatory\&. Note that during an upgrade operation, none of the install or remove functions will be called\&.
515 .sp
516 Scripts are passed either one or two \(lqfull version strings\(rq, where a full version string is either \fIpkgver\-pkgrel\fR or \fIepoch:pkgver\-pkgrel\fR, if epoch is non\-zero\&.
517 .PP
518 \fBpre_install\fR
519 .RS 4
520 Run right before files are extracted\&. One argument is passed: new package full version string\&.
521 .RE
522 .PP
523 \fBpost_install\fR
524 .RS 4
525 Run right after files are extracted\&. One argument is passed: new package full version string\&.
526 .RE
527 .PP
528 \fBpre_upgrade\fR
529 .RS 4
530 Run right before files are extracted\&. Two arguments are passed in this order: new package full version string, old package full version string\&.
531 .RE
532 .PP
533 \fBpost_upgrade\fR
534 .RS 4
535 Run after files are extracted\&. Two arguments are passed in this order: new package full version string, old package full version string\&.
536 .RE
537 .PP
538 \fBpre_remove\fR
539 .RS 4
540 Run right before files are removed\&. One argument is passed: old package full version string\&.
541 .RE
542 .PP
543 \fBpost_remove\fR
544 .RS 4
545 Run right after files are removed\&. One argument is passed: old package full version string\&.
546 .RE
547 .sp
548 To use this feature, create a file such as \fIpkgname\&.install\fR and put it in the same directory as the PKGBUILD script\&. Then use the install directive:
549 .sp
550 .if n \{\
551 .RS 4
552 .\}
553 .nf
554 install=pkgname\&.install
555 .fi
556 .if n \{\
557 .RE
558 .\}
559 .sp
560 The install script does not need to be specified in the source array\&. A template install file is available in \fI/usr/share/pacman\fR as \fIproto\&.install\fR for reference with all of the available functions defined\&.
561 .SH "USING VCS SOURCES"
562 .sp
563 Building a developmental version of a package using sources from a version control system (VCS) is enabled by specifying the source in the form:
564 .sp
565 .if n \{\
566 .RS 4
567 .\}
568 .nf
569 source=(\*(Aqdirectory::url#fragment?query\*(Aq)
570 .fi
571 .if n \{\
572 .RE
573 .\}
574 .sp
575 Currently makepkg supports the Bazaar, Git, Subversion, Fossil and Mercurial version control systems\&. For other version control systems, manual cloning of upstream repositories must be done in the prepare() function\&.
576 .sp
577 Some VCS Sources like Git support pinning the checkout by a checksum of its content using deterministic export functionality like \(lqgit archive\(rq\&.
578 .sp
579 The source URL is divided into four components:
580 .PP
581 \fBdirectory\fR
582 .RS 4
583 (optional) Specifies an alternate directory name for makepkg to download the VCS source into\&.
584 .RE
585 .PP
586 \fBurl\fR
587 .RS 4
588 The URL to the VCS repository\&. This must include the VCS in the URL protocol for makepkg to recognize this as a VCS source\&. If the protocol does not include the VCS name, it can be added by prefixing the URL with
589 vcs+\&. For example, using a Git repository over HTTPS would have a source URL in the form:
590 git+https://\&.\&.\&.\&.
591 .RE
592 .PP
593 \fBfragment\fR
594 .RS 4
595 (optional) Allows specifying a revision number or branch for makepkg to checkout from the VCS\&. A fragment has the form
596 type=value, for example to checkout a given revision the source line would be
597 source=(url#revision=123)\&. The available types depends on the VCS being used:
598 .PP
599 \fBbzr\fR
600 .RS 4
601 revision (see
602 \*(Aqbzr help revisionspec\*(Aq
603 for details)
604 .RE
605 .PP
606 \fBfossil\fR
607 .RS 4
608 branch, commit, tag
609 .RE
610 .PP
611 \fBgit\fR
612 .RS 4
613 branch, commit, tag
614 .RE
615 .PP
616 \fBhg\fR
617 .RS 4
618 branch, revision, tag
619 .RE
620 .PP
621 \fBsvn\fR
622 .RS 4
623 revision
624 .RE
625 .RE
626 .PP
627 \fBquery\fR
628 .RS 4
629 (optional) Allows specifying whether a VCS checkout should be checked for PGP\-signed revisions\&. The source line should have the format
630 source=(url#fragment?signed)
631 or
632 source=(url?signed#fragment)\&. Currently only supported by Git\&.
633 .RE
634 .SH "EXAMPLE"
635 .sp
636 The following is an example PKGBUILD for the \fIpatch\fR package\&. For more examples, look through the build files of your distribution\(cqs packages\&.
637 .sp
638 .if n \{\
639 .RS 4
640 .\}
641 .nf
642 # Maintainer: Joe User <joe\&.user@example\&.com>
643
644 pkgname=patch
645 pkgver=2\&.7\&.1
646 pkgrel=1
647 pkgdesc="A utility to apply patch files to original sources"
648 arch=(\*(Aqi686\*(Aq \*(Aqx86_64\*(Aq)
649 url="https://www\&.gnu\&.org/software/patch/patch\&.html"
650 license=(\*(AqGPL\*(Aq)
651 groups=(\*(Aqbase\-devel\*(Aq)
652 depends=(\*(Aqglibc\*(Aq)
653 makedepends=(\*(Aqed\*(Aq)
654 optdepends=(\*(Aqed: for "patch \-e" functionality\*(Aq)
655 source=("ftp://ftp\&.gnu\&.org/gnu/$pkgname/$pkgname\-$pkgver\&.tar\&.xz"{,\&.sig})
656 sha256sums=(\*(Aq9124ba46db0abd873d0995c2ca880e81252676bb6c03e0a37dfc5f608a9b0ceb\*(Aq
657 \*(AqSKIP\*(Aq)
658
659 build() {
660 cd "$srcdir/$pkgname\-$pkgver"
661 \&./configure \-\-prefix=/usr
662 make
663 }
664
665 package() {
666 cd "$srcdir/$pkgname\-$pkgver"
667 make DESTDIR="$pkgdir/" install
668 }
669 .fi
670 .if n \{\
671 .RE
672 .\}
673 .SH "SEE ALSO"
674 .sp
675 \fBmakepkg\fR(8), \fBpacman\fR(8), \fBmakepkg.conf\fR(5)
676 .sp
677 See the pacman website at https://archlinux\&.org/pacman/ for current information on pacman and its related tools\&.
678 .SH "BUGS"
679 .sp
680 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\&.
681 .SH "AUTHORS"
682 .sp
683 Current maintainers:
684 .sp
685 .RS 4
686 .ie n \{\
687 \h'-04'\(bu\h'+03'\c
688 .\}
689 .el \{\
690 .sp -1
691 .IP \(bu 2.3
692 .\}
693 Allan McRae <allan@archlinux\&.org>
694 .RE
695 .sp
696 .RS 4
697 .ie n \{\
698 \h'-04'\(bu\h'+03'\c
699 .\}
700 .el \{\
701 .sp -1
702 .IP \(bu 2.3
703 .\}
704 Andrew Gregory <andrew\&.gregory\&.8@gmail\&.com>
705 .RE
706 .sp
707 .RS 4
708 .ie n \{\
709 \h'-04'\(bu\h'+03'\c
710 .\}
711 .el \{\
712 .sp -1
713 .IP \(bu 2.3
714 .\}
715 Morgan Adamiec <morganamilo@archlinux\&.org>
716 .RE
717 .sp
718 Past major contributors:
719 .sp
720 .RS 4
721 .ie n \{\
722 \h'-04'\(bu\h'+03'\c
723 .\}
724 .el \{\
725 .sp -1
726 .IP \(bu 2.3
727 .\}
728 Judd Vinet <jvinet@zeroflux\&.org>
729 .RE
730 .sp
731 .RS 4
732 .ie n \{\
733 \h'-04'\(bu\h'+03'\c
734 .\}
735 .el \{\
736 .sp -1
737 .IP \(bu 2.3
738 .\}
739 Aurelien Foret <aurelien@archlinux\&.org>
740 .RE
741 .sp
742 .RS 4
743 .ie n \{\
744 \h'-04'\(bu\h'+03'\c
745 .\}
746 .el \{\
747 .sp -1
748 .IP \(bu 2.3
749 .\}
750 Aaron Griffin <aaron@archlinux\&.org>
751 .RE
752 .sp
753 .RS 4
754 .ie n \{\
755 \h'-04'\(bu\h'+03'\c
756 .\}
757 .el \{\
758 .sp -1
759 .IP \(bu 2.3
760 .\}
761 Dan McGee <dan@archlinux\&.org>
762 .RE
763 .sp
764 .RS 4
765 .ie n \{\
766 \h'-04'\(bu\h'+03'\c
767 .\}
768 .el \{\
769 .sp -1
770 .IP \(bu 2.3
771 .\}
772 Xavier Chantry <shiningxc@gmail\&.com>
773 .RE
774 .sp
775 .RS 4
776 .ie n \{\
777 \h'-04'\(bu\h'+03'\c
778 .\}
779 .el \{\
780 .sp -1
781 .IP \(bu 2.3
782 .\}
783 Nagy Gabor <ngaba@bibl\&.u\-szeged\&.hu>
784 .RE
785 .sp
786 .RS 4
787 .ie n \{\
788 \h'-04'\(bu\h'+03'\c
789 .\}
790 .el \{\
791 .sp -1
792 .IP \(bu 2.3
793 .\}
794 Dave Reisner <dreisner@archlinux\&.org>
795 .RE
796 .sp
797 .RS 4
798 .ie n \{\
799 \h'-04'\(bu\h'+03'\c
800 .\}
801 .el \{\
802 .sp -1
803 .IP \(bu 2.3
804 .\}
805 Eli Schwartz <eschwartz@archlinux\&.org>
806 .RE
807 .sp
808 For additional contributors, use git shortlog \-s on the pacman\&.git repository\&.