fix curl compile (based on patch by Ambroz Bizjak)
[openwrt/svn-archive/archive.git] / libs / net-snmp / Makefile
1 #
2 # Copyright (C) 2006-2007 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=net-snmp
12 PKG_VERSION:=5.1.2
13 PKG_RELEASE:=2.3
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=@SF/net-snmp
17 PKG_MD5SUM:=8080555ab3f90011f25d5122042d9a8d
18
19 include $(INCLUDE_DIR)/package.mk
20
21 define Package/net-snmp/Default
22 SECTION:=net
23 CATEGORY:=Network
24 URL:=http://www.net-snmp.org/
25 endef
26
27 define Package/net-snmp/Default/description
28 Simple Network Management Protocol (SNMP) is a widely used protocol for
29 monitoring the health and welfare of network equipment (eg. routers),
30 computer equipment and even devices like UPSs. Net-SNMP is a suite of
31 applications used to implement SNMP v1, SNMP v2c and SNMP v3 using both
32 IPv4 and IPv6.
33 endef
34
35
36 define Package/libnetsnmp
37 $(call Package/net-snmp/Default)
38 SECTION:=libs
39 CATEGORY:=Libraries
40 DEPENDS:=+libelf
41 TITLE:=Open source SNMP implementation (librairies)
42 endef
43
44 define Package/libnetsnmp/description
45 $(call Package/net-snmp/Default/description)
46 .
47 This package contains shared libraries, needed by other programs.
48 endef
49
50
51 define Package/snmp-utils
52 $(call Package/net-snmp/Default)
53 DEPENDS:=+libnetsnmp
54 TITLE:=Open source SNMP implementation (utilities)
55 endef
56
57 define Package/snmp-utils/description
58 $(call Package/net-snmp/Default/description)
59 .
60 This package contains SNMP client utilities.
61 endef
62
63
64 define Package/snmpd
65 $(call Package/net-snmp/Default)
66 DEPENDS:=+libnetsnmp
67 TITLE:=Open source SNMP implementation (daemon)
68 endef
69
70 define Package/snmpd/description
71 $(call Package/net-snmp/Default/description)
72 .
73 This package contains the SNMP agent, dynamically linked.
74 endef
75
76
77 define Package/snmpd-static
78 $(call Package/net-snmp/Default)
79 TITLE:=Open source SNMP implementation (daemon)
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 CONFIGURE_ARGS += \
143 --enable-shared \
144 --enable-static \
145 --with-endianness=little \
146 --with-logfile=/var/log/snmpd.log \
147 --with-persistent-directory=/usr/lib/snmp/ \
148 --with-default-snmp-version=1 \
149 --with-sys-contact=root@localhost \
150 --with-sys-location=Unknown \
151 --enable-applications \
152 --disable-debugging \
153 --disable-ipv6 \
154 --disable-manuals \
155 --disable-mibs \
156 --disable-scripts \
157 --with-out-mib-modules="$(SNMP_MIB_MODULES_EXCLUDED)" \
158 --with-mib-modules="$(SNMP_MIB_MODULES_INCLUDED)" \
159 --with-out-transports="$(SNMP_TRANSPORTS_EXCLUDED)" \
160 --with-transports="$(SNMP_TRANSPORTS_INCLUDED)" \
161 --without-openssl \
162 --without-libwrap \
163 --without-rpm \
164 --without-zlib \
165
166 define Build/Compile
167 rm -rf $(PKG_INSTALL_DIR)
168 mkdir -p $(PKG_INSTALL_DIR)
169 $(MAKE) -C $(PKG_BUILD_DIR) \
170 INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
171 all install
172 ( cd $(PKG_INSTALL_DIR); mv ./usr/sbin/snmpd ./usr/sbin/snmpd-shared; )
173 #ifneq ($(CONFIG_PACKAGE_snmpd-static),)
174 ( cd $(PKG_BUILD_DIR); rm -f agent/snmpd; )
175 $(MAKE) -C $(PKG_BUILD_DIR) \
176 LDFLAGS="$(TARGET_LDFLAGS) -static" \
177 INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
178 all install
179 ( cd $(PKG_INSTALL_DIR); mv ./usr/sbin/snmpd ./usr/sbin/snmpd-static; )
180 #endif
181 endef
182
183 define Build/InstallDev
184 mkdir -p $(1)/usr/bin
185 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/net-snmp-config $(1)/usr/bin/
186 mkdir -p $(1)/usr/include
187 $(CP) $(PKG_INSTALL_DIR)/usr/include/net-snmp $(1)/usr/include/
188 mkdir -p $(1)/usr/lib
189 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.{a,so*} $(1)/usr/lib/
190 $(SED) 's,-I/usr/include,,g' $(1)/usr/bin/net-snmp-config
191 $(SED) 's,-L/usr/lib,,g' $(1)/usr/bin/net-snmp-config
192 endef
193
194 define Package/libnetsnmp/install
195 $(INSTALL_DIR) $(1)/usr/lib
196 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.so.* $(1)/usr/lib/
197 endef
198
199 define Package/snmpd/conffiles
200 /etc/default/snmpd
201 /etc/snmp/snmpd.conf
202 endef
203
204 define Package/snmpd/install
205 $(INSTALL_DIR) $(1)/etc/snmp
206 $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/snmp/snmpd.conf
207 $(INSTALL_DIR) $(1)/etc/default
208 $(INSTALL_DATA) ./files/snmpd.default $(1)/etc/default/snmpd
209 $(INSTALL_DIR) $(1)/etc/init.d
210 $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
211 $(INSTALL_DIR) $(1)/usr/sbin
212 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmpd-shared $(1)/usr/sbin/snmpd
213 endef
214
215 define Package/snmpd-static/conffiles
216 /etc/default/snmpd
217 /etc/snmp/snmpd.conf
218 endef
219
220 define Package/snmpd-static/install
221 $(INSTALL_DIR) $(1)/etc/snmp
222 $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/snmp/snmpd.conf
223 $(INSTALL_DIR) $(1)/etc/default
224 $(INSTALL_DATA) ./files/snmpd.default $(1)/etc/default/snmpd
225 $(INSTALL_DIR) $(1)/etc/init.d
226 $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
227 $(INSTALL_DIR) $(1)/usr/sbin
228 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmpd-static $(1)/usr/sbin/snmpd
229 endef
230
231 define Package/snmp-utils/install
232 $(INSTALL_DIR) $(1)/usr/bin
233 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/snmp{get,set,status,test,trap,walk} $(1)/usr/bin/
234 endef
235
236 $(eval $(call BuildPackage,libnetsnmp))
237 $(eval $(call BuildPackage,snmp-utils))
238 $(eval $(call BuildPackage,snmpd))
239 $(eval $(call BuildPackage,snmpd-static))