Port ulogd to -ng
[openwrt/svn-archive/archive.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 PKG_MD5SUM:=05b4ed2926b9a22aaeaf642917bbf8ff
15
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_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
21 PKG_CAT:=bzcat
22
23 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
24 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
25
26 define Package/ulogd
27 SECTION:=net
28 CATEGORY:=Network
29 DEPENDS:=+iptables
30 MENU:=1
31 TITLE:=Netfilter userspace logging daemon
32 DESCRIPTION:=The netfilter userspace logging daemon\\\
33 URL:=http://gnumonks.org/projects/ulogd
34 endef
35
36 define Package/ulogd/conffiles
37 /etc/default/ulogd
38 /etc/ulogd.conf
39 endef
40
41 define Package/ulogd-mod-mysql
42 SECTION:=net
43 CATEGORY:=Network
44 DEPENDS:=ulogd +libmysqlclient
45 TITLE:=Output plugin for logging into a MySQL database
46 endef
47
48 define Package/ulogd-mod-pcap
49 SECTION:=net
50 CATEGORY:=Network
51 DEPENDS:=ulogd +libpcap
52 TITLE:=Output plugin for logging into pcap format
53 endef
54
55 define Package/ulogd-mod-pgsql
56 SECTION:=net
57 CATEGORY:=Network
58 DEPENDS:=ulogd +libpq
59 TITLE:=Output plugin for logging into a PostgreSQL database
60 endef
61
62 define Package/ulogd-mod-sqlite
63 SECTION:=net
64 CATEGORY:=Network
65 DEPENDS:=ulogd +libsqlite3
66 TITLE:=Output plugin for logging into an SQLite database
67 endef
68
69 define Package/ulogd-mod-extra
70 SECTION:=net
71 CATEGORY:=Network
72 DEPENDS:=ulogd
73 TITLE:=All other plugins
74 endef
75
76 include $(INCLUDE_DIR)/package.mk
77
78 ifneq ($(Package/ulogd-mod-mysql),)
79 ULOGD_MYSQL_OPTION:=--with-mysql=$(STAGING_DIR)/usr
80 endif
81
82 ifneq ($(Package/ulogd-mod-pcap),)
83 ULOGD_PCAP_HEADER:=yes
84 else
85 ULOGD_PCAP_HEADER:=no
86 endif
87
88 ifneq ($(Package/ulogd-mod-pgsql),)
89 ULOGD_PGSQL_OPTION:=--with-pgsql=$(STAGING_DIR)/usr
90 endif
91
92 ifneq ($(Package/ulogd-mod-sqlite),)
93 ULOGD_SQLITE_OPTION:=--with-sqlite3=$(STAGING_DIR)/usr
94 endif
95
96 define Build/Configure
97 $(call Build/Configure/Default,--enable-shared \
98 --disable-static \
99 $(ULOGD_MYSQL_OPTION) \
100 $(ULOGD_PGSQL_OPTION) \
101 $(ULOGD_SQLITE_OPTION),ac_cv_header_pcap_h=$(ULOGD_PCAP_HEADER))
102 endef
103
104 define Build/Compile
105 $(call Build/Compile/Default,DESTDIR="$(PKG_INSTALL_DIR)" \
106 STAGING_DIR=$(STAGING_DIR) \
107 all install)
108 endef
109
110 define Package/ulogd/install
111 install -d -m0755 $(1)/etc
112 $(CP) $(PKG_INSTALL_DIR)/etc/ulogd.conf $(1)/etc/
113 install -d -m0755 $(1)/etc/default
114 install -m0644 ./files/ulogd.default $(1)/etc/default/ulogd
115 install -d -m0755 $(1)/etc/init.d
116 install -m0755 ./files/ulogd.init $(1)/etc/init.d/ulogd
117 ln -sf ulogd $(1)/etc/init.d/S49ulogd
118 install -d -m0755 $(1)/usr/lib/ulogd
119 $(CP) $(PKG_INSTALL_DIR)/usr/lib/ulogd/ulogd_BASE.so $(1)/usr/lib/ulogd/
120 install -d -m0755 $(1)/usr/sbin
121 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ulogd $(1)/usr/sbin/
122 endef
123
124 define BuildPlugin
125 define Package/$(1)/install
126 install -m0755 -d $$(1)/usr/lib/ulogd
127 for m in $(2); do \
128 $(CP) $(PKG_INSTALL_DIR)/usr/lib/ulogd/ulogd_$$$$$$$${m}.so $$(1)/usr/lib/ulogd/ ; \
129 done
130 endef
131
132 $$(eval $$(call BuildPackage,$(1)))
133 endef
134
135 $(eval $(call BuildPackage,ulogd))
136 $(eval $(call BuildPlugin,ulogd-mod-mysql,MYSQL))
137 $(eval $(call BuildPlugin,ulogd-mod-pcap,PCAP))
138 $(eval $(call BuildPlugin,ulogd-mod-pgsql,PGSQL))
139 $(eval $(call BuildPlugin,ulogd-mod-sqlite,SQLITE3))
140 $(eval $(call BuildPlugin,ulogd-mod-extra,LOCAL LOGEMU OPRINT PWSNIFF SYSLOG))