blob: a8ff21a125c951d45b749f7bbcc86673eeac0448 [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
Andrew Geissler9aee5002022-03-30 16:27:02 +00005LICENSE = "GPL-2.0-only | GPL-3.0-only"
Andrew Geissler87f5cff2022-09-30 13:13:31 -05006LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
7 file://COPYING-v3;md5=d32239bcb673463ab874e80d47fae504 \
8 "
Patrick Williamsb48b7b42016-08-17 15:04:38 -05009
Brad Bishopd7bf8c12018-02-25 22:55:05 -050010#at least versions 2.69 and prior are moved to the archive folder on the server
11SRC_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 -050012 file://init \
13 file://dnsmasq.conf \
14 file://dnsmasq-resolvconf.service \
15 file://dnsmasq-noresolvconf.service \
Brad Bishop19323692019-04-05 15:28:33 -040016 file://dnsmasq-resolved.conf \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050017"
18
19inherit pkgconfig update-rc.d systemd
20
21INITSCRIPT_NAME = "dnsmasq"
22INITSCRIPT_PARAMS = "defaults"
23
24PACKAGECONFIG ?= ""
25PACKAGECONFIG[dbus] = ",,dbus"
26PACKAGECONFIG[idn] = ",,libidn"
27PACKAGECONFIG[conntrack] = ",,libnetfilter-conntrack"
28PACKAGECONFIG[lua] = ",,lua"
29PACKAGECONFIG[resolvconf] = ",,,resolvconf"
30EXTRA_OEMAKE = "\
Patrick Williamsddad1a12017-02-23 20:36:32 -060031 'COPTS=${@bb.utils.contains('PACKAGECONFIG', 'dbus', '-DHAVE_DBUS', '', d)} \
32 ${@bb.utils.contains('PACKAGECONFIG', 'idn', '-DHAVE_IDN', '', d)} \
33 ${@bb.utils.contains('PACKAGECONFIG', 'conntrack', '-DHAVE_CONNTRACK', '', d)} \
34 ${@bb.utils.contains('PACKAGECONFIG', 'lua', '-DHAVE_LUASCRIPT', '', d)}' \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050035 'CFLAGS=${CFLAGS}' \
36 'LDFLAGS=${LDFLAGS}' \
37"
38
39SRC_URI += "${@bb.utils.contains('PACKAGECONFIG', 'resolvconf', 'file://dnsmasq.resolvconf file://99_dnsmasq file://dnsmasq-resolvconf-helper', '', d)}"
40
Patrick Williams213cb262021-08-07 19:21:33 -050041do_compile:append() {
Patrick Williamsb48b7b42016-08-17 15:04:38 -050042 # build dhcp_release
Patrick Williamsddad1a12017-02-23 20:36:32 -060043 cd ${S}/contrib/lease-tools
Patrick Williamsb48b7b42016-08-17 15:04:38 -050044 oe_runmake
45}
46
47do_install () {
48 oe_runmake "PREFIX=${D}${prefix}" \
49 "BINDIR=${D}${bindir}" \
50 "MANDIR=${D}${mandir}" \
51 install
52 install -d ${D}${sysconfdir}/ ${D}${sysconfdir}/init.d ${D}${sysconfdir}/dnsmasq.d
53 install -m 644 ${WORKDIR}/dnsmasq.conf ${D}${sysconfdir}/
54 install -m 755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/dnsmasq
55
56 install -d ${D}${systemd_unitdir}/system
57
Brad Bishop6e60e8b2018-02-01 10:27:11 -050058 if [ "${@bb.utils.filter('PACKAGECONFIG', 'resolvconf', d)}" ]; then
Patrick Williamsb48b7b42016-08-17 15:04:38 -050059 install -m 0644 ${WORKDIR}/dnsmasq-resolvconf.service ${D}${systemd_unitdir}/system/dnsmasq.service
60 else
61 install -m 0644 ${WORKDIR}/dnsmasq-noresolvconf.service ${D}${systemd_unitdir}/system/dnsmasq.service
62 fi
Brad Bishop19323692019-04-05 15:28:33 -040063 install -d ${D}${sysconfdir}/systemd/resolved.conf.d/
64 install -m 0644 ${WORKDIR}/dnsmasq-resolved.conf ${D}${sysconfdir}/systemd/resolved.conf.d/
Patrick Williamsb48b7b42016-08-17 15:04:38 -050065
Patrick Williamsddad1a12017-02-23 20:36:32 -060066 install -m 0755 ${S}/contrib/lease-tools/dhcp_release ${D}${bindir}
Patrick Williamsb48b7b42016-08-17 15:04:38 -050067
Brad Bishop6e60e8b2018-02-01 10:27:11 -050068 if [ "${@bb.utils.filter('PACKAGECONFIG', 'dbus', d)}" ]; then
Patrick Williamsb48b7b42016-08-17 15:04:38 -050069 install -d ${D}${sysconfdir}/dbus-1/system.d
70 install -m 644 dbus/dnsmasq.conf ${D}${sysconfdir}/dbus-1/system.d/
71 fi
Brad Bishop6e60e8b2018-02-01 10:27:11 -050072 if [ "${@bb.utils.filter('PACKAGECONFIG', 'resolvconf', d)}" ]; then
Patrick Williamsb48b7b42016-08-17 15:04:38 -050073 install -d ${D}${sysconfdir}/resolvconf/update.d/
74 install -m 0755 ${WORKDIR}/dnsmasq.resolvconf ${D}${sysconfdir}/resolvconf/update.d/dnsmasq
75
76 install -d ${D}${sysconfdir}/default/volatiles
77 install -m 0644 ${WORKDIR}/99_dnsmasq ${D}${sysconfdir}/default/volatiles
78 install -m 0755 ${WORKDIR}/dnsmasq-resolvconf-helper ${D}${bindir}
79 fi
80}
81
Patrick Williams213cb262021-08-07 19:21:33 -050082CONFFILES:${PN} = "${sysconfdir}/dnsmasq.conf"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050083
Patrick Williams213cb262021-08-07 19:21:33 -050084RPROVIDES:${PN} += "${PN}-systemd"
85RREPLACES:${PN} += "${PN}-systemd"
86RCONFLICTS:${PN} += "${PN}-systemd"
87SYSTEMD_SERVICE:${PN} = "dnsmasq.service"