nuke $Id$ in /packages as well
[packages.git] / libs / net-snmp / Makefile
1 #
2 # Copyright (C) 2006-2008 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.1.2
12 PKG_RELEASE:=2.4
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=@SF/net-snmp
16 PKG_MD5SUM:=8080555ab3f90011f25d5122042d9a8d
17
18 include $(INCLUDE_DIR)/package.mk
19
20 define Package/net-snmp/Default
21   SECTION:=net
22   CATEGORY:=Network
23   URL:=http://www.net-snmp.org/
24 endef
25
26 define Package/net-snmp/Default/description
27  Simple Network Management Protocol (SNMP) is a widely used protocol for 
28  monitoring the health and welfare of network equipment (eg. routers), 
29  computer equipment and even devices like UPSs. Net-SNMP is a suite of 
30  applications used to implement SNMP v1, SNMP v2c and SNMP v3 using both 
31  IPv4 and IPv6.
32 endef
33
34
35 define Package/libnetsnmp
36 $(call Package/net-snmp/Default)
37   SECTION:=libs
38   CATEGORY:=Libraries
39   DEPENDS:=+libelf
40   TITLE:=Open source SNMP implementation (librairies)
41 endef
42
43 define Package/libnetsnmp/description
44 $(call Package/net-snmp/Default/description)
45  .
46  This package contains shared libraries, needed by other programs.
47 endef
48
49
50 define Package/snmp-utils
51 $(call Package/net-snmp/Default)
52   DEPENDS:=+libnetsnmp
53   TITLE:=Open source SNMP implementation (utilities)
54 endef
55
56 define Package/snmp-utils/description
57 $(call Package/net-snmp/Default/description)
58  .
59  This package contains SNMP client utilities.
60 endef
61
62
63 define Package/snmpd
64 $(call Package/net-snmp/Default)
65   DEPENDS:=+libnetsnmp
66   TITLE:=Open source SNMP implementation (daemon)
67 endef
68
69 define Package/snmpd/description
70 $(call Package/net-snmp/Default/description)
71  .
72  This package contains the SNMP agent, dynamically linked.
73 endef
74
75
76 define Package/snmpd-static
77 $(call Package/net-snmp/Default)
78   TITLE:=Open source SNMP implementation (daemon)
79   DEPENDS:=+libelf
80 endef
81
82 define Package/snmpd-static/description
83 $(call Package/net-snmp/Default/description)
84  .
85  This package contains the SNMP agent, statically linked.
86 endef
87
88
89 SNMP_MIB_MODULES_INCLUDED = \
90         host/hr_device \
91         host/hr_disk \
92         host/hr_filesys \
93         host/hr_network \
94         host/hr_partition \
95         host/hr_proc \
96         host/hr_storage \
97         host/hr_system \
98         mibII/at \
99         mibII/icmp \
100         mibII/interfaces \
101         mibII/ip \
102         mibII/snmp_mib \
103         mibII/sysORTable \
104         mibII/system_mib \
105         mibII/tcp \
106         mibII/udp \
107         mibII/vacm_context \
108         mibII/vacm_vars \
109         snmpv3/snmpEngine \
110         snmpv3/snmpMPDStats \
111         snmpv3/usmStats \
112         snmpv3/usmUser \
113         snmpv3mibs \
114         tunnel \
115         ucd-snmp/disk \
116         ucd-snmp/dlmod \
117         ucd-snmp/extensible \
118         ucd-snmp/loadave \
119         ucd-snmp/memory \
120         ucd-snmp/pass \
121         ucd-snmp/proc \
122         ucd-snmp/vmstat \
123         util_funcs \
124         utilities/execute \
125
126 SNMP_MIB_MODULES_EXCLUDED = \
127         agent_mibs \
128         agentx \
129         host \
130         ieee802dot11 \
131         mibII \
132         notification \
133         snmpv3mibs \
134         target \
135         ucd_snmp \
136         utilities \
137
138 SNMP_TRANSPORTS_INCLUDED = Callback UDP
139
140 SNMP_TRANSPORTS_EXCLUDED = TCP TCPv6 UDPv6 Unix
141
142 TARGET_CFLAGS += $(FPIC)
143
144 CONFIGURE_ARGS += \
145         --enable-shared \
146         --enable-static \
147         --with-endianness=little \
148         --with-logfile=/var/log/snmpd.log \
149         --with-persistent-directory=/usr/lib/snmp/ \
150         --with-default-snmp-version=1 \
151         --with-sys-contact=root@localhost \
152         --with-sys-location=Unknown \
153         --enable-applications \
154         --disable-debugging \
155         --disable-ipv6 \
156         --disable-manuals \
157         --disable-mibs \
158         --disable-scripts \
159         --with-out-mib-modules="$(SNMP_MIB_MODULES_EXCLUDED)" \
160         --with-mib-modules="$(SNMP_MIB_MODULES_INCLUDED)" \
161         --with-out-transports="$(SNMP_TRANSPORTS_EXCLUDED)" \
162         --with-transports="$(SNMP_TRANSPORTS_INCLUDED)" \
163         --without-openssl \
164         --without-libwrap \
165         --without-rpm \
166         --without-zlib \
167
168 define Build/Compile
169         rm -rf $(PKG_INSTALL_DIR)
170         mkdir -p $(PKG_INSTALL_DIR)
171         $(MAKE) -C $(PKG_BUILD_DIR) \
172                 INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
173                 all install
174         ( cd $(PKG_INSTALL_DIR); mv ./usr/sbin/snmpd ./usr/sbin/snmpd-shared; )
175         #ifneq ($(CONFIG_PACKAGE_snmpd-static),)
176         ( cd $(PKG_BUILD_DIR); rm -f agent/snmpd; )
177         $(MAKE) -C $(PKG_BUILD_DIR) \
178                 LDFLAGS="$(TARGET_LDFLAGS) -static" \
179                 INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
180                 all install
181         ( cd $(PKG_INSTALL_DIR); mv ./usr/sbin/snmpd ./usr/sbin/snmpd-static; )
182         #endif
183 endef
184
185 define Build/InstallDev
186         $(INSTALL_DIR) $(2)/bin
187         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/net-snmp-config $(2)/bin/
188         $(SED) 's,=/usr,=$(STAGING_DIR)/usr,g' $(2)/bin/net-snmp-config
189
190         $(INSTALL_DIR) $(1)/usr/include
191         $(CP) $(PKG_INSTALL_DIR)/usr/include/net-snmp $(1)/usr/include/
192         $(INSTALL_DIR) $(1)/usr/lib
193         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.{a,so*} $(1)/usr/lib/
194 endef
195
196 define Package/libnetsnmp/install
197         $(INSTALL_DIR) $(1)/usr/lib
198         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.so.* $(1)/usr/lib/
199 endef
200
201 define Package/snmpd/conffiles
202 /etc/default/snmpd
203 /etc/config/snmpd
204 endef
205
206 define Package/snmpd/install
207         $(INSTALL_DIR) $(1)/etc/config
208         $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/config/snmpd
209         $(INSTALL_DIR) $(1)/etc/snmp
210         ln -sf /var/run/snmpd.conf $(1)/etc/snmp/
211         $(INSTALL_DIR) $(1)/etc/default
212         $(INSTALL_DATA) ./files/snmpd.default $(1)/etc/default/snmpd
213         $(INSTALL_DIR) $(1)/etc/init.d
214         $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
215         $(INSTALL_DIR) $(1)/usr/sbin
216         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmpd-shared $(1)/usr/sbin/snmpd
217 endef
218
219 define Package/snmpd-static/conffiles
220 /etc/default/snmpd
221 /etc/config/snmpd
222 endef
223
224 define Package/snmpd-static/install
225         $(INSTALL_DIR) $(1)/etc/config
226         $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/config/snmpd
227         $(INSTALL_DIR) $(1)/etc/snmp
228         ln -sf /var/run/snmpd.conf $(1)/etc/snmp/
229         $(INSTALL_DIR) $(1)/etc/default
230         $(INSTALL_DATA) ./files/snmpd.default $(1)/etc/default/snmpd
231         $(INSTALL_DIR) $(1)/etc/init.d
232         $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
233         $(INSTALL_DIR) $(1)/usr/sbin
234         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmpd-static $(1)/usr/sbin/snmpd
235 endef
236
237 define Package/snmp-utils/install
238         $(INSTALL_DIR) $(1)/usr/bin
239         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/snmp{get,set,status,test,trap,walk} $(1)/usr/bin/
240 endef
241
242 $(eval $(call BuildPackage,libnetsnmp))
243 $(eval $(call BuildPackage,snmp-utils))
244 $(eval $(call BuildPackage,snmpd))
245 $(eval $(call BuildPackage,snmpd-static))