summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 1ae9ecc6717ad9c9bfecd2308159d37c2b40bbeb (plain)
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
38
39
40
41
42
43
44
45
46
# Maintainer: Christian Muehlhaeuser <muesli at gmail dot com>

pkgname=pam_beacon-git
pkgver=r36.52d058d
pkgrel=1
pkgdesc="PAM module for multi-factor authentication with Bluetooth Devices & Beacons"
arch=('x86_64' 'i686' 'armv6h' 'armv7h' 'aarch64')
url="https://github.com/muesli/pam-beacon"
license=('MIT')
depends=('pam')
makedepends=('git' 'go')
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
source=($pkgname::"git+${url}.git")
sha256sums=('SKIP')

pkgver() {
    cd "$srcdir/$pkgname"
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
    cd "$srcdir/$pkgname"

    export CGO_CPPFLAGS="${CPPFLAGS}"
    export CGO_CFLAGS="${CFLAGS}"
    export CGO_CXXFLAGS="${CXXFLAGS}"
    export CGO_LDFLAGS="${LDFLAGS}"

    go build \
        -trimpath \
        -buildmode=pie \
        -mod=readonly \
        -modcacherw \
        -ldflags "${extraflags} -extldflags \"${LDFLAGS}\"" \
        -buildmode=c-shared \
        -o "pam_beacon.so" .
}

package() {
    cd "$srcdir/$pkgname"

    install -Dm755 "pam_beacon.so" "$pkgdir/usr/lib/security/pam_beacon.so"
    install -Dm644 "config/pam.d/system-auth-beacon" "$pkgdir/etc/pam.d/system-auth-beacon"
    install -Dm644 "LICENSE" "$pkgdir/usr/share/licenses/${pkgname%-git}/LICENSE"
}