snort: initial import from old-packages
[feed/packages.git] / net / snort / Makefile
1 #
2 # Copyright (C) 2006-2015 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.9.7.0
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=https://www.snort.org/downloads/snort/
16 PKG_MD5SUM:=c2a45bc56441ee9456478f219dd8d1e2
17
18 PKG_BUILD_DEPENDS:=librpc
19 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
20 PKG_FIXUP:=autoreconf
21 PKG_INSTALL:=1
22
23 include $(INCLUDE_DIR)/package.mk
24
25 define Package/snort/Default
26 SUBMENU:=Firewall
27 SECTION:=net
28 CATEGORY:=Network
29 DEPENDS:=+libdaq +libdnet +libopenssl +libpcap +libpcre +libpthread +libuuid +zlib
30 TITLE:=Lightweight Network Intrusion Detection System
31 URL:=http://www.snort.org/
32 endef
33
34 define Package/snort/Default/description
35 Snort is an open source network intrusion detection and prevention system.
36 It is capable of performing real-time traffic analysis, alerting, blocking
37 and packet logging on IP networks. It utilizes a combination of protocol
38 analysis and pattern matching in order to detect anomalies, misuse and
39 attacks.
40 endef
41
42 define Package/snort
43 $(call Package/snort/Default)
44 VARIANT:=basic
45 endef
46
47 define Package/snort/description
48 $(call Package/snort/Default/description)
49 endef
50
51 define Package/snort-mysql
52 $(call Package/snort/Default)
53 DEPENDS+= +libmysqlclient
54 TITLE+= (MySQL)
55 VARIANT:=mysql
56 endef
57
58 define Package/snort-mysql/description
59 $(call Package/snort/Default/description)
60 This package contains snort with support for logging to a MySQL database.
61 endef
62
63 define Package/snort-pgsql
64 $(call Package/snort/Default)
65 DEPENDS+= +libpq +libuuid
66 TITLE+= (PostgreSQL)
67 VARIANT:=pgsql
68 endef
69
70 define Package/snort-pgsql/description
71 $(call Package/snort/Default/description)
72 This package contains snort with support for logging to a PostgreSQL database.
73 endef
74
75 CONFIGURE_ARGS += \
76 --prefix="/usr" \
77 --enable-flexresp \
78 --with-dnet-includes="$(STAGING_DIR)/usr/include" \
79 --with-dnet-libraries="$(STAGING_DIR)/usr/lib" \
80 --with-libpcap-includes="$(STAGING_DIR)/usr/include" \
81 --with-libpcap-libraries="$(STAGING_DIR)/usr/lib" \
82 --with-libpcre-includes="$(STAGING_DIR)/usr/include" \
83 --with-libpcre-libraries="$(STAGING_DIR)/usr/lib" \
84 --with-daq-includes="$(STAGING_DIR)/usr/include" \
85 --with-daq-libraries="$(STAGING_DIR)/usr/lib" \
86 --disable-static-daq
87
88 CONFIGURE_VARS += \
89 CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/mysql" \
90 LDFLAGS="$$$$LDFLAGS -L$(STAGING_DIR)/usr/lib/mysql" \
91 PATH="$(STAGING_DIR)/usr/lib/libnet-1.0.x/bin:$$$$PATH"
92
93 MAKE_FLAGS += \
94 extra_incl=""
95
96 ifeq ($(BUILD_VARIANT),basic)
97 CONFIGURE_ARGS += \
98 --without-mysql \
99 --without-postgresql
100 endif
101 ifeq ($(BUILD_VARIANT),mysql)
102 CONFIGURE_VARS += \
103 mysql_has_reconnect=yes
104 CONFIGURE_ARGS += \
105 --with-mysql="$(STAGING_DIR)/usr" \
106 --without-postgresql
107 endif
108 ifeq ($(BUILD_VARIANT),pgsql)
109 CONFIGURE_ARGS += \
110 --without-mysql \
111 --with-postgresql="$(STAGING_DIR)/usr"
112 endif
113
114 define Build/InstallDev
115 $(INSTALL_DIR) $(STAGING_DIR)/usr/include/snort/dynamic_preproc
116 $(CP) \
117 $(PKG_INSTALL_DIR)/usr/include/snort/dynamic_preproc/* \
118 $(STAGING_DIR)/usr/include/snort/dynamic_preproc/
119 $(INSTALL_DIR) $(STAGING_DIR)/usr/lib/snort/dynamic_preproc
120 $(CP) \
121 $(PKG_INSTALL_DIR)/usr/lib/snort/dynamic_preproc/* \
122 $(STAGING_DIR)/usr/lib/snort/dynamic_preproc/
123 $(INSTALL_DIR) $(STAGING_DIR)/usr/lib/snort_dynamicengine
124 $(CP) \
125 $(PKG_INSTALL_DIR)/usr/lib/snort_dynamicengine/* \
126 $(STAGING_DIR)/usr/lib/snort_dynamicengine/
127 $(INSTALL_DIR) $(STAGING_DIR)/usr/lib/snort_dynamicpreprocessor
128 $(CP) \
129 $(PKG_INSTALL_DIR)/usr/lib/snort_dynamicpreprocessor/* \
130 $(STAGING_DIR)/usr/lib/snort_dynamicpreprocessor/
131 endef
132
133 define Package/snort/conffiles
134 /etc/config/snort
135 /etc/snort/snort.conf
136 endef
137
138 Package/snort-mysql/conffiles = $(Package/snort/conffiles)
139 Package/snort-mysql/install = $(Package/snort/install)
140
141 Package/snort-pgsql/conffiles = $(Package/snort/conffiles)
142 Package/snort-pgsql/install = $(Package/snort/install)
143
144 define Package/snort/install
145 $(INSTALL_DIR) $(1)/usr/bin
146 $(INSTALL_BIN) \
147 $(PKG_INSTALL_DIR)/usr/bin/snort \
148 $(1)/usr/bin/snort
149
150 $(INSTALL_BIN) \
151 $(PKG_INSTALL_DIR)/usr/bin/u2{boat,spewfoo} \
152 $(1)/usr/bin
153
154 $(INSTALL_DIR) $(1)/usr/lib/snort_dynamicengine
155 $(CP) \
156 $(PKG_INSTALL_DIR)/usr/lib/snort_dynamicengine/libsf_engine.so* \
157 $(1)/usr/lib/snort_dynamicengine/
158
159 $(INSTALL_DIR) $(1)/usr/lib/snort_dynamicpreprocessor
160 $(CP) \
161 $(PKG_INSTALL_DIR)/usr/lib/snort_dynamicpreprocessor/libsf*.so* \
162 $(1)/usr/lib/snort_dynamicpreprocessor/
163
164 $(INSTALL_DIR) $(1)/etc/snort
165 $(INSTALL_CONF) \
166 $(PKG_BUILD_DIR)/etc/snort.conf \
167 $(1)/etc/snort/
168 $(INSTALL_CONF) \
169 $(PKG_BUILD_DIR)/etc/attribute_table.dtd \
170 $(1)/etc/snort/
171 $(INSTALL_CONF) \
172 $(PKG_BUILD_DIR)/etc/classification.config \
173 $(1)/etc/snort/
174 $(INSTALL_CONF) \
175 $(PKG_BUILD_DIR)/etc/gen-msg.map \
176 $(1)/etc/snort/
177 $(INSTALL_CONF) \
178 $(PKG_BUILD_DIR)/etc/reference.config \
179 $(1)/etc/snort/
180 $(INSTALL_CONF) \
181 $(PKG_BUILD_DIR)/etc/unicode.map \
182 $(1)/etc/snort/
183
184 $(INSTALL_DIR) $(1)/etc/snort/preproc_rules
185 $(INSTALL_CONF) \
186 $(PKG_BUILD_DIR)/preproc_rules/*.rules \
187 $(1)/etc/snort/preproc_rules/
188
189 $(INSTALL_DIR) $(1)/etc/init.d
190 $(INSTALL_BIN) \
191 ./files/snort.init \
192 $(1)/etc/init.d/snort
193
194 $(INSTALL_DIR) $(1)/etc/config
195 $(INSTALL_CONF) \
196 ./files/snort.config \
197 $(1)/etc/config/snort
198 endef
199
200 $(eval $(call BuildPackage,snort))
201 $(eval $(call BuildPackage,snort-mysql))
202 $(eval $(call BuildPackage,snort-pgsql))