summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 30c98a8097459d5996f169a1c61b5715fd4105c8 (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
# Maintainer: Mohammadreza Abdollahzadeh <morealaz at gmail dot com>
pkgname='warp-plus-git'
pkgver=1.2.3.r13.c805ea8
pkgrel=1
pkgdesc="An open-source implementation of Cloudflare's Warp, enhanced with Psiphon integration (GitHub Version)."
arch=('i686' 'pentium4' 'x86_64' 'arm' 'armv7h' 'armv6h' 'aarch64')
url="https://github.com/bepass-org/warp-plus"
license=('MIT')
makedepends=('git' 'go')
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
backup=('etc/warp-plus/config.json')
install="${pkgname%-git}.install"
source=("${pkgname%-git}::git+${url}.git"
		"${pkgname%-git}.service")

sha256sums=('SKIP'
            '5ada20e3b2871c0921dfe36d721914fa02fe2f4892919160daa71992e91be49b')
pkgver() {
    cd "${pkgname%-git}"
    printf "%s" "$(git describe --long --tags | sed 's/^v//;s/\([^-]*-\)g/r\1/;s/-/./g')"
}

prepare() {
    cd "${pkgname%-git}"
    sed -i 's|"gool".*|"gool": true,|' example_config.json
    sed -i 's|"cache-dir".*|"cache-dir": "/etc/warp-plus",|' example_config.json
    go mod tidy
}

build() {
    cd "${pkgname%-git}/cmd/warp-plus/"
    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 .
}

package() {
    cd "${pkgname%-git}"
	install -Dm 755 ./cmd/warp-plus/warp-plus "${pkgdir}/usr/bin/${pkgname%-git}"
	install -D -t "${pkgdir}/usr/lib/systemd/system/" -m 644 ../"${pkgname%-git}.service"
	install -Dm 644 example_config.json "${pkgdir}/etc/${pkgname%-git}/config.json"
	install -Dm 644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname%-git}/LICENSE"
}
# vim:set ts=4 sw=4 et: