2 # Copyright (C) 2006-2010 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR)/rules.mk
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=http://dl.snort.org/snort-current/
16 PKG_MD5SUM:=63f4e76ae96a2d133f4c7b741bad5458
20 include $(INCLUDE_DIR)/package.mk
22 define Package/snort/Default
23 SUBMENU:=snort (Ligthweight Network Intrusion Detection System)
26 DEPENDS:=+libnet0 +libpcap +libpcre
27 TITLE:=Ligthweight Network Intrusion Detection System
28 URL:=http://www.snort.org/
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
40 $(call Package/snort/Default)
43 define Package/snort/description
44 $(call Package/snort/Default/description)
47 define Package/snort-mysql
48 $(call Package/snort/Default)
49 DEPENDS+= +libmysqlclient
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.
58 define Package/snort-pgsql
59 $(call Package/snort/Default)
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.
69 define Compile/Template
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, \
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" \
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" \
90 $(MAKE) -C $(PKG_BUILD_DIR) \
93 mv $(PKG_BUILD_DIR)/src/snort $(PKG_BUILD_DIR)/snort$(1)
95 $(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/snort$(1)
100 define Install/Template
102 define Package/snort$(1)/conffiles
104 /etc/snort/snort.conf
105 /etc/snort/threshold.conf
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
128 ifneq ($(SDK)$(CONFIG_PACKAGE_snort),)
130 $(call Compile/Template,, \
132 --without-postgresql \
134 $(call Install/Template,)
137 $(eval $(Compile/snort))
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 \
145 $(call Install/Template,-mysql)
148 $(eval $(Compile/snort-mysql))
151 ifneq ($(SDK)$(CONFIG_PACKAGE_snort-pgsql),)
152 define Compile/snort-pgsql
153 $(call Compile/Template,-pgsql, \
155 --with-postgresql="$(STAGING_DIR)/usr" \
157 $(call Install/Template,-pgsql)
160 $(eval $(Compile/snort-pgsql))
162 define Build/Configure
168 $(eval $(call BuildPackage,snort))
169 $(eval $(call BuildPackage,snort-mysql))
170 $(eval $(call BuildPackage,snort-pgsql))