# $Id: PKGBUILD 138485 2015-08-18 13:35:19Z fyan $
# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=gost
pkgver=1.8
pkgrel=1
pkgdesc="GO Simple Tunnel"
arch=('i686' 'x86_64')
url="https://github.com/ginuerzh/gost"
license=('MIT')
depends=('gcc-go')
makedepends=('git' 'mercurial')
source=("git+https://github.com/ginuerzh/gost.git#tag=v$pkgver")
md5sums=('SKIP')

prepare() {
  cd gost

  mkdir -p .gopath/src/github.com/ginuerzh
  ln -sf "$PWD" .gopath/src/github.com/ginuerzh/gost
  export GOPATH="$PWD/.gopath"

  go get github.com/ginuerzh/gosocks5
  go get github.com/gorilla/websocket
  go get github.com/shadowsocks/shadowsocks-go/shadowsocks
  go get code.google.com/p/go-uuid/uuid
}

build() {
  cd gost
  export GOPATH="$PWD/.gopath"

  go build
}

package() {
  cd gost
  install -Dm755 gost "$pkgdir/usr/bin/gost"
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
