- don't use custom variables when not needed (use
${pkgname%-git}
instead). All custom variables should contain leading "_" - quoting in
arch=()
license=()
depends=()
makedepends=()
depends=()
is pointless and a personal choice, except when needed:optdepends=('gst-libav: additional codecs') license=('custom:WTFPL') license=('custom:corp EULA')
. But always use double quotting for"$pkgdir"
and"$pkgscr"
- remember to quote variables for avoiding failures due to whitespaces in paths
- just
name
of the package orname-git
orname-bin
. Do not use custom variables for naming
- cut 'v' and other prefixes from
pkgver
- number should be increased after any edit of
PKGBUILD
file
- Do not add "A" at description at start, just:
pkgdesc="Web user interface to manage your WireGuard setup"
- if developer of package provide other versions of arches you can add them, e.g.
arch=(aarch64 armv7h i686 x86_64)
- use
pkgname
for url -$pkgname
,${pkgname%-bin}
,${pkgname%-git}
- install not common licenses in
"$pkgdir"/usr/share/licenses/$pkgname
, not mandatory to install common licenses; see 'licenses' package. Use proper identifier from SPDX list. For-git
-bin
-whatever
packages useinstall -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/${pkgname%-bin}/
- for MIT (or similar) license for Github sourse you could use
$url/raw/main/LICENSE
- All depends should be writed at new string, and brackets too:
depends=( gcc-libs glib2 glibc ... )
- Same as depends
- Same as depends
- Same as depends
- Use for
-git
and-bin
packages only but not for named packages:provides=(${pkgname%-bin})
orprovides=(${pkgname%-git})
- Use for
-git
and-bin
packages only but not for named packages:conflicts=(${pkgname%-bin})
orconflicts=(${pkgname%-git})
Not need to list all other packages, just write the main name
Recommeneded: options=(!debug)
. And for Rust packages also need add !lto
-
prefer
git+$url
overgit://
for taking advantage of TLS encryption -
pkgrel
is for internal use of the PKGBUILD and must not be used insource=()
or as part of pkgver -
use
source_$ARCH
for$ARCH
specific sources -
use a common source folder,
SRCDEST=
in/etc/makepkg.conf
-
add git submodules to
source=()
, it is a good packaging practice and make sources re-usable, especially with a commonSRCDEST
-
make downloaded sources non-conflicting and re-usable, i.e.
for Github releases use just
source=($url/archive/v$pkgver/$pkgname-$pkgver.tar.gz)
orsource=($pkgname-$pkgver.tar.gz::$url/....)
for other hostings.for git repository find a common ground for source name
-
for git avoid
$pkgname-$pkgver::git+url/name.git
(waste as redownload whole source ) -
for git avoid
$pkgname::git+url/name.git
whenpkgname=$NAME-git
(i.e. textosaurus and textosaurus-git use the same source) -
for git avoid
$pkgname::git+url/name.git
whenpkgname=name
(pointless since source is already called 'name') -
for ease of use when git source have uppercase name
${pkgname%-git}::git+url/Name.git
-
use
source=(${pkgname%-git}::git+$url.git
-
b2sum
is the preferred hash check
- for packages
-bin
you can use additional hashsum check (if contributor of software provide it) inprepare
function:
prepare(){
md5sum -c $pkgname-$pkgver.md5
#OR
echo $(<*.md5) *.tar.gz | md5sum -c -
}
Example for installing files:
install -vDm755 usr/bin/${pkgname%-bin}{,-session} -t "$pkgdir"/usr/bin/