summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e06eaf3c92b322b8fc79ade9798fbbf9aaa297a2 (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
# Maintainer: Simon Legner <Simon.Legner@gmail.com>
pkgname=imposm
_gitname=imposm3
pkgver=0.14.0
pkgrel=1
pkgdesc="Imports OpenStreetMap data into PostGIS"
arch=('x86_64')
url="https://github.com/omniscale/$_gitname"
license=('Apache')
depends=('geos' 'leveldb')
makedepends=('go')
source=("$pkgname-$pkgver.tar.gz::https://github.com/omniscale/$_gitname/archive/v$pkgver.tar.gz")
sha256sums=('d6b012497eff1b8faa25d125ce0becb97f68c95a68dd2c35cf65a0bf3c34b833')

_importpath="github.com/omniscale/$_gitname"

prepare() {
  cd "$_gitname-$pkgver"
  go mod download
}

build() {
  cd "$_gitname-$pkgver/cmd/$pkgname"
  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export CGO_LDFLAGS="${LDFLAGS}"
  export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
  go build -ldflags="-X github.com/omniscale/imposm3.Version=$pkgver"
}

check() {
  cd "$_gitname-$pkgver"
  go test $(go list ./... | grep --invert-match \/test)
  # TODO go test $(go list ./...)
}

package() {
  cd "$srcdir/$_gitname-$pkgver/cmd/$pkgname"
  install -dm755 "$pkgdir/usr/bin"
  install -m755 "$pkgname" "$pkgdir/usr/bin/imposm"
}