replace lots of manual install commands with INSTALL_* variables
[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
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 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/Default
27 SECTION:=net
28 CATEGORY:=Network
29 URL:=http://gnumonks.org/projects/ulogd
30 endef
31
32 define Package/ulogd
33 $(call Package/ulogd/Default)
34 DEPENDS:=+iptables
35 TITLE:=Netfilter userspace logging daemon
36 MENU:=1
37 endef
38
39 define Package/ulogd/conffiles
40 /etc/default/ulogd
41 /etc/ulogd.conf
42 endef
43
44 define Package/ulogd-mod-mysql
45 $(call Package/ulogd/Default)
46 DEPENDS:=ulogd +libmysqlclient
47 TITLE:=Output plugin for logging to a MySQL database
48 endef
49
50 define Package/ulogd-mod-pcap
51 $(call Package/ulogd/Default)
52 DEPENDS:=ulogd +libpcap
53 TITLE:=Output plugin for logging in pcap format
54 endef
55
56 define Package/ulogd-mod-pgsql
57 $(call Package/ulogd/Default)
58 DEPENDS:=ulogd +libpq
59 TITLE:=Output plugin for logging to a PostgreSQL database
60 endef
61
62 define Package/ulogd-mod-sqlite
63 $(call Package/ulogd/Default)
64 DEPENDS:=ulogd +libsqlite3
65 TITLE:=Output plugin for logging to an SQLite database
66 endef
67
68 define Package/ulogd-mod-extra
69 $(call Package/ulogd/Default)
70 DEPENDS:=ulogd
71 TITLE:=Extra plugins
72 DESCRIPTION:=\
73 This package contains the LOCAL, LOGEMU, OPRINT, PWSNIFF and SYSLOG 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, \
98 $(ULOGD_MYSQL_OPTION) \
99 $(ULOGD_PGSQL_OPTION) \
100 $(ULOGD_SQLITE_OPTION) \
101 , \
102 ac_cv_header_pcap_h=$(ULOGD_PCAP_HEADER) \
103 )
104 endef
105
106 define Build/Compile
107 $(MAKE) -C $(PKG_BUILD_DIR) \
108 DESTDIR="$(PKG_INSTALL_DIR)" \
109 all install
110 endef
111
112 define Package/ulogd/install
113 $(INSTALL_DIR) $(1)/etc
114 $(CP) $(PKG_INSTALL_DIR)/etc/ulogd.conf $(1)/etc/
115 $(INSTALL_DIR) $(1)/usr/sbin
116 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ulogd $(1)/usr/sbin/
117 $(INSTALL_DIR) $(1)/usr/lib/ulogd
118 $(CP) $(PKG_INSTALL_DIR)/usr/lib/ulogd/ulogd_BASE.so $(1)/usr/lib/ulogd/
119 $(INSTALL_DIR) $(1)/etc/default
120 $(INSTALL_DATA) ./files/ulogd.default $(1)/etc/default/ulogd
121 $(INSTALL_DIR) $(1)/etc/init.d
122 $(INSTALL_BIN) ./files/ulogd.init $(1)/etc/init.d/ulogd
123 endef
124
125 define BuildPlugin
126 define Package/$(1)/install
127 $(INSTALL_DIR) $$(1)/usr/lib/ulogd
128 for m in $(2); do \
129 $(CP) $(PKG_INSTALL_DIR)/usr/lib/ulogd/ulogd_$$$$$$$${m}.so $$(1)/usr/lib/ulogd/ ; \
130 done
131 endef
132
133 $$(eval $$(call BuildPackage,$(1)))
134 endef
135
136 $(eval $(call BuildPackage,ulogd))
137 $(eval $(call BuildPlugin,ulogd-mod-mysql,MYSQL))
138 $(eval $(call BuildPlugin,ulogd-mod-pcap,PCAP))
139 $(eval $(call BuildPlugin,ulogd-mod-pgsql,PGSQL))
140 $(eval $(call BuildPlugin,ulogd-mod-sqlite,SQLITE3))
141 $(eval $(call BuildPlugin,ulogd-mod-extra,LOCAL LOGEMU OPRINT PWSNIFF SYSLOG))