libdaq: moved to github
[packages.git] / net / snort / Makefile
1
2 # Copyright (C) 2006-2012 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.2.2
12 PKG_RELEASE:=3
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=http://snort.org/dl/snort-current/
16 PKG_MD5SUM:=4254389550e3be31afebc70e64e6002f
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:=+libpcap +libpcre +libdnet +libdaq +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
76 CONFIGURE_ARGS += \
77         --prefix="/usr" \
78         --enable-flexresp \
79         --with-dnet-includes="$(STAGING_DIR)/usr/include" \
80         --with-dnet-libraries="$(STAGING_DIR)/usr/lib" \
81         --with-libpcap-includes="$(STAGING_DIR)/usr/include" \
82         --with-libpcap-libraries="$(STAGING_DIR)/usr/lib" \
83         --with-libpcre-includes="$(STAGING_DIR)/usr/include" \
84         --with-libpcre-libraries="$(STAGING_DIR)/usr/lib" \
85         --with-daq-includes="$(STAGING_DIR)/usr/include" \
86         --with-daq-libraries="$(STAGING_DIR)/usr/lib" \
87         --disable-static-daq
88
89 CONFIGURE_VARS += \
90         CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/mysql" \
91         LDFLAGS="$$$$LDFLAGS -L$(STAGING_DIR)/usr/lib/mysql" \
92         PATH="$(STAGING_DIR)/usr/lib/libnet-1.0.x/bin:$$$$PATH" \
93
94 MAKE_FLAGS += \
95         extra_incl="" \
96
97 ifeq ($(BUILD_VARIANT),basic)
98
99   CONFIGURE_ARGS += \
100         --without-mysql \
101         --without-postgresql \
102
103 endif
104 ifeq ($(BUILD_VARIANT),mysql)
105   CONFIGURE_VARS += \
106         mysql_has_reconnect=yes
107
108   CONFIGURE_ARGS += \
109         --with-mysql="$(STAGING_DIR)/usr" \
110         --without-postgresql \
111
112 endif
113 ifeq ($(BUILD_VARIANT),pgsql)
114
115   CONFIGURE_ARGS += \
116         --without-mysql \
117         --with-postgresql="$(STAGING_DIR)/usr" \
118
119 endif
120
121 define Build/InstallDev
122         $(INSTALL_DIR) $(STAGING_DIR)/usr/include/snort/dynamic_preproc
123         $(CP) \
124                 $(PKG_INSTALL_DIR)/usr/include/snort/dynamic_preproc/* \
125                 $(STAGING_DIR)/usr/include/snort/dynamic_preproc/
126         $(INSTALL_DIR) $(STAGING_DIR)/usr/lib/snort/dynamic_preproc
127         $(CP) \
128                 $(PKG_INSTALL_DIR)/usr/lib/snort/dynamic_preproc/* \
129                 $(STAGING_DIR)/usr/lib/snort/dynamic_preproc/
130         $(INSTALL_DIR) $(STAGING_DIR)/usr/lib/snort_dynamicengine
131         $(CP) \
132                 $(PKG_INSTALL_DIR)/usr/lib/snort_dynamicengine/* \
133                 $(STAGING_DIR)/usr/lib/snort_dynamicengine/
134         $(INSTALL_DIR) $(STAGING_DIR)/usr/lib/snort_dynamicpreprocessor
135         $(CP) \
136                 $(PKG_INSTALL_DIR)/usr/lib/snort_dynamicpreprocessor/* \
137                 $(STAGING_DIR)/usr/lib/snort_dynamicpreprocessor/
138 endef
139
140 define Package/snort/conffiles
141 /etc/default/snort
142 /etc/snort/snort.conf
143 /etc/snort/threshold.conf
144 endef
145
146 define Package/snort/install
147         $(INSTALL_DIR) $(1)/usr/bin
148         $(CP) $(PKG_INSTALL_DIR)/usr/bin/snort $(1)/usr/bin/snort.bin
149         $(CP) $(PKG_INSTALL_DIR)/usr/bin/u2{boat,spewfoo} $(1)/usr/bin
150         $(INSTALL_BIN) ./files/snort.bin $(1)/usr/bin/snort
151         $(INSTALL_DIR) $(1)/usr/lib/snort_dynamicengine
152         $(CP) $(PKG_INSTALL_DIR)/usr/lib/snort_dynamicengine/libsf_engine.so* $(1)/usr/lib/snort_dynamicengine/
153         $(INSTALL_DIR) $(1)/usr/lib/snort_dynamicpreprocessor
154         $(CP) $(PKG_INSTALL_DIR)/usr/lib/snort_dynamicpreprocessor/libsf*.so* $(1)/usr/lib/snort_dynamicpreprocessor/
155         $(INSTALL_DIR) $(1)/etc/snort
156         $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/snort.conf $(1)/etc/snort/
157         $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/attribute_table.dtd $(1)/etc/snort/
158         $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/classification.config $(1)/etc/snort/
159         $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/gen-msg.map $(1)/etc/snort/
160         $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/reference.config $(1)/etc/snort/
161         $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/threshold.conf $(1)/etc/snort/
162         $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/unicode.map $(1)/etc/snort/
163         $(INSTALL_DIR) $(1)/etc/snort/preproc_rules
164         $(INSTALL_DATA) $(PKG_BUILD_DIR)/preproc_rules/*.rules $(1)/etc/snort/preproc_rules/
165         $(INSTALL_DIR) $(1)/etc/snort/rules
166         $(INSTALL_DATA) ./files/snort.local.rules $(1)/etc/snort/rules/local.rules
167         $(INSTALL_DIR) $(1)/etc/default
168         $(INSTALL_DATA) ./files/snort.default $(1)/etc/default/snort
169         $(INSTALL_DIR) $(1)/etc/init.d
170         $(INSTALL_BIN) ./files/snort.init $(1)/etc/init.d/snort
171 endef
172
173 Package/snort-mysql/conffiles = $(Package/snort/conffiles)
174 Package/snort-mysql/install = $(Package/snort/install)
175
176 Package/snort-pgsql/conffiles = $(Package/snort/conffiles)
177 Package/snort-pgsql/install = $(Package/snort/install)
178
179 $(eval $(call BuildPackage,snort))
180 $(eval $(call BuildPackage,snort-mysql))
181 $(eval $(call BuildPackage,snort-pgsql))