enable mib loading, required for a soon to be committed package
[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.2
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-mibs \
165 --disable-scripts \
166 --with-out-mib-modules="$(SNMP_MIB_MODULES_EXCLUDED)" \
167 --with-mib-modules="$(SNMP_MIB_MODULES_INCLUDED)" \
168 --with-out-transports="$(SNMP_TRANSPORTS_EXCLUDED)" \
169 --with-transports="$(SNMP_TRANSPORTS_INCLUDED)" \
170 --without-opaque-special-types \
171 --without-openssl \
172 --without-libwrap \
173 --without-rpm \
174 --without-zlib \
175
176 define Build/Configure
177 (cd $(PKG_BUILD_DIR); rm -f config.cache; \
178 $(TARGET_CONFIGURE_OPTS) \
179 CFLAGS="$(TARGET_CFLAGS)" \
180 CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
181 LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
182 ac_cv_header_pcap_h=no \
183 ./configure \
184 --target=$(GNU_TARGET_NAME) \
185 --host=$(GNU_TARGET_NAME) \
186 --build=$(GNU_HOST_NAME) \
187 --program-prefix="" \
188 --program-suffix="" \
189 --prefix=/usr \
190 --exec-prefix=/usr \
191 --bindir=/usr/bin \
192 --datadir=/usr/share \
193 --includedir=/usr/include \
194 --infodir=/usr/share/info \
195 --libdir=/usr/lib \
196 --libexecdir=/usr/lib \
197 --localstatedir=/var \
198 --mandir=/usr/share/man \
199 --sbindir=/usr/sbin \
200 --sysconfdir=/etc \
201 $(DISABLE_LARGEFILE) \
202 $(DISABLE_NLS) \
203 $(PKG_CONFIGURE_OPTIONS) \
204 );
205 endef
206
207 define Build/Compile
208 rm -rf $(PKG_INSTALL_DIR)
209 mkdir -p $(PKG_INSTALL_DIR)
210 $(MAKE) -C $(PKG_BUILD_DIR) \
211 INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
212 all install
213 ( cd $(PKG_INSTALL_DIR); mv ./usr/sbin/snmpd ./usr/sbin/snmpd-shared; )
214 #ifneq ($(CONFIG_PACKAGE_snmpd-static),)
215 ( cd $(PKG_BUILD_DIR); rm -f agent/snmpd; )
216 $(MAKE) -C $(PKG_BUILD_DIR) \
217 LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib -static" \
218 INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
219 all install
220 ( cd $(PKG_INSTALL_DIR); mv ./usr/sbin/snmpd ./usr/sbin/snmpd-static; )
221 #endif
222 endef
223
224 define Package/libnetsnmp/install
225 $(INSTALL_DIR) $(1)/usr/lib
226 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.so.* $(1)/usr/lib/
227 endef
228
229 define Package/snmpd/install
230 $(INSTALL_DIR) $(1)/etc/snmp
231 $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/snmp/snmpd.conf
232 $(INSTALL_DIR) $(1)/etc/default
233 $(INSTALL_DATA) ./files/snmpd.default $(1)/etc/default/snmpd
234 $(INSTALL_DIR) $(1)/etc/init.d
235 $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
236 $(INSTALL_DIR) $(1)/usr/sbin
237 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmpd-shared $(1)/usr/sbin/snmpd
238 endef
239
240 define Package/snmpd-static/install
241 $(INSTALL_DIR) $(1)/etc/snmp
242 $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/snmp/snmpd.conf
243 $(INSTALL_DIR) $(1)/etc/default
244 $(INSTALL_DATA) ./files/snmpd.default $(1)/etc/default/snmpd
245 $(INSTALL_DIR) $(1)/etc/init.d
246 $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
247 $(INSTALL_DIR) $(1)/usr/sbin
248 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmpd-static $(1)/usr/sbin/snmpd
249 endef
250
251 define Package/snmp-utils/install
252 $(INSTALL_DIR) $(1)/usr/bin
253 $(CP) $(PKG_INSTALL_DIR)/usr/bin/snmp{get,set,status,test,trap,walk} $(1)/usr/bin/
254 endef
255
256 define Build/InstallDev
257 mkdir -p $(STAGING_DIR)/usr/bin
258 $(CP) $(PKG_INSTALL_DIR)/usr/bin/net-snmp-config $(STAGING_DIR)/usr/bin/
259 mkdir -p $(STAGING_DIR)/usr/include
260 $(CP) $(PKG_INSTALL_DIR)/usr/include/net-snmp $(STAGING_DIR)/usr/include/
261 mkdir -p $(STAGING_DIR)/usr/lib
262 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.{a,so*} $(STAGING_DIR)/usr/lib/
263 endef
264
265 define Build/UninstallDev
266 rm -rf \
267 $(STAGING_DIR)/usr/bin/net-snmp-config \
268 $(STAGING_DIR)/usr/include/net-snmp \
269 $(STAGING_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.{a,so*}
270 endef
271
272 $(eval $(call BuildPackage,libnetsnmp))
273 $(eval $(call BuildPackage,snmp-utils))
274 $(eval $(call BuildPackage,snmpd))
275 $(eval $(call BuildPackage,snmpd-static))