summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 55fa5c52d08f5ec4b56c713659769155dc0bad9b (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
47
48
49
50
51
52
# Maintainer: Vyacheslav Konovalov <🦀vk@protonmail.com>

pkgname=swarm-bee-git
pkgver=v0.6.1.r149.g65c1774d
pkgrel=1
pkgdesc='Swarm client implemented in Go, basic building block for Swarm Network'
arch=('x86_64')
url='https://swarm.ethereum.org/'
license=('BSD-3-Clause')
depends=('bash')
optdepends=('bee-clef: external signer for bee')
makedepends=('git' 'go')
backup=('etc/bee/bee.yaml')
source=("git+https://github.com/ethersphere/bee.git")
sha512sums=('SKIP')
install='bee.install'

pkgver() {
    cd bee
    version=$(sed -nr 's/\s*version = "(.+)".*/\1/p' version.go)
    git describe --long | sed -e "s/^v[^-]*/v$version/" -e 's/\([^-]*-g\)/r\1/' -e 's/-/./g'
}

build() {
    cd bee
    export LDFLAGS='-s -w'
    # -s Omit the symbol table and debug information.
    # -w Omit the DWARF symbol table.

    go build \
        -trimpath \
        -buildmode=pie \
        -mod=readonly \
        -modcacherw \
        -ldflags "-linkmode external -extldflags \"${LDFLAGS}\"" \
        -o dist/bee \
        ./cmd/bee
}

check() {
    cd bee
    go test -race -failfast -v ./...
}

package() {
    cd bee
    install -Dm644 LICENSE -t "$pkgdir/usr/share/licenses/bee"
    install -Dm644 packaging/default "$pkgdir/etc/default/bee"
    install -Dm644 packaging/bee.yaml -t "$pkgdir/etc/bee"
    install -Dm644 packaging/bee.service -t "$pkgdir/usr/lib/systemd/system"
    install -Dm755 dist/bee packaging/bee-get-addr -t "$pkgdir/usr/bin"
}