# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=shadowsocks-v2ray-plugin
pkgver=1.3.1
pkgrel=3
pkgdesc='A SIP003 plugin based on v2ray for shadowsocks'
arch=('x86_64')
url='https://github.com/shadowsocks/v2ray-plugin'
license=('GPL')
depends=('glibc')
makedepends=('go' 'git')
source=("$pkgname-$pkgver.tar.gz::https://github.com/shadowsocks/v2ray-plugin/archive/v$pkgver.tar.gz")
sha512sums=('771ec19ee7ed4f4827f4e04ef13bd680e72022f9e267e6a25d6e0bd3d22ac59ae52545387073d4263666e5847840f7b33963a64c1e7d8fbe0813218f5acf0ead')

build() {
  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export CGO_LDFLAGS="${LDFLAGS}"
  export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"

  cd v2ray-plugin-$pkgver
  go build
}

package() {
  cd v2ray-plugin-$pkgver
  install -Dm755 v2ray-plugin "$pkgdir"/usr/bin/v2ray-plugin
}
