5f6ec18d1892d5e7117f5673f724e29a3beaf106
[pti/rtp.git] / meta-starlingx / meta-stx-integ / recipes-support / dnsmasq / dnsmasq_2.76.bb
1 SUMMARY = "Lightweight, easy to configure DNS forwarder and DHCP server"
2 DESCRIPTION = "\
3 Dnsmasq is lightweight, easy to configure DNS forwarder and DHCP server. \
4 It is designed to provide DNS and, optionally, DHCP, to a small network. \
5 It can serve the names of local machines which are not in the global \
6 DNS. The DHCP server integrates with the DNS server and allows machines \
7 with DHCP-allocated addresses to appear in the DNS with names configured \
8 either in each host or in a central configuration file. Dnsmasq supports \
9 static and dynamic DHCP leases and BOOTP for network booting of diskless \
10 machines. \
11 "
12 HOMEPAGE = "http://www.thekelleys.org.uk/dnsmasq"
13 SECTION = "net"
14
15
16 SRCREV_FORMAT = "opendev"
17 SRCREV_opendev = "d778e862571957ece3c404c0c37d325769772fde"
18 SUBPATH0 = "dnsmasq-config"
19 DSTSUFX0 = "stx-configfiles"
20
21 # GPLv3 was added in version 2.41 as license option
22 LICENSE = "GPLv2 | GPLv3"
23 LIC_FILES_CHKSUM = "\
24     file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \
25     file://COPYING-v3;md5=d32239bcb673463ab874e80d47fae504 \
26 "
27
28 SRC_URI = " \
29     git://opendev.org/starlingx/config-files.git;protocol=https;destsuffix=${DSTSUFX0};branch="r/stx.3.0";subpath=${SUBPATH0};name=opendev \
30     http://www.thekelleys.org.uk/${BPN}/${BP}.tar.gz \
31     file://init \
32     file://dnsmasq-resolvconf.service \
33     file://lua.patch \
34     \
35     file://stx/dnsmasq-2.76-dns-sleep-resume.patch \
36     file://stx/dnsmasq-2.76-fix-dhcp-option-arrangements.patch \
37     file://stx/dnsmasq-2.76-pftables.patch \
38     file://stx/dnsmasq-2.76-fix-crash-dns-resume.patch \
39     file://stx/dnsmasq-2.76-warning-fixes.patch \
40     file://stx/dnsmasq-2.76-label-warning.patch \
41     file://stx/dnsmasq-2.76-label-man.patch \
42     file://stx/dnsmasq-2.76-coverity.patch \
43     file://stx/dnsmasq-2.76-dhcp-script-log.patch \
44     file://stx/dnsmasq-2.76-file_offset32.patch \
45     file://stx/dnsmasq-2.76-CVE-2017-14491.patch \
46     file://stx/dnsmasq-2.76-CVE-2017-14492.patch \
47     file://stx/dnsmasq-2.76-CVE-2017-14493.patch \
48     file://stx/dnsmasq-2.76-CVE-2017-14494.patch \
49     file://stx/dnsmasq-2.76-CVE-2017-14496.patch \
50     file://stx/dnsmasq-2.76-CVE-2017-14495.patch \
51     file://stx/dnsmasq-2.76-gita3303e196.patch \
52     file://stx/dnsmasq-2.76-underflow.patch \
53     file://stx/dnsmasq-2.76-misc-cleanups.patch \
54     file://stx/dnsmasq-2.76-CVE-2017-14491-2.patch \
55     file://stx/dnsmasq-2.76-inotify.patch \
56     file://stx/dnsmasq-update-ipv6-leases-from-config.patch \
57     file://stx/close-tftp-sockets-immediately.patch \
58     file://stx/dnsmasq.service \
59 "
60 SRC_URI[md5sum] = "6610f8233ca89b15a1bb47c788ffb84f"
61 SRC_URI[sha256sum] = "777c4762d2fee3738a0380401f2d087b47faa41db2317c60660d69ad10a76c32"
62
63 inherit pkgconfig update-rc.d systemd
64
65 INITSCRIPT_NAME = "dnsmasq"
66 INITSCRIPT_PARAMS = "defaults"
67
68 PACKAGECONFIG ?= "dbus idn"
69 PACKAGECONFIG[dbus] = ",,dbus"
70 PACKAGECONFIG[idn] = ",,libidn"
71 PACKAGECONFIG[conntrack] = ",,libnetfilter-conntrack"
72 PACKAGECONFIG[lua] = ",,lua"
73 PACKAGECONFIG[resolvconf] = ",,,resolvconf"
74
75 EXTRA_OEMAKE = "\
76     'COPTS=${@bb.utils.contains('PACKAGECONFIG', 'dbus', '-DHAVE_DBUS', '', d)} \
77            ${@bb.utils.contains('PACKAGECONFIG', 'idn', '-DHAVE_IDN', '', d)} \
78            ${@bb.utils.contains('PACKAGECONFIG', 'conntrack', '-DHAVE_CONNTRACK', '', d)} \
79            ${@bb.utils.contains('PACKAGECONFIG', 'lua', '-DHAVE_LUASCRIPT', '', d)}' \
80     'CFLAGS=${CFLAGS}' \
81     'LDFLAGS=${LDFLAGS}' \
82 "
83
84 SRC_URI += "${@bb.utils.contains('PACKAGECONFIG', 'resolvconf', 'file://dnsmasq.resolvconf file://99_dnsmasq file://dnsmasq-resolvconf-helper', '', d)}"
85
86 do_compile_append() {
87     # build dhcp_release
88     cd ${S}/contrib/lease-tools
89     oe_runmake
90 }
91
92 do_install () {
93     oe_runmake "PREFIX=${D}${prefix}" \
94                "BINDIR=${D}${bindir}" \
95                "MANDIR=${D}${mandir}" \
96                install
97
98     install -d ${D}${sysconfdir}/
99     install -d ${D}${sysconfdir}/init.d
100     install -d ${D}${sysconfdir}/dnsmasq.d
101
102     install -m 644 ${S}/dnsmasq.conf.example ${D}${sysconfdir}/dnsmasq.conf
103     cat << EOF >> ${D}${sysconfdir}/dnsmasq.conf
104
105 # Include all files in /etc/dnsmasq.d except RPM backup files
106 conf-dir=/etc/dnsmasq.d,.rpmnew,.rpmsave,.rpmorig
107 EOF
108
109     install -m 755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/dnsmasq
110
111     install -d ${D}${systemd_system_unitdir}
112
113     if [ "${@bb.utils.filter('PACKAGECONFIG', 'resolvconf', d)}" ]; then
114         install -m 0644 ${WORKDIR}/dnsmasq-resolvconf.service ${D}${systemd_system_unitdir}/dnsmasq.service
115     else
116         install -m 0644 ${WORKDIR}/stx/dnsmasq.service ${D}${systemd_system_unitdir}/dnsmasq.service
117     fi
118
119     install -m 0755 ${S}/contrib/lease-tools/dhcp_release ${D}${bindir}
120     install -m 0755 ${S}/contrib/lease-tools/dhcp_release6 ${D}${bindir}
121     install -m 0755 ${S}/contrib/lease-tools/dhcp_lease_time ${D}${bindir}
122
123     if [ "${@bb.utils.filter('PACKAGECONFIG', 'dbus', d)}" ]; then
124         install -d ${D}${sysconfdir}/dbus-1/system.d
125         install -m 644 dbus/dnsmasq.conf ${D}${sysconfdir}/dbus-1/system.d/
126     fi
127     if [ "${@bb.utils.filter('PACKAGECONFIG', 'resolvconf', d)}" ]; then
128         install -d ${D}${sysconfdir}/resolvconf/update.d/
129         install -m 0755 ${WORKDIR}/dnsmasq.resolvconf ${D}${sysconfdir}/resolvconf/update.d/dnsmasq
130
131         install -d ${D}${sysconfdir}/default/volatiles
132         install -m 0644 ${WORKDIR}/99_dnsmasq ${D}${sysconfdir}/default/volatiles
133         install -m 0755 ${WORKDIR}/dnsmasq-resolvconf-helper ${D}${bindir}
134     fi
135     install -m 755 ${WORKDIR}/${DSTSUFX0}/files/init ${D}/${sysconfdir}/init.d/dnsmasq
136 }
137
138 DISTRO_FEATURES_BACKFILL_CONSIDERED_remove = "sysvinit"
139
140 CONFFILES_${PN} = "${sysconfdir}/dnsmasq.conf"
141
142 RPROVIDES_${PN} += "${PN}-systemd"
143 RREPLACES_${PN} += "${PN}-systemd"
144 RCONFLICTS_${PN} += "${PN}-systemd"
145 SYSTEMD_SERVICE_${PN} = "dnsmasq.service"