fix init scripts and config files
[packages.git] / net / ulogd / Makefile
1 #
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=ulogd
12 PKG_VERSION:=1.24
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
16 PKG_SOURCE_URL:=ftp://ftp.netfilter.org/pub/ulogd/ \
17         ftp://ftp.be.netfilter.org/pub/netfilter/ulogd/ \
18         ftp://ftp.de.netfilter.org/pub/netfilter/ulogd/ \
19         ftp://ftp.no.netfilter.org/pub/netfilter/ulogd/
20 PKG_MD5SUM:=05b4ed2926b9a22aaeaf642917bbf8ff
21
22 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
23 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
24
25 define Package/ulogd/Default
26   SECTION:=net
27   CATEGORY:=Network
28   URL:=http://gnumonks.org/projects/ulogd
29 endef
30
31 define Package/ulogd
32   $(call Package/ulogd/Default)
33   DEPENDS:=+iptables
34   TITLE:=Netfilter userspace logging daemon
35   MENU:=1
36 endef
37
38 define Package/ulogd/conffiles
39 /etc/default/ulogd
40 /etc/ulogd.conf
41 endef
42
43 define Package/ulogd-mod-mysql
44   $(call Package/ulogd/Default)
45   DEPENDS:=ulogd +libmysqlclient
46   TITLE:=Output plugin for logging to a MySQL database
47 endef
48
49 define Package/ulogd-mod-pcap
50   $(call Package/ulogd/Default)
51   DEPENDS:=ulogd +libpcap
52   TITLE:=Output plugin for logging in pcap format
53 endef
54
55 define Package/ulogd-mod-pgsql
56   $(call Package/ulogd/Default)
57   DEPENDS:=ulogd +libpq
58   TITLE:=Output plugin for logging to a PostgreSQL database
59 endef
60
61 define Package/ulogd-mod-sqlite
62   $(call Package/ulogd/Default)
63   DEPENDS:=ulogd +libsqlite3
64   TITLE:=Output plugin for logging to an SQLite database
65 endef
66
67 define Package/ulogd-mod-extra
68   $(call Package/ulogd/Default)
69   DEPENDS:=ulogd
70   TITLE:=Extra plugins
71 endef
72
73 define Package/ulogd-mod-extra/description
74         This package contains the LOCAL, LOGEMU, OPRINT, PWSNIFF and SYSLOG plugins.
75 endef
76
77 include $(INCLUDE_DIR)/package.mk
78
79 ifneq ($(Package/ulogd-mod-mysql),)
80   ULOGD_MYSQL_OPTION:= --with-mysql="$(STAGING_DIR)/usr"
81 endif
82
83 ifneq ($(Package/ulogd-mod-pcap),)
84   ULOGD_PCAP_HEADER:=yes
85 else
86   ULOGD_PCAP_HEADER:=no
87 endif
88
89 ifneq ($(Package/ulogd-mod-pgsql),)
90   ULOGD_PGSQL_OPTION:= --with-pgsql="$(STAGING_DIR)/usr"
91 endif
92
93 ifneq ($(Package/ulogd-mod-sqlite),)
94   ULOGD_SQLITE_OPTION:= --with-sqlite3="$(STAGING_DIR)/usr"
95 endif
96
97 define Build/Configure
98         $(call Build/Configure/Default, \
99                 $(ULOGD_MYSQL_OPTION) \
100                 $(ULOGD_PGSQL_OPTION) \
101                 $(ULOGD_SQLITE_OPTION) \
102                 , \
103                 ac_cv_header_pcap_h=$(ULOGD_PCAP_HEADER) \
104         )
105 endef
106
107 define Build/Compile
108         $(MAKE) -C $(PKG_BUILD_DIR) \
109                 DESTDIR="$(PKG_INSTALL_DIR)" \
110                 CFLAGS="$(TARGET_CFLAGS) \
111                         -Iinclude \
112                         -I$(PKG_BUILD_DIR)/include/ulogd \
113                         -I$(PKG_BUILD_DIR)/include \
114                         -I$(PKG_BUILD_DIR)/libipulog/include \
115                         -I$(STAGING_DIR)/usr/include" \
116                 all install
117 endef
118
119 define Package/ulogd/install    
120         $(INSTALL_DIR) $(1)/etc
121         $(CP) $(PKG_INSTALL_DIR)/etc/ulogd.conf $(1)/etc/
122         $(INSTALL_DIR) $(1)/usr/sbin
123         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ulogd $(1)/usr/sbin/
124         $(INSTALL_DIR) $(1)/usr/lib/ulogd
125         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ulogd/ulogd_BASE.so $(1)/usr/lib/ulogd/
126         $(INSTALL_DIR) $(1)/etc/default
127         $(INSTALL_DATA) ./files/ulogd.default $(1)/etc/default/ulogd
128         $(INSTALL_DIR) $(1)/etc/init.d
129         $(INSTALL_BIN) ./files/ulogd.init $(1)/etc/init.d/ulogd
130 endef
131
132 define BuildPlugin
133   define Package/$(1)/install
134         $(INSTALL_DIR) $$(1)/usr/lib/ulogd
135         for m in $(2); do \
136                 $(CP) $(PKG_INSTALL_DIR)/usr/lib/ulogd/ulogd_$$$$$$$${m}.so $$(1)/usr/lib/ulogd/ ; \
137         done
138   endef
139
140   $$(eval $$(call BuildPackage,$(1)))
141 endef
142
143 $(eval $(call BuildPackage,ulogd))
144 $(eval $(call BuildPlugin,ulogd-mod-mysql,MYSQL))
145 $(eval $(call BuildPlugin,ulogd-mod-pcap,PCAP))
146 $(eval $(call BuildPlugin,ulogd-mod-pgsql,PGSQL))
147 $(eval $(call BuildPlugin,ulogd-mod-sqlite,SQLITE3))
148 $(eval $(call BuildPlugin,ulogd-mod-extra,LOCAL LOGEMU OPRINT PWSNIFF SYSLOG))