summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9edbf172717e85883442cef714376c0b01b6fdd3 (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
# Maintainer: Patrick Northon <northon_patrick3@yahoo.ca>

_pkgname=netns-helper
pkgname=${_pkgname}-git
provides=("${_pkgname}")
conflicts=("${_pkgname}")
pkgver=r83.7cd2cbd
pkgrel=1
pkgdesc='Helper systemd services to create network namespaces for other programs and services.'
url="https://gitlab.com/patlefort/${_pkgname}"
license=('GPL3')
depends=()
arch=('any')
optdepends=(
	'nftables: nat feature'
	'bash-completion'
	'dnsmasq: DNS support'
	'dhcpcd: DHCP support'
	'openresolv: for dhcpcd')
makedepends=('git' 'libxslt' 'docbook-xsl' 'cmake')
sha256sums=('SKIP')
source=("git+${url}.git")
options=('!strip')

pkgver() {
	cd "${_pkgname}"
	( set -o pipefail
		git describe --tags --abbrev=7 --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
		printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)"
	)
}

build() {
	cmake -S "${_pkgname}" -B 'build' -DCMAKE_INSTALL_PREFIX=/usr
	cmake --build 'build'
}

package() {
	depends+=('systemd' 'iproute2')

	DESTDIR="${pkgdir}" cmake --install 'build'

	install -dm755 "${pkgdir}/etc/netns-helper/ns"
	install -Dm644 "${_pkgname}/license.txt" -t "${pkgdir}/usr/share/licenses/${_pkgname}"
}