1*44b3caf2SPatrick WilliamsSUMMARY = "Publishes & browses available services on a link according to the Zeroconf / Bonjour protocol"
2*44b3caf2SPatrick WilliamsDESCRIPTION = "Bonjour, also known as zero-configuration networking, enables automatic discovery of computers, devices, and services on IP networks."
3*44b3caf2SPatrick WilliamsHOMEPAGE = "https://developer.apple.com/bonjour/"
4*44b3caf2SPatrick WilliamsLICENSE = "Apache-2.0 & BSD-3-Clause"
5*44b3caf2SPatrick WilliamsLIC_FILES_CHKSUM = "file://LICENSE;md5=31c50371921e0fb731003bbc665f29bf"
6*44b3caf2SPatrick Williams
7*44b3caf2SPatrick WilliamsDEPENDS:append:libc-musl = " musl-nscd"
8*44b3caf2SPatrick Williams
9*44b3caf2SPatrick WilliamsSRC_URI = "git://github.com/apple-oss-distributions/mDNSResponder;protocol=https;branch=rel/mDNSResponder-2200 \
10*44b3caf2SPatrick Williams           file://0001-dns-sd-Include-missing-headers.patch \
11*44b3caf2SPatrick Williams           file://0002-make-Set-libdns_sd.so-soname-correctly.patch \
12*44b3caf2SPatrick Williams           file://0004-make-Separate-TLS-targets-from-libraries.patch \
13*44b3caf2SPatrick Williams           file://0005-mDNSCore-Fix-broken-debug-parameter.patch \
14*44b3caf2SPatrick Williams           file://0006-make-Add-top-level-Makefile.patch \
15*44b3caf2SPatrick Williams           file://0001-Create-subroutine-for-cleaning-recent-interfaces.patch \
16*44b3caf2SPatrick Williams           file://0002-Create-subroutine-for-tearing-down-an-interface.patch \
17*44b3caf2SPatrick Williams           file://0003-Track-interface-socket-family.patch \
18*44b3caf2SPatrick Williams           file://0004-Indicate-loopback-interface-to-mDNS-core.patch \
19*44b3caf2SPatrick Williams           file://0005-Use-list-for-changed-interfaces.patch \
20*44b3caf2SPatrick Williams           file://0006-Handle-noisy-netlink-sockets.patch \
21*44b3caf2SPatrick Williams           file://0007-Mark-deleted-interfaces-as-being-changed.patch \
22*44b3caf2SPatrick Williams           file://0008-Handle-errors-from-socket-calls.patch \
23*44b3caf2SPatrick Williams           file://0009-remove-unneeded-headers.patch \
24*44b3caf2SPatrick Williams           file://mdns.service \
25*44b3caf2SPatrick Williams           file://0015-Add-missing-limits.h.patch \
26*44b3caf2SPatrick Williams           file://0001-Handle-interface-without-ifa_addr.patch \
27*44b3caf2SPatrick Williams           file://0001-Fix-SIGSEGV-during-DumpStateLog.patch \
28*44b3caf2SPatrick Williams           "
29*44b3caf2SPatrick WilliamsSRCREV = "8f70f98fc1d0cf439ca3a6470be6ad8ac2bcc019"
30*44b3caf2SPatrick Williams
31*44b3caf2SPatrick Williams# We install a stub Makefile in the top directory so that the various checks
32*44b3caf2SPatrick Williams# in base.bbclass pass their tests for a Makefile, this ensures (that amongst
33*44b3caf2SPatrick Williams# other things) the sstate checks will clean the build directory when the
34*44b3caf2SPatrick Williams# task hashes changes.
35*44b3caf2SPatrick Williams#
36*44b3caf2SPatrick Williams# We can't use the approach of setting ${S} to mDNSPosix as we need
37*44b3caf2SPatrick Williams# DEBUG_PREFIX_MAP to cover files which come from the Clients directory too.
38*44b3caf2SPatrick WilliamsS = "${WORKDIR}/git"
39*44b3caf2SPatrick Williams
40*44b3caf2SPatrick Williamsinherit github-releases manpages systemd update-rc.d
41*44b3caf2SPatrick Williams
42*44b3caf2SPatrick WilliamsPACKAGECONFIG ?= "tls \
43*44b3caf2SPatrick Williams		  ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}"
44*44b3caf2SPatrick WilliamsPACKAGECONFIG[debug] = "DEBUG=1,DEBUG=0"
45*44b3caf2SPatrick WilliamsPACKAGECONFIG[ipv6] = "HAVE_IPV6=1,HAVE_IPV6=0"
46*44b3caf2SPatrick WilliamsPACKAGECONFIG[manpages] = ""
47*44b3caf2SPatrick WilliamsPACKAGECONFIG[tls] = ",tls=no,mbedtls"
48*44b3caf2SPatrick Williams
49*44b3caf2SPatrick WilliamsCVE_PRODUCT = "apple:mdnsresponder"
50*44b3caf2SPatrick Williams
51*44b3caf2SPatrick WilliamsCVE_STATUS[CVE-2007-0613] = "not-applicable-platform: Issue affects Apple products \
52*44b3caf2SPatrick Williamsi.e. ichat,mdnsresponder, instant message framework and MacOS. Also, \
53*44b3caf2SPatrick Williamshttps://www.exploit-db.com/exploits/3230 shows the part of code \
54*44b3caf2SPatrick Williamsaffected by CVE-2007-0613 which is not preset in upstream source code. \
55*44b3caf2SPatrick WilliamsHence, CVE-2007-0613 does not affect other Yocto implementations and \
56*44b3caf2SPatrick Williamsis not reported for other distros can be marked whitelisted. \
57*44b3caf2SPatrick WilliamsLinks: https://vulmon.com/vulnerabilitydetails?qid=CVE-2007-0613 \
58*44b3caf2SPatrick Williamshttps://www.incibe-cert.es/en/early-warning/vulnerabilities/cve-2007-0613 \
59*44b3caf2SPatrick Williamshttps://security-tracker.debian.org/tracker/CVE-2007-0613 \
60*44b3caf2SPatrick Williamshttps://vulmon.com/vulnerabilitydetails?qid=CVE-2007-0613"
61*44b3caf2SPatrick Williams
62*44b3caf2SPatrick WilliamsPARALLEL_MAKE = ""
63*44b3caf2SPatrick Williams
64*44b3caf2SPatrick WilliamsEXTRA_OEMAKE = "os=linux 'CC=${CCLD}' 'LD=${CCLD}' 'LINKOPTS=${LDFLAGS}' STRIP=: ${PACKAGECONFIG_CONFARGS}"
65*44b3caf2SPatrick Williams
66*44b3caf2SPatrick Williams# MDNS_VERSIONSTR_NODTS disables __DATE__ and __TIME__ in the version string,
67*44b3caf2SPatrick Williams# which are fixed anyway for build reproducibility.
68*44b3caf2SPatrick WilliamsTARGET_CPPFLAGS += "-DMDNS_VERSIONSTR_NODTS"
69*44b3caf2SPatrick Williams
70*44b3caf2SPatrick WilliamsTARGET_CC_ARCH += "${LDFLAGS}"
71*44b3caf2SPatrick Williams
72*44b3caf2SPatrick WilliamsMDNS_BUILDDIR = "build/${@bb.utils.contains('PACKAGECONFIG','debug','debug','prod', d)}"
73*44b3caf2SPatrick Williams
74*44b3caf2SPatrick Williamsdo_install () {
75*44b3caf2SPatrick Williams	cd mDNSPosix
76*44b3caf2SPatrick Williams
77*44b3caf2SPatrick Williams	install -d ${D}${sbindir}
78*44b3caf2SPatrick Williams	install ${MDNS_BUILDDIR}/mdnsd ${D}${sbindir}
79*44b3caf2SPatrick Williams
80*44b3caf2SPatrick Williams	install -d ${D}${libdir}
81*44b3caf2SPatrick Williams	install -m 0644 ${MDNS_BUILDDIR}/libdns_sd.so ${D}${libdir}/libdns_sd.so.1
82*44b3caf2SPatrick Williams	ln -s libdns_sd.so.1 ${D}${libdir}/libdns_sd.so
83*44b3caf2SPatrick Williams
84*44b3caf2SPatrick Williams	install -d ${D}${includedir}
85*44b3caf2SPatrick Williams	install -m 0644 ../mDNSShared/dns_sd.h ${D}${includedir}
86*44b3caf2SPatrick Williams
87*44b3caf2SPatrick Williams	install -d ${D}${mandir}/man8
88*44b3caf2SPatrick Williams	install -m 0644 ../mDNSShared/mDNSResponder.8 ${D}${mandir}/man8/mdnsd.8
89*44b3caf2SPatrick Williams
90*44b3caf2SPatrick Williams	install -d ${D}${bindir}
91*44b3caf2SPatrick Williams	install -m 0755 ../Clients/build/dns-sd ${D}${bindir}
92*44b3caf2SPatrick Williams
93*44b3caf2SPatrick Williams	install -d ${D}${libdir}
94*44b3caf2SPatrick Williams	oe_libinstall -C ${MDNS_BUILDDIR} -so libnss_mdns-0.2 ${D}${libdir}
95*44b3caf2SPatrick Williams	ln -s libnss_mdns-0.2.so ${D}${libdir}/libnss_mdns.so.2
96*44b3caf2SPatrick Williams
97*44b3caf2SPatrick Williams	install -d ${D}${sysconfdir}
98*44b3caf2SPatrick Williams	install -m 0644 nss_mdns.conf ${D}${sysconfdir}
99*44b3caf2SPatrick Williams
100*44b3caf2SPatrick Williams	install -d ${D}${mandir}/man5
101*44b3caf2SPatrick Williams	install -m 0644 nss_mdns.conf.5 ${D}${mandir}/man5
102*44b3caf2SPatrick Williams
103*44b3caf2SPatrick Williams	install -d ${D}${mandir}/man8
104*44b3caf2SPatrick Williams	install -m 0644 libnss_mdns.8 ${D}${mandir}/man8
105*44b3caf2SPatrick Williams
106*44b3caf2SPatrick Williams	install -d ${D}${systemd_system_unitdir}
107*44b3caf2SPatrick Williams	install -m 0644 ${WORKDIR}/mdns.service ${D}${systemd_system_unitdir}
108*44b3caf2SPatrick Williams
109*44b3caf2SPatrick Williams	install -d ${D}${INIT_D_DIR}
110*44b3caf2SPatrick Williams	install mdnsd.sh ${D}${INIT_D_DIR}/mdns
111*44b3caf2SPatrick Williams}
112*44b3caf2SPatrick Williams
113*44b3caf2SPatrick Williamspkg_postinst:${PN} () {
114*44b3caf2SPatrick Williams	if [ -r $D${sysconfdir}/nsswitch.conf ]; then
115*44b3caf2SPatrick Williams		sed -e '/^hosts:/s/\s*\<mdns\>//' \
116*44b3caf2SPatrick Williams			-e 's/\(^hosts:.*\)\(\<files\>\)\(.*\)\(\<dns\>\)\(.*\)/\1\2 mdns\3\4\5/' \
117*44b3caf2SPatrick Williams			-i $D${sysconfdir}/nsswitch.conf
118*44b3caf2SPatrick Williams	fi
119*44b3caf2SPatrick Williams}
120*44b3caf2SPatrick Williams
121*44b3caf2SPatrick Williamspkg_prerm:${PN} () {
122*44b3caf2SPatrick Williams	if [ -r $D${sysconfdir}/nsswitch.conf ]; then
123*44b3caf2SPatrick Williams		sed -e '/^hosts:/s/\s*\<mdns\>//' \
124*44b3caf2SPatrick Williams			-e '/^hosts:/s/\s*mdns//' \
125*44b3caf2SPatrick Williams				-i $D${sysconfdir}/nsswitch.conf
126*44b3caf2SPatrick Williams	fi
127*44b3caf2SPatrick Williams}
128*44b3caf2SPatrick Williams
129*44b3caf2SPatrick WilliamsSYSTEMD_SERVICE:${PN} = "mdns.service"
130*44b3caf2SPatrick WilliamsINITSCRIPT_NAME = "mdns"
131*44b3caf2SPatrick Williams
132*44b3caf2SPatrick WilliamsFILES_SOLIBSDEV = "${libdir}/libdns_sd.so"
133*44b3caf2SPatrick WilliamsFILES:${PN} += "${libdir}/libnss_mdns-0.2.so"
134*44b3caf2SPatrick Williams
135*44b3caf2SPatrick WilliamsRPROVIDES:${PN} += "libdns_sd.so"
136