summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 277211fde5599b8ed8c83950207debbdbb1eba64 (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
# Maintainer: Misaka13514 <Misaka13514 at gmail dot com>
pkgname=easierconnect-git
_pkgname=${pkgname%-git}
pkgver=TestBuild13.r0.7a1dc42
pkgrel=1
pkgdesc="Sangfor EasyConnect protocol reimplementation in Go"
arch=('x86_64' 'aarch64')
url="https://github.com/lyc8503/EasierConnect"
license=('AGPL3')
depends=('glibc')
makedepends=('git' 'go')
provides=($_pkgname)
conflicts=($_pkgname)
_tag="7a1dc4260786d22c2cdc852ce66dcbe55eb2e6a7" # git rev-parse TestBuild13
source=($_pkgname::git+$url.git#tag=$_tag)
sha256sums=('SKIP')

pkgver() {
    cd "$_pkgname"
    printf "%s" "$(git describe --long --tags | sed 's/\([^-]*-\)g/r\1/;s/-/./g')"
}

prepare() {
    cd "$_pkgname"
    mkdir -p build/
}

build() {
    cd "$_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 -o build .
}

check() {
    cd "$_pkgname"
    go test ./...
}

package() {
    cd "$_pkgname"
    install -Dm755 build/EasierConnect "$pkgdir/usr/bin/$_pkgname"
    install -Dm644 -t "$pkgdir/usr/share/doc/$pkgname/" *.md
}