[package] update snort to 2.8.4.1 (#3653)
[packages.git] / net / snort / Makefile
1
2 # Copyright (C) 2006-2009 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=snort
11 PKG_VERSION:=2.8.4.1
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=http://dl.snort.org/snort-current/
16 PKG_MD5SUM:=63f4e76ae96a2d133f4c7b741bad5458
17
18 include $(INCLUDE_DIR)/package.mk
19
20 define Package/snort/Default
21   SUBMENU:=snort (Ligthweight Network Intrusion Detection System)
22   SECTION:=net
23   CATEGORY:=Network
24   DEPENDS:=+libnet0 +libpcap +libpcre
25   TITLE:=Ligthweight Network Intrusion Detection System
26   URL:=http://www.snort.org/
27 endef
28
29 define Package/snort/Default/description
30   Snort is an open source network intrusion detection and prevention system.
31   It is capable of performing real-time traffic analysis, alerting, blocking
32   and packet logging on IP networks.  It utilizes a combination of protocol
33   analysis and pattern matching in order to detect anomalies, misuse and
34   attacks.
35 endef
36
37 define Package/snort
38   $(call Package/snort/Default)
39 endef
40
41 define Package/snort/description
42   $(call Package/snort/Default/description)
43 endef
44
45 define Package/snort-mysql
46   $(call Package/snort/Default)
47   DEPENDS+= +libmysqlclient
48   TITLE+= (MySQL)
49 endef
50
51 define Package/snort-mysql/description
52   $(call Package/snort/Default/description)
53   This package contains snort with support for logging to a MySQL database.
54 endef
55
56 define Package/snort-pgsql
57   $(call Package/snort/Default)
58   DEPENDS+= +libpq
59   TITLE+= (PostgreSQL)
60 endef
61
62 define Package/snort-pgsql/description
63   $(call Package/snort/Default/description)
64   This package contains snort with support for logging to a PostgreSQL database.
65 endef
66
67 define Compile/Template
68
69 $(PKG_BUILD_DIR)/snort$(1): $(STAMP_CONFIGURED)
70         touch -r $(PKG_BUILD_DIR)/Makefile.am $(PKG_BUILD_DIR)/configure.in 
71         touch -r $(PKG_BUILD_DIR)/Makefile.in $(PKG_BUILD_DIR)/configure
72         -$(MAKE) -C $(PKG_BUILD_DIR) distclean
73         $(call Build/Configure/Default, \
74                 --enable-flexresp \
75                 --with-libnet-includes="$(STAGING_DIR)/usr/lib/libnet-1.0.x/include" \
76                 --with-libnet-libraries="$(STAGING_DIR)/usr/lib/libnet-1.0.x/lib" \
77                 --with-libpcap-includes="$(STAGING_DIR)/usr/include" \
78                 --with-libpcap-libraries="$(STAGING_DIR)/usr/lib" \
79                 --with-libpcre-includes="$(STAGING_DIR)/usr/include" \
80                 --with-libpcre-libraries="$(STAGING_DIR)/usr/lib" \
81                 $(2) \
82                 , \
83                 CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/mysql" \
84                 LDFLAGS="$$$$LDFLAGS -L$(STAGING_DIR)/usr/lib/mysql" \
85                 PATH="$(STAGING_DIR)/usr/lib/libnet-1.0.x/bin:$$$$PATH" \
86                 $(3) \
87         );
88         $(MAKE) -C $(PKG_BUILD_DIR) \
89                 extra_incl="" \
90                 all
91         mv $(PKG_BUILD_DIR)/src/snort $(PKG_BUILD_DIR)/snort$(1)
92
93 $(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/snort$(1)
94
95 endef
96
97
98 define Install/Template
99
100 define Package/snort$(1)/conffiles
101 /etc/default/snort
102 /etc/snort/snort.conf
103 /etc/snort/threshold.conf
104 endef
105
106 define Package/snort$(1)/install
107         $(INSTALL_DIR) $$(1)/usr/sbin
108         $(INSTALL_BIN) $(PKG_BUILD_DIR)/snort$(1) $$(1)/usr/sbin/snort
109         $(INSTALL_DIR) $$(1)/etc/snort
110         $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/snort.conf $$(1)/etc/snort/
111         $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/classification.config $$(1)/etc/snort/
112         $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/gen-msg.map $$(1)/etc/snort/
113         $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/reference.config $$(1)/etc/snort/
114         $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/sid-msg.map $$(1)/etc/snort/
115         $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/threshold.conf $$(1)/etc/snort/
116         $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/unicode.map $$(1)/etc/snort/
117         $(INSTALL_DIR) $$(1)/etc/default
118         $(INSTALL_DATA) ./files/snort.default $$(1)/etc/default/snort
119         $(INSTALL_DIR) $$(1)/etc/init.d
120         $(INSTALL_BIN) ./files/snort.init $$(1)/etc/init.d/snort
121 endef
122
123 endef
124
125
126 ifneq ($(SDK)$(CONFIG_PACKAGE_snort),)
127   define Compile/snort
128     $(call Compile/Template,, \
129                 --without-mysql \
130                 --without-postgresql \
131     )
132     $(call Install/Template,)
133   endef
134 endif
135 $(eval $(Compile/snort))
136
137 ifneq ($(SDK)$(CONFIG_PACKAGE_snort-mysql),)
138   define Compile/snort-mysql
139     $(call Compile/Template,-mysql, \
140                 --with-mysql="$(STAGING_DIR)/usr" \
141                 --without-postgresql \
142     )
143     $(call Install/Template,-mysql)
144   endef
145 endif
146 $(eval $(Compile/snort-mysql))
147
148
149 ifneq ($(SDK)$(CONFIG_PACKAGE_snort-pgsql),)
150   define Compile/snort-pgsql
151     $(call Compile/Template,-pgsql, \
152                 --without-mysql \
153                 --with-postgresql="$(STAGING_DIR)/usr" \
154     )
155     $(call Install/Template,-pgsql)
156   endef
157 endif
158 $(eval $(Compile/snort-pgsql))
159
160 define Build/Configure
161 endef
162
163 define Build/Compile
164 endef
165
166 $(eval $(call BuildPackage,snort))
167 $(eval $(call BuildPackage,snort-mysql))
168 $(eval $(call BuildPackage,snort-pgsql))