2 # Copyright (C) 2006-2009 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
18 include $(INCLUDE_DIR)/package.mk
20 define Package/snort/Default
21 SUBMENU:=snort (Ligthweight Network Intrusion Detection System)
24 DEPENDS:=+libnet0 +libpcap +libpcre
25 TITLE:=Ligthweight Network Intrusion Detection System
26 URL:=http://www.snort.org/
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
38 $(call Package/snort/Default)
41 define Package/snort/description
42 $(call Package/snort/Default/description)
45 define Package/snort-mysql
46 $(call Package/snort/Default)
47 DEPENDS+= +libmysqlclient
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.
56 define Package/snort-pgsql
57 $(call Package/snort/Default)
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.
67 define Compile/Template
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, \
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" \
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" \
88 $(MAKE) -C $(PKG_BUILD_DIR) \
91 mv $(PKG_BUILD_DIR)/src/snort $(PKG_BUILD_DIR)/snort$(1)
93 $(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/snort$(1)
98 define Install/Template
100 define Package/snort$(1)/conffiles
102 /etc/snort/snort.conf
103 /etc/snort/threshold.conf
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
126 ifneq ($(SDK)$(CONFIG_PACKAGE_snort),)
128 $(call Compile/Template,, \
130 --without-postgresql \
132 $(call Install/Template,)
135 $(eval $(Compile/snort))
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 \
143 $(call Install/Template,-mysql)
146 $(eval $(Compile/snort-mysql))
149 ifneq ($(SDK)$(CONFIG_PACKAGE_snort-pgsql),)
150 define Compile/snort-pgsql
151 $(call Compile/Template,-pgsql, \
153 --with-postgresql="$(STAGING_DIR)/usr" \
155 $(call Install/Template,-pgsql)
158 $(eval $(Compile/snort-pgsql))
160 define Build/Configure
166 $(eval $(call BuildPackage,snort))
167 $(eval $(call BuildPackage,snort-mysql))
168 $(eval $(call BuildPackage,snort-pgsql))