let ipkg fail when a package file to be installed is not found
[openwrt/svn-archive/archive.git] / openwrt / package / net-snmp / Makefile
1 # $Id$
2
3 include $(TOPDIR)/rules.mk
4
5 PKG_NAME:=net-snmp
6 PKG_VERSION:=5.1.2
7 PKG_RELEASE:=2.1
8 PKG_MD5SUM:=8080555ab3f90011f25d5122042d9a8d
9
10 PKG_SOURCE_URL:=@SF/net-snmp
11 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
12 PKG_CAT:=zcat
13
14 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
15 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
16
17 SNMP_MIB_MODULES_INCLUDED = \
18 host/hr_device \
19 host/hr_disk \
20 host/hr_filesys \
21 host/hr_network \
22 host/hr_partition \
23 host/hr_proc \
24 host/hr_storage \
25 host/hr_system \
26 mibII/at \
27 mibII/icmp \
28 mibII/interfaces \
29 mibII/ip \
30 mibII/snmp_mib \
31 mibII/sysORTable \
32 mibII/system_mib \
33 mibII/tcp \
34 mibII/udp \
35 mibII/vacm_context \
36 mibII/vacm_vars \
37 snmpv3/snmpEngine \
38 snmpv3/snmpMPDStats \
39 snmpv3/usmStats \
40 snmpv3/usmUser \
41 snmpv3mibs \
42 tunnel \
43 ucd-snmp/disk \
44 ucd-snmp/dlmod \
45 ucd-snmp/extensible \
46 ucd-snmp/loadave \
47 ucd-snmp/memory \
48 ucd-snmp/pass \
49 ucd-snmp/proc \
50 ucd-snmp/vmstat \
51 util_funcs \
52 utilities/execute \
53
54 SNMP_MIB_MODULES_EXCLUDED = \
55 agent_mibs \
56 agentx \
57 host \
58 ieee802dot11 \
59 mibII \
60 notification \
61 snmpv3mibs \
62 target \
63 ucd_snmp \
64 utilities \
65
66 SNMP_TRANSPORTS_INCLUDED = Callback UDP
67
68 SNMP_TRANSPORTS_EXCLUDED = TCP TCPv6 UDPv6 Unix
69
70 PKG_CONFIGURE_OPTIONS = \
71 --enable-shared \
72 --enable-static \
73 --with-endianness=little \
74 --with-logfile=/var/log/snmpd.log \
75 --with-persistent-directory=/usr/lib/snmp/ \
76 --with-default-snmp-version=1 \
77 --with-sys-contact=root@localhost \
78 --with-sys-location=Unknown \
79 --enable-applications \
80 --disable-debugging \
81 --disable-ipv6 \
82 --disable-manuals \
83 --disable-mib-loading \
84 --disable-mibs \
85 --disable-scripts \
86 --with-out-mib-modules="$(SNMP_MIB_MODULES_EXCLUDED)" \
87 --with-mib-modules="$(SNMP_MIB_MODULES_INCLUDED)" \
88 --with-out-transports="$(SNMP_TRANSPORTS_EXCLUDED)" \
89 --with-transports="$(SNMP_TRANSPORTS_INCLUDED)" \
90 --without-opaque-special-types \
91 --without-openssl \
92 --without-libwrap \
93 --without-rpm \
94 --without-zlib \
95
96 include $(TOPDIR)/package/rules.mk
97
98 $(eval $(call PKG_template,LIBNETSNMP,libnetsnmp,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
99 $(eval $(call PKG_template,SNMPD,snmpd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
100 $(eval $(call PKG_template,SNMPD_STATIC,snmpd-static,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
101 $(eval $(call PKG_template,SNMP_UTILS,snmp-utils,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
102
103 $(PKG_BUILD_DIR)/.configured:
104 ( cd $(PKG_BUILD_DIR); rm -rf config.{cache,status}; \
105 $(TARGET_CONFIGURE_OPTS) \
106 CFLAGS="$(TARGET_CFLAGS)" \
107 CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
108 LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
109 ac_cv_header_pcap_h=no \
110 ./configure \
111 --target=$(GNU_TARGET_NAME) \
112 --host=$(GNU_TARGET_NAME) \
113 --build=$(GNU_HOST_NAME) \
114 --program-prefix="" \
115 --program-suffix="" \
116 --prefix=/usr \
117 --exec-prefix=/usr \
118 --bindir=/usr/bin \
119 --datadir=/usr/share \
120 --includedir=/usr/include \
121 --infodir=/usr/share/info \
122 --libdir=/usr/lib \
123 --libexecdir=/usr/lib \
124 --localstatedir=/var \
125 --mandir=/usr/share/man \
126 --sbindir=/usr/sbin \
127 --sysconfdir=/etc \
128 $(DISABLE_LARGEFILE) \
129 $(DISABLE_NLS) \
130 $(PKG_CONFIGURE_OPTIONS) \
131 );
132 touch $@
133
134 $(PKG_BUILD_DIR)/.built:
135 rm -rf $(PKG_INSTALL_DIR)
136 mkdir -p $(PKG_INSTALL_DIR)
137 $(MAKE) -C $(PKG_BUILD_DIR) \
138 INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
139 all install
140 ( cd $(PKG_INSTALL_DIR); mv ./usr/sbin/snmpd ./usr/sbin/snmpd-shared; )
141 ifneq ($(BR2_PACKAGE_SNMPD_STATIC),)
142 ( cd $(PKG_BUILD_DIR); rm -f agent/snmpd; )
143 $(MAKE) -C $(PKG_BUILD_DIR) \
144 LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib -static" \
145 INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
146 all install
147 ( cd $(PKG_INSTALL_DIR); mv ./usr/sbin/snmpd ./usr/sbin/snmpd-static; )
148 endif
149 touch $@
150
151 $(IPKG_LIBNETSNMP):
152 install -d -m0755 $(IDIR_LIBNETSNMP)/usr/lib
153 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.so.* $(IDIR_LIBNETSNMP)/usr/lib/
154 $(RSTRIP) $(IDIR_LIBNETSNMP)
155 $(IPKG_BUILD) $(IDIR_LIBNETSNMP) $(PACKAGE_DIR)
156
157 $(IPKG_SNMPD):
158 install -d -m0755 $(IDIR_SNMPD)/etc/snmp
159 install -m0644 ./files/snmpd.conf $(IDIR_SNMPD)/etc/snmp/snmpd.conf
160 install -d -m0755 $(IDIR_SNMPD)/etc/default
161 install -m0644 ./files/snmpd.default $(IDIR_SNMPD)/etc/default/snmpd
162 install -d -m0755 $(IDIR_SNMPD)/etc/init.d
163 install -m0755 ./files/snmpd.init $(IDIR_SNMPD)/etc/init.d/snmpd
164 install -d -m0755 $(IDIR_SNMPD)/usr/sbin
165 install -m0755 $(PKG_INSTALL_DIR)/usr/sbin/snmpd-shared $(IDIR_SNMPD)/usr/sbin/snmpd
166 $(RSTRIP) $(IDIR_SNMPD)
167 $(IPKG_BUILD) $(IDIR_SNMPD) $(PACKAGE_DIR)
168
169 $(IPKG_SNMPD_STATIC):
170 install -d -m0755 $(IDIR_SNMPD_STATIC)/etc/snmp
171 install -m0644 ./files/snmpd.conf $(IDIR_SNMPD_STATIC)/etc/snmp/snmpd.conf
172 install -d -m0755 $(IDIR_SNMPD_STATIC)/etc/default
173 install -m0644 ./files/snmpd.default $(IDIR_SNMPD_STATIC)/etc/default/snmpd
174 install -d -m0755 $(IDIR_SNMPD_STATIC)/etc/init.d
175 install -m0755 ./files/snmpd.init $(IDIR_SNMPD_STATIC)/etc/init.d/snmpd
176 install -d -m0755 $(IDIR_SNMPD_STATIC)/usr/sbin
177 install -m0755 $(PKG_INSTALL_DIR)/usr/sbin/snmpd-static $(IDIR_SNMPD_STATIC)/usr/sbin/snmpd
178 $(RSTRIP) $(IDIR_SNMPD_STATIC)
179 $(IPKG_BUILD) $(IDIR_SNMPD_STATIC) $(PACKAGE_DIR)
180
181 $(IPKG_SNMP_UTILS):
182 install -d -m0755 $(IDIR_SNMP_UTILS)/usr/bin
183 $(CP) $(PKG_INSTALL_DIR)/usr/bin/snmp{get,set,status,test,trap,walk} $(IDIR_SNMP_UTILS)/usr/bin/
184 $(RSTRIP) $(IDIR_SNMP_UTILS)
185 $(IPKG_BUILD) $(IDIR_SNMP_UTILS) $(PACKAGE_DIR)
186
187 $(STAGING_DIR)/usr/lib/libnetsnmp.so: $(PKG_BUILD_DIR)/.built
188 mkdir -p $(STAGING_DIR)/usr/bin
189 $(CP) $(PKG_INSTALL_DIR)/usr/bin/net-snmp-config $(STAGING_DIR)/usr/bin/
190 mkdir -p $(STAGING_DIR)/usr/include
191 $(CP) $(PKG_INSTALL_DIR)/usr/include/net-snmp $(STAGING_DIR)/usr/include/
192 mkdir -p $(STAGING_DIR)/usr/lib
193 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.{a,so*} $(STAGING_DIR)/usr/lib/
194 touch $@
195
196 install-dev: $(STAGING_DIR)/usr/lib/libnetsnmp.so
197
198 uninstall-dev:
199 rm -rf \
200 $(STAGING_DIR)/usr/bin/net-snmp-config \
201 $(STAGING_DIR)/usr/include/net-snmp \
202 $(STAGING_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.{a,so*} \
203
204 compile-targets: install-dev
205 clean-targets: uninstall-dev