summaryrefslogtreecommitdiff
blob: 457f65c48f16253f54e8f599c76bf25981ac76f0 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6

inherit user fcaps systemd

DESCRIPTION="Modern asynchronous DNS API"
HOMEPAGE="https://getdnsapi.net/"
SRC_URI="https://getdnsapi.net/releases/${P//./-}/${P}.tar.gz"

LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="stubby +getdns_query +getdns_server_mon libressl +idn +unbound libevent libev libuv +threads static-libs"

# https://bugs.gentoo.org/661760
# https://github.com/getdnsapi/getdns/issues/407
RESTRICT="test"

DEPEND="
	dev-libs/libbsd:=
	dev-libs/libyaml:=
	!libressl? ( dev-libs/openssl:0= )
	libressl? ( dev-libs/libressl:0= )
	idn? ( net-dns/libidn2:= )
	unbound? ( >=net-dns/unbound-1.4.16:= )
	libevent? ( dev-libs/libevent:= )
	libev? ( dev-libs/libev:= )
	libuv? ( dev-libs/libuv:= )
"
RDEPEND="
	${DEPEND}
	stubby? ( sys-libs/libcap:= )
"

PATCHES=( "${FILESDIR}/${PN}-1.4.2-stubby.service.patch" )

src_configure() {
	econf \
		--runstatedir=/var/run \
		--with-piddir=/var/run/stubby \
		$(use_with stubby) \
		$(use_with getdns_query) \
		$(use_with getdns_server_mon) \
		$(use_with idn libidn2) \
		--without-libidn \
		$(use_with unbound libunbound) \
		$(use_with libevent) \
		$(use_with libev) \
		$(use_with libuv) \
		$(use_with threads libpthread) \
		$(use_enable static-libs static)
}

src_install() {
	default
	if use stubby; then
		newinitd "${FILESDIR}"/stubby.initd-r1 stubby
		newconfd "${FILESDIR}"/stubby.confd-r1 stubby
		insinto /etc/logrotate.d
		newins "${FILESDIR}"/stubby.logrotate stubby
		systemd_dounit "${S}"/stubby/systemd/stubby.service
		systemd_dotmpfilesd "${S}"/stubby/systemd/stubby.conf
	fi
}

pkg_postinst() {
	if use stubby; then
		enewgroup stubby
		enewuser stubby -1 -1 -1 stubby
		fcaps cap_net_bind_service=ei /usr/bin/stubby
	fi

	if has_version <dev-libs/libressl-2.7.0; then
		ewarn "BEWARE: dev-libs/libressl prior to 2.7 does NOT check TLS certificates."
		if use stubby; then
			ewarn "You will NOT be able to use strict profile in Stubby."
		fi
	fi
}