net-snmp: import from oldpackages, add myself as maintainer, add license information...
[feed/packages.git] / net / net-snmp / Makefile
1 #
2 # Copyright (C) 2006-2014 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.4.4
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=@SF/net-snmp
16 PKG_MD5SUM:=95aa054f3c99a1ce242807d7eaf98619
17 PKG_MAINTAINER:=Jo-Philipp Wich <jow@openwrt.org>
18 PKG_LICENSE:=MIT BSD-3-Clause-Clear
19
20 PKG_FIXUP = patch-libtool
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:=+libelf1
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-utils
55 $(call Package/net-snmp/Default)
56 DEPENDS:=+libnetsnmp
57 TITLE:=Open source SNMP implementation (utilities)
58 endef
59
60 define Package/snmp-utils/description
61 $(call Package/net-snmp/Default/description)
62 .
63 This package contains SNMP client utilities.
64 endef
65
66
67 define Package/snmpd
68 $(call Package/net-snmp/Default)
69 DEPENDS:=+libnetsnmp
70 TITLE:=Open source SNMP implementation (daemon)
71 endef
72
73 define Package/snmpd/description
74 $(call Package/net-snmp/Default/description)
75 .
76 This package contains the SNMP agent, dynamically linked.
77 endef
78
79
80 define Package/snmpd-static
81 $(call Package/net-snmp/Default)
82 TITLE:=Open source SNMP implementation (daemon)
83 DEPENDS:=+libelf1
84 endef
85
86 define Package/snmpd-static/description
87 $(call Package/net-snmp/Default/description)
88 .
89 This package contains the SNMP agent, statically linked.
90 endef
91
92
93 SNMP_MIB_MODULES_INCLUDED = \
94 host/hr_device \
95 host/hr_disk \
96 host/hr_filesys \
97 host/hr_network \
98 host/hr_partition \
99 host/hr_proc \
100 host/hr_storage \
101 host/hr_system \
102 ieee802dot11 \
103 if-mib/ifXTable \
104 mibII/at \
105 mibII/icmp \
106 mibII/ifTable \
107 mibII/ip \
108 mibII/snmp_mib \
109 mibII/sysORTable \
110 mibII/system_mib \
111 mibII/tcp \
112 mibII/udp \
113 mibII/vacm_context \
114 mibII/vacm_vars \
115 snmpv3/snmpEngine \
116 snmpv3/snmpMPDStats \
117 snmpv3/usmConf \
118 snmpv3/usmStats \
119 snmpv3/usmUser \
120 tunnel \
121 ucd-snmp/disk \
122 ucd-snmp/dlmod \
123 ucd-snmp/extensible \
124 ucd-snmp/loadave \
125 ucd-snmp/memory \
126 ucd-snmp/pass \
127 ucd-snmp/proc \
128 ucd-snmp/vmstat \
129 util_funcs \
130 utilities/execute \
131
132 SNMP_MIB_MODULES_EXCLUDED = \
133 agent_mibs \
134 agentx \
135 disman/event \
136 disman/schedule \
137 hardware \
138 host \
139 if-mib \
140 mibII \
141 notification \
142 notification-log-mib \
143 snmpv3mibs \
144 target \
145 tcp-mib \
146 ucd_snmp \
147 udp-mib \
148 utilities \
149
150 SNMP_TRANSPORTS_INCLUDED = Callback UDP
151
152 SNMP_TRANSPORTS_EXCLUDED = TCP TCPIPv6 Unix
153
154 TARGET_CFLAGS += $(FPIC)
155
156 CONFIGURE_ARGS += \
157 --enable-mfd-rewrites \
158 --enable-shared \
159 --enable-static \
160 --with-endianness=$(if $(CONFIG_BIG_ENDIAN),big,little) \
161 --with-logfile=/var/log/snmpd.log \
162 --with-persistent-directory=/usr/lib/snmp/ \
163 --with-default-snmp-version=1 \
164 --with-sys-contact=root@localhost \
165 --with-sys-location=Unknown \
166 --enable-applications \
167 --disable-debugging \
168 --disable-manuals \
169 --disable-mibs \
170 --disable-scripts \
171 --with-out-mib-modules="$(SNMP_MIB_MODULES_EXCLUDED)" \
172 --with-mib-modules="$(SNMP_MIB_MODULES_INCLUDED)" \
173 --with-out-transports="$(SNMP_TRANSPORTS_EXCLUDED)" \
174 --with-transports="$(SNMP_TRANSPORTS_INCLUDED)" \
175 --without-openssl \
176 --without-libwrap \
177 --without-rpm \
178 --without-zlib \
179 $(call autoconf_bool,CONFIG_IPV6,ipv6) \
180
181 ifeq ($(CONFIG_IPV6),y)
182 SNMP_TRANSPORTS_INCLUDED+= UDPIPv6
183 endif
184
185 TARGET_LDFLAGS += -L$(TOOLCHAIN_DIR)/usr/lib
186
187 ifdef CONFIG_PACKAGE_snmpd-static
188 define Build/Compile/static
189 $(MAKE) -C $(PKG_BUILD_DIR)/agent \
190 LDFLAGS="$(TARGET_LDFLAGS) -lm -static" \
191 EXEEXT="-static" \
192 snmpd-static
193 endef
194 endif
195
196 define Build/Compile
197 $(MAKE) -C $(PKG_BUILD_DIR) \
198 INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
199 LDFLAGS="$(TARGET_LDFLAGS) -lm -lc" \
200 all install
201 $(Build/Compile/static)
202 endef
203
204 define Build/InstallDev
205 $(INSTALL_DIR) $(2)/bin
206 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/net-snmp-config $(2)/bin/
207 $(SED) 's,=/usr,=$(STAGING_DIR)/usr,g' $(2)/bin/net-snmp-config
208
209 $(INSTALL_DIR) $(1)/usr/include
210 $(CP) $(PKG_INSTALL_DIR)/usr/include/net-snmp $(1)/usr/include/
211 $(INSTALL_DIR) $(1)/usr/lib
212 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.{a,so*} $(1)/usr/lib/
213 endef
214
215 define Package/libnetsnmp/install
216 $(INSTALL_DIR) $(1)/usr/lib
217 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.so.* $(1)/usr/lib/
218 endef
219
220 define Package/snmpd/conffiles
221 /etc/default/snmpd
222 /etc/config/snmpd
223 endef
224
225 define Package/snmpd/install
226 $(INSTALL_DIR) $(1)/etc/config
227 $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/config/snmpd
228 $(INSTALL_DIR) $(1)/etc/snmp
229 ln -sf /var/run/snmpd.conf $(1)/etc/snmp/
230 $(INSTALL_DIR) $(1)/etc/default
231 $(INSTALL_DATA) ./files/snmpd.default $(1)/etc/default/snmpd
232 $(INSTALL_DIR) $(1)/etc/init.d
233 $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
234 $(INSTALL_DIR) $(1)/usr/sbin
235 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmpd $(1)/usr/sbin/snmpd
236 endef
237
238 define Package/snmpd-static/conffiles
239 /etc/default/snmpd
240 /etc/config/snmpd
241 endef
242
243 define Package/snmpd-static/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/default
249 $(INSTALL_DATA) ./files/snmpd.default $(1)/etc/default/snmpd
250 $(INSTALL_DIR) $(1)/etc/init.d
251 $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
252 $(INSTALL_DIR) $(1)/usr/sbin
253 $(INSTALL_BIN) $(PKG_BUILD_DIR)/agent/snmpd-static $(1)/usr/sbin/snmpd
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 $(eval $(call BuildPackage,libnetsnmp))
262 $(eval $(call BuildPackage,snmp-utils))
263 $(eval $(call BuildPackage,snmpd))
264 $(eval $(call BuildPackage,snmpd-static))