summaryrefslogtreecommitdiff
path: root/dns/knot-resolver/Makefile
blob: e4a5dbf103dc79d17bfccefb1bd2c8abfb12443b (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
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
151
152
153
154
155
156
157
158
159
160
161
PORTNAME=	knot-resolver
DISTVERSION=	5.5.0
CATEGORIES=	dns
MASTER_SITES=	https://secure.nic.cz/files/knot-resolver/ \
		https://dns.company/downloads/knot-resolver/

MAINTAINER=	freebsd@dns.company
COMMENT=	Caching full resolver implementation

LICENSE=	GPLv3+
LICENSE_FILE=	${WRKSRC}/COPYING

BUILD_DEPENDS=	bash:shells/bash \
		cmake:devel/cmake \
		flake8:devel/py-flake8@${PY_FLAVOR} \
		lua51-cqueues>=20200726_1:devel/lua-cqueues@lua51 \
		luacheck:devel/lua-luacheck

LIB_DEPENDS=	libdnssec.so:dns/knot3-lib \
		libgnutls.so:security/gnutls \
		libknot.so:dns/knot3-lib \
		liblmdb.so:databases/lmdb \
		libluajit-5.1.so:lang/luajit-openresty \
		libnghttp2.so:www/libnghttp2 \
		libuv.so:devel/libuv \
		libzscanner.so:dns/knot3-lib

RUN_DEPENDS=	lua51-cqueues>=20200726_1:devel/lua-cqueues@lua51

USES=		compiler:c11 libedit libtool meson ncurses ninja pkgconfig \
		python:3.5+,build shebangfix tar:xz

USE_CXXSTD=	c++11

USE_RC_SUBR=	krescachegc kresd

SHEBANG_FILES=	scripts/bench.sh \
		scripts/build-in-obs.sh \
		scripts/coverage_c_combine.sh \
		scripts/coverage_env.sh \
		scripts/gen-cdefs.sh \
		scripts/gen-pgp-keyblock.sh \
		scripts/get-date.sh \
		scripts/luacov_gen_empty.sh \
		scripts/make-archive.sh \
		scripts/make-doc.sh \
		scripts/make-obs.sh \
		scripts/run-pylint.sh \
		scripts/run-scanbuild-with-args.sh \
		scripts/test-config.sh \
		scripts/test-integration-prepare.sh \
		scripts/update-authors.sh \
		scripts/update-root-hints.sh

MESON_ARGS=	--buildtype=release \
		--default-library=static \
		--libdir=${PREFIX}/lib \
		--pkg-config-path=${PREFIX}/libdata/pkgconfig \
		--prefix=${LOCALBASE} \
		-Dclient=enabled \
		-Dgroup=${GROUPS} \
		-Dinstall_kresd_conf=enabled \
		-Dkeyfile_default=${ETCDIR}/root.keys \
		-Droot_hints=${ETCDIR}/root.hints \
		-Duser=${USERS} \
		-Dutils=enabled

LDFLAGS+=	-L${LOCALBASE}/lib

CONFLICTS=	knot-1.* knot1-[0-6].*

SUB_FILES=	pkg-message

KRESD_USER=	kresd
KRESD_GROUP=	kresd
KRESD_RUNDIR=	/var/run/kresd

SUB_LIST=	GROUPS=${GROUPS} \
		RUNDIR=${RUNDIR} \
		USERS=${USERS}

USERS=		${KRESD_USER}
GROUPS=		${KRESD_GROUP}
RUNDIR=		${KRESD_RUNDIR}

PLIST_SUB=	GROUPS=${GROUPS} \
		RUNDIR=${RUNDIR} \
		USERS=${USERS}

PORTDOCS=	AUTHORS COPYING CodingStyle NEWS README.md
PORTEXAMPLES=	config.cluster config.docker config.internal config.isp \
		config.personal config.privacy config.splitview

OPTIONS_DEFINE=		DOCS EXAMPLES DNSTAP ROOTKEYS TRUSTANCHOR TEST TESTUNIT TESTCONF TESTEXTRA
OPTIONS_DEFAULT=	DOCS EXAMPLES        ROOTKEYS TRUSTANCHOR TEST TESTUNIT

DNSTAP_DESC=		dnstap support
ROOTKEYS_DESC=		install root.keys
TESTCONF_DESC=		Do config tests
TESTEXTRA_DESC=		Do extra tests
TESTUNIT_DESC=		Do unit tests
TEST_DESC=		Do tests
TRUSTANCHOR_DESC=	Trust anchor bootstrapping, management and stats

DNSTAP_LIB_DEPENDS=	libfstrm.so:devel/fstrm \
			libprotobuf-c.so:devel/protobuf-c \
			libprotobuf.so:devel/protobuf
DNSTAP_MESON_ON=	-Ddnstap=enabled
DNSTAP_MESON_OFF=	-Ddnstap=disabled
DNSTAP_PLIST_FILES=	lib/knot-resolver/kres_modules/dnstap.so

ROOTKEYS_MESON_ON=	-Dinstall_root_keys=enabled
ROOTKEYS_MESON_OFF=	-Dinstall_root_keys=disabled
ROOTKEYS_PLIST_FILES=	${ETCDIR}/root.keys

TESTCONF_BROKEN=	missing luajit basexx package
TESTCONF_MESON_ON=	-Dconfig_tests=enabled
TESTCONF_MESON_OFF=	-Dconfig_tests=disabled

TESTEXTRA_BROKEN=		CMake Error: The source directory misses CMakeLists.txt
TESTEXTRA_BUILD_DEPENDS=	git:devel/git
TESTEXTRA_USES=			cmake python:3
TESTEXTRA_MESON_ON=		-Dextra_tests=enabled \
				-Dsendmmsg=disabled
TESTEXTRA_MESON_OFF=		-Dextra_tests=disabled

TESTUNIT_BUILD_DEPENDS=	cmocka>=1.1.1:sysutils/cmocka
TESTUNIT_MESON_ON=	-Dunit_tests=enabled
TESTUNIT_MESON_OFF=	-Dunit_tests=disabled

TRUSTANCHOR_MESON_ON=	-Dmanaged_ta=enabled
TRUSTANCHOR_MESON_OFF=	-Dmanaged_ta=disabled

STRIP_TARGETS=	sbin/kres-cache-gc \
		sbin/kresc \
		sbin/kresd \
		lib/knot-resolver/ahocorasick.so \
		lib/knot-resolver/kres_modules/bogus_log.so \
		lib/knot-resolver/kres_modules/dnstap.so \
		lib/knot-resolver/kres_modules/edns_keepalive.so \
		lib/knot-resolver/kres_modules/hints.so \
		lib/knot-resolver/kres_modules/lib/knot-resolver/kres_modules/nsid.so \
		lib/knot-resolver/kres_modules/refuse_nord.so \
		lib/knot-resolver/kres_modules/stats.so

pre-install:
	${MKDIR} ${STAGEDIR}${DOCSDIR}
	${MKDIR} ${STAGEDIR}${RUNDIR}

pre-install-TEST-on: do-test

post-install:
	${MV} ${STAGEDIR}${ETCDIR}/kresd.conf ${STAGEDIR}${ETCDIR}/kresd.conf.sample
	${INSTALL_DATA} ${PORTDOCS:S,^,${WRKSRC}/,} ${STAGEDIR}${DOCSDIR}/
.for STRIP_TGT in ${STRIP_TARGETS}
	if [ -f ${STAGEDIR}${PREFIX}/${STRIP_TGT} ]; then \
	  ${STRIP_CMD} ${STAGEDIR}${PREFIX}/${STRIP_TGT}; \
	fi
.endfor

.include <bsd.port.mk>