linux-pam: add optional libselinux and audit dependencies
[buildroot-gz.git] / package / dnsmasq / dnsmasq.mk
blob7fb120003cea984d0acb0992587d82d51a23c2e8
1 ################################################################################
3 # dnsmasq
5 ################################################################################
7 DNSMASQ_VERSION = 2.75
8 DNSMASQ_SOURCE = dnsmasq-$(DNSMASQ_VERSION).tar.xz
9 DNSMASQ_SITE = http://thekelleys.org.uk/dnsmasq
10 DNSMASQ_MAKE_ENV = $(TARGET_MAKE_ENV) CC="$(TARGET_CC)"
11 DNSMASQ_MAKE_OPTS = COPTS="$(DNSMASQ_COPTS)" PREFIX=/usr CFLAGS="$(TARGET_CFLAGS)"
12 DNSMASQ_MAKE_OPTS += DESTDIR=$(TARGET_DIR) LDFLAGS="$(TARGET_LDFLAGS)"
13 DNSMASQ_DEPENDENCIES = host-pkgconf
14 DNSMASQ_LICENSE = GPLv2 or GPLv3
15 DNSMASQ_LICENSE_FILES = COPYING COPYING-v3
17 ifneq ($(BR2_PACKAGE_DNSMASQ_DHCP),y)
18 DNSMASQ_COPTS += -DNO_DHCP
19 endif
21 ifeq ($(BR2_PACKAGE_DNSMASQ_DNSSEC),y)
22 DNSMASQ_DEPENDENCIES += gmp nettle
23 DNSMASQ_COPTS += -DHAVE_DNSSEC
24 ifeq ($(BR2_STATIC_LIBS),y)
25 DNSMASQ_COPTS += -DHAVE_DNSSEC_STATIC
26 endif
27 endif
29 ifneq ($(BR2_PACKAGE_DNSMASQ_TFTP),y)
30 DNSMASQ_COPTS += -DNO_TFTP
31 endif
33 # NLS requires IDN so only enable it (i18n) when IDN is true
34 ifeq ($(BR2_PACKAGE_DNSMASQ_IDN),y)
35 DNSMASQ_DEPENDENCIES += libidn $(if $(BR2_NEEDS_GETTEXT_IF_LOCALE),gettext) host-gettext
36 DNSMASQ_MAKE_OPTS += LIBS+="$(if $(BR2_NEEDS_GETTEXT_IF_LOCALE),-lintl)"
37 DNSMASQ_COPTS += -DHAVE_IDN
38 DNSMASQ_I18N = $(if $(BR2_ENABLE_LOCALE),-i18n)
39 endif
41 ifeq ($(BR2_PACKAGE_DNSMASQ_CONNTRACK),y)
42 DNSMASQ_DEPENDENCIES += libnetfilter_conntrack
43 endif
45 ifeq ($(BR2_PACKAGE_DNSMASQ_CONNTRACK),y)
46 define DNSMASQ_ENABLE_CONNTRACK
47 $(SED) 's^.*#define HAVE_CONNTRACK.*^#define HAVE_CONNTRACK^' \
48 $(DNSMASQ_DIR)/src/config.h
49 endef
50 endif
52 ifeq ($(BR2_PACKAGE_DNSMASQ_LUA),y)
53 DNSMASQ_DEPENDENCIES += lua
55 # liblua uses dlopen when dynamically linked
56 ifneq ($(BR2_STATIC_LIBS),y)
57 DNSMASQ_MAKE_OPTS += LIBS+="-ldl"
58 endif
60 define DNSMASQ_ENABLE_LUA
61 $(SED) 's/lua5.1/lua/g' $(DNSMASQ_DIR)/Makefile
62 $(SED) 's^.*#define HAVE_LUASCRIPT.*^#define HAVE_LUASCRIPT^' \
63 $(DNSMASQ_DIR)/src/config.h
64 endef
65 endif
67 ifeq ($(BR2_PACKAGE_DBUS),y)
68 DNSMASQ_DEPENDENCIES += dbus
69 endif
71 define DNSMASQ_FIX_PKGCONFIG
72 $(SED) 's^PKG_CONFIG = pkg-config^PKG_CONFIG = $(PKG_CONFIG_HOST_BINARY)^' \
73 $(DNSMASQ_DIR)/Makefile
74 endef
76 ifeq ($(BR2_PACKAGE_DBUS),y)
77 define DNSMASQ_ENABLE_DBUS
78 $(SED) 's^.*#define HAVE_DBUS.*^#define HAVE_DBUS^' \
79 $(DNSMASQ_DIR)/src/config.h
80 endef
81 else
82 define DNSMASQ_ENABLE_DBUS
83 $(SED) 's^.*#define HAVE_DBUS.*^/* #define HAVE_DBUS */^' \
84 $(DNSMASQ_DIR)/src/config.h
85 endef
86 endif
88 define DNSMASQ_BUILD_CMDS
89 $(DNSMASQ_FIX_PKGCONFIG)
90 $(DNSMASQ_ENABLE_DBUS)
91 $(DNSMASQ_ENABLE_LUA)
92 $(DNSMASQ_ENABLE_CONNTRACK)
93 $(DNSMASQ_MAKE_ENV) $(MAKE) -C $(@D) $(DNSMASQ_MAKE_OPTS) all$(DNSMASQ_I18N)
94 endef
96 ifeq ($(BR2_PACKAGE_DBUS),y)
97 define DNSMASQ_INSTALL_DBUS
98 $(INSTALL) -m 0644 -D $(@D)/dbus/dnsmasq.conf \
99 $(TARGET_DIR)/etc/dbus-1/system.d/dnsmasq.conf
100 endef
101 endif
103 define DNSMASQ_INSTALL_TARGET_CMDS
104 $(DNSMASQ_MAKE_ENV) $(MAKE) -C $(@D) $(DNSMASQ_MAKE_OPTS) install$(DNSMASQ_I18N)
105 mkdir -p $(TARGET_DIR)/var/lib/misc/
106 $(DNSMASQ_INSTALL_DBUS)
107 endef
109 define DNSMASQ_INSTALL_INIT_SYSV
110 $(INSTALL) -m 755 -D package/dnsmasq/S80dnsmasq \
111 $(TARGET_DIR)/etc/init.d/S80dnsmasq
112 endef
114 $(eval $(generic-package))