initial commit of arptables-0.0.3-2
[15.05/openwrt.git] / obsolete-buildroot / make / netsnmp.mk
1 #############################################################
2 #
3 # netsnmp
4 #
5 #############################################################
6
7 NETSNMP_URL:=http://aleron.dl.sourceforge.net/sourceforge/net-snmp/
8 NETSNMP_DIR:=$(BUILD_DIR)/net-snmp-5.1
9 NETSNMP_SOURCE:=net-snmp-5.1.tar.gz
10 NETSNMP_PATCH1:=net-snmp_5.1-5.diff.gz
11 NETSNMP_PATCH1_URL:=http://ftp.debian.org/debian/pool/main/n/net-snmp/
12 NETSNMP_PATCH2:=$(SOURCE_DIR)/netsnmp.patch
13
14 $(DL_DIR)/$(NETSNMP_SOURCE):
15         $(WGET) -P $(DL_DIR) $(NETSNMP_URL)/$(NETSNMP_SOURCE)
16
17 $(DL_DIR)/$(NETSNMP_PATCH1):
18         $(WGET) -P $(DL_DIR) $(NETSNMP_PATCH1_URL)/$(NETSNMP_PATCH1)
19
20 $(NETSNMP_DIR)/.unpacked: $(DL_DIR)/$(NETSNMP_SOURCE) $(DL_DIR)/$(NETSNMP_PATCH1)
21         zcat $(DL_DIR)/$(NETSNMP_SOURCE) | tar -C $(BUILD_DIR) -xvf -
22         zcat $(DL_DIR)/$(NETSNMP_PATCH1) | patch -p1 -d $(NETSNMP_DIR)
23         cat $(NETSNMP_PATCH2) | patch -p1 -d $(NETSNMP_DIR)
24         touch  $(NETSNMP_DIR)/.unpacked
25
26 # We set CAN_USE_SYSCTL to no and use /proc since the
27 # sysctl code in this thing is apparently intended for
28 # freebsd or some such thing...
29 $(NETSNMP_DIR)/.configured: $(NETSNMP_DIR)/.unpacked
30         (cd $(NETSNMP_DIR); autoconf; \
31                 ac_cv_CAN_USE_SYSCTL=no \
32                 PATH=$(TARGET_PATH) \
33                 ./configure \
34                 --with-cc=$(TARGET_CROSS)gcc \
35                 --with-ar=$(TARGET_CROSS)ar \
36                 --target=$(GNU_TARGET_NAME) \
37                 --host=$(GNU_TARGET_NAME) \
38                 --build=$(GNU_HOST_NAME) \
39                 --with-endianness=little \
40                 --with-persistent-directory=/var/lib/snmp \
41                 --enable-ucd-snmp-compatibility \
42                 --enable-shared \
43                 --disable-static \
44                 --with-logfile=none \
45                 --without-rpm \
46                 --with-openssl \
47                 --without-dmalloc \
48                 --without-efence \
49                 --without-rsaref \
50                 --with-sys-contact="root" \
51                 --with-sys-location="Unknown" \
52                 --with-mib-modules="host smux ucd-snmp/dlmod" \
53                 --with-defaults \
54                 --prefix=/usr \
55                 --sysconfdir=/etc \
56                 --mandir=/usr/man \
57                 --infodir=/usr/info \
58         );
59         touch  $(NETSNMP_DIR)/.configured
60
61 $(NETSNMP_DIR)/agent/snmpd: $(NETSNMP_DIR)/.configured
62         $(MAKE) -C $(NETSNMP_DIR)
63
64 $(TARGET_DIR)/usr/sbin/snmpd: $(NETSNMP_DIR)/agent/snmpd
65         #$(MAKE) DESTDIR=$(TARGET_DIR) -C $(NETSNMP_DIR) install
66         $(MAKE) PREFIX=$(TARGET_DIR)/usr \
67             prefix=$(TARGET_DIR)/usr \
68             exec_prefix=$(TARGET_DIR)/usr \
69             persistentdir=$(TARGET_DIR)/var/lib/snmp \
70             infodir=$(TARGET_DIR)/usr/info \
71             mandir=$(TARGET_DIR)/usr/man \
72             includedir=$(STAGING_DIR)/include/net-snmp \
73             ucdincludedir=$(STAGING_DIR)/include/ucd-snmp \
74             -C $(NETSNMP_DIR) install;
75         rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \
76                 $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc
77         # Copy the .conf files.
78         mkdir -p $(TARGET_DIR)/etc/snmp
79         cp $(NETSNMP_DIR)/EXAMPLE.conf $(TARGET_DIR)/etc/snmp/snmpd.conf
80         cp $(NETSNMP_DIR)/EXAMPLE-trap.conf $(TARGET_DIR)/etc/snmp/snmptrapd.conf
81         -mv $(TARGET_DIR)/usr/share/snmp/mib2c*.conf $(TARGET_DIR)/etc/snmp
82         mkdir -p $(TARGET_DIR)/etc/default
83         cp $(NETSNMP_DIR)/debian/snmpd.default $(TARGET_DIR)/etc/default/snmpd
84         # Remove the unsupported snmpcheck program
85         rm $(TARGET_DIR)/usr/bin/snmpcheck
86         # Install the "broken" headers
87         cp $(NETSNMP_DIR)/agent/mibgroup/struct.h $(STAGING_DIR)/include/net-snmp/agent
88         cp $(NETSNMP_DIR)/agent/mibgroup/util_funcs.h $(STAGING_DIR)/include/net-snmp
89         cp $(NETSNMP_DIR)/agent/mibgroup/mibincl.h $(STAGING_DIR)/include/net-snmp/library
90         cp $(NETSNMP_DIR)/agent/mibgroup/header_complex.h $(STAGING_DIR)/include/net-snmp/agent
91
92 netsnmp: $(TARGET_DIR)/usr/sbin/snmpd
93
94 netsnmp-headers: $(TARGET_DIR)/usr/include/net-snmp/net-snmp-config.h
95         cp -a $(STAGING_DIR)/include/net-snmp $(TARGET_DIR)/usr/include/net-snmp
96         cp -a $(STAGING_DIR)/include/ucd-snmp $(TARGET_DIR)/usr/include/net-snmp
97
98 netsnmp-source: $(DL_DIR)/$(NETSNMP_SOURCE)
99
100 netsnmp-clean: 
101         $(MAKE) -C $(NETSNMP_DIR) clean
102
103 netsnmp-dirclean: 
104         rm -rf $(NETSNMP_DIR)
105