summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: bacf615e48ff000531a0fb1d5316c480c03550bb (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
63
64
65
# Maintainer: Kaizhao Zhang <zhangkaizhao@gmail.com>

_pkgname=gobeansdb

pkgname="${_pkgname}-git"
pkgver=r623.d940fae
pkgrel=1
pkgdesc="High performance distributed object storage server 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')
source=("git+${url}.git")
sha256sums=('SKIP')

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

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}"

  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}"

  # 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"
}