net-snmp : update to 5.7.3
[feed/packages.git] / net / net-snmp / Makefile
1 #
2 # Copyright (C) 2006-2017 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=net-snmp
11 PKG_VERSION:=5.7.3
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=@SF/net-snmp
16 PKG_MD5SUM:=d4a3459e1577d0efa8d96ca70a885e53
17 PKG_MAINTAINER:=Stijn Tintel <stijn@linux-ipv6.be>
18 PKG_LICENSE:=MIT BSD-3-Clause-Clear
19
20 include $(INCLUDE_DIR)/package.mk
21
22 define Package/net-snmp/Default
23 SECTION:=net
24 CATEGORY:=Network
25 URL:=http://www.net-snmp.org/
26 endef
27
28 define Package/net-snmp/Default/description
29 Simple Network Management Protocol (SNMP) is a widely used protocol for
30 monitoring the health and welfare of network equipment (eg. routers),
31 computer equipment and even devices like UPSs. Net-SNMP is a suite of
32 applications used to implement SNMP v1, SNMP v2c and SNMP v3 using both
33 IPv4 and IPv6.
34 endef
35
36
37 define Package/libnetsnmp
38 $(call Package/net-snmp/Default)
39 SECTION:=libs
40 CATEGORY:=Libraries
41 DEPENDS:=+PACKAGE_libnl:libnl
42 TITLE:=Open source SNMP implementation (libraries)
43 endef
44
45 define Package/libnetsnmp/description
46 $(call Package/net-snmp/Default/description)
47 .
48 This package contains shared libraries, needed by other programs.
49 endef
50
51
52 define Package/snmp-mibs
53 $(call Package/net-snmp/Default)
54 TITLE:=Open source SNMP implementation (MIB-files)
55 endef
56
57 define Package/snmp-mibs/description
58 $(call Package/net-snmp/Default/description)
59 .
60 This package contains SNMP MIB-Files.
61 endef
62
63
64 define Package/snmp-utils
65 $(call Package/net-snmp/Default)
66 DEPENDS:=+libnetsnmp
67 TITLE:=Open source SNMP implementation (utilities)
68 endef
69
70 define Package/snmp-utils/description
71 $(call Package/net-snmp/Default/description)
72 .
73 This package contains SNMP client utilities.
74 endef
75
76
77 define Package/snmpd
78 $(call Package/net-snmp/Default)
79 DEPENDS:=+libnetsnmp
80 TITLE:=Open source SNMP implementation (daemon)
81 endef
82
83 define Package/snmpd/description
84 $(call Package/net-snmp/Default/description)
85 .
86 This package contains the SNMP agent, dynamically linked.
87 endef
88
89
90 define Package/snmpd-static
91 $(call Package/net-snmp/Default)
92 TITLE:=Open source SNMP implementation (daemon)
93 endef
94
95 define Package/snmpd-static/description
96 $(call Package/net-snmp/Default/description)
97 .
98 This package contains the SNMP agent, statically linked.
99 endef
100
101
102 SNMP_MIB_MODULES_INCLUDED = \
103 host/hr_device \
104 host/hr_disk \
105 host/hr_filesys \
106 host/hr_network \
107 host/hr_partition \
108 host/hr_proc \
109 host/hr_storage \
110 host/hr_system \
111 ieee802dot11 \
112 if-mib/ifXTable \
113 mibII/at \
114 mibII/icmp \
115 mibII/ifTable \
116 mibII/ip \
117 mibII/snmp_mib \
118 mibII/sysORTable \
119 mibII/system_mib \
120 mibII/tcp \
121 mibII/udp \
122 mibII/vacm_context \
123 mibII/vacm_vars \
124 snmpv3/snmpEngine \
125 snmpv3/snmpMPDStats \
126 snmpv3/usmConf \
127 snmpv3/usmStats \
128 snmpv3/usmUser \
129 tunnel \
130 ucd-snmp/disk \
131 ucd-snmp/dlmod \
132 ucd-snmp/extensible \
133 ucd-snmp/loadave \
134 ucd-snmp/memory \
135 ucd-snmp/pass \
136 ucd-snmp/pass_persist \
137 ucd-snmp/proc \
138 ucd-snmp/vmstat \
139 util_funcs \
140 utilities/execute \
141
142 SNMP_MIB_MODULES_EXCLUDED = \
143 agent_mibs \
144 agentx \
145 disman/event \
146 disman/schedule \
147 hardware \
148 host \
149 if-mib \
150 mibII \
151 notification \
152 notification-log-mib \
153 snmpv3mibs \
154 target \
155 tcp-mib \
156 ucd_snmp \
157 udp-mib \
158 utilities \
159
160 SNMP_TRANSPORTS_INCLUDED = Callback UDP
161
162 SNMP_TRANSPORTS_EXCLUDED = TCP TCPIPv6 Unix
163
164 TARGET_CFLAGS += $(FPIC)
165
166 CONFIGURE_ARGS += \
167 --enable-mfd-rewrites \
168 --enable-shared \
169 --enable-static \
170 --with-endianness=$(if $(CONFIG_BIG_ENDIAN),big,little) \
171 --with-logfile=/var/log/snmpd.log \
172 --with-persistent-directory=/usr/lib/snmp/ \
173 --with-default-snmp-version=1 \
174 --with-sys-contact=root@localhost \
175 --with-sys-location=Unknown \
176 --enable-applications \
177 --disable-debugging \
178 --disable-manuals \
179 --disable-scripts \
180 --with-out-mib-modules="$(SNMP_MIB_MODULES_EXCLUDED)" \
181 --with-mib-modules="$(SNMP_MIB_MODULES_INCLUDED)" \
182 --with-out-transports="$(SNMP_TRANSPORTS_EXCLUDED)" \
183 --with-transports="$(SNMP_TRANSPORTS_INCLUDED)" \
184 --without-openssl \
185 --without-libwrap \
186 --without-rpm \
187 --without-zlib \
188 $(call autoconf_bool,CONFIG_IPV6,ipv6) \
189
190 ifeq ($(CONFIG_IPV6),y)
191 SNMP_TRANSPORTS_INCLUDED+= UDPIPv6
192 endif
193
194 TARGET_LDFLAGS += -L$(TOOLCHAIN_DIR)/usr/lib
195
196 ifdef CONFIG_PACKAGE_snmpd-static
197 define Build/Compile/static
198 $(MAKE) -C $(PKG_BUILD_DIR)/agent \
199 LDFLAGS="$(TARGET_LDFLAGS) -lm -static" \
200 EXEEXT="-static" \
201 snmpd-static
202 endef
203 endif
204
205 define Build/Compile
206 $(MAKE) -C $(PKG_BUILD_DIR) \
207 INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
208 LDFLAGS="$(TARGET_LDFLAGS) -lm -lc" \
209 all install
210 $(Build/Compile/static)
211 endef
212
213 define Build/InstallDev
214 $(INSTALL_DIR) $(2)/bin
215 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/net-snmp-config $(2)/bin/
216 $(SED) 's,=/usr,=$(STAGING_DIR)/usr,g' $(2)/bin/net-snmp-config
217
218 $(INSTALL_DIR) $(1)/usr/include
219 $(CP) $(PKG_INSTALL_DIR)/usr/include/net-snmp $(1)/usr/include/
220 $(INSTALL_DIR) $(1)/usr/lib
221 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.{a,so*} $(1)/usr/lib/
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/snmp-mibs/install
230 $(INSTALL_DIR) $(1)/usr/share/snmp/mibs
231 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/snmp/mibs/* $(1)/usr/share/snmp/mibs/
232 endef
233
234 define Package/snmp-utils/install
235 $(INSTALL_DIR) $(1)/usr/bin
236 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/snmp{get,set,status,test,trap,walk} $(1)/usr/bin/
237 endef
238
239 define Package/snmpd/conffiles
240 /etc/config/snmpd
241 endef
242
243 define Package/snmpd/install
244 $(INSTALL_DIR) $(1)/etc/config
245 $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/config/snmpd
246 $(INSTALL_DIR) $(1)/etc/snmp
247 ln -sf /var/run/snmpd.conf $(1)/etc/snmp/
248 $(INSTALL_DIR) $(1)/etc/init.d
249 $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
250 $(INSTALL_DIR) $(1)/usr/sbin
251 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmpd $(1)/usr/sbin/snmpd
252 endef
253
254 define Package/snmpd-static/conffiles
255 /etc/config/snmpd
256 endef
257
258 define Package/snmpd-static/install
259 $(INSTALL_DIR) $(1)/etc/config
260 $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/config/snmpd
261 $(INSTALL_DIR) $(1)/etc/snmp
262 ln -sf /var/run/snmpd.conf $(1)/etc/snmp/
263 $(INSTALL_DIR) $(1)/etc/init.d
264 $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
265 $(INSTALL_DIR) $(1)/usr/sbin
266 $(INSTALL_BIN) $(PKG_BUILD_DIR)/agent/snmpd-static $(1)/usr/sbin/snmpd
267 endef
268
269 $(eval $(call BuildPackage,libnetsnmp))
270 $(eval $(call BuildPackage,snmp-mibs))
271 $(eval $(call BuildPackage,snmp-utils))
272 $(eval $(call BuildPackage,snmpd))
273 $(eval $(call BuildPackage,snmpd-static))