blob: e0c93d800ba2255316cac6a86644af2f66543b62 (
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
57
58
59
60
61
|
# Maintainer: Haruue Icymoon <i@haruue.moe>
_pkgbase=mwgp
pkgname="$_pkgbase"
pkgver=2.1.7
pkgrel=1
pkgdesc='A WireGuard proxy designed to reuse one UDP port for multiple WireGuard interfaces'
arch=('x86_64')
url="https://github.com/apernet/mwgp"
license=('MIT')
depends=('glibc')
makedepends=('go' 'git')
_srcbase="github-apernet-$_pkgbase"
source=("$_srcbase"::"git+$url.git#tag=v$pkgver")
sha256sums=('SKIP')
prepare(){
mkdir -p "$srcdir/gopath"
export GOPATH="$srcdir/gopath"
cd "$srcdir/$_srcbase"
mkdir -p build/
}
build() {
cd "$srcdir/$_srcbase"
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
export CGO_LDFLAGS="${LDFLAGS}"
local _goldflags="-w -s -linkmode=external"
local _goldflags="$_goldflags -X 'main.MWGPVersion=$(git describe --tags)'"
go build \
-buildmode=pie -trimpath -mod=readonly -modcacherw \
-o "build/$_pkgbase" \
-ldflags "$_goldflags" \
./cmd/mwgp
}
#check() {
# cd "$srcdir/$_pkgbase"
# go test ./...
#}
package() {
# install mwgp
install -Dm755 "$srcdir/$_srcbase/build/$_pkgbase" "$pkgdir/usr/bin/$_pkgbase"
# install sysusers & tmpfiles
install -Dm644 "$srcdir/$_srcbase/release/sysusers.conf" "$pkgdir/usr/lib/sysusers.d/$_pkgbase.conf"
install -Dm644 "$srcdir/$_srcbase/release/tmpfiles.conf" "$pkgdir/usr/lib/tmpfiles.d/$_pkgbase.conf"
# install systemd units
install -Dm644 "$srcdir/$_srcbase/release/mwgp-client@.service" "$pkgdir/usr/lib/systemd/system/mwgp-client@.service"
install -Dm644 "$srcdir/$_srcbase/release/mwgp-server@.service" "$pkgdir/usr/lib/systemd/system/mwgp-server@.service"
# install license
install -Dm644 "$srcdir/$_srcbase/LICENSE" "$pkgdir/usr/share/licenses/$_pkgbase/LICENSE"
# install config directory
install -dm755 "$pkgdir/etc/mwgp"
}
|