blob: 4f4bbf144a62626ce9879074967af81d3f3ba4f9 [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001SUMMARY = "Lightweight, easy to configure DNS forwarder and DHCP server"
2HOMEPAGE = "http://www.thekelleys.org.uk/dnsmasq/doc.html"
3SECTION = "net"
4# GPLv3 was added in version 2.41 as license option
5LICENSE = "GPLv2 | GPLv3"
6LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \
7 file://COPYING-v3;md5=d32239bcb673463ab874e80d47fae504"
8
Brad Bishopd7bf8c12018-02-25 22:55:05 -05009#at least versions 2.69 and prior are moved to the archive folder on the server
10SRC_URI = "http://www.thekelleys.org.uk/dnsmasq/${@['archive/', ''][float(d.getVar('PV').split('.')[1]) > 69]}dnsmasq-${PV}.tar.gz;name=dnsmasq-${PV} \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050011 file://init \
12 file://dnsmasq.conf \
13 file://dnsmasq-resolvconf.service \
14 file://dnsmasq-noresolvconf.service \
15"
16
17inherit pkgconfig update-rc.d systemd
18
19INITSCRIPT_NAME = "dnsmasq"
20INITSCRIPT_PARAMS = "defaults"
21
22PACKAGECONFIG ?= ""
23PACKAGECONFIG[dbus] = ",,dbus"
24PACKAGECONFIG[idn] = ",,libidn"
25PACKAGECONFIG[conntrack] = ",,libnetfilter-conntrack"
26PACKAGECONFIG[lua] = ",,lua"
27PACKAGECONFIG[resolvconf] = ",,,resolvconf"
28EXTRA_OEMAKE = "\
Patrick Williamsddad1a12017-02-23 20:36:32 -060029 'COPTS=${@bb.utils.contains('PACKAGECONFIG', 'dbus', '-DHAVE_DBUS', '', d)} \
30 ${@bb.utils.contains('PACKAGECONFIG', 'idn', '-DHAVE_IDN', '', d)} \
31 ${@bb.utils.contains('PACKAGECONFIG', 'conntrack', '-DHAVE_CONNTRACK', '', d)} \
32 ${@bb.utils.contains('PACKAGECONFIG', 'lua', '-DHAVE_LUASCRIPT', '', d)}' \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050033 'CFLAGS=${CFLAGS}' \
34 'LDFLAGS=${LDFLAGS}' \
35"
36
37SRC_URI += "${@bb.utils.contains('PACKAGECONFIG', 'resolvconf', 'file://dnsmasq.resolvconf file://99_dnsmasq file://dnsmasq-resolvconf-helper', '', d)}"
38
39do_compile_append() {
40 # build dhcp_release
Patrick Williamsddad1a12017-02-23 20:36:32 -060041 cd ${S}/contrib/lease-tools
Patrick Williamsb48b7b42016-08-17 15:04:38 -050042 oe_runmake
43}
44
45do_install () {
46 oe_runmake "PREFIX=${D}${prefix}" \
47 "BINDIR=${D}${bindir}" \
48 "MANDIR=${D}${mandir}" \
49 install
50 install -d ${D}${sysconfdir}/ ${D}${sysconfdir}/init.d ${D}${sysconfdir}/dnsmasq.d
51 install -m 644 ${WORKDIR}/dnsmasq.conf ${D}${sysconfdir}/
52 install -m 755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/dnsmasq
53
54 install -d ${D}${systemd_unitdir}/system
55
Brad Bishop6e60e8b2018-02-01 10:27:11 -050056 if [ "${@bb.utils.filter('PACKAGECONFIG', 'resolvconf', d)}" ]; then
Patrick Williamsb48b7b42016-08-17 15:04:38 -050057 install -m 0644 ${WORKDIR}/dnsmasq-resolvconf.service ${D}${systemd_unitdir}/system/dnsmasq.service
58 else
59 install -m 0644 ${WORKDIR}/dnsmasq-noresolvconf.service ${D}${systemd_unitdir}/system/dnsmasq.service
60 fi
61
Patrick Williamsddad1a12017-02-23 20:36:32 -060062 install -m 0755 ${S}/contrib/lease-tools/dhcp_release ${D}${bindir}
Patrick Williamsb48b7b42016-08-17 15:04:38 -050063
Brad Bishop6e60e8b2018-02-01 10:27:11 -050064 if [ "${@bb.utils.filter('PACKAGECONFIG', 'dbus', d)}" ]; then
Patrick Williamsb48b7b42016-08-17 15:04:38 -050065 install -d ${D}${sysconfdir}/dbus-1/system.d
66 install -m 644 dbus/dnsmasq.conf ${D}${sysconfdir}/dbus-1/system.d/
67 fi
Brad Bishop6e60e8b2018-02-01 10:27:11 -050068 if [ "${@bb.utils.filter('PACKAGECONFIG', 'resolvconf', d)}" ]; then
Patrick Williamsb48b7b42016-08-17 15:04:38 -050069 install -d ${D}${sysconfdir}/resolvconf/update.d/
70 install -m 0755 ${WORKDIR}/dnsmasq.resolvconf ${D}${sysconfdir}/resolvconf/update.d/dnsmasq
71
72 install -d ${D}${sysconfdir}/default/volatiles
73 install -m 0644 ${WORKDIR}/99_dnsmasq ${D}${sysconfdir}/default/volatiles
74 install -m 0755 ${WORKDIR}/dnsmasq-resolvconf-helper ${D}${bindir}
75 fi
76}
77
78CONFFILES_${PN} = "${sysconfdir}/dnsmasq.conf"
79
80RPROVIDES_${PN} += "${PN}-systemd"
81RREPLACES_${PN} += "${PN}-systemd"
82RCONFLICTS_${PN} += "${PN}-systemd"
83SYSTEMD_SERVICE_${PN} = "dnsmasq.service"