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