893fd5b8f99576715a7a98598b78c4a8e6938224
[openwrt.git] / 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_PGSQL),)
25 ULOGD_PGSQL_OPTION:=--with-pgsql=$(STAGING_DIR)/usr
26 endif
27
28 define IPKG_plugin_template
29
30 $$(IPKG_$(1)):
31         install -m0755 -d $$(IDIR_$(1))/usr/lib/ulogd
32         for m in $(2); do \
33                 $(CP) $(PKG_INSTALL_DIR)/usr/lib/ulogd/ulogd_$$$${m}.so $$(IDIR_$(1))/usr/lib/ulogd/ ; \
34         done
35         $(RSTRIP) $$(IDIR_$(1))
36         $(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR)
37
38 endef
39
40 include $(TOPDIR)/package/rules.mk
41
42 $(eval $(call PKG_template,ULOGD,ulogd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
43 $(eval $(call PKG_template,ULOGD_MOD_MYSQL,ulogd-mod-mysql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
44 $(eval $(call PKG_template,ULOGD_MOD_PGSQL,ulogd-mod-pgsql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
45 $(eval $(call PKG_template,ULOGD_MOD_EXTRA,ulogd-mod-extra,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
46
47 $(eval $(call IPKG_plugin_template,ULOGD_MOD_MYSQL,MYSQL))
48 $(eval $(call IPKG_plugin_template,ULOGD_MOD_PGSQL,PGSQL))
49 $(eval $(call IPKG_plugin_template,ULOGD_MOD_EXTRA,LOCAL LOGEMU OPRINT PWSNIFF SYSLOG))
50
51 $(PKG_BUILD_DIR)/.configured:
52         (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status}; \
53                 $(TARGET_CONFIGURE_OPTS) \
54                 CFLAGS="$(TARGET_CFLAGS)" \
55                 CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
56                 LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
57                 ac_cv_header_pcap_h=no \
58                 ./configure \
59                         --target=$(GNU_TARGET_NAME) \
60                         --host=$(GNU_TARGET_NAME) \
61                         --build=$(GNU_HOST_NAME) \
62                         --program-prefix="" \
63                         --program-suffix="" \
64                         --prefix=/usr \
65                         --exec-prefix=/usr \
66                         --bindir=/usr/bin \
67                         --datadir=/usr/share \
68                         --includedir=/usr/include \
69                         --infodir=/usr/share/info \
70                         --libdir=/usr/lib \
71                         --libexecdir=/usr/lib \
72                         --localstatedir=/var \
73                         --mandir=/usr/share/man \
74                         --sbindir=/usr/sbin \
75                         --sysconfdir=/etc \
76                         $(DISABLE_LARGEFILE) \
77                         $(DISABLE_NLS) \
78                         --enable-shared \
79                         --disable-static \
80                         $(ULOGD_MYSQL_OPTION) \
81                         $(ULOGD_PGSQL_OPTION) \
82         );
83         touch $@
84
85 $(PKG_BUILD_DIR)/.built:
86         rm -rf $(PKG_INSTALL_DIR)
87         mkdir -p $(PKG_INSTALL_DIR)
88         $(MAKE) -C $(PKG_BUILD_DIR) \
89                 DESTDIR="$(PKG_INSTALL_DIR)" \
90                 all install
91         touch $@
92
93 $(IPKG_ULOGD):
94         install -d -m0755 $(IDIR_ULOGD)/etc
95         $(CP) $(PKG_INSTALL_DIR)/etc/ulogd.conf $(IDIR_ULOGD)/etc/
96         install -d -m0755 $(IDIR_ULOGD)/etc/default
97         install -m0644 ./files/ulogd.default $(IDIR_ULOGD)/etc/default/ulogd
98         install -d -m0755 $(IDIR_ULOGD)/etc/init.d
99         install -m0755 ./files/ulogd.init $(IDIR_ULOGD)/etc/init.d/ulogd
100         ln -sf ulogd $(IDIR_ULOGD)/etc/init.d/S49ulogd
101         install -d -m0755 $(IDIR_ULOGD)/usr/lib/ulogd
102         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ulogd/ulogd_BASE.so $(IDIR_ULOGD)/usr/lib/ulogd/
103         install -d -m0755 $(IDIR_ULOGD)/usr/sbin
104         $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ulogd $(IDIR_ULOGD)/usr/sbin/
105         $(RSTRIP) $(IDIR_ULOGD)
106         $(IPKG_BUILD) $(IDIR_ULOGD) $(PACKAGE_DIR)