Pacman packages: Difference between revisions
From wikinotes
(→Files) |
|||
(21 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
<blockquote> | <blockquote> | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |||
| <code>man PKGBUILD</code> || https://man.archlinux.org/man/PKGBUILD.5 | |||
|- | |- | ||
| PKGBUILD docs || https://wiki.archlinux.org/title/PKGBUILD | | PKGBUILD docs || https://wiki.archlinux.org/title/PKGBUILD | ||
Line 20: | Line 22: | ||
= PKGBUILD Syntax = | = PKGBUILD Syntax = | ||
<blockquote> | |||
== Example == | |||
<blockquote> | |||
See [https://man.archlinux.org/man/PKGBUILD.5#EXAMPLE man PKGBUILD]. | |||
</blockquote><!-- Example --> | |||
== Package Info == | |||
<blockquote> | <blockquote> | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
pkgname=blah | |||
pkgname= | |||
pkgver=1.1.1 # '[0-9a-Z.@_+-]+', versions must increase alphanumerically | pkgver=1.1.1 # '[0-9a-Z.@_+-]+', versions must increase alphanumerically | ||
pkgrel=2 # | pkgrel=2 # increment for each build-version of the same package-version. | ||
arch=('x86_64') # | arch=('x86_64') # supported cpu architectures. ('any') supports any arch | ||
license=('MIT') # (optional) licences (see /usr/share/licences/common/) | |||
</syntaxhighlight> | |||
</blockquote><!-- Package Info --> | |||
== Requirements, Metapackages, Conflicts == | |||
<blockquote> | |||
<syntaxhighlight lang="bash"> | |||
# package version requests | |||
depends=('foobar>=1.8.0' 'foobar<2.0.0') # required to build/run | |||
makedepends=('foobar>=1.8.0' 'foobar<2.0.0') # required to build | |||
checkdepends=('foobar>=1.8.0' 'foobar<2.0.0') # required to run tests | |||
optdepends=('foo: does foo' 'bar: does bar') # if installed, program uses these | |||
groups=('metapackage-name') # included in metapackage X | |||
provides=('blah=1.1.1') # provided by this pkg. (may overlap) | |||
conflicts=('bleh') # cannot be installed alongside this pkg | |||
replaces=('bloo') # this package should replace these older/deprecated pkgs | |||
</syntaxhighlight> | |||
</blockquote><!-- Requirements, Metapackages, Conflicts --> | |||
== Files == | |||
<blockquote> | |||
<syntaxhighlight lang="bash"> | |||
# download,verify,extract these (local, HTTP, FTP) | |||
source=('https://foo.com/$pkgname-$pkgver.tar.gz' | |||
'https://foo.com/$pkgname-$pkgver.tar.gz.sig' # (sig, sign, asc) PGP signature to verify verify file | |||
'customname.tar::https://foo.com/file.tar.gz' # change filename | |||
'foo.txt') # local file (abort if not present) | |||
# checksums (corresponds to matching index in array) | |||
# md5sums, sha1sums, sha256sums, sha224sums, | |||
# sha384sums, sha512sums, b2sums | |||
md5sums=('e9ae5393426d3ad783a300a338c09b72' # 1st sources item | |||
'SKIP') # 2nd sources item etc | |||
backup=('etc/pacman.conf') # create .pacnew files when ovewritten (relpaths) | |||
</syntaxhighlight> | |||
</blockquote><!-- Files --> | |||
== Build == | |||
<blockquote> | |||
<syntaxhighlight lang="bash"> | |||
# override makepkg.conf configured behaviour | |||
# using variables defined in this file (ex: CXXFLAGS=) | |||
# (see 'man makepkg.conf') | |||
options=(!docs debug makeflags) | |||
# | # build functions | ||
# - all PKGBUILD variables in scope | |||
# - also: | |||
# srcdir | |||
# pkgdir | |||
# startdir | |||
prepare() { ... } # apply patches | |||
build() { ... } # configure/compile the package | |||
check() { ... } # run tests | |||
package() { ... } # install files | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</blockquote><!-- Build --> | |||
</blockquote><!-- PKGBUILD Syntax --> | </blockquote><!-- PKGBUILD Syntax --> |
Latest revision as of 00:57, 26 December 2021
Archlinux packages are described in PKGBUILD
files, and built using makepkg
.
They are expressed in bash shellscript.
Documentation
man PKGBUILD
https://man.archlinux.org/man/PKGBUILD.5 PKGBUILD docs https://wiki.archlinux.org/title/PKGBUILD
Usage
cd ${DIR_W_PKGBUILD} makepkg
PKGBUILD Syntax
Example
See man PKGBUILD.
Package Info
pkgname=blah pkgver=1.1.1 # '[0-9a-Z.@_+-]+', versions must increase alphanumerically pkgrel=2 # increment for each build-version of the same package-version. arch=('x86_64') # supported cpu architectures. ('any') supports any arch license=('MIT') # (optional) licences (see /usr/share/licences/common/)Requirements, Metapackages, Conflicts
# package version requests depends=('foobar>=1.8.0' 'foobar<2.0.0') # required to build/run makedepends=('foobar>=1.8.0' 'foobar<2.0.0') # required to build checkdepends=('foobar>=1.8.0' 'foobar<2.0.0') # required to run tests optdepends=('foo: does foo' 'bar: does bar') # if installed, program uses these groups=('metapackage-name') # included in metapackage X provides=('blah=1.1.1') # provided by this pkg. (may overlap) conflicts=('bleh') # cannot be installed alongside this pkg replaces=('bloo') # this package should replace these older/deprecated pkgsFiles
# download,verify,extract these (local, HTTP, FTP) source=('https://foo.com/$pkgname-$pkgver.tar.gz' 'https://foo.com/$pkgname-$pkgver.tar.gz.sig' # (sig, sign, asc) PGP signature to verify verify file 'customname.tar::https://foo.com/file.tar.gz' # change filename 'foo.txt') # local file (abort if not present) # checksums (corresponds to matching index in array) # md5sums, sha1sums, sha256sums, sha224sums, # sha384sums, sha512sums, b2sums md5sums=('e9ae5393426d3ad783a300a338c09b72' # 1st sources item 'SKIP') # 2nd sources item etc backup=('etc/pacman.conf') # create .pacnew files when ovewritten (relpaths)Build
# override makepkg.conf configured behaviour # using variables defined in this file (ex: CXXFLAGS=) # (see 'man makepkg.conf') options=(!docs debug makeflags) # build functions # - all PKGBUILD variables in scope # - also: # srcdir # pkgdir # startdir prepare() { ... } # apply patches build() { ... } # configure/compile the package check() { ... } # run tests package() { ... } # install files