summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4fcd2fb5e4cb20709a4e1d08d443c88164530377 (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
# Maintainer: Kimiblock Moe

pkgname=common-proxies
arch=('x86_64')
pkgver=3.1.0
pkgrel=1
pkgdesc="Gateways and Rewrite Proxies for UnifiedPush written in Go"
url=https://codeberg.org/UnifiedPush/common-proxies.git
license=("MIT")
depends=("glibc")
source=("git+https://codeberg.org/UnifiedPush/common-proxies.git#tag=${pkgver}")
makedepends=("go" "git" )
sha256sums=('be8700433b22ca7ecdb537a44bf9f9ffd205e145077f3d361e7cf7e1c0bc8ddb')
provides=("common-proxies")

function prepare(){
	cd "${srcdir}/${pkgname}"
	git submodule init
	git submodule update --depth=1
	export GOPATH="${srcdir}"
	go mod download -modcacherw
}

function build(){
	cd "${srcdir}/${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 \
		-trimpath \
		-buildmode=pie \
		-mod=readonly \
		-modcacherw \
		-o output-binary \
		-ldflags "-linkmode external -extldflags \"${LDFLAGS}\"" \
		.
}

function package(){
	cd "${srcdir}/${pkgname}"
	install -Dm755 \
		"${srcdir}/${pkgname}/output-binary" \
		"${pkgdir}/usr/bin/${pkgname}"
	install -Dm644 \
		"${srcdir}/${pkgname}/LICENSE" \
		-t "${pkgdir}/usr/share/licenses/${pkgname}"
}