Fix the snort build with openwrt eglibc toolchain
[openwrt/svn-archive/archive.git] / net / snort / Makefile
1 #
2 # Copyright (C) 2006-2011 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:=3
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_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:=+libnet0 +libpcap +libpcre
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
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
76 CONFIGURE_ARGS += \
77 --enable-flexresp \
78 --with-libnet-includes="$(STAGING_DIR)/usr/lib/libnet-1.0.x/include" \
79 --with-libnet-libraries="$(STAGING_DIR)/usr/lib/libnet-1.0.x/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
85 CONFIGURE_VARS += \
86 CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/mysql" \
87 LDFLAGS="$$$$LDFLAGS -L$(STAGING_DIR)/usr/lib/mysql" \
88 PATH="$(STAGING_DIR)/usr/lib/libnet-1.0.x/bin:$$$$PATH" \
89
90 MAKE_FLAGS += \
91 extra_incl="" \
92
93 ifeq ($(BUILD_VARIANT),basic)
94
95 CONFIGURE_ARGS += \
96 --without-mysql \
97 --without-postgresql \
98
99 endif
100 ifeq ($(BUILD_VARIANT),mysql)
101
102 CONFIGURE_ARGS += \
103 --with-mysql="$(STAGING_DIR)/usr" \
104 --without-postgresql \
105
106 endif
107 ifeq ($(BUILD_VARIANT),pgsql)
108
109 CONFIGURE_ARGS += \
110 --without-mysql \
111 --with-postgresql="$(STAGING_DIR)/usr" \
112
113 endif
114
115
116 define Package/snort/conffiles
117 /etc/default/snort
118 /etc/snort/snort.conf
119 /etc/snort/threshold.conf
120 endef
121
122 define Package/snort/install
123 $(INSTALL_DIR) $(1)/usr/bin
124 $(CP) $(PKG_INSTALL_DIR)/usr/bin/snort $(1)/usr/bin/
125 $(INSTALL_DIR) $(1)/usr/lib/snort_dynamicengine
126 $(CP) $(PKG_INSTALL_DIR)/usr/lib/snort_dynamicengine/libsf_engine.so* $(1)/usr/lib/snort_dynamicengine/
127 $(INSTALL_DIR) $(1)/usr/lib/snort_dynamicpreprocessor
128 $(CP) $(PKG_INSTALL_DIR)/usr/lib/snort_dynamicpreprocessor/libsf_{dce2,dcerpc,dns,ftptelnet,smtp,ssh,ssl}_preproc.so* $(1)/usr/lib/snort_dynamicpreprocessor/
129 $(INSTALL_DIR) $(1)/etc/snort
130 $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/snort.conf $(1)/etc/snort/
131 $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/classification.config $(1)/etc/snort/
132 $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/gen-msg.map $(1)/etc/snort/
133 $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/reference.config $(1)/etc/snort/
134 $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/sid-msg.map $(1)/etc/snort/
135 $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/threshold.conf $(1)/etc/snort/
136 $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/unicode.map $(1)/etc/snort/
137 $(INSTALL_DIR) $(1)/etc/snort/preproc_rules
138 $(INSTALL_DATA) $(PKG_BUILD_DIR)/preproc_rules/*.rules $(1)/etc/snort/preproc_rules/
139 $(INSTALL_DIR) $(1)/etc/snort/rules
140 $(INSTALL_DATA) ./files/snort.local.rules $(1)/etc/snort/rules/local.rules
141 $(INSTALL_DIR) $(1)/etc/default
142 $(INSTALL_DATA) ./files/snort.default $(1)/etc/default/snort
143 $(INSTALL_DIR) $(1)/etc/init.d
144 $(INSTALL_BIN) ./files/snort.init $(1)/etc/init.d/snort
145 endef
146
147 Package/snort-mysql/conffiles = $(Package/snort/conffiles)
148 Package/snort-mysql/install = $(Package/snort/install)
149
150 Package/snort-pgsql/conffiles = $(Package/snort/conffiles)
151 Package/snort-pgsql/install = $(Package/snort/install)
152
153 $(eval $(call BuildPackage,snort))
154 $(eval $(call BuildPackage,snort-mysql))
155 $(eval $(call BuildPackage,snort-pgsql))