summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e8089a2dfc607770d7bd556f75d05ee17b9e4cc0 (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
# Maintainer: asaka <aisk1988@gmail.com>
pkgname=lean-cli-git
pkgver=r317.2799385
pkgrel=1
pkgdesc="LeanCloud command line tool"
arch=('i686' 'x86_64')
url="https://leancloud.cn"
license=('Apache')
groups=()
depends=()
makedepends=('git' 'go')
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
source=('git+https://github.com/leancloud/lean-cli')
md5sums=('SKIP')

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

build() {
    export GOPATH="$srcdir/go"
	cd "$srcdir"
    mkdir -p $srcdir/go/src/github.com/leancloud
    ln -s -f $srcdir/lean-cli/ $srcdir/go/src/github.com/leancloud/lean-cli
	go build -o lean -ldflags="-X main.pkgType=aur-git -s -w" github.com/leancloud/lean-cli/lean
}

check() {
	cd "$srcdir"
    ./lean --version | grep -q 'lean version'
}

package() {
	cd "$srcdir"
    install -Dm755 "lean" "$pkgdir/usr/bin/lean"
    install -Dm644 "${pkgname%-git}/LICENSE.txt" "$pkgdir/usr/share/licenses/${pkgname%-git}/LICENSE.txt"
}