_alpm_checkconflicts split
[pacman.git] / doc / PKGBUILD.5.txt
blobd022c9af0c9a3b75fcac88b44a42ed6e630b447f
1 /////
2 vim:set ts=4 sw=4 syntax=asciidoc noet:
3 /////
4 PKGBUILD(5)
5 ===========
7 Name
8 ----
9 PKGBUILD - Arch Linux package build description file
12 Synopsis
13 --------
14 PKGBUILD
17 Description
18 -----------
19 This manual page is meant to describe general rules about PKGBUILDs. Once a
20 PKGBUILD is written, the actual package is built using makepkg and installed
21 with pacman.
23 NOTE: If you have a local copy of the Arch Build System (ABS) tree on your
24 computer, you can copy the PKGBUILD.proto file to your new package build
25 directory and edit it from there. To acquire/sync the ABS tree, use the abs
26 script included with pacman.
29 Options and Directives
30 ----------------------
31 *pkgname*::
32         The name of the package. This has be a unix-friendly name as it will be
33         used in the package filename.
35 *pkgver*::
36         The version of the software as released from the author (e.g. \'2.7.1').
38 *pkgrel*::
39         This is the release number specific to the Arch Linux release. This
40         allows package maintainers to make updates to the package's configure
41         flags, for example. A pkgrel of 1 is typically used for each upstream
42         software release and is incremented for intermediate PKGBUILD updates.
44 *pkgdesc*::
45         This should be a brief description of the package and its functionality.
46         Try to keep the description to one line of text.
48 *url*::
49         This field contains a URL that is associated with the software being
50         packaged. This is typically the project's website.
52 *license (array)*::
53         This field specifies the license(s) that apply to the package.
54         Commonly-used licenses are found in '/usr/share/licenses/common'. If you
55         see the package's license there, simply reference it in the license
56         field (e.g. `$$license=('GPL')$$`). If the package provides a license not
57         found in '/usr/share/licenses/common', then you should include the license
58         in the package itself and set `$$license=('custom')$$` or
59         `$$license=('custom:LicenseName')$$`. The license should be placed in
60         '$pkgdir/usr/share/licenses/$pkgname' when building the package. If
61         multiple licenses are applicable for a package, list all of them:
62         `$$license=('GPL' 'FDL')$$`.
64 *install*::
65         Specifies a special install script that is to be included in the package.
66         This file should reside in the same directory as the PKGBUILD, and will
67         be copied into the package by makepkg. It does not need to be included
68         in the source array (e.g. `$$install=pkgname.install$$`).
70 *source (array)*::
71         An array of source files required to build the package. Source files
72         must either reside in the same directory as the PKGBUILD file, or be a
73         fully-qualified URL that makepkg will use to download the file. In order
74         to make the PKGBUILD as useful as possible, use the $pkgname and $pkgver
75         variables if possible when specifying the download location. Any files
76         that are compressed will automatically be extracted, unless found in
77         the noextract array listed below.
79 *noextract (array)*::
80         An array of filenames corresponding to those from the source array. Files
81         listed here will not be extracted with the rest of the source files. This
82         is useful for packages which use compressed data which is downloaded but
83         not necessary to uncompress.
85 *md5sums (array)*::
86         This array contains an MD5 hash for every source file specified in the
87         source array (in the same order). makepkg will use this to verify source
88         file integrity during subsequent builds. To easily generate md5sums, run
89         ``makepkg -g >> PKGBUILD''. If desired, move the md5sums line to an
90         appropriate location. *NOTE:* makepkg supports multiple integrity
91         algorithms and their corresponding arrays (i.e. sha1sums for the SHA1
92         algorithm); however, official packages use only md5sums for the time
93         being.
95 *sha1sums, etc.*::
96         Alternative integrity checks that makepkg supports, as noted in md5sums
97         above.
99 *groups (array)*::
100         An array of symbolic names that represent groups of packages, allowing
101         you to install multiple packages by requesting a single target. For
102         example, one could install all KDE packages by installing the 'kde' group.
104 *arch (array)*::
105         Defines on which architectures the given package is available (e.g.
106         `$$arch=('i686' 'x86_64')$$`).
108 *backup (array)*::
109         A space-delimited array of filenames, without preceding slashes, that
110         should be backed up if the package is removed or upgraded. This is
111         commonly used for packages placing configuration files in /etc. See
112         Handling Config Files in manlink:pacman[8] for more information.
114 *depends (array)*::
115         An array of packages that this package depends on to run. Packages in
116         this list should be surrounded with single quotes and contain at least
117         the package name. Entries can also include a version requirement of the
118         form 'name<>version', where <> is one of three comparisons: >= (greater
119         than or equal to), <= (less than or equal to), or = (equal to).
121 *makedepends (array)*::
122         An array of packages that this package depends on to build, but are not
123         needed at runtime. Packages in this list follow the same format as
124         depends.
126 *conflicts (array)*::
127         An array of packages that will conflict with this package (i.e. they
128         cannot both be installed at the same time). This directive follows the
129         same format as depends. Versioned conflicts are also supported.
131 *provides (array)*::
132         An array of ``virtual provisions'' that this package provides. This allows
133         a package to provide dependencies other than its own package name. For
134         example, the dcron package can provide 'cron', which allows packages to
135         depend on 'cron' rather than 'dcron OR fcron'.
136         Versioned provisions are also possible. For example, dcron can provide
137         'cron 2.0' to satisfy the 'cron>=2.0' dependency of other packages.
139 *replaces (array)*::
140         An array of packages that this package should replace, and can be used
141         to handle renamed/combined packages. For example, if the 'j2re' package
142         is renamed to 'jre', this directive allows future upgrades to continue
143         as expected even though the package has moved. Sysupgrade is currently
144         the only pacman operation that utilizes this field, a normal sync will
145         not use its value.
147 *options (array)*::
148         This array allows you to override some of makepkg's default behavior
149         when building packages. To set an option, just include the option name
150         in the options array. To reverse the default behavior, place an ``!'' at
151         the front of the option. Only specify the options you specifically want
152         to override, the rest will be taken from manlink:makepkg.conf[5].
153         *NOTE:* 'force' is a special option only used in a manlink:PKGBUILD[5],
154         do not use it unless you know what you are doing.
156         *strip*;;
157                 Strip symbols from binaries and libraries. If you frequently
158                 use a debugger on programs or libraries, it may be helpful to
159                 disable this option.
161         *docs*;;
162                 Save doc and info directories. If you wish to delete doc and
163                 info directories, specify `!docs` in the array.
165         *libtool*;;
166                 Leave libtool (.la) files in packages. Specify `!libtool` to
167                 remove them.
169         *emptydirs*;;
170                 Leave empty directories in packages.
172         *ccache*;;
173                 Allow the use of ccache during build. More useful in its negative
174                 form `!ccache` with select packages that have problems building
175                 with ccache.
177         *distcc*;;
178                 Allow the use of distcc during build. More useful in its negative
179                 form `!distcc` with select packages that have problems building
180                 with distcc.
182         *makeflags*;;
183                 Allow the use of user-specific makeflags during build as specified
184                 in manlink:makepkg.conf[5]. More useful in its negative form
185                 `!makeflags` with select packages that have problems building with
186                 custom makeflags such as `-j2` (or higher).
188         *force*;;
189                 Force the package to be upgraded by a pacman system upgrade
190                 operation, even if the version number would normally not trigger
191                 such an upgrade. This is useful when the version numbering scheme
192                 of a package changes (or is alphanumeric).
195 Install/Upgrade/Remove Scripting
196 --------------------------------
197 Pacman has the ability to store and execute a package-specific script when it
198 installs, removes, or upgrades a package. This allows a package to configure
199 itself after installation and perform an opposite action upon removal.
201 The exact time the script is run varies with each operation:
203 *pre_install*::
204         script is run right before files are extracted.
206 *post_install*::
207         script is run right after files are extracted.
209 *pre_upgrade*::
210         script is run right before files are extracted.
212 *post_upgrade*::
213         script is run after files are extracted.
215 *pre_remove*::
216         script is run right before files are removed.
218 *post_remove*::
219         script is run right after files are removed.
221 To use this feature, create a file such as 'pkgname.install' and put it in the
222 same directory as the PKGBUILD script. Then use the install directive:
224         install=pkgname.install
226 The install script does not need to be specified in the source array. A
227 template install file is available in the ABS tree (/var/abs/install.proto).
230 Development Directives
231 ----------------------
232 makepkg supports building development versions of packages without having to
233 manually update the pkgver in the PKGBUILD. This was formerly done using the
234 separate utility 'versionpkg'. In order to utilize this functionality, your
235 PKGBUILD must use correct variable names depending on the SCM being fetched
236 from.
238 *CVS*::
239         The generated pkgver will be the date the package is built.
241         *_cvsroot*;;
242                 The root of the CVS repository.
244         *_cvsmod*;;
245                 The CVS module to fetch.
247 *SVN*::
248         The generated pkgver will be the latest SVN revision number.
250         *_svntrunk*;;
251                 The trunk of the SVN repository.
253         *_cvsmod*;;
254                 The SVN module to fetch.
256 *Git*::
257         The generated pkgver will be one formatted by the 'git-describe'
258         command, with '-' characters converted to '_' characters.
260         *_gitroot*;;
261                 The URL (all protocols supported) to the GIT repository.
263         *_gitname*;;
264                 GIT tag or branch to use.
266 *Mercurial*::
267         The generated pkgver will be the hg tip revision number.
269         *_hgroot*;;
270                 The URL of the mercurial repository.
272         *_hgrepo*;;
273                 The repository to follow.
275 *Darcs*::
276         The generated pkgver will be the date the package is built.
278         *_darcstrunk*;;
279                 URL to the repository trunk.
281         *_darcsmod*;;
282                 Darcs module to use.
284 *Bazaar*::
285         The generated pkgver will be the latest Bazaar revision number (revno).
287         *_bzrtrunk*;;
288                 URL to the bazaar repository.
290         *_bzrmod*;;
291                 Bazaar module to use.
294 Example
295 -------
296 The following is an example PKGBUILD for the 'patch' package. For more
297 examples, look through the ABS tree.
299 [sh]
300 source~~~~~
301 include::PKGBUILD-example.txt[]
302 source~~~~~
305 See Also
306 --------
307 manlink:makepkg[8], manlink:pacman[8], manlink:makepkg.conf[5]
309 include::footer.txt[]