3446d151426291a5c2dc4929a6d15099ace0f072
[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:=3
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 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 endef
77
78
79 define Package/snmpd
80 $(call Package/net-snmp/Default)
81 DEPENDS:=+libnetsnmp
82 TITLE:=Open source SNMP implementation (daemon)
83 endef
84
85 define Package/snmpd/description
86 $(call Package/net-snmp/Default/description)
87 .
88 This package contains the SNMP agent, dynamically linked.
89 endef
90
91
92 define Package/snmpd-static
93 $(call Package/net-snmp/Default)
94 DEPENDS:=+snmpd
95 TITLE:=Open source SNMP implementation (daemon)
96 endef
97
98
99
100 SNMP_MIB_MODULES_INCLUDED = \
101 agentx \
102 host/hr_device \
103 host/hr_disk \
104 host/hr_filesys \
105 host/hr_network \
106 host/hr_partition \
107 host/hr_proc \
108 host/hr_storage \
109 host/hr_system \
110 ieee802dot11 \
111 if-mib/ifXTable \
112 mibII/at \
113 mibII/icmp \
114 mibII/ifTable \
115 mibII/ip \
116 mibII/snmp_mib \
117 mibII/sysORTable \
118 mibII/system_mib \
119 mibII/tcp \
120 mibII/udp \
121 mibII/vacm_context \
122 mibII/vacm_vars \
123 snmpv3/snmpEngine \
124 snmpv3/snmpMPDStats \
125 snmpv3/usmConf \
126 snmpv3/usmStats \
127 snmpv3/usmUser \
128 tunnel \
129 ucd-snmp/disk \
130 ucd-snmp/dlmod \
131 ucd-snmp/extensible \
132 ucd-snmp/loadave \
133 ucd-snmp/memory \
134 ucd-snmp/pass \
135 ucd-snmp/pass_persist \
136 ucd-snmp/proc \
137 ucd-snmp/vmstat \
138 util_funcs \
139 utilities/execute \
140
141 SNMP_MIB_MODULES_EXCLUDED = \
142 agent_mibs \
143 disman/event \
144 disman/schedule \
145 hardware \
146 host \
147 if-mib \
148 mibII \
149 notification \
150 notification-log-mib \
151 snmpv3mibs \
152 target \
153 tcp-mib \
154 ucd_snmp \
155 udp-mib \
156 utilities \
157
158 SNMP_TRANSPORTS_INCLUDED = Callback UDP Unix
159
160 SNMP_TRANSPORTS_EXCLUDED = TCP TCPIPv6
161
162 TARGET_CFLAGS += $(FPIC)
163 TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/libnl-tiny
164
165 CONFIGURE_ARGS += \
166 --enable-mfd-rewrites \
167 --enable-shared \
168 --enable-static \
169 --with-endianness=$(if $(CONFIG_BIG_ENDIAN),big,little) \
170 --with-logfile=/var/log/snmpd.log \
171 --with-persistent-directory=/usr/lib/snmp/ \
172 --with-default-snmp-version=1 \
173 --with-sys-contact=root@localhost \
174 --with-sys-location=Unknown \
175 --enable-applications \
176 --disable-debugging \
177 --disable-manuals \
178 --disable-scripts \
179 --with-out-mib-modules="$(SNMP_MIB_MODULES_EXCLUDED)" \
180 --with-mib-modules="$(SNMP_MIB_MODULES_INCLUDED)" \
181 --with-out-transports="$(SNMP_TRANSPORTS_EXCLUDED)" \
182 --with-transports="$(SNMP_TRANSPORTS_INCLUDED)" \
183 --without-openssl \
184 --without-libwrap \
185 --without-rpm \
186 --without-zlib \
187 --with-nl \
188 $(call autoconf_bool,CONFIG_IPV6,ipv6) \
189
190 CONFIGURE_VARS += \
191 ac_cv_header_netlink_netlink_h=yes \
192 netsnmp_cv_func_nl_connect_LIBS=-lnl-tiny \
193
194 ifeq ($(CONFIG_IPV6),y)
195 SNMP_TRANSPORTS_INCLUDED+= UDPIPv6
196 endif
197
198 TARGET_LDFLAGS += -L$(TOOLCHAIN_DIR)/usr/lib
199
200 define Build/Compile
201 $(MAKE) -C $(PKG_BUILD_DIR) \
202 INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
203 LDFLAGS="$(TARGET_LDFLAGS) -lm -lc" \
204 all install
205 endef
206
207 define Build/InstallDev
208 $(INSTALL_DIR) $(2)/bin
209 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/net-snmp-config $(2)/bin/
210 $(SED) 's,=/usr,=$(STAGING_DIR)/usr,g' $(2)/bin/net-snmp-config
211
212 $(INSTALL_DIR) $(1)/usr/include
213 $(CP) $(PKG_INSTALL_DIR)/usr/include/net-snmp $(1)/usr/include/
214 $(INSTALL_DIR) $(1)/usr/lib
215 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.{a,so*} $(1)/usr/lib/
216 endef
217
218 define Package/libnetsnmp/install
219 $(INSTALL_DIR) $(1)/usr/lib
220 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.so.* $(1)/usr/lib/
221 endef
222
223 define Package/snmp-mibs/install
224 $(INSTALL_DIR) $(1)/usr/share/snmp/mibs
225 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/snmp/mibs/* $(1)/usr/share/snmp/mibs/
226 endef
227
228 define Package/snmp-utils/install
229 $(INSTALL_DIR) $(1)/usr/bin
230 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/snmp{get,set,status,test,trap,walk} $(1)/usr/bin/
231 endef
232
233 define Package/snmpd/conffiles
234 /etc/config/snmpd
235 endef
236
237 define Package/snmpd/install
238 $(INSTALL_DIR) $(1)/etc/config
239 $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/config/snmpd
240 $(INSTALL_DIR) $(1)/etc/snmp
241 ln -sf /var/run/snmpd.conf $(1)/etc/snmp/
242 $(INSTALL_DIR) $(1)/etc/init.d
243 $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
244 $(INSTALL_DIR) $(1)/usr/sbin
245 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmpd $(1)/usr/sbin/snmpd
246 endef
247
248 $(eval $(call BuildPackage,libnetsnmp))
249 $(eval $(call BuildPackage,snmp-mibs))
250 $(eval $(call BuildPackage,snmp-utils))
251 $(eval $(call BuildPackage,snmpd))
252 $(eval $(call BuildPackage,snmpd-static))