blob: cd51c07dc132d916c23a52f4b250e74965a522c8 [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 \
Brad Bishop19323692019-04-05 15:28:33 -040015 file://dnsmasq-resolved.conf \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050016"
17
18inherit pkgconfig update-rc.d systemd
19
20INITSCRIPT_NAME = "dnsmasq"
21INITSCRIPT_PARAMS = "defaults"
22
23PACKAGECONFIG ?= ""
24PACKAGECONFIG[dbus] = ",,dbus"
25PACKAGECONFIG[idn] = ",,libidn"
26PACKAGECONFIG[conntrack] = ",,libnetfilter-conntrack"
27PACKAGECONFIG[lua] = ",,lua"
28PACKAGECONFIG[resolvconf] = ",,,resolvconf"
29EXTRA_OEMAKE = "\
Patrick Williamsddad1a12017-02-23 20:36:32 -060030 'COPTS=${@bb.utils.contains('PACKAGECONFIG', 'dbus', '-DHAVE_DBUS', '', d)} \
31 ${@bb.utils.contains('PACKAGECONFIG', 'idn', '-DHAVE_IDN', '', d)} \
32 ${@bb.utils.contains('PACKAGECONFIG', 'conntrack', '-DHAVE_CONNTRACK', '', d)} \
33 ${@bb.utils.contains('PACKAGECONFIG', 'lua', '-DHAVE_LUASCRIPT', '', d)}' \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050034 'CFLAGS=${CFLAGS}' \
35 'LDFLAGS=${LDFLAGS}' \
36"
37
38SRC_URI += "${@bb.utils.contains('PACKAGECONFIG', 'resolvconf', 'file://dnsmasq.resolvconf file://99_dnsmasq file://dnsmasq-resolvconf-helper', '', d)}"
39
Patrick Williams213cb262021-08-07 19:21:33 -050040do_compile:append() {
Patrick Williamsb48b7b42016-08-17 15:04:38 -050041 # build dhcp_release
Patrick Williamsddad1a12017-02-23 20:36:32 -060042 cd ${S}/contrib/lease-tools
Patrick Williamsb48b7b42016-08-17 15:04:38 -050043 oe_runmake
44}
45
46do_install () {
47 oe_runmake "PREFIX=${D}${prefix}" \
48 "BINDIR=${D}${bindir}" \
49 "MANDIR=${D}${mandir}" \
50 install
51 install -d ${D}${sysconfdir}/ ${D}${sysconfdir}/init.d ${D}${sysconfdir}/dnsmasq.d
52 install -m 644 ${WORKDIR}/dnsmasq.conf ${D}${sysconfdir}/
53 install -m 755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/dnsmasq
54
55 install -d ${D}${systemd_unitdir}/system
56
Brad Bishop6e60e8b2018-02-01 10:27:11 -050057 if [ "${@bb.utils.filter('PACKAGECONFIG', 'resolvconf', d)}" ]; then
Patrick Williamsb48b7b42016-08-17 15:04:38 -050058 install -m 0644 ${WORKDIR}/dnsmasq-resolvconf.service ${D}${systemd_unitdir}/system/dnsmasq.service
59 else
60 install -m 0644 ${WORKDIR}/dnsmasq-noresolvconf.service ${D}${systemd_unitdir}/system/dnsmasq.service
61 fi
Brad Bishop19323692019-04-05 15:28:33 -040062 install -d ${D}${sysconfdir}/systemd/resolved.conf.d/
63 install -m 0644 ${WORKDIR}/dnsmasq-resolved.conf ${D}${sysconfdir}/systemd/resolved.conf.d/
Patrick Williamsb48b7b42016-08-17 15:04:38 -050064
Patrick Williamsddad1a12017-02-23 20:36:32 -060065 install -m 0755 ${S}/contrib/lease-tools/dhcp_release ${D}${bindir}
Patrick Williamsb48b7b42016-08-17 15:04:38 -050066
Brad Bishop6e60e8b2018-02-01 10:27:11 -050067 if [ "${@bb.utils.filter('PACKAGECONFIG', 'dbus', d)}" ]; then
Patrick Williamsb48b7b42016-08-17 15:04:38 -050068 install -d ${D}${sysconfdir}/dbus-1/system.d
69 install -m 644 dbus/dnsmasq.conf ${D}${sysconfdir}/dbus-1/system.d/
70 fi
Brad Bishop6e60e8b2018-02-01 10:27:11 -050071 if [ "${@bb.utils.filter('PACKAGECONFIG', 'resolvconf', d)}" ]; then
Patrick Williamsb48b7b42016-08-17 15:04:38 -050072 install -d ${D}${sysconfdir}/resolvconf/update.d/
73 install -m 0755 ${WORKDIR}/dnsmasq.resolvconf ${D}${sysconfdir}/resolvconf/update.d/dnsmasq
74
75 install -d ${D}${sysconfdir}/default/volatiles
76 install -m 0644 ${WORKDIR}/99_dnsmasq ${D}${sysconfdir}/default/volatiles
77 install -m 0755 ${WORKDIR}/dnsmasq-resolvconf-helper ${D}${bindir}
78 fi
79}
80
Patrick Williams213cb262021-08-07 19:21:33 -050081CONFFILES:${PN} = "${sysconfdir}/dnsmasq.conf"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050082
Patrick Williams213cb262021-08-07 19:21:33 -050083RPROVIDES:${PN} += "${PN}-systemd"
84RREPLACES:${PN} += "${PN}-systemd"
85RCONFLICTS:${PN} += "${PN}-systemd"
86SYSTEMD_SERVICE:${PN} = "dnsmasq.service"