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