summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d2cb7fe077d4a4a1c0c465df24d83aceafc900d5 (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
53
54
55
56
57
58
59
60
61
62
# Maintainer: Kaizhao Zhang <zhangkaizhao@gmail.com>

pkgname=gobeansdb
pkgver=1.1.3
pkgrel=1
pkgdesc='Yet anonther distributed key-value storage system from Douban Inc.'
url='https://github.com/douban/gobeansdb'
makedepends=('go>=1.11')
options=('!strip' '!emptydirs')
arch=('x86_64')
license=('BSD-3-Clause')
conflicts=('gobeansdb-git')
source=(
  "https://github.com/douban/gobeansdb/archive/v${pkgver}.tar.gz"
)
sha256sums=(
  'a6529b3add5663de38dc1ad43a99092c13b28e831b01750e80c4e892cbbd4621'
)

prepare() {
  cd "${srcdir}"

  if [[ -d "${srcdir}/goext" ]]; then
    # Why read-only? :/
    chmod -R u=rwX,go=rX "${srcdir}/goext"

    rm -rf "${srcdir}/goext"
  fi
}

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

  export GOPATH="${srcdir}/goext"
  #export GO111MODULE=on

  go install ./
}

package() {
  install -d -m755 "${pkgdir}"/usr/bin
  install -d -m755 "${pkgdir}"/usr/share/"${pkgname}"/{bin,conf,tests}

  export GOPATH="${srcdir}/goext"
  cd "${GOPATH}"

  # binary file
  install -D -m755 bin/gobeansdb "${pkgdir}/usr/share/${pkgname}/bin/gobeansdb"
  ln -s "/usr/share/${pkgname}/bin/gobeansdb" "${pkgdir}/usr/bin/gobeansdb"

  cd "${srcdir}/${pkgname}-${pkgver}"

  # conf and tests files
  install -D -m644 conf/* "${pkgdir}/usr/share/${pkgname}/conf/"
  install -D -m644 tests/* "${pkgdir}/usr/share/${pkgname}/tests/"

  # document
  install -D -m644 README.md "${pkgdir}/usr/share/doc/${pkgname}/README.md"

  # license
  install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}