Gentoo Archives: gentoo-commits

From: Ben Kohler <bkohler@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-misc/connman/files/, net-misc/connman/
Date: Fri, 04 Feb 2022 20:27:05
Message-Id: 1644006315.f3641eecc7c75afc5307e248ca98a390ded51bc2.bkohler@gentoo
1 commit: f3641eecc7c75afc5307e248ca98a390ded51bc2
2 Author: Ben Kohler <bkohler <AT> gentoo <DOT> org>
3 AuthorDate: Fri Feb 4 20:15:28 2022 +0000
4 Commit: Ben Kohler <bkohler <AT> gentoo <DOT> org>
5 CommitDate: Fri Feb 4 20:25:15 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f3641eec
7
8 net-misc/connman: musl fix
9
10 Closes: https://bugs.gentoo.org/832548
11 Package-Manager: Portage-3.0.30, Repoman-3.0.3
12 Signed-off-by: Ben Kohler <bkohler <AT> gentoo.org>
13
14 net-misc/connman/connman-1.41-r1.ebuild | 103 ++++++++++++++++++++++++
15 net-misc/connman/files/libresolv-musl-fix.patch | 61 ++++++++++++++
16 2 files changed, 164 insertions(+)
17
18 diff --git a/net-misc/connman/connman-1.41-r1.ebuild b/net-misc/connman/connman-1.41-r1.ebuild
19 new file mode 100644
20 index 000000000000..2db37a70b743
21 --- /dev/null
22 +++ b/net-misc/connman/connman-1.41-r1.ebuild
23 @@ -0,0 +1,103 @@
24 +# Copyright 1999-2022 Gentoo Authors
25 +# Distributed under the terms of the GNU General Public License v2
26 +
27 +EAPI="7"
28 +inherit autotools systemd tmpfiles
29 +
30 +if [[ ${PV} == *9999* ]]; then
31 + inherit git-r3
32 + EGIT_REPO_URI="https://git.kernel.org/pub/scm/network/connman/connman.git"
33 +else
34 + SRC_URI="https://www.kernel.org/pub/linux/network/${PN}/${P}.tar.xz"
35 + KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~x86"
36 +fi
37 +
38 +DESCRIPTION="Provides a daemon for managing internet connections"
39 +HOMEPAGE="https://git.kernel.org/pub/scm/network/connman/connman.git/"
40 +
41 +LICENSE="GPL-2"
42 +SLOT="0"
43 +
44 +IUSE="bluetooth debug doc +ethernet examples iptables iwd l2tp networkmanager
45 ++nftables ofono openconnect openvpn policykit pptp tools vpnc +wifi wireguard
46 +wispr"
47 +
48 +REQUIRED_USE="^^ ( iptables nftables )"
49 +BDEPEND="virtual/pkgconfig"
50 +RDEPEND=">=dev-libs/glib-2.16
51 + >=sys-apps/dbus-1.2.24
52 + sys-libs/readline:0=
53 + bluetooth? ( net-wireless/bluez )
54 + iptables? ( >=net-firewall/iptables-1.4.8 )
55 + iwd? ( net-wireless/iwd )
56 + l2tp? ( net-dialup/xl2tpd )
57 + nftables? (
58 + >=net-libs/libnftnl-1.0.4:0=
59 + >=net-libs/libmnl-1.0.0:0= )
60 + ofono? ( net-misc/ofono )
61 + openconnect? ( net-vpn/openconnect )
62 + openvpn? ( net-vpn/openvpn )
63 + policykit? ( sys-auth/polkit )
64 + pptp? ( net-dialup/pptpclient )
65 + vpnc? ( net-vpn/vpnc )
66 + wifi? ( >=net-wireless/wpa_supplicant-2.0[dbus] )
67 + wireguard? ( >=net-libs/libmnl-1.0.0:0= )
68 + wispr? ( net-libs/gnutls )"
69 +
70 +DEPEND="${RDEPEND}
71 + >=sys-kernel/linux-headers-2.6.39"
72 +
73 +PATCHES=( "${FILESDIR}/libresolv-musl-fix.patch" )
74 +
75 +src_prepare() {
76 + default
77 + eautoreconf
78 +}
79 +
80 +src_configure() {
81 + econf \
82 + --localstatedir=/var \
83 + --runstatedir=/run \
84 + --with-systemdunitdir=$(systemd_get_systemunitdir) \
85 + --with-tmpfilesdir="${EPREFIX}"/usr/lib/tmpfiles.d \
86 + --enable-client \
87 + --enable-datafiles \
88 + --enable-loopback=builtin \
89 + $(use_enable bluetooth bluetooth builtin) \
90 + $(use_enable debug) \
91 + $(use_enable ethernet ethernet builtin) \
92 + $(use_enable examples test) \
93 + $(use_enable iwd) \
94 + $(use_enable l2tp l2tp builtin) \
95 + $(use_enable networkmanager nmcompat) \
96 + $(use_enable ofono ofono builtin) \
97 + $(use_enable openconnect openconnect builtin) \
98 + $(use_enable openvpn openvpn builtin) \
99 + $(use_enable policykit polkit builtin) \
100 + $(use_enable pptp pptp builtin) \
101 + $(use_enable tools) \
102 + $(use_enable vpnc vpnc builtin) \
103 + $(use_enable wifi wifi builtin) \
104 + $(use_enable wireguard) \
105 + $(use_enable wispr wispr builtin) \
106 + --with-firewall=$(usex iptables "iptables" "nftables" ) \
107 + --disable-iospm \
108 + --disable-hh2serial-gps
109 +}
110 +
111 +src_install() {
112 + default
113 + dobin client/connmanctl
114 +
115 + if use doc; then
116 + dodoc doc/*.txt
117 + fi
118 + keepdir /usr/lib/${PN}/scripts
119 + keepdir /var/lib/${PN}
120 + newinitd "${FILESDIR}"/${PN}.initd2 ${PN}
121 + newconfd "${FILESDIR}"/${PN}.confd ${PN}
122 +}
123 +
124 +pkg_postinst() {
125 + tmpfiles_process connman_resolvconf.conf
126 +}
127
128 diff --git a/net-misc/connman/files/libresolv-musl-fix.patch b/net-misc/connman/files/libresolv-musl-fix.patch
129 new file mode 100644
130 index 000000000000..c28a7c1e3589
131 --- /dev/null
132 +++ b/net-misc/connman/files/libresolv-musl-fix.patch
133 @@ -0,0 +1,61 @@
134 +musl does not implement res_ninit
135 +
136 +diff --exclude '*.*o' -ru connman-1.24.orig/gweb/gresolv.c connman-1.24/gweb/gresolv.c
137 +--- connman-1.24.orig/gweb/gresolv.c 2014-07-18 20:17:25.000000000 -0300
138 ++++ connman-1.24/gweb/gresolv.c 2014-07-18 20:24:01.874669130 -0300
139 +@@ -874,8 +874,6 @@
140 + resolv->index = index;
141 + resolv->nameserver_list = NULL;
142 +
143 +- res_ninit(&resolv->res);
144 +-
145 + return resolv;
146 + }
147 +
148 +@@ -915,8 +913,6 @@
149 +
150 + flush_nameservers(resolv);
151 +
152 +- res_nclose(&resolv->res);
153 +-
154 + g_free(resolv);
155 + }
156 +
157 +@@ -1019,24 +1015,19 @@
158 + debug(resolv, "hostname %s", hostname);
159 +
160 + if (!resolv->nameserver_list) {
161 +- int i;
162 +-
163 +- for (i = 0; i < resolv->res.nscount; i++) {
164 +- char buf[100];
165 +- int family = resolv->res.nsaddr_list[i].sin_family;
166 +- void *sa_addr = &resolv->res.nsaddr_list[i].sin_addr;
167 +-
168 +- if (family != AF_INET &&
169 +- resolv->res._u._ext.nsaddrs[i]) {
170 +- family = AF_INET6;
171 +- sa_addr = &resolv->res._u._ext.nsaddrs[i]->sin6_addr;
172 ++ FILE *f = fopen("/etc/resolv.conf", "r");
173 ++ if (f) {
174 ++ char line[256], *s;
175 ++ int i;
176 ++ while (fgets(line, sizeof(line), f)) {
177 ++ if (strncmp(line, "nameserver", 10) || !isspace(line[10]))
178 ++ continue;
179 ++ for (s = &line[11]; isspace(s[0]); s++);
180 ++ for (i = 0; s[i] && !isspace(s[i]); i++);
181 ++ s[i] = 0;
182 ++ g_resolv_add_nameserver(resolv, s, 53, 0);
183 + }
184 +-
185 +- if (family != AF_INET && family != AF_INET6)
186 +- continue;
187 +-
188 +- if (inet_ntop(family, sa_addr, buf, sizeof(buf)))
189 +- g_resolv_add_nameserver(resolv, buf, 53, 0);
190 ++ fclose(f);
191 + }
192 +
193 + if (!resolv->nameserver_list)
194 +