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