summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 829d4a8c0c4c05235a7ddb89a04b93419ab0201e (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
# Maintainer: Vianney Bouchaud <aur dot vianney at bouchaud dot org>
# Contributor: Daniel Milde <daniel at milde dot cz>

pkgname=gore
pkgdesc="Yet another Go REPL that works nicely"
pkgver=0.5.7
pkgrel=1
arch=('x86_64')
_gopkg="github.com/x-motemen/gore"
url="https://${_gopkg}"
license=('MIT')
depends=(
  'go'
)

# no idea why --flto=auto is added to the LDFLAGS with a format
# causing an issue with the compiler.
options=('!lto')

source=(
  "${pkgname}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz"
)

sha256sums=(
  'bbd06377093dd760f54fbc7ee608e67430f5f005464d92c7cc237bad57490dd0'
)

prepare(){
  cd $pkgname-$pkgver
  mkdir -p build/
}

build() {
    cd $pkgname-$pkgver
    export GOPATH="$srcdir/gopath"
    export CGO_CPPFLAGS="${CPPFLAGS}"
    export CGO_CFLAGS="${CFLAGS}"
    export CGO_CXXFLAGS="${CXXFLAGS}"

    go build \
      -trimpath \
      -buildmode=pie \
      -mod=readonly \
      -modcacherw \
      -ldflags "\
        -linkmode=external \
        -buildid=''
        -extldflags='${LDFLAGS}' \
        -X '${_gopkg}/cli.revision=${pkgver}'
        " \
      -o build ./cmd/gore
}

package() {
  cd "$pkgname-$pkgver"

  install -D -m0755 build/gore "${pkgdir}/usr/bin/gore"
  install -D -m0644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

# vim:set ts=2 sw=2 et: