# Description: General purpose file previewer designed for Ranger, Lf to make scope.sh redundant
# URL: https://github.com/doronbehar/pistol
# Maintainer: Tim Biermann, tbier at posteo dot de
# Depends on: go

name=pistol
version=0.4.2
release=1
source=(https://github.com/doronbehar/pistol/archive/v$version/$name-$version.tar.gz)

build() {
  cd $name-$version

  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export CGO_LDFLAGS="${LDFLAGS}"
  export GO111MODULE=on
  export CGO_ENABLED=1
  export GO111MODULE=on

  mkdir "$PKGMK_SOURCE_DIR/gopath" || true
  export GOPATH="$PKGMK_SOURCE_DIR/gopath"

  go build -ldflags "-X 'main.Version=${version}-git'" ./cmd/pistol

  install -Dm755 pistol $PKG/usr/bin/pistol
}
