Merge pull request #7098 from ammubhave/add_libgflags
[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.8
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=@SF/net-snmp
16 PKG_HASH:=b2fc3500840ebe532734c4786b0da4ef0a5f67e51ef4c86b3345d697e4976adf
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 +libpci
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 ip-mib/inetNetToMediaTable \
132 mibII/at \
133 mibII/icmp \
134 mibII/ifTable \
135 mibII/ip \
136 mibII/snmp_mib \
137 mibII/sysORTable \
138 mibII/system_mib \
139 mibII/tcp \
140 mibII/udp \
141 mibII/vacm_context \
142 mibII/vacm_vars \
143 snmpv3/snmpEngine \
144 snmpv3/snmpMPDStats \
145 snmpv3/usmConf \
146 snmpv3/usmStats \
147 snmpv3/usmUser \
148 tunnel \
149 ucd-snmp/disk \
150 ucd-snmp/dlmod \
151 ucd-snmp/extensible \
152 ucd-snmp/loadave \
153 ucd-snmp/memory \
154 ucd-snmp/pass \
155 ucd-snmp/pass_persist \
156 ucd-snmp/proc \
157 ucd-snmp/vmstat \
158 util_funcs \
159 utilities/execute \
160
161 SNMP_MIB_MODULES_EXCLUDED = \
162 agent_mibs \
163 disman/event \
164 disman/schedule \
165 hardware \
166 host \
167 if-mib \
168 ip-mib \
169 mibII \
170 notification \
171 notification-log-mib \
172 snmpv3mibs \
173 target \
174 tcp-mib \
175 ucd_snmp \
176 udp-mib \
177 utilities \
178
179 SNMP_TRANSPORTS_INCLUDED = Callback UDP Unix
180
181 SNMP_TRANSPORTS_EXCLUDED = TCP TCPIPv6
182
183 TARGET_CFLAGS += $(FPIC)
184 TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/libnl-tiny
185
186 CONFIGURE_ARGS += \
187 --enable-mfd-rewrites \
188 --enable-shared \
189 --enable-static \
190 --with-endianness=$(if $(CONFIG_BIG_ENDIAN),big,little) \
191 --with-logfile=/var/log/snmpd.log \
192 --with-persistent-directory=/usr/lib/snmp/ \
193 --with-default-snmp-version=1 \
194 --with-sys-contact=root@localhost \
195 --with-sys-location=Unknown \
196 --enable-applications \
197 --disable-debugging \
198 --disable-manuals \
199 --disable-scripts \
200 --with-out-mib-modules="$(SNMP_MIB_MODULES_EXCLUDED)" \
201 --with-mib-modules="$(SNMP_MIB_MODULES_INCLUDED)" \
202 --with-out-transports="$(SNMP_TRANSPORTS_EXCLUDED)" \
203 --with-transports="$(SNMP_TRANSPORTS_INCLUDED)" \
204 --without-openssl \
205 --without-libwrap \
206 --without-mysql \
207 --without-rpm \
208 --without-zlib \
209 --with-nl \
210 $(call autoconf_bool,CONFIG_IPV6,ipv6) \
211 --disable-perl-cc-checks \
212 --disable-embedded-perl \
213 --without-perl-modules
214
215 CONFIGURE_VARS += \
216 ac_cv_header_netlink_netlink_h=yes \
217 ac_cv_header_pcre_h=no \
218 netsnmp_cv_func_nl_connect_LIBS=-lnl-tiny \
219
220 ifeq ($(CONFIG_IPV6),y)
221 SNMP_TRANSPORTS_INCLUDED+= UDPIPv6
222 endif
223
224 TARGET_LDFLAGS += -L$(TOOLCHAIN_DIR)/usr/lib
225
226 define Build/Compile
227 $(MAKE) -C $(PKG_BUILD_DIR) \
228 INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
229 LDFLAGS="$(TARGET_LDFLAGS) -lm -lc" \
230 all install
231 endef
232
233 define Build/InstallDev
234 $(INSTALL_DIR) $(2)/bin
235 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/net-snmp-config $(2)/bin/
236 $(SED) 's,=/usr,=$(STAGING_DIR)/usr,g' $(2)/bin/net-snmp-config
237 $(INSTALL_DIR) $(STAGING_DIR)/usr/bin
238 $(LN) $(STAGING_DIR)/host/bin/net-snmp-config $(STAGING_DIR)/usr/bin/
239
240 $(INSTALL_DIR) $(1)/usr/include
241 $(CP) $(PKG_INSTALL_DIR)/usr/include/net-snmp $(1)/usr/include/
242 $(INSTALL_DIR) $(1)/usr/lib
243 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.{a,so*} $(1)/usr/lib/
244 endef
245
246 define Package/libnetsnmp/install
247 $(INSTALL_DIR) $(1)/usr/lib
248 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.so.* $(1)/usr/lib/
249 endef
250
251 define Package/snmp-mibs/install
252 $(INSTALL_DIR) $(1)/usr/share/snmp/mibs
253 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/snmp/mibs/* $(1)/usr/share/snmp/mibs/
254 endef
255
256 define Package/snmp-utils/install
257 $(INSTALL_DIR) $(1)/usr/bin
258 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/snmp{get,set,status,test,trap,walk} $(1)/usr/bin/
259 endef
260
261 define Package/snmpd/conffiles
262 /etc/config/snmpd
263 endef
264
265 define Package/snmpd/install
266 $(INSTALL_DIR) $(1)/etc/config
267 $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/config/snmpd
268 $(INSTALL_DIR) $(1)/etc/snmp
269 $(LN) /var/run/snmpd.conf $(1)/etc/snmp/
270 $(INSTALL_DIR) $(1)/etc/init.d
271 $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
272 $(INSTALL_DIR) $(1)/usr/sbin
273 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmpd $(1)/usr/sbin/snmpd
274 endef
275
276 define Package/snmptrapd/install
277 $(INSTALL_DIR) $(1)/etc/init.d
278 $(INSTALL_BIN) ./files/snmptrapd.init $(1)/etc/init.d/snmptrapd
279 $(INSTALL_DIR) $(1)/usr/lib
280 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmptrapd.so.* $(1)/usr/lib/
281 $(INSTALL_DIR) $(1)/usr/sbin
282 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmptrapd $(1)/usr/sbin/
283 endef
284
285 $(eval $(call BuildPackage,libnetsnmp))
286 $(eval $(call BuildPackage,snmp-mibs))
287 $(eval $(call BuildPackage,snmp-utils))
288 $(eval $(call BuildPackage,snmpd))
289 $(eval $(call BuildPackage,snmpd-static))
290 $(eval $(call BuildPackage,snmptrapd))