summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b0534f41722eaed77147209fff4fcb21f95c7f29 (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
# Maintainer: Tony Lambiris <tony@libpcap.net>

pkgname=speedtest-go-git
pkgver=1.6.0.r1.ge4a8852
pkgrel=1
pkgdesc="Command Line Interface and pure Go API for speedtest.net"
arch=('x86_64')
license=('MIT')
depends=()
makedepends=('go' 'git')
optdepends=()
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
source=("${pkgname}::git+https://github.com/showwin/speedtest-go.git")
sha256sums=('SKIP')

pkgver() {
    cd "${srcdir}/${pkgname}"

    git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//g'
}

prepare() {
    cd "${srcdir}/${pkgname}"

    mkdir -p "${srcdir}/go/src/github.com/showwin"
    ln -sf "${srcdir}/${pkgname}" "${srcdir}/go/src/github.com/showwin/speedtest-go"
}

build() {
    cd "${srcdir}/go/src/github.com/showwin/speedtest-go"

    mkdir -p build

    export GOPATH="${srcdir}/go" GO111MODULE="auto"

    go build \
        -trimpath -modcacherw -ldflags "-s -w" \
        -o build/speedtest-go .
}

package() {
    cd "${srcdir}/go/src/github.com/showwin/speedtest-go"

    install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
    install -Dm755 build/speedtest-go "${pkgdir}/usr/bin/speedtest-go"
}