summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9b15cd4d9895de774000cda0994b6dab62e2af93 (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
# Maintainer: George Rawlinson <george@rawlinson.net.nz>
pkgname=realize
pkgver=2.0.2
pkgrel=2
pkgdesc="Golang live reload and task runner"
arch=('x86_64')
url="https://github.com/oxequa/realize"
license=('GPL')
conflicts=('realize-git')
provides=('realize')
depends=('glibc')
makedepends=('go>=1.11' 'git')
options=('!strip')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/oxequa/${pkgname}/archive/v${pkgver}.tar.gz")
sha512sums=('8e68504710552a487dcec92e6295d18ea830d29192c4c3d1af316589861a04325b99765eb0051adb7ecb8ff344d98bf667453d7bbd8e6d588a44db446f267a56')

prepare() {
  # setup env variables & dirs
  mkdir -p "${srcdir}/go"
  export GOPATH="${srcdir}/go"
  export GO111MODULE=on

  # initialize module & add dependencies to go.mod
  cd "${srcdir}/${pkgname}-${pkgver}"
  if [ ! -f go.mod ]; then
    go mod init github.com/oxequa/realize
    go mod tidy
  fi

  # download dependencies
  go mod download
}

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

  go build -o "${pkgname}-${pkgver}"
}

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

  install -Dm755 "${pkgname}-${pkgver}" "${pkgdir}/usr/bin/realize"
  install -Dm644 "LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}