blob: b361fd6fc8ebec5a9914a95a63a41775360b09ce (
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
62
63
64
|
# Maintainer: Kimiblock Moe
pkgname=netsock-git
epoch=1
pkgver=0.2.r0.g1407c03d
pkgrel=1
epoch=
pkgdesc="Per-app firewall for the Portable sandbox"
arch=('x86_64' 'aarch64' 'loongarch64')
url="https://github.com/Kimiblock/netsock"
license=(GPL-3.0-or-later)
provides=(netsock)
groups=()
options=()
conflicts=(netsock)
depends=(
nftables
glibc
)
makedepends+=(
"git"
"go"
)
checkdepends=()
source=(source::git+https://github.com/Kimiblock/netsock.git)
md5sums=('SKIP')
function pkgver() {
cd "${srcdir}/source"
git describe --long --tags --abbrev=8 --always | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}
function prepare() {
cd source
git clean -fdx
}
function build() {
cd "${srcdir}/source"
go mod download -modcacherw
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 \
-trimpath \
-buildmode=pie \
-modcacherw \
-mod=readonly \
-ldflags "-linkmode external -extldflags \"${LDFLAGS}\"" \
.
}
function package() {
cd "${srcdir}/source"
install -vDm755 top.kimiblock.netsock "${pkgdir}/usr/bin/netsock"
install -vDm644 netsock.service -t "${pkgdir}/usr/lib/systemd/system"
install -vDm644 netsock.socket -t "${pkgdir}/usr/lib/systemd/system"
}
|