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