xref: /OK3568_Linux_fs/yocto/poky/meta/recipes-connectivity/bind/bind_9.18.11.bb (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunSUMMARY = "ISC Internet Domain Name Server"
2*4882a593SmuzhiyunHOMEPAGE = "https://www.isc.org/bind/"
3*4882a593SmuzhiyunDESCRIPTION = "BIND 9 provides a full-featured Domain Name Server system"
4*4882a593SmuzhiyunSECTION = "console/network"
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunLICENSE = "MPL-2.0"
7*4882a593SmuzhiyunLIC_FILES_CHKSUM = "file://COPYRIGHT;md5=d8cf7bd9c4fd5471a588e7e66e672408"
8*4882a593Smuzhiyun
9*4882a593SmuzhiyunDEPENDS = "openssl libcap zlib libuv"
10*4882a593Smuzhiyun
11*4882a593SmuzhiyunSRC_URI = "https://ftp.isc.org/isc/bind9/${PV}/${BPN}-${PV}.tar.xz \
12*4882a593Smuzhiyun           file://conf.patch \
13*4882a593Smuzhiyun           file://named.service \
14*4882a593Smuzhiyun           file://bind9 \
15*4882a593Smuzhiyun           file://generate-rndc-key.sh \
16*4882a593Smuzhiyun           file://make-etc-initd-bind-stop-work.patch \
17*4882a593Smuzhiyun           file://init.d-add-support-for-read-only-rootfs.patch \
18*4882a593Smuzhiyun           file://bind-ensure-searching-for-json-headers-searches-sysr.patch \
19*4882a593Smuzhiyun           file://0001-named-lwresd-V-and-start-log-hide-build-options.patch \
20*4882a593Smuzhiyun           file://0001-avoid-start-failure-with-bind-user.patch \
21*4882a593Smuzhiyun           "
22*4882a593Smuzhiyun
23*4882a593SmuzhiyunSRC_URI[sha256sum] = "8ff3352812230cbcbda42df87cad961f94163d3da457c5e4bef8057fd5df2158"
24*4882a593Smuzhiyun
25*4882a593SmuzhiyunUPSTREAM_CHECK_URI = "https://ftp.isc.org/isc/bind9/"
26*4882a593Smuzhiyun# follow the ESV versions divisible by 2
27*4882a593SmuzhiyunUPSTREAM_CHECK_REGEX = "(?P<pver>9.(\d*[02468])+(\.\d+)+(-P\d+)*)/"
28*4882a593Smuzhiyun
29*4882a593Smuzhiyun# Issue only affects dhcpd with recent bind versions. We don't ship dhcpd anymore
30*4882a593Smuzhiyun# so the issue doesn't affect us.
31*4882a593SmuzhiyunCVE_CHECK_IGNORE += "CVE-2019-6470"
32*4882a593Smuzhiyun
33*4882a593Smuzhiyuninherit autotools update-rc.d systemd useradd pkgconfig multilib_header update-alternatives
34*4882a593Smuzhiyun
35*4882a593Smuzhiyun# PACKAGECONFIGs readline and libedit should NOT be set at same time
36*4882a593SmuzhiyunPACKAGECONFIG ?= "readline"
37*4882a593SmuzhiyunPACKAGECONFIG[httpstats] = "--with-libxml2=${STAGING_DIR_HOST}${prefix},--without-libxml2,libxml2"
38*4882a593SmuzhiyunPACKAGECONFIG[readline] = "--with-readline=readline,,readline"
39*4882a593SmuzhiyunPACKAGECONFIG[libedit] = "--with-readline=libedit,,libedit"
40*4882a593SmuzhiyunPACKAGECONFIG[dns-over-http] = "--enable-doh,--disable-doh,nghttp2"
41*4882a593Smuzhiyun
42*4882a593SmuzhiyunEXTRA_OECONF = " --disable-devpoll --disable-auto-validation --enable-epoll \
43*4882a593Smuzhiyun                 --with-gssapi=no --with-lmdb=no --with-zlib \
44*4882a593Smuzhiyun                 --sysconfdir=${sysconfdir}/bind \
45*4882a593Smuzhiyun                 --with-openssl=${STAGING_DIR_HOST}${prefix} \
46*4882a593Smuzhiyun               "
47*4882a593SmuzhiyunLDFLAGS:append = " -lz"
48*4882a593Smuzhiyun
49*4882a593Smuzhiyun# dhcp needs .la so keep them
50*4882a593SmuzhiyunREMOVE_LIBTOOL_LA = "0"
51*4882a593Smuzhiyun
52*4882a593SmuzhiyunUSERADD_PACKAGES = "${PN}"
53*4882a593SmuzhiyunUSERADD_PARAM:${PN} = "--system --home ${localstatedir}/cache/bind --no-create-home \
54*4882a593Smuzhiyun                       --user-group bind"
55*4882a593Smuzhiyun
56*4882a593SmuzhiyunINITSCRIPT_NAME = "bind"
57*4882a593SmuzhiyunINITSCRIPT_PARAMS = "defaults"
58*4882a593Smuzhiyun
59*4882a593SmuzhiyunSYSTEMD_SERVICE:${PN} = "named.service"
60*4882a593Smuzhiyun
61*4882a593Smuzhiyundo_install:append() {
62*4882a593Smuzhiyun
63*4882a593Smuzhiyun	install -d -o bind "${D}${localstatedir}/cache/bind"
64*4882a593Smuzhiyun	install -d "${D}${sysconfdir}/bind"
65*4882a593Smuzhiyun	install -d "${D}${sysconfdir}/init.d"
66*4882a593Smuzhiyun	install -m 644 ${S}/conf/* "${D}${sysconfdir}/bind/"
67*4882a593Smuzhiyun	install -m 755 "${S}/init.d" "${D}${sysconfdir}/init.d/bind"
68*4882a593Smuzhiyun
69*4882a593Smuzhiyun	# Install systemd related files
70*4882a593Smuzhiyun	install -d ${D}${sbindir}
71*4882a593Smuzhiyun	install -m 755 ${WORKDIR}/generate-rndc-key.sh ${D}${sbindir}
72*4882a593Smuzhiyun	install -d ${D}${systemd_system_unitdir}
73*4882a593Smuzhiyun	install -m 0644 ${WORKDIR}/named.service ${D}${systemd_system_unitdir}
74*4882a593Smuzhiyun	sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
75*4882a593Smuzhiyun	       -e 's,@SBINDIR@,${sbindir},g' \
76*4882a593Smuzhiyun	       ${D}${systemd_system_unitdir}/named.service
77*4882a593Smuzhiyun
78*4882a593Smuzhiyun	install -d ${D}${sysconfdir}/default
79*4882a593Smuzhiyun	install -m 0644 ${WORKDIR}/bind9 ${D}${sysconfdir}/default
80*4882a593Smuzhiyun
81*4882a593Smuzhiyun	if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
82*4882a593Smuzhiyun		install -d ${D}${sysconfdir}/tmpfiles.d
83*4882a593Smuzhiyun		echo "d /run/named 0755 bind bind - -" > ${D}${sysconfdir}/tmpfiles.d/bind.conf
84*4882a593Smuzhiyun	fi
85*4882a593Smuzhiyun}
86*4882a593Smuzhiyun
87*4882a593SmuzhiyunCONFFILES:${PN} = " \
88*4882a593Smuzhiyun	${sysconfdir}/bind/named.conf \
89*4882a593Smuzhiyun	${sysconfdir}/bind/named.conf.local \
90*4882a593Smuzhiyun	${sysconfdir}/bind/named.conf.options \
91*4882a593Smuzhiyun	${sysconfdir}/bind/db.0 \
92*4882a593Smuzhiyun	${sysconfdir}/bind/db.127 \
93*4882a593Smuzhiyun	${sysconfdir}/bind/db.empty \
94*4882a593Smuzhiyun	${sysconfdir}/bind/db.local \
95*4882a593Smuzhiyun	${sysconfdir}/bind/db.root \
96*4882a593Smuzhiyun	"
97*4882a593Smuzhiyun
98*4882a593SmuzhiyunALTERNATIVE:${PN}-utils = "nslookup"
99*4882a593SmuzhiyunALTERNATIVE_LINK_NAME[nslookup] = "${bindir}/nslookup"
100*4882a593SmuzhiyunALTERNATIVE_PRIORITY = "100"
101*4882a593Smuzhiyun
102*4882a593SmuzhiyunPACKAGE_BEFORE_PN += "${PN}-utils"
103*4882a593SmuzhiyunFILES:${PN}-utils = "${bindir}/host ${bindir}/dig ${bindir}/mdig ${bindir}/nslookup ${bindir}/nsupdate"
104*4882a593SmuzhiyunFILES:${PN}-dev += "${bindir}/isc-config.h"
105*4882a593SmuzhiyunFILES:${PN} += "${sbindir}/generate-rndc-key.sh"
106*4882a593Smuzhiyun
107*4882a593SmuzhiyunPACKAGE_BEFORE_PN += "${PN}-libs"
108*4882a593Smuzhiyun# special arrangement below due to
109*4882a593Smuzhiyun# https://github.com/isc-projects/bind9/commit/0e25af628cd776f98c04fc4cc59048f5448f6c88
110*4882a593SmuzhiyunFILES_SOLIBSDEV = "${libdir}/*[!0-9].so ${libdir}/libbind9.so"
111*4882a593SmuzhiyunFILES:${PN}-libs = "${libdir}/named/*.so* ${libdir}/*-${PV}.so"
112*4882a593SmuzhiyunFILES:${PN}-staticdev += "${libdir}/*.la"
113*4882a593Smuzhiyun
114*4882a593SmuzhiyunRDEPENDS:${PN}-dev = ""
115