summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4d1ea26d8621541eb0070e1d58fd5b3a032b6ac9 (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
# Maintainer: m8D2 <omui (at) proton mail (dot) com>
# Contributor: Dct Mei <dctxmei@gmail.com>
# Contributor: Felix Yan <felixonmars@archlinux.org>
# Contributor: pandada8 <pandada8@gmail.com>

pkgname=v2ray-git
pkgver=4.28.2.r25.g73311d10
pkgrel=1
pkgdesc="A set of network tools that help you to build your own computer network (git version)."
arch=(x86_64)
url="https://github.com/v2fly/v2ray-core"
license=(MIT)
depends=(glibc v2ray-domain-list-community v2ray-geoip)
makedepends=(go git)
backup=(etc/v2ray/config.json)
provides=(v2ray)
conflicts=(v2ray)
source=("$pkgname::git+$url.git")
sha512sums=('SKIP')

prepare() {
  cd "$srcdir"/$pkgname
  sed -i 's|/usr/local/bin|/usr/bin|;s|/usr/local/etc|/etc|' release/config/systemd/system/*.service
}

pkgver() {
    cd "$pkgname"

    # cutting off 'v' prefix that presents in the git tag
    git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
  cd "$srcdir"/$pkgname
  export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external"
  export CGO_LDFLAGS="${LDFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CPPFLAGS="${CPPFLAGS}"
  go build -o v2ray ./main
  go build -o v2ctl ./infra/control/main
}

check() {
  cd "$srcdir"/$pkgname
  go test -p 1 -tags json -v -timeout 30m v2ray.com/core/...
}

package() {
  cd "$srcdir"/$pkgname
  install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/v2ray/LICENSE
  install -Dm644 release/config/systemd/system/v2ray.service "$pkgdir"/usr/lib/systemd/system/v2ray.service
  install -Dm644 release/config/systemd/system/v2ray@.service "$pkgdir"/usr/lib/systemd/system/v2ray@.service
  install -Dm644 release/config/*.json -t "$pkgdir"/etc/v2ray/
  install -Dm755 v2ray -t "$pkgdir"/usr/bin/
  install -Dm755 v2ctl -t "$pkgdir"/usr/bin/
}