netsnmp.mk 3.9 KB

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