replace bool by tristate to avoid unnecessary -install calls
[openwrt.git] / openwrt / package / snort / Makefile
1 # $Id$
2
3 include $(TOPDIR)/rules.mk
4
5 PKG_NAME:=snort
6 PKG_VERSION:=2.3.3
7 PKG_RELEASE:=1
8 PKG_MD5SUM:=06bf140893e7cb120aaa9372d10a0100
9
10 PKG_SOURCE_URL:=http://www.snort.org/dl/current/
11 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
12 PKG_CAT:=zcat
13
14 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
15 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
16
17 include $(TOPDIR)/package/rules.mk
18
19 PKG_CONFIGURE_OPTS := \
20 --target=$(GNU_TARGET_NAME) \
21 --host=$(GNU_TARGET_NAME) \
22 --build=$(GNU_HOST_NAME) \
23 --program-prefix="" \
24 --program-suffix="" \
25 --prefix=/usr \
26 --exec-prefix=/usr \
27 --bindir=/usr/sbin \
28 --datadir=/usr/share \
29 --includedir=/usr/include \
30 --infodir=/usr/share/info \
31 --libdir=/usr/lib \
32 --libexecdir=/usr/lib/locate \
33 --localstatedir=/var/lib \
34 --mandir=/usr/share/man \
35 --sbindir=/usr/sbin \
36 --sysconfdir=/etc \
37 $(DISABLE_LARGEFILE) \
38 $(DISABLE_NLS) \
39 --enable-shared \
40 --disable-static \
41 --enable-flexresp \
42 --with-libnet-includes="$(STAGING_DIR)/usr/include" \
43 --with-libnet-libraries="$(STAGING_DIR)/usr/lib" \
44 --with-libpcap-includes="$(STAGING_DIR)/usr/include" \
45 --with-libpcap-libraries="$(STAGING_DIR)/usr/lib" \
46 --with-libpcre-includes="$(STAGING_DIR)/usr/include" \
47 --with-libpcre-libraries="$(STAGING_DIR)/usr/lib" \
48
49 SNORT_BASIC_CONFIGURE_OPTS := \
50 --without-mysql \
51 --without-postgresql \
52
53 SNORT_MYSQL_CONFIGURE_OPTS := \
54 --with-mysql=$(STAGING_DIR)/usr \
55 --without-postgresql \
56
57 SNORT_PGSQL_CONFIGURE_OPTS := \
58 --without-mysql \
59 --with-postgresql=$(STAGING_DIR)/usr \
60
61 SNORT_CUSTOM_CONFIGURE_OPTS := \
62
63 ifeq ($(BR2_PACKAGE_SNORT_ENABLE_DEBUG),y)
64 SNORT_CUSTOM_CONFIGURE_OPTS += --enable-debug
65 else
66 SNORT_CUSTOM_CONFIGURE_OPTS += --disable-debug
67 endif
68
69 ifeq ($(BR2_PACKAGE_SNORT_ENABLE_INLINE),y)
70 SNORT_CUSTOM_CONFIGURE_OPTS += --enable-inline
71 SNORT_CUSTOM_CONFIGURE_OPTS += --with-libipq-includes="$(STAGING_DIR)/include/libipq"
72 SNORT_CUSTOM_CONFIGURE_OPTS += --with-libipq-libraries="$(STAGING_DIR)/lib"
73 else
74 SNORT_CUSTOM_CONFIGURE_OPTS += --disable-inline
75 endif
76
77 ifeq ($(BR2_PACKAGE_SNORT_WITH_MYSQL),y)
78 SNORT_CUSTOM_CONFIGURE_OPTS += --with-mysql="$(STAGING_DIR)/usr"
79 else
80 SNORT_CUSTOM_CONFIGURE_OPTS += --without-mysql
81 endif
82
83 ifeq ($(BR2_PACKAGE_SNORT_WITH_PGSQL),y)
84 SNORT_CUSTOM_CONFIGURE_OPTS += --with-postgresql="$(STAGING_DIR)/usr"
85 else
86 SNORT_CUSTOM_CONFIGURE_OPTS += --without-postgresql
87 endif
88
89 define PKG_build
90
91 ifneq ($(BR2_PACKAGE_$(1)),)
92 BUILD_TARGETS += $(PKG_BUILD_DIR)/$(2)
93 endif
94
95 $(PKG_BUILD_DIR)/$(2): $(PKG_BUILD_DIR)/.prepared
96 touch -r $(PKG_BUILD_DIR)/Makefile.am $(PKG_BUILD_DIR)/configure.in
97 touch -r $(PKG_BUILD_DIR)/Makefile.in $(PKG_BUILD_DIR)/configure
98 -$(MAKE) -C $(PKG_BUILD_DIR) distclean
99 (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status} ; \
100 $(TARGET_CONFIGURE_OPTS) \
101 CFLAGS="$(TARGET_CFLAGS)" \
102 CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/usr/include/mysql" \
103 LDFLAGS="-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/usr/lib/mysql" \
104 ./configure \
105 $(PKG_CONFIGURE_OPTS) \
106 $$($(1)_CONFIGURE_OPTS) \
107 );
108 $(MAKE) -C $(PKG_BUILD_DIR)
109 mv $(PKG_BUILD_DIR)/src/snort $(PKG_BUILD_DIR)/$(2)
110
111 $$(IPKG_$(1)): $(PKG_BUILD_DIR)/.installed $(PKG_BUILD_DIR)/$(2)
112 rm -rf $$(IDIR_$(1))
113 $(SCRIPT_DIR)/make-ipkg-dir.sh $$(IDIR_$(1)) ./ipkg/$(2).control $(3) $(4)
114 install -m0644 ./ipkg/snort.conffiles $$(IDIR_$(1))/CONTROL/conffiles
115 install -d -m0755 $$(IDIR_$(1))/etc/default
116 install -m0644 ./ipkg/snort.default $$(IDIR_$(1))/etc/default/snort
117 install -d -m0755 $$(IDIR_$(1))/etc/init.d
118 install -m0755 ./ipkg/snort.init $$(IDIR_$(1))/etc/init.d/snort
119 install -d -m0755 $$(IDIR_$(1))/etc/snort
120 install -m0644 $(PKG_BUILD_DIR)/etc/snort.conf $$(IDIR_$(1))/etc/snort/
121 install -m0644 $(PKG_BUILD_DIR)/etc/classification.config $$(IDIR_$(1))/etc/snort/
122 install -m0644 $(PKG_BUILD_DIR)/etc/gen-msg.map $$(IDIR_$(1))/etc/snort/
123 install -m0644 $(PKG_BUILD_DIR)/etc/reference.config $$(IDIR_$(1))/etc/snort/
124 install -m0644 $(PKG_BUILD_DIR)/etc/sid-msg.map $$(IDIR_$(1))/etc/snort/
125 install -m0644 $(PKG_BUILD_DIR)/etc/threshold.conf $$(IDIR_$(1))/etc/snort/
126 install -m0644 $(PKG_BUILD_DIR)/etc/unicode.map $$(IDIR_$(1))/etc/snort/
127 install -d -m0755 $$(IDIR_$(1))/usr/sbin
128 install -m0755 $(PKG_BUILD_DIR)/$(2) $$(IDIR_$(1))/usr/sbin/snort
129 $(RSTRIP) $$(IDIR_$(1))
130 mkdir -p $(PACKAGE_DIR)
131 $(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR)
132
133 endef
134
135 $(eval $(call PKG_template,SNORT_BASIC,snort,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
136 $(eval $(call PKG_template,SNORT_MYSQL,snort-mysql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
137 $(eval $(call PKG_template,SNORT_PGSQL,snort-pgsql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
138 $(eval $(call PKG_template,SNORT_CUSTOM,snort-custom,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
139
140 $(eval $(call PKG_build,SNORT_BASIC,snort,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
141 $(eval $(call PKG_build,SNORT_MYSQL,snort-mysql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
142 $(eval $(call PKG_build,SNORT_PGSQL,snort-pgsql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
143 $(eval $(call PKG_build,SNORT_CUSTOM,snort-custom,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
144
145 $(PKG_BUILD_DIR)/.configured:
146 touch $@
147
148 $(PKG_BUILD_DIR)/.built: $(BUILD_TARGETS)
149 touch $@
150
151 $(PKG_BUILD_DIR)/.installed: $(PKG_BUILD_DIR)/.built
152 mkdir -p $(PKG_INSTALL_DIR)
153 $(MAKE) -C $(PKG_BUILD_DIR) \
154 DESTDIR="$(PKG_INSTALL_DIR)" \
155 install
156 touch $(PKG_BUILD_DIR)/.installed
157
This page took 0.054347 seconds and 5 git commands to generate.