replace lots of manual install commands with INSTALL_* variables
[openwrt/svn-archive/archive.git] / libs / net-snmp / 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:=net-snmp
12 PKG_VERSION:=5.1.2
13 PKG_RELEASE:=2.1
14
15 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
16 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
17 PKG_SOURCE_URL:=@SF/net-snmp
18 PKG_MD5SUM:=8080555ab3f90011f25d5122042d9a8d
19 PKG_CAT:=zcat
20
21 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
22
23 include $(INCLUDE_DIR)/package.mk
24
25 define Package/libnetsnmp
26 SECTION:=libs
27 CATEGORY:=Libraries
28 DEPENDS:=+libelf
29 TITLE:=Open source SNMP implementation (librairies)
30 DESCRIPTION:=Open source SNMP (Simple Network Management Protocol) implementation (libraries).\\\
31 Simple Network Management Protocol (SNMP) is a widely used \\\
32 protocol for monitoring the health and welfare of network \\\
33 equipment (eg. routers), computer equipment and even devices \\\
34 like UPSs. Net-SNMP is a suite of applications used to implement \\\
35 SNMP v1, SNMP v2c and SNMP v3 using both IPv4 and IPv6.\\\
36 \\\
37 This package contains shared libraries, needed by other programs.
38 URL:=http://www.net-snmp.org/
39 endef
40
41 define Package/snmp-utils
42 SECTION:=net
43 CATEGORY:=Network
44 DEPENDS:=+libnetsnmp
45 TITLE:=Open source SNMP implementation (utilities)
46 DESCRIPTION:=Open source SNMP (Simple Network Management Protocol) implementation (utilities).\\\
47 Simple Network Management Protocol (SNMP) is a widely used \\\
48 protocol for monitoring the health and welfare of network \\\
49 equipment (eg. routers), computer equipment and even devices \\\
50 like UPSs. Net-SNMP is a suite of applications used to implement \\\
51 SNMP v1, SNMP v2c and SNMP v3 using both IPv4 and IPv6.\\\
52 \\\
53 This package contains SNMP client utilities.
54 URL:=http://www.net-snmp.org/
55 endef
56
57 define Package/snmpd
58 SECTION:=net
59 CATEGORY:=Network
60 DEPENDS:=+libnetsnmp
61 TITLE:=Open source SNMP implementation (daemon)
62 DESCRIPTION:=Open source SNMP (Simple Network Management Protocol) implementation (daemon).\\\
63 Simple Network Management Protocol (SNMP) is a widely used \\\
64 protocol for monitoring the health and welfare of network \\\
65 equipment (eg. routers), computer equipment and even devices \\\
66 like UPSs. Net-SNMP is a suite of applications used to implement \\\
67 SNMP v1, SNMP v2c and SNMP v3 using both IPv4 and IPv6.\\\
68 \\\
69 This package contains the SNMP agent, dynamically linked.
70 URL:=http://www.net-snmp.org/
71 endef
72
73 define Package/snmpd/conffiles
74 /etc/default/snmpd
75 /etc/snmp/snmpd.conf
76 endef
77
78 define Package/snmpd-static
79 SECTION:=net
80 CATEGORY:=Network
81 TITLE:=Open source SNMP implementation (daemon)
82 DESCRIPTION:=Open source SNMP (Simple Network Management Protocol) implementation (daemon).\\\
83 Simple Network Management Protocol (SNMP) is a widely used \\\
84 protocol for monitoring the health and welfare of network \\\
85 equipment (eg. routers), computer equipment and even devices \\\
86 like UPSs. Net-SNMP is a suite of applications used to implement \\\
87 SNMP v1, SNMP v2c and SNMP v3 using both IPv4 and IPv6.\\\
88 \\\
89 This package contains the SNMP agent, statically linked.
90 URL:=http://www.net-snmp.org/
91 endef
92
93 define Package/snmpd-static/conffiles
94 /etc/default/snmpd
95 /etc/snmp/snmpd.conf
96 endef
97
98 SNMP_MIB_MODULES_INCLUDED = \
99 host/hr_device \
100 host/hr_disk \
101 host/hr_filesys \
102 host/hr_network \
103 host/hr_partition \
104 host/hr_proc \
105 host/hr_storage \
106 host/hr_system \
107 mibII/at \
108 mibII/icmp \
109 mibII/interfaces \
110 mibII/ip \
111 mibII/snmp_mib \
112 mibII/sysORTable \
113 mibII/system_mib \
114 mibII/tcp \
115 mibII/udp \
116 mibII/vacm_context \
117 mibII/vacm_vars \
118 snmpv3/snmpEngine \
119 snmpv3/snmpMPDStats \
120 snmpv3/usmStats \
121 snmpv3/usmUser \
122 snmpv3mibs \
123 tunnel \
124 ucd-snmp/disk \
125 ucd-snmp/dlmod \
126 ucd-snmp/extensible \
127 ucd-snmp/loadave \
128 ucd-snmp/memory \
129 ucd-snmp/pass \
130 ucd-snmp/proc \
131 ucd-snmp/vmstat \
132 util_funcs \
133 utilities/execute \
134
135 SNMP_MIB_MODULES_EXCLUDED = \
136 agent_mibs \
137 agentx \
138 host \
139 ieee802dot11 \
140 mibII \
141 notification \
142 snmpv3mibs \
143 target \
144 ucd_snmp \
145 utilities \
146
147 SNMP_TRANSPORTS_INCLUDED = Callback UDP
148
149 SNMP_TRANSPORTS_EXCLUDED = TCP TCPv6 UDPv6 Unix
150
151 PKG_CONFIGURE_OPTIONS = \
152 --enable-shared \
153 --enable-static \
154 --with-endianness=little \
155 --with-logfile=/var/log/snmpd.log \
156 --with-persistent-directory=/usr/lib/snmp/ \
157 --with-default-snmp-version=1 \
158 --with-sys-contact=root@localhost \
159 --with-sys-location=Unknown \
160 --enable-applications \
161 --disable-debugging \
162 --disable-ipv6 \
163 --disable-manuals \
164 --disable-mib-loading \
165 --disable-mibs \
166 --disable-scripts \
167 --with-out-mib-modules="$(SNMP_MIB_MODULES_EXCLUDED)" \
168 --with-mib-modules="$(SNMP_MIB_MODULES_INCLUDED)" \
169 --with-out-transports="$(SNMP_TRANSPORTS_EXCLUDED)" \
170 --with-transports="$(SNMP_TRANSPORTS_INCLUDED)" \
171 --without-opaque-special-types \
172 --without-openssl \
173 --without-libwrap \
174 --without-rpm \
175 --without-zlib \
176
177 define Build/Configure
178 (cd $(PKG_BUILD_DIR); rm -f config.cache; \
179 $(TARGET_CONFIGURE_OPTS) \
180 CFLAGS="$(TARGET_CFLAGS)" \
181 CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
182 LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
183 ac_cv_header_pcap_h=no \
184 ./configure \
185 --target=$(GNU_TARGET_NAME) \
186 --host=$(GNU_TARGET_NAME) \
187 --build=$(GNU_HOST_NAME) \
188 --program-prefix="" \
189 --program-suffix="" \
190 --prefix=/usr \
191 --exec-prefix=/usr \
192 --bindir=/usr/bin \
193 --datadir=/usr/share \
194 --includedir=/usr/include \
195 --infodir=/usr/share/info \
196 --libdir=/usr/lib \
197 --libexecdir=/usr/lib \
198 --localstatedir=/var \
199 --mandir=/usr/share/man \
200 --sbindir=/usr/sbin \
201 --sysconfdir=/etc \
202 $(DISABLE_LARGEFILE) \
203 $(DISABLE_NLS) \
204 $(PKG_CONFIGURE_OPTIONS) \
205 );
206 endef
207
208 define Build/Compile
209 rm -rf $(PKG_INSTALL_DIR)
210 mkdir -p $(PKG_INSTALL_DIR)
211 $(MAKE) -C $(PKG_BUILD_DIR) \
212 INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
213 all install
214 ( cd $(PKG_INSTALL_DIR); mv ./usr/sbin/snmpd ./usr/sbin/snmpd-shared; )
215 #ifneq ($(CONFIG_PACKAGE_snmpd-static),)
216 ( cd $(PKG_BUILD_DIR); rm -f agent/snmpd; )
217 $(MAKE) -C $(PKG_BUILD_DIR) \
218 LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib -static" \
219 INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
220 all install
221 ( cd $(PKG_INSTALL_DIR); mv ./usr/sbin/snmpd ./usr/sbin/snmpd-static; )
222 #endif
223 endef
224
225 define Package/libnetsnmp/install
226 $(INSTALL_DIR) $(1)/usr/lib
227 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.so.* $(1)/usr/lib/
228 endef
229
230 define Package/snmpd/install
231 $(INSTALL_DIR) $(1)/etc/snmp
232 $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/snmp/snmpd.conf
233 $(INSTALL_DIR) $(1)/etc/default
234 $(INSTALL_DATA) ./files/snmpd.default $(1)/etc/default/snmpd
235 $(INSTALL_DIR) $(1)/etc/init.d
236 $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
237 $(INSTALL_DIR) $(1)/usr/sbin
238 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmpd-shared $(1)/usr/sbin/snmpd
239 endef
240
241 define Package/snmpd-static/install
242 $(INSTALL_DIR) $(1)/etc/snmp
243 $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/snmp/snmpd.conf
244 $(INSTALL_DIR) $(1)/etc/default
245 $(INSTALL_DATA) ./files/snmpd.default $(1)/etc/default/snmpd
246 $(INSTALL_DIR) $(1)/etc/init.d
247 $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
248 $(INSTALL_DIR) $(1)/usr/sbin
249 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmpd-static $(1)/usr/sbin/snmpd
250 endef
251
252 define Package/snmp-utils/install
253 $(INSTALL_DIR) $(1)/usr/bin
254 $(CP) $(PKG_INSTALL_DIR)/usr/bin/snmp{get,set,status,test,trap,walk} $(1)/usr/bin/
255 endef
256
257 define Build/InstallDev
258 mkdir -p $(STAGING_DIR)/usr/bin
259 $(CP) $(PKG_INSTALL_DIR)/usr/bin/net-snmp-config $(STAGING_DIR)/usr/bin/
260 mkdir -p $(STAGING_DIR)/usr/include
261 $(CP) $(PKG_INSTALL_DIR)/usr/include/net-snmp $(STAGING_DIR)/usr/include/
262 mkdir -p $(STAGING_DIR)/usr/lib
263 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.{a,so*} $(STAGING_DIR)/usr/lib/
264 endef
265
266 define Build/UninstallDev
267 rm -rf \
268 $(STAGING_DIR)/usr/bin/net-snmp-config \
269 $(STAGING_DIR)/usr/include/net-snmp \
270 $(STAGING_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.{a,so*}
271 endef
272
273 $(eval $(call BuildPackage,libnetsnmp))
274 $(eval $(call BuildPackage,snmp-utils))
275 $(eval $(call BuildPackage,snmpd))
276 $(eval $(call BuildPackage,snmpd-static))