blob: 5c6d220200973b00e20ad232903fc53ee792ca0f [file] [log] [blame]
Andrew Geissler595f6302022-01-24 19:11:47 +00001SUMMARY = "Publishes & browses available services on a link according to the Zeroconf / Bonjour protocol"
2DESCRIPTION = "Bonjour, also known as zero-configuration networking, enables automatic discovery of computers, devices, and services on IP networks."
3HOMEPAGE = "http://developer.apple.com/networking/bonjour/"
4LICENSE = "Apache-2.0 & BSD-3-Clause"
5LIC_FILES_CHKSUM = "file://../LICENSE;md5=31c50371921e0fb731003bbc665f29bf"
6
7DEPENDS:append:libc-musl = " musl-nscd"
8
9RPROVIDES:${PN} += "libdns_sd.so"
10
11SRC_URI = "https://opensource.apple.com/tarballs/mDNSResponder/mDNSResponder-${PV}.tar.gz \
12 file://mdns.service \
13 file://0001-mdns-include-stddef.h-for-NULL.patch;patchdir=.. \
14 file://0002-mdns-cross-compilation-fixes-for-bitbake.patch;patchdir=.. \
15 file://0001-Create-subroutine-for-cleaning-recent-interfaces.patch;patchdir=.. \
16 file://0002-Create-subroutine-for-tearing-down-an-interface.patch;patchdir=.. \
17 file://0003-Track-interface-socket-family.patch;patchdir=.. \
18 file://0004-Use-list-for-changed-interfaces.patch;patchdir=.. \
19 file://0006-Remove-unneeded-function.patch;patchdir=.. \
20 file://0008-Mark-deleted-interfaces-as-being-changed.patch;patchdir=.. \
21 file://0009-Fix-possible-NULL-dereference.patch;patchdir=.. \
22 file://0010-Handle-errors-from-socket-calls.patch;patchdir=.. \
23 file://0011-Change-a-dynamic-allocation-to-file-scope-variable.patch;patchdir=.. \
24 file://0001-dns-sd-Include-missing-headers.patch;patchdir=.. \
25 "
26SRC_URI[sha256sum] = "040f6495c18b9f0557bcf9e00cbcfc82b03405f5ba6963dc147730ca0ca90d6f"
27
28CVE_PRODUCT = "apple:mdnsresponder"
29
30# CVE-2007-0613 is not applicable as it only affects Apple products
31# i.e. ichat,mdnsresponder, instant message framework and MacOS.
32# Also, https://www.exploit-db.com/exploits/3230 shows the part of code
33# affected by CVE-2007-0613 which is not preset in upstream source code.
34# Hence, CVE-2007-0613 does not affect other Yocto implementations and
35# is not reported for other distros can be marked whitelisted.
36# Links:
37# https://vulmon.com/vulnerabilitydetails?qid=CVE-2007-0613
38# https://www.incibe-cert.es/en/early-warning/vulnerabilities/cve-2007-0613
39# https://security-tracker.debian.org/tracker/CVE-2007-0613
40# https://vulmon.com/vulnerabilitydetails?qid=CVE-2007-0613
41CVE_CHECK_WHITELIST += "CVE-2007-0613"
42
43PARALLEL_MAKE = ""
44
45S = "${WORKDIR}/mDNSResponder-${PV}/mDNSPosix"
46
47EXTRA_OEMAKE += "os=linux DEBUG=0 'CC=${CC}' 'LD=${CCLD} ${LDFLAGS}'"
48
49TARGET_CC_ARCH += "${LDFLAGS}"
50
51do_install () {
52 install -d ${D}${sbindir}
53 install -m 0755 build/prod/mdnsd ${D}${sbindir}
54
55 install -d ${D}${libdir}
56 cp build/prod/libdns_sd.so ${D}${libdir}/libdns_sd.so.1
57 chmod 0644 ${D}${libdir}/libdns_sd.so.1
58 ln -s libdns_sd.so.1 ${D}${libdir}/libdns_sd.so
59
60 install -d ${D}${includedir}
61 install -m 0644 ../mDNSShared/dns_sd.h ${D}${includedir}
62
63 install -d ${D}${mandir}/man8
64 install -m 0644 ../mDNSShared/mDNSResponder.8 ${D}${mandir}/man8/mdnsd.8
65
66 install -d ${D}${bindir}
67 install -m 0755 ../Clients/build/dns-sd ${D}${bindir}
68
69 install -d ${D}${libdir}
70 oe_libinstall -C build/prod -so libnss_mdns-0.2 ${D}${libdir}
71 ln -s libnss_mdns-0.2.so ${D}${libdir}/libnss_mdns.so.2
72
73 install -d ${D}${sysconfdir}
74 install -m 0644 nss_mdns.conf ${D}${sysconfdir}
75
76 install -d ${D}${mandir}/man5
77 install -m 0644 nss_mdns.conf.5 ${D}${mandir}/man5
78
79 install -d ${D}${mandir}/man8
80 install -m 0644 libnss_mdns.8 ${D}${mandir}/man8
81
82 install -d ${D}${systemd_unitdir}/system/
83 install -m 0644 ${WORKDIR}/mdns.service ${D}${systemd_unitdir}/system/
84}
85
86pkg_postinst:${PN} () {
87 sed -e '/^hosts:/s/\s*\<mdns\>//' \
88 -e 's/\(^hosts:.*\)\(\<files\>\)\(.*\)\(\<dns\>\)\(.*\)/\1\2 mdns\3\4\5/' \
89 -i $D/etc/nsswitch.conf
90}
91
92pkg_prerm:${PN} () {
93 sed -e '/^hosts:/s/\s*\<mdns\>//' \
94 -e '/^hosts:/s/\s*mdns//' \
95 -i $D/etc/nsswitch.conf
96}
97
98inherit systemd
99
100SYSTEMD_SERVICE:${PN} = "mdns.service"
101
102FILES:${PN} += "${systemd_unitdir}/system/mdns.service"
103FILES:${PN} += "${libdir}/libdns_sd.so.1 \
104 ${bindir}/dns-sd \
105 ${libdir}/libnss_mdns-0.2.so \
106 ${sysconfdir}/nss_mdns.conf"
107
108FILES:${PN}-dev += "${libdir}/libdns_sd.so \
109 ${includedir}/dns_sd.h "
110
111FILES:${PN}-man += "${mandir}/man8/mdnsd.8 \
112 ${mandir}/man5/nss_mdns.conf.5 \
113 ${mandir}/man8/libnss_mdns.8"
114
115PACKAGES = "${PN} ${PN}-dev ${PN}-man ${PN}-dbg"