Creating a PKGBUILD
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# Maintainer: YeZheng <csyezheng@gmail.com>
pkgname=a2fa
pkgver=0.16.2
pkgrel=1
pkgdesc="a2fa (annoying two-factor authentication) is a command line tool for generating and validating one-time password."
arch=('x86_64')
url="https://github.com/csyezheng/a2fa"
license=('Apache')
makedepends=('go')
source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz")
sha256sums=('0E9C5891854EF1C46B0CC452285325ABBBB227A04E8A2869EA931CD819522789')
prepare() {
cd "$pkgname-$pkgver"
mkdir -p build/
}
build() {
cd "$pkgname-$pkgver"
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
export CGO_LDFLAGS="${LDFLAGS}"
export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
go build -o build/$pkgname ./cmd/
}
check() {
cd "$pkgname-$pkgver"
go test ./...
}
package() {
cd "$pkgname-$pkgver"
install -Dm755 build/$pkgname "$pkgdir"/usr/bin/$pkgname
}
|
Testing the PKGBUILD and package
1
2
|
# makepkg --install
sudo pacman -U a2fa-0.16.2-1-x86_64.pkg.tar.zst
|
Checking package sanity
1
2
|
namcap PKGBUILD
namcap a2fa-0.16.2-1-x86_64.pkg.tar.zst
|
Authentication
1
2
3
|
Host aur.archlinux.org
IdentityFile ~/.ssh/aur
User aur
|
1
|
ssh-keygen -f ~/.ssh/aur
|
paste SSH Public Key to account in web page
Creating package repositories
1
2
3
|
git -c init.defaultBranch=master init
git remote add label ssh://aur@aur.archlinux.org/a2fa.git
|
Publishing new package
1
|
makepkg --printsrcinfo > .SRCINFO
|
1
|
git add PKGBUILD .SRCINFO
|
1
|
git commit -m "useful commit message"
|