aboutsummaryrefslogtreecommitdiffstats
path: root/community/connman/APKBUILD
blob: 46d24ebc4e43c23564aa00061ac97a6582a1c9ed (plain) (blame)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# Maintainer: Clayton Craft <clayton@craftyguy.net>
# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
pkgname=connman
pkgver=1.40
pkgrel=4
pkgdesc="Daemon for managing internet connections"
url="https://git.kernel.org/pub/scm/network/connman/connman.git"
arch="all"
license="GPL-2.0-only"
depends="dbus"
makedepends="autoconf automake dbus-dev glib-dev iptables-dev libnftnl-dev libtool
	readline-dev libmnl-dev openvpn ppp-dev vpnc wpa_supplicant xl2tpd"
install="$pkgname.post-upgrade"
subpackages="
	$pkgname-dbg
	$pkgname-iptables
	$pkgname-nftables
	$pkgname-l2tp
	$pkgname-openvpn
	$pkgname-vpnc
	$pkgname-wireguard
	$pkgname-dev
	$pkgname-doc
	$pkgname-openrc
	"
source="https://www.kernel.org/pub/linux/network/connman/connman-$pkgver.tar.xz
	libresolv.patch
	$pkgname.initd
	$pkgname.confd
	"

# secfixes:
#   1.39-r0:
#     - CVE-2021-26675
#     - CVE-2021-26676

prepare() {
	default_prepare
	autoreconf -vif

	cp -r "$builddir" "$builddir~nftables"
}

_build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--disable-wispr \
		--enable-pie \
		--enable-iwd \
		--enable-nmcompat \
		--enable-wireguard \
		--enable-openvpn \
		--enable-l2tp \
		--enable-vpnc \
		"$@"
	make
}

build() {
	cd "$builddir~nftables"
	_build --with-firewall=nftables

	cd "$builddir"
	_build --with-firewall=iptables  # this is the default value
}

check() {
	make check
}

package() {
	# Provided by connman-iptables or connman-nftables (mutually exclusive).
	# NOTE: It must be defined here, not on top-level!
	depends="$depends cmd:connmand"

	make install DESTDIR="$pkgdir"
	install -Dm644 src/main.conf "$pkgdir"/etc/$pkgname/main.conf

	mv "$pkgdir"/usr/sbin/connmand "$pkgdir"/usr/sbin/connmand.iptables
	install -D -m 755 "$builddir~nftables"/src/connmand "$pkgdir"/usr/sbin/connmand.nftables

	install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
}

iptables() {
	pkgdesc="ConnMan daemon built with iptables support"
	depends="$pkgname=$pkgver-r$pkgrel !$pkgname-nftables"
	provider_priority=20  # highest
	replaces="$pkgname $pkgname-nftables"

	amove usr/sbin/connmand.iptables
	ln -s connmand.iptables "$subpkgdir"/usr/sbin/connmand
}

nftables() {
	pkgdesc="ConnMan daemon built with nftables support"
	depends="$pkgname=$pkgver-r$pkgrel !$pkgname-iptables"
	provider_priority=10  # lowest
	replaces="$pkgname $pkgname-iptables"

	amove usr/sbin/connmand.nftables
	ln -s connmand.nftables "$subpkgdir"/usr/sbin/connmand
}

l2tp() {
	pkgdesc="L2TP VPN plugin for ConnMan"
	depends="$pkgname=$pkgver-r$pkgrel xl2tpd"

	amove usr/lib/connman/plugins-vpn/l2tp.so
	amove usr/lib/connman/scripts/libppp-plugin.so
}

openvpn() {
	pkgdesc="OpenVPN plugin for ConnMan"
	depends="$pkgname=$pkgver-r$pkgrel openvpn"
	replaces="$pkgname"  # for backward compatibility

	amove usr/lib/connman/plugins-vpn/openvpn.so
	amove usr/lib/connman/scripts/openvpn-script
}

vpnc() {
	pkgdesc="IPsec (Cisco/Juniper) VPN plugin for ConnMan"
	depends="$pkgname=$pkgver-r$pkgrel vpnc"

	amove usr/lib/connman/plugins-vpn/vpnc.so
}

wireguard() {
	pkgdesc="WireGuard VPN plugin for ConnMan"
	depends="$pkgname=$pkgver-r$pkgrel"
	replaces="$pkgname"  # for backward compatibility

	amove usr/lib/connman/plugins-vpn/wireguard.so
}

sha512sums="
33df90814b7499aeafcd51fca4f8ffbc07efacfa29dda46d3b9bcd3ff26264dc53c3991e7e53a8563ca403015c345e59c7ad29427c38ee3d88dd282479db7a0f  connman-1.40.tar.xz
122b48fc9e25354e25ba3a3e0864bdd84da84457fed94aeea726bcb189b2f05f2cc361ae15f44af5c49bcee572e91e4c0488ef3b0bc79d20f6efe15853fb6b3a  libresolv.patch
17c21c1c3e138790610a30ff397272e8f10b348c630e11f340fc7e97bdb871be00abc2955e11b9dad2c4be44cb6fdbf26c6c73aa18c1a2109f0668b14278593f  connman.initd
4d266e0cb30af7aec5359a5456b12c9358c266ce0a7afdff247da7423f91b99748a15e44facec51eaab0f5a193b9c7542d9a3988c85f1bf5027a742aea995326  connman.confd
"