add an snmpd-static package
[openwrt.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
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/extensible \
45 ucd-snmp/loadave \
46 ucd-snmp/memory \
47 ucd-snmp/pass \
48 ucd-snmp/proc \
49 ucd-snmp/vmstat \
50 util_funcs \
51 utilities/execute \
52
53 SNMP_MIB_MODULES_EXCLUDED = \
54 agent_mibs \
55 agentx \
56 host \
57 ieee802dot11 \
58 mibII \
59 notification \
60 snmpv3mibs \
61 target \
62 ucd_snmp \
63 utilities \
64
65 SNMP_TRANSPORTS_INCLUDED = UDP
66
67 SNMP_TRANSPORTS_EXCLUDED = Callback TCP TCPv6 UDPv6 Unix
68
69 PKG_CONFIGURE_OPTIONS = \
70 --enable-shared \
71 --enable-static \
72 --with-endianness=little \
73 --with-logfile=/var/log/snmpd.log \
74 --with-persistent-directory=/usr/lib/snmp/ \
75 --with-default-snmp-version=1 \
76 --with-sys-contact=root@localhost \
77 --with-sys-location=Unknown \
78 --enable-applications \
79 --disable-debugging \
80 --disable-ipv6 \
81 --disable-manuals \
82 --disable-mib-loading \
83 --disable-mibs \
84 --disable-scripts \
85 --with-out-mib-modules="$(SNMP_MIB_MODULES_EXCLUDED)" \
86 --with-mib-modules="$(SNMP_MIB_MODULES_INCLUDED)" \
87 --with-out-transports="$(SNMP_TRANSPORTS_EXCLUDED)" \
88 --with-transports="$(SNMP_TRANSPORTS_INCLUDED)" \
89 --without-opaque-special-types \
90 --without-openssl \
91 --without-libwrap \
92 --without-rpm \
93 --without-zlib \
94
95 include $(TOPDIR)/package/rules.mk
96
97 $(eval $(call PKG_template,LIBNETSNMP,libnetsnmp,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
98 $(eval $(call PKG_template,SNMPD,snmpd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
99 $(eval $(call PKG_template,SNMPD_STATIC,snmpd-static,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
100 $(eval $(call PKG_template,SNMP_UTILS,snmp-utils,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
101
102 $(PKG_BUILD_DIR)/.configured:
103 ( cd $(PKG_BUILD_DIR); rm -rf config.{cache,status}; \
104 $(TARGET_CONFIGURE_OPTS) \
105 CFLAGS="$(TARGET_CFLAGS)" \
106 CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
107 LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
108 ac_cv_header_pcap_h=no \
109 ./configure \
110 --target=$(GNU_TARGET_NAME) \
111 --host=$(GNU_TARGET_NAME) \
112 --build=$(GNU_HOST_NAME) \
113 --program-prefix="" \
114 --program-suffix="" \
115 --prefix=/usr \
116 --exec-prefix=/usr \
117 --bindir=/usr/bin \
118 --datadir=/usr/share \
119 --includedir=/usr/include \
120 --infodir=/usr/share/info \
121 --libdir=/usr/lib \
122 --libexecdir=/usr/lib \
123 --localstatedir=/var \
124 --mandir=/usr/share/man \
125 --sbindir=/usr/sbin \
126 --sysconfdir=/etc \
127 $(DISABLE_LARGEFILE) \
128 $(DISABLE_NLS) \
129 $(PKG_CONFIGURE_OPTIONS) \
130 );
131 touch $@
132
133 $(PKG_BUILD_DIR)/.built:
134 rm -rf $(PKG_INSTALL_DIR)
135 mkdir -p $(PKG_INSTALL_DIR)
136 $(MAKE) -C $(PKG_BUILD_DIR) \
137 INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
138 all install
139 ( cd $(PKG_INSTALL_DIR); mv ./usr/sbin/snmpd ./usr/sbin/snmpd-shared; )
140 ifneq ($(BR2_PACKAGE_SNMPD_STATIC),)
141 ( cd $(PKG_BUILD_DIR); rm -f agent/snmpd; )
142 $(MAKE) -C $(PKG_BUILD_DIR) \
143 LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib -static" \
144 INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
145 all install
146 ( cd $(PKG_INSTALL_DIR); mv ./usr/sbin/snmpd ./usr/sbin/snmpd-static; )
147 endif
148 touch $@
149
150 $(IPKG_LIBNETSNMP):
151 install -d -m0755 $(IDIR_LIBNETSNMP)/usr/lib
152 cp -fpR $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.so.* $(IDIR_LIBNETSNMP)/usr/lib/
153 $(RSTRIP) $(IDIR_LIBNETSNMP)
154 $(IPKG_BUILD) $(IDIR_LIBNETSNMP) $(PACKAGE_DIR)
155
156 $(IPKG_SNMPD):
157 install -d -m0755 $(IDIR_SNMPD)/etc/snmp
158 install -m0644 ./files/snmpd.conf $(IDIR_SNMPD)/etc/snmp/snmpd.conf
159 install -d -m0755 $(IDIR_SNMPD)/etc/default
160 install -m0644 ./files/snmpd.default $(IDIR_SNMPD)/etc/default/snmpd
161 install -d -m0755 $(IDIR_SNMPD)/etc/init.d
162 install -m0755 ./files/snmpd.init $(IDIR_SNMPD)/etc/init.d/snmpd
163 install -d -m0755 $(IDIR_SNMPD)/usr/sbin
164 install -m0755 $(PKG_INSTALL_DIR)/usr/sbin/snmpd-shared $(IDIR_SNMPD)/usr/sbin/snmpd
165 $(RSTRIP) $(IDIR_SNMPD)
166 $(IPKG_BUILD) $(IDIR_SNMPD) $(PACKAGE_DIR)
167
168 $(IPKG_SNMPD_STATIC):
169 install -d -m0755 $(IDIR_SNMPD_STATIC)/etc/snmp
170 install -m0644 ./files/snmpd.conf $(IDIR_SNMPD_STATIC)/etc/snmp/snmpd.conf
171 install -d -m0755 $(IDIR_SNMPD_STATIC)/etc/default
172 install -m0644 ./files/snmpd.default $(IDIR_SNMPD_STATIC)/etc/default/snmpd
173 install -d -m0755 $(IDIR_SNMPD_STATIC)/etc/init.d
174 install -m0755 ./files/snmpd.init $(IDIR_SNMPD_STATIC)/etc/init.d/snmpd
175 install -d -m0755 $(IDIR_SNMPD_STATIC)/usr/sbin
176 install -m0755 $(PKG_INSTALL_DIR)/usr/sbin/snmpd-static $(IDIR_SNMPD_STATIC)/usr/sbin/snmpd
177 $(RSTRIP) $(IDIR_SNMPD_STATIC)
178 $(IPKG_BUILD) $(IDIR_SNMPD_STATIC) $(PACKAGE_DIR)
179
180 $(IPKG_SNMP_UTILS):
181 install -d -m0755 $(IDIR_SNMP_UTILS)/usr/bin
182 cp -fpR $(PKG_INSTALL_DIR)/usr/bin/snmp{get,set,status,test,trap,walk} $(IDIR_SNMP_UTILS)/usr/bin/
183 $(RSTRIP) $(IDIR_SNMP_UTILS)
184 $(IPKG_BUILD) $(IDIR_SNMP_UTILS) $(PACKAGE_DIR)
185
186 $(STAGING_DIR)/usr/lib/libnetsnmp.so: $(PKG_BUILD_DIR)/.built
187 mkdir -p $(STAGING_DIR)/usr/bin
188 cp -fpR $(PKG_INSTALL_DIR)/usr/bin/net-snmp-config $(STAGING_DIR)/usr/bin/
189 mkdir -p $(STAGING_DIR)/usr/include
190 cp -fpR $(PKG_INSTALL_DIR)/usr/include/net-snmp $(STAGING_DIR)/usr/include/
191 mkdir -p $(STAGING_DIR)/usr/lib
192 cp -fpR $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.{a,so*} $(STAGING_DIR)/usr/lib/
193 touch $@
194
195 install-dev: $(STAGING_DIR)/usr/lib/libnetsnmp.so
196
197 uninstall-dev:
198 rm -rf \
199 $(STAGING_DIR)/usr/bin/net-snmp-config \
200 $(STAGING_DIR)/usr/include/net-snmp \
201 $(STAGING_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.{a,so*} \
202
203 compile: install-dev
204 clean: uninstall-dev
This page took 0.070435 seconds and 5 git commands to generate.