summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 44cb9d7992335bac17addb46aa4a1fa552e07fa0 (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: Yesterday17 <t@yesterday17.cn>
pkgname=jlu-http-proxy-git
_pkgname=jlu-http-proxy
pkgver=1.0.1
pkgrel=2
pkgdesc="HTTP Forward proxy for vpns.jlu.edu.cn"
arch=('i686' 'x86_64')
url="https://github.com/Yesterday17/jlu-http-proxy"
license=('MIT')
makedepends=(
	'go'
	'git'
)
backup=('etc/jlu-http-config/config.json')

source=(
	"$_pkgname::git+https://github.com/Yesterday17/jlu-http-proxy.git"
)

md5sums=('SKIP')

build() {
    export GO111MODULE=on

	if [ -L "$srcdir/$_pkgname" ]; then
		rm "$srcdir/$_pkgname" -rf
		mv "$srcdir/go/src/$_pkgname/" "$srcdir/$_pkgname"
	fi

	rm -rf "go/src"

	mkdir -p "go/src"

	mv "$_pkgname" "go/src/"

	ln -sf "go/src/$_pkgname/" "$_pkgname"
	cd "go/src/${_pkgname}/"

	echo ":: Building binary"
	go build
}

package() {
    cd "${_pkgname}"
    install -Dm755 ${_pkgname} "${pkgdir}/usr/bin/${_pkgname}"
    install -Dm644 release/config.json -t "${pkgdir}/etc/jlu-http-proxy/"
    install -Dm644 release/jlu-http-proxy.service -t "${pkgdir}/usr/lib/systemd/system"
}