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