summaryrefslogtreecommitdiff
path: root/cleopatre/buildroot/package/spidnetsnmp/spidnetsnmp.mk
blob: a8c8a9bd74b29564196dc8308b89b5639b2b9fef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#############################################################
#
# spidnetsnmp
# netsnmp agent customized for Spidcom  
#
#
#############################################################
NETSNMP_VERSION:=5.4.2.1
NETSNMP_SITE:=$(BASE_DIR)/../application/spidnetsnmp
NETSNMP_NAME:=netsnmp-$(NETSNMP_VERSION)
NETSNMP_DIR:=$(BUILD_DIR)/spidnetsnmp-$(NETSNMP_VERSION)

NETSNMP_WO_TRANSPORT:=
ifneq ($(BR2_INET_IPX),y)
NETSNMP_WO_TRANSPORT+= IPX
endif
ifneq ($(BR2_INET_IPV6),y)
NETSNMP_WO_TRANSPORT+= UDPIPv6 TCPIPv6
endif


$(NETSNMP_DIR)/.unpacked:
	ln -s $(NETSNMP_SITE) $(NETSNMP_DIR) 
	touch $@

ifeq ($(BR2_ENDIAN),"BIG")
NETSNMP_ENDIAN=big
else
NETSNMP_ENDIAN=little
endif


ifneq ($(findstring y,$(BR2_HAVE_MANPAGES)$(BR2_HAVE_INFOPAGES)),y)
NETSNMP_DOCS:=--disable-manuals
endif

$(NETSNMP_DIR)/.configured: $(NETSNMP_DIR)/.unpacked
	(cd $(NETSNMP_DIR); rm -f config.cache; \
		autoconf && \
		ac_cv_NETSNMP_CAN_USE_SYSCTL=no \
		$(TARGET_CONFIGURE_OPTS) \
		$(TARGET_CONFIGURE_ARGS) \
		./configure \
		--target=$(GNU_TARGET_NAME) \
		--host=$(GNU_TARGET_NAME) \
		--build=$(GNU_HOST_NAME) \
		--with-cc=$(TARGET_CROSS)gcc \
		--with-linkcc=$(TARGET_CROSS)gcc \
		--with-ar=$(TARGET_CROSS)ar \
		--with-cflags="$(TARGET_CFLAGS) -I$(BASE_DIR)/../application/spidlib/inc -I$(BASE_DIR)/../linux-2.6.25.10-spc300/include/asm-arm/arch-spc300" \
		--with-ldflags="$(TARGET_LDFLAGS) -Bstatic -L$(BASE_DIR)/../application/spidlib/ -lspidlib" \
		--with-endianness=$(NETSNMP_ENDIAN) \
		--with-persistent-directory=/var/lib/snmp \
		--disable-shared \
		--enable-static \
		--with-logfile=none \
		--without-rpm \
		--disable-privacy \
		--disable-md5 \
		--without-openssl \
		$(NETSNMP_DOCS) \
		--disable-embedded-perl \
		--disable-perl-cc-checks \
		--without-perl-modules \
		--without-dmalloc \
		--without-efence \
		--without-rsaref \
		--with-default-snmp-version="2" \
		--with-sys-contact="root" \
		--with-sys-location="Unknown" \
		--with-transports="UDP" \
		--with-out-transports="$(NETSNMP_WO_TRANSPORT)" \
		--with-mib-modules="mibII sarft-eoc-mib" \
		--with-out-mib-modules="snmpv3mib mibII/vacm" \
		--disable-debugging \
		--prefix=/usr \
		--sysconfdir=/etc \
		--enable-mini-agent \
		--without-kmem-usage \
		--disable-applications \
		--disable-scripts \
		--disable-mibs \
		--disable-mib-loading \
		$(DISABLE_IPV6) \
	)
	touch $@

$(NETSNMP_DIR)/agent/snmpd: $(NETSNMP_DIR)/.configured
	$(MAKE1) -C $(NETSNMP_DIR)
	touch -c $@

$(TARGET_DIR)/usr/sbin/spidsnmpd: $(NETSNMP_DIR)/agent/snmpd
	$(MAKE) PREFIX=$(TARGET_DIR)/usr \
	    prefix=$(TARGET_DIR)/usr \
	    exec_prefix=$(TARGET_DIR)/usr \
	    persistentdir=$(TARGET_DIR)/var/lib/snmp \
	    includedir=$(STAGING_DIR)/usr/include/net-snmp \
	    ucdincludedir=$(STAGING_DIR)/usr/include/ucd-snmp \
	    -C $(NETSNMP_DIR) install
	rm -rf $(TARGET_DIR)/usr/share/doc
ifneq ($(BR2_HAVE_MANPAGES),y)
	rm -rf $(TARGET_DIR)/usr/share/man
endif
ifneq ($(BR2_HAVE_INFOPAGES),y)
	rm -rf $(TARGET_DIR)/usr/share/info
endif
	# Copy the .conf files.
	#$(INSTALL) -D -m 0644 $(NETSNMP_DIR)/EXAMPLE.conf $(TARGET_DIR)/etc/snmp/snmpd.conf
	$(INSTALL) -D -m 0644 $(NETSNMP_DIR)/spidcom.conf $(TARGET_DIR)/etc/snmp/snmpd.conf
	-mv $(TARGET_DIR)/usr/share/snmp/mib2c*.conf $(TARGET_DIR)/etc/snmp
	# Remove the unsupported snmpcheck program
	rm -f $(TARGET_DIR)/usr/bin/snmpcheck
	# Install the "broken" headers
	$(INSTALL) -D -m 0644 $(NETSNMP_DIR)/agent/mibgroup/struct.h $(STAGING_DIR)/usr/include/net-snmp/agent/struct.h
	$(INSTALL) -D -m 0644 $(NETSNMP_DIR)/agent/mibgroup/util_funcs.h $(STAGING_DIR)/usr/include/net-snmp/util_funcs.h
	$(INSTALL) -D -m 0644 $(NETSNMP_DIR)/agent/mibgroup/mibincl.h $(STAGING_DIR)/usr/include/net-snmp/library/mibincl.h
	$(INSTALL) -D -m 0644 $(NETSNMP_DIR)/agent/mibgroup/header_complex.h $(STAGING_DIR)/usr/include/net-snmp/agent/header_complex.h
#	$(INSTALL) -D -m 0755 package/netsnmp/S59snmpd $(TARGET_DIR)/etc/init.d/S59snmpd

spidnetsnmp: $(TARGET_DIR)/usr/sbin/spidsnmpd

spidnetsnmp-headers: $(TARGET_DIR)/usr/include/net-snmp/net-snmp-config.h
	$(INSTALL) -d $(TARGET_DIR)/usr/include/net-snmp
	cp -a $(STAGING_DIR)/usr/include/net-snmp $(TARGET_DIR)/usr/include/net-snmp
	cp -a $(STAGING_DIR)/usr/include/ucd-snmp $(TARGET_DIR)/usr/include/net-snmp

spidnetsnmp-clean:
	-$(MAKE) PREFIX=$(TARGET_DIR) INSTALL_PREFIX=$(TARGET_DIR) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(NETSNMP_DIR) uninstall
	-$(MAKE) -C $(NETSNMP_DIR) clean
	-rm -rf $(TARGET_DIR)/etc/snmp/{snmpd{,trapd},mib2c*}.conf \
		$(TARGET_DIR)/etc/default/snmpd \
		$(TARGET_DIR)/usr/include/net-snmp

spidnetsnmp-dirclean:
	rm -rf $(NETSNMP_DIR)

#############################################################
#
# Toplevel Makefile options
#
#############################################################
ifeq ($(BR2_PACKAGE_SPIDNETSNMP),y)
TARGETS+=spidnetsnmp
endif