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