a399b07613911ec11df0a10f23b44658b65bbaf3
[openwrt/svn-archive/archive.git] / openwrt / package / ulogd / Makefile
1 # $Id$
2
3 include $(TOPDIR)/rules.mk
4
5 PKG_NAME:=ulogd
6 PKG_VERSION:=1.23
7 PKG_RELEASE:=2.1
8 PKG_MD5SUM:=fa3dfcaacf31855626d5b731b04a077f
9
10 PKG_SOURCE_URL:=ftp://ftp.netfilter.org/pub/ulogd/ \
11 ftp://ftp.be.netfilter.org/pub/netfilter/ulogd/ \
12 ftp://ftp.de.netfilter.org/pub/netfilter/ulogd/ \
13 ftp://ftp.no.netfilter.org/pub/netfilter/ulogd/
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15 PKG_CAT:=bzcat
16
17 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
18 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
19
20 ifneq ($(BR2_PACKAGE_ULOGD_MOD_MYSQL),)
21 ULOGD_MYSQL_OPTION:=--with-mysql=$(STAGING_DIR)/usr
22 endif
23
24 ifneq ($(BR2_PACKAGE_ULOGD_MOD_PCAP),)
25 ULOGD_PCAP_HEADER:=yes
26 else
27 ULOGD_PCAP_HEADER:=no
28 endif
29
30 ifneq ($(BR2_PACKAGE_ULOGD_MOD_PGSQL),)
31 ULOGD_PGSQL_OPTION:=--with-pgsql=$(STAGING_DIR)/usr
32 endif
33
34 define IPKG_plugin_template
35
36 $$(IPKG_$(1)):
37 install -m0755 -d $$(IDIR_$(1))/usr/lib/ulogd
38 for m in $(2); do \
39 $(CP) $(PKG_INSTALL_DIR)/usr/lib/ulogd/ulogd_$$$${m}.so $$(IDIR_$(1))/usr/lib/ulogd/ ; \
40 done
41 $(RSTRIP) $$(IDIR_$(1))
42 $(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR)
43
44 endef
45
46 include $(TOPDIR)/package/rules.mk
47
48 $(eval $(call PKG_template,ULOGD,ulogd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
49 $(eval $(call PKG_template,ULOGD_MOD_MYSQL,ulogd-mod-mysql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
50 $(eval $(call PKG_template,ULOGD_MOD_PGSQL,ulogd-mod-pgsql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
51 $(eval $(call PKG_template,ULOGD_MOD_EXTRA,ulogd-mod-extra,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
52 $(eval $(call PKG_template,ULOGD_MOD_EXTRA,ulogd-mod-pcap,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
53
54 $(eval $(call IPKG_plugin_template,ULOGD_MOD_MYSQL,MYSQL))
55 $(eval $(call IPKG_plugin_template,ULOGD_MOD_PGSQL,PGSQL))
56 $(eval $(call IPKG_plugin_template,ULOGD_MOD_PCAP,PCAP))
57 $(eval $(call IPKG_plugin_template,ULOGD_MOD_EXTRA,LOCAL LOGEMU OPRINT PWSNIFF SYSLOG))
58
59 $(PKG_BUILD_DIR)/.configured:
60 (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status}; \
61 $(TARGET_CONFIGURE_OPTS) \
62 CFLAGS="$(TARGET_CFLAGS)" \
63 CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
64 LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
65 ac_cv_header_pcap_h=$(ULOGD_PCAP_HEADER) \
66 ./configure \
67 --target=$(GNU_TARGET_NAME) \
68 --host=$(GNU_TARGET_NAME) \
69 --build=$(GNU_HOST_NAME) \
70 --program-prefix="" \
71 --program-suffix="" \
72 --prefix=/usr \
73 --exec-prefix=/usr \
74 --bindir=/usr/bin \
75 --datadir=/usr/share \
76 --includedir=/usr/include \
77 --infodir=/usr/share/info \
78 --libdir=/usr/lib \
79 --libexecdir=/usr/lib \
80 --localstatedir=/var \
81 --mandir=/usr/share/man \
82 --sbindir=/usr/sbin \
83 --sysconfdir=/etc \
84 $(DISABLE_LARGEFILE) \
85 $(DISABLE_NLS) \
86 --enable-shared \
87 --disable-static \
88 $(ULOGD_MYSQL_OPTION) \
89 $(ULOGD_PGSQL_OPTION) \
90 );
91 touch $@
92
93 $(PKG_BUILD_DIR)/.built:
94 rm -rf $(PKG_INSTALL_DIR)
95 mkdir -p $(PKG_INSTALL_DIR)
96 $(MAKE) -C $(PKG_BUILD_DIR) \
97 DESTDIR="$(PKG_INSTALL_DIR)" \
98 STAGING_DIR=$(STAGING_DIR) \
99 all install
100 touch $@
101
102 $(IPKG_ULOGD):
103 install -d -m0755 $(IDIR_ULOGD)/etc
104 $(CP) $(PKG_INSTALL_DIR)/etc/ulogd.conf $(IDIR_ULOGD)/etc/
105 install -d -m0755 $(IDIR_ULOGD)/etc/default
106 install -m0644 ./files/ulogd.default $(IDIR_ULOGD)/etc/default/ulogd
107 install -d -m0755 $(IDIR_ULOGD)/etc/init.d
108 install -m0755 ./files/ulogd.init $(IDIR_ULOGD)/etc/init.d/ulogd
109 ln -sf ulogd $(IDIR_ULOGD)/etc/init.d/S49ulogd
110 install -d -m0755 $(IDIR_ULOGD)/usr/lib/ulogd
111 $(CP) $(PKG_INSTALL_DIR)/usr/lib/ulogd/ulogd_BASE.so $(IDIR_ULOGD)/usr/lib/ulogd/
112 install -d -m0755 $(IDIR_ULOGD)/usr/sbin
113 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ulogd $(IDIR_ULOGD)/usr/sbin/
114 $(RSTRIP) $(IDIR_ULOGD)
115 $(IPKG_BUILD) $(IDIR_ULOGD) $(PACKAGE_DIR)