1*4882a593SmuzhiyunSUMMARY = "Publishes & browses available services on a link according to the Zeroconf / Bonjour protocol"
2*4882a593SmuzhiyunDESCRIPTION = "Bonjour, also known as zero-configuration networking, enables automatic discovery of computers, devices, and services on IP networks."
3*4882a593SmuzhiyunHOMEPAGE = "http://developer.apple.com/networking/bonjour/"
4*4882a593SmuzhiyunLICENSE = "Apache-2.0 & BSD-3-Clause"
5*4882a593SmuzhiyunLIC_FILES_CHKSUM = "file://LICENSE;md5=31c50371921e0fb731003bbc665f29bf"
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunDEPENDS:append:libc-musl = " musl-nscd"
8*4882a593Smuzhiyun
9*4882a593SmuzhiyunRPROVIDES:${PN} += "libdns_sd.so"
10*4882a593Smuzhiyun
11*4882a593Smuzhiyun# matches annotated tag mDNSResponder-1310.140.1
12*4882a593SmuzhiyunSRCREV = "1d1de95b98fba2077d34c9d78b839a96aa0e1c77"
13*4882a593SmuzhiyunBRANCH = "rel/mDNSResponder-1310"
14*4882a593SmuzhiyunSRC_URI = "git://github.com/apple-oss-distributions/mDNSResponder;protocol=https;branch=${BRANCH} \
15*4882a593Smuzhiyun           file://mdns.service \
16*4882a593Smuzhiyun           file://0001-mdns-include-stddef.h-for-NULL.patch \
17*4882a593Smuzhiyun           file://0002-mdns-cross-compilation-fixes-for-bitbake.patch \
18*4882a593Smuzhiyun           file://0001-Create-subroutine-for-cleaning-recent-interfaces.patch \
19*4882a593Smuzhiyun           file://0002-Create-subroutine-for-tearing-down-an-interface.patch \
20*4882a593Smuzhiyun           file://0003-Track-interface-socket-family.patch \
21*4882a593Smuzhiyun           file://0004-Use-list-for-changed-interfaces.patch \
22*4882a593Smuzhiyun           file://0006-Remove-unneeded-function.patch \
23*4882a593Smuzhiyun           file://0008-Mark-deleted-interfaces-as-being-changed.patch \
24*4882a593Smuzhiyun           file://0009-Fix-possible-NULL-dereference.patch \
25*4882a593Smuzhiyun           file://0010-Handle-errors-from-socket-calls.patch \
26*4882a593Smuzhiyun           file://0011-Change-a-dynamic-allocation-to-file-scope-variable.patch \
27*4882a593Smuzhiyun           file://0001-dns-sd-Include-missing-headers.patch \
28*4882a593Smuzhiyun           file://0006-make-Add-top-level-Makefile.patch \
29*4882a593Smuzhiyun           "
30*4882a593Smuzhiyun
31*4882a593SmuzhiyunCVE_PRODUCT = "apple:mdnsresponder"
32*4882a593Smuzhiyun
33*4882a593Smuzhiyun# CVE-2007-0613 is not applicable as it only affects Apple products
34*4882a593Smuzhiyun# i.e. ichat,mdnsresponder, instant message framework and MacOS.
35*4882a593Smuzhiyun# Also, https://www.exploit-db.com/exploits/3230 shows the part of code
36*4882a593Smuzhiyun# affected by CVE-2007-0613 which is not preset in upstream source code.
37*4882a593Smuzhiyun# Hence, CVE-2007-0613 does not affect other Yocto implementations and
38*4882a593Smuzhiyun# is not reported for other distros can be marked whitelisted.
39*4882a593Smuzhiyun# Links:
40*4882a593Smuzhiyun# https://vulmon.com/vulnerabilitydetails?qid=CVE-2007-0613
41*4882a593Smuzhiyun# https://www.incibe-cert.es/en/early-warning/vulnerabilities/cve-2007-0613
42*4882a593Smuzhiyun# https://security-tracker.debian.org/tracker/CVE-2007-0613
43*4882a593Smuzhiyun# https://vulmon.com/vulnerabilitydetails?qid=CVE-2007-0613
44*4882a593SmuzhiyunCVE_CHECK_IGNORE += "CVE-2007-0613"
45*4882a593Smuzhiyun
46*4882a593SmuzhiyunPARALLEL_MAKE = ""
47*4882a593Smuzhiyun
48*4882a593Smuzhiyun# We install a stub Makefile in the top directory so that the various checks
49*4882a593Smuzhiyun# in base.bbclass pass their tests for a Makefile, this ensures (that amongst
50*4882a593Smuzhiyun# other things) the sstate checks will clean the build directory when the
51*4882a593Smuzhiyun# task hashes changes.
52*4882a593Smuzhiyun#
53*4882a593Smuzhiyun# We can't use the approach of setting ${S} to mDNSPosix as we need
54*4882a593Smuzhiyun# DEBUG_PREFIX_MAP to cover files which come from the Clients directory too.
55*4882a593SmuzhiyunS = "${WORKDIR}/git"
56*4882a593Smuzhiyun
57*4882a593SmuzhiyunEXTRA_OEMAKE += "os=linux DEBUG=0 'CC=${CC}' 'LD=${CCLD} ${LDFLAGS}'"
58*4882a593Smuzhiyun
59*4882a593SmuzhiyunTARGET_CC_ARCH += "${LDFLAGS}"
60*4882a593Smuzhiyun
61*4882a593Smuzhiyundo_install () {
62*4882a593Smuzhiyun    cd mDNSPosix
63*4882a593Smuzhiyun
64*4882a593Smuzhiyun    install -d ${D}${sbindir}
65*4882a593Smuzhiyun    install -m 0755 build/prod/mdnsd ${D}${sbindir}
66*4882a593Smuzhiyun
67*4882a593Smuzhiyun    install -d ${D}${libdir}
68*4882a593Smuzhiyun    cp build/prod/libdns_sd.so ${D}${libdir}/libdns_sd.so.1
69*4882a593Smuzhiyun    chmod 0644 ${D}${libdir}/libdns_sd.so.1
70*4882a593Smuzhiyun    ln -s libdns_sd.so.1 ${D}${libdir}/libdns_sd.so
71*4882a593Smuzhiyun
72*4882a593Smuzhiyun    install -d ${D}${includedir}
73*4882a593Smuzhiyun    install -m 0644 ../mDNSShared/dns_sd.h ${D}${includedir}
74*4882a593Smuzhiyun
75*4882a593Smuzhiyun    install -d ${D}${mandir}/man8
76*4882a593Smuzhiyun    install -m 0644 ../mDNSShared/mDNSResponder.8 ${D}${mandir}/man8/mdnsd.8
77*4882a593Smuzhiyun
78*4882a593Smuzhiyun    install -d ${D}${bindir}
79*4882a593Smuzhiyun    install -m 0755 ../Clients/build/dns-sd ${D}${bindir}
80*4882a593Smuzhiyun
81*4882a593Smuzhiyun    install -d ${D}${libdir}
82*4882a593Smuzhiyun    oe_libinstall -C build/prod -so libnss_mdns-0.2 ${D}${libdir}
83*4882a593Smuzhiyun    ln -s libnss_mdns-0.2.so ${D}${libdir}/libnss_mdns.so.2
84*4882a593Smuzhiyun
85*4882a593Smuzhiyun    install -d ${D}${sysconfdir}
86*4882a593Smuzhiyun    install -m 0644 nss_mdns.conf ${D}${sysconfdir}
87*4882a593Smuzhiyun
88*4882a593Smuzhiyun    install -d ${D}${mandir}/man5
89*4882a593Smuzhiyun    install -m 0644 nss_mdns.conf.5 ${D}${mandir}/man5
90*4882a593Smuzhiyun
91*4882a593Smuzhiyun    install -d ${D}${mandir}/man8
92*4882a593Smuzhiyun    install -m 0644 libnss_mdns.8 ${D}${mandir}/man8
93*4882a593Smuzhiyun
94*4882a593Smuzhiyun    install -d ${D}${systemd_unitdir}/system/
95*4882a593Smuzhiyun    install -m 0644 ${WORKDIR}/mdns.service ${D}${systemd_unitdir}/system/
96*4882a593Smuzhiyun}
97*4882a593Smuzhiyun
98*4882a593Smuzhiyunpkg_postinst:${PN} () {
99*4882a593Smuzhiyun    sed -e '/^hosts:/s/\s*\<mdns\>//' \
100*4882a593Smuzhiyun        -e 's/\(^hosts:.*\)\(\<files\>\)\(.*\)\(\<dns\>\)\(.*\)/\1\2 mdns\3\4\5/' \
101*4882a593Smuzhiyun        -i $D/etc/nsswitch.conf
102*4882a593Smuzhiyun}
103*4882a593Smuzhiyun
104*4882a593Smuzhiyunpkg_prerm:${PN} () {
105*4882a593Smuzhiyun    sed -e '/^hosts:/s/\s*\<mdns\>//' \
106*4882a593Smuzhiyun        -e '/^hosts:/s/\s*mdns//' \
107*4882a593Smuzhiyun        -i $D/etc/nsswitch.conf
108*4882a593Smuzhiyun}
109*4882a593Smuzhiyun
110*4882a593Smuzhiyuninherit systemd
111*4882a593Smuzhiyun
112*4882a593SmuzhiyunSYSTEMD_SERVICE:${PN} = "mdns.service"
113*4882a593Smuzhiyun
114*4882a593SmuzhiyunFILES:${PN} += "${systemd_unitdir}/system/mdns.service"
115*4882a593SmuzhiyunFILES:${PN} += "${libdir}/libdns_sd.so.1 \
116*4882a593Smuzhiyun                ${bindir}/dns-sd \
117*4882a593Smuzhiyun                ${libdir}/libnss_mdns-0.2.so \
118*4882a593Smuzhiyun                ${sysconfdir}/nss_mdns.conf"
119*4882a593Smuzhiyun
120*4882a593SmuzhiyunFILES:${PN}-dev += "${libdir}/libdns_sd.so \
121*4882a593Smuzhiyun                    ${includedir}/dns_sd.h "
122*4882a593Smuzhiyun
123*4882a593SmuzhiyunFILES:${PN}-man += "${mandir}/man8/mdnsd.8 \
124*4882a593Smuzhiyun                    ${mandir}/man5/nss_mdns.conf.5 \
125*4882a593Smuzhiyun                    ${mandir}/man8/libnss_mdns.8"
126*4882a593Smuzhiyun
127*4882a593SmuzhiyunPACKAGES = "${PN} ${PN}-dev ${PN}-man ${PN}-dbg"
128