f482485d5d62c758e1a5f2650490b2d9ae74e12b
[openwrt/svn-archive/archive.git] / net / snort / Makefile
1 #
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=snort
12 PKG_VERSION:=2.4.4
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=http://www.snort.org/dl/current/
17 PKG_MD5SUM:=9dc9060d1f2e248663eceffadfc45e7e
18 PKG_CAT:=zcat
19
20 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
21 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
22
23 include $(INCLUDE_DIR)/package.mk
24
25 define Package/snort/Default
26 SUBMENU:=snort (Ligthweight Network Intrusion Detection System)
27 SECTION:=net
28 CATEGORY:=Network
29 DEPENDS:=+libnet0 +libpcap +libpcre
30 TITLE:=Ligthweight Network Intrusion Detection System
31 URL:=http://www.snort.org/
32 endef
33
34 define Package/snort
35 $(call Package/snort/Default)
36 endef
37
38 define Package/snort-mysql
39 $(call Package/snort/Default)
40 DEPENDS+= +libmysqlclient
41 TITLE+= (MySQL)
42 endef
43
44 define Package/snort-pgsql
45 $(call Package/snort/Default)
46 DEPENDS+= +libpq
47 TITLE+= (PostgreSQL)
48 endef
49
50
51 ifneq ($(SDK),)
52 CONFIG_PACKAGE_snort:=m
53 CONFIG_PACKAGE_snort-mysql:=m
54 CONFIG_PACKAGE_snort-pgsql:=m
55 endif
56
57 define Compile/Template
58
59 $(PKG_BUILD_DIR)/snort-$(1): $(PKG_BUILD_DIR)/.configured
60 touch -r $(PKG_BUILD_DIR)/Makefile.am $(PKG_BUILD_DIR)/configure.in
61 touch -r $(PKG_BUILD_DIR)/Makefile.in $(PKG_BUILD_DIR)/configure
62 -$(MAKE) -C $(PKG_BUILD_DIR) distclean
63 $(call Build/Configure/Default, \
64 --enable-flexresp \
65 --with-libnet-includes="$(STAGING_DIR)/usr/lib/libnet-1.0.x/include" \
66 --with-libnet-libraries="$(STAGING_DIR)/usr/lib/libnet-1.0.x/lib" \
67 --with-libpcap-includes="$(STAGING_DIR)/usr/include" \
68 --with-libpcap-libraries="$(STAGING_DIR)/usr/lib" \
69 --with-libpcre-includes="$(STAGING_DIR)/usr/include" \
70 --with-libpcre-libraries="$(STAGING_DIR)/usr/lib" \
71 $(2) \
72 , \
73 CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/mysql" \
74 LDFLAGS="$$$$LDFLAGS -L$(STAGING_DIR)/usr/lib/mysql" \
75 PATH="$(STAGING_DIR)/usr/lib/libnet-1.0.x/bin:$$$$PATH" \
76 $(3) \
77 );
78 $(MAKE) -C $(PKG_BUILD_DIR) \
79 extra_incl="" \
80 all
81 mv $(PKG_BUILD_DIR)/src/snort $(PKG_BUILD_DIR)/snort-$(1)
82
83 $(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/snort-$(1)
84
85 endef
86
87
88 define Install/Template
89
90 define Package/$(1)/conffiles
91 /etc/default/snort
92 /etc/snort/snort.conf
93 /etc/snort/threshold.conf
94 endef
95
96 define Package/$(1)/install
97 install -d -m0755 $$(1)/usr/sbin
98 install -m0755 $(PKG_BUILD_DIR)/snort-$(2) $$(1)/usr/sbin/snort
99 install -d -m0755 $$(1)/etc/snort
100 install -m0644 $(PKG_BUILD_DIR)/etc/snort.conf $$(1)/etc/snort/
101 install -m0644 $(PKG_BUILD_DIR)/etc/classification.config $$(1)/etc/snort/
102 install -m0644 $(PKG_BUILD_DIR)/etc/gen-msg.map $$(1)/etc/snort/
103 install -m0644 $(PKG_BUILD_DIR)/etc/reference.config $$(1)/etc/snort/
104 install -m0644 $(PKG_BUILD_DIR)/etc/sid-msg.map $$(1)/etc/snort/
105 install -m0644 $(PKG_BUILD_DIR)/etc/threshold.conf $$(1)/etc/snort/
106 install -m0644 $(PKG_BUILD_DIR)/etc/unicode.map $$(1)/etc/snort/
107 install -d -m0755 $$(1)/etc/default
108 install -m0644 ./files/snort.default $$(1)/etc/default/snort
109 install -d -m0755 $$(1)/etc/init.d
110 install -m0755 ./files/snort.init $$(1)/etc/init.d/snort
111 endef
112
113 endef
114
115
116 ifneq ($(CONFIG_PACKAGE_snort),)
117 $(eval $(call Compile/Template,basic, \
118 --without-mysql \
119 --without-postgresql \
120 ))
121 $(eval $(call Install/Template,snort,basic))
122 endif
123 ifneq ($(CONFIG_PACKAGE_snort-mysql),)
124 $(eval $(call Compile/Template,mysql, \
125 --with-mysql="$(STAGING_DIR)/usr" \
126 --without-postgresql \
127 ))
128 $(eval $(call Install/Template,snort-mysql,mysql))
129 endif
130 ifneq ($(CONFIG_PACKAGE_snort-pgsql),)
131 $(eval $(call Compile/Template,pgsql, \
132 --without-mysql \
133 --with-postgresql="$(STAGING_DIR)/usr" \
134 ))
135 $(eval $(call Install/Template,snort-pgsql,pgsql))
136 endif
137
138 define Build/Configure
139 endef
140
141 define Build/Compile
142 endef
143
144 $(eval $(call BuildPackage,snort))
145 $(eval $(call BuildPackage,snort-mysql))
146 $(eval $(call BuildPackage,snort-pgsql))