PageRenderTime 48ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/Library/Formula/net-snmp.rb

https://github.com/arnihermann/homebrew
Ruby | 186 lines | 178 code | 5 blank | 3 comment | 1 complexity | f5b94bf25bf8ce339d660fda976bef60 MD5 | raw file
  1. require 'formula'
  2. class NetSnmp < Formula
  3. homepage 'http://www.net-snmp.org/'
  4. url 'http://sourceforge.net/projects/net-snmp/files/net-snmp/5.7.1/net-snmp-5.7.1.tar.gz'
  5. md5 'c95d08fd5d93df0c11a2e1bdf0e01e0b'
  6. def patches
  7. # Fixes compile error on Lion, missing header darwin11.h
  8. # The patch is reported upstream and does not exist in HEAD as of 2012-03-30.
  9. # https://sourceforge.net/tracker/?func=detail&aid=3514049&group_id=12694&atid=312694
  10. DATA
  11. end
  12. def install
  13. system "./configure", "--prefix=#{prefix}",
  14. "--with-persistent-directory=#{var}/db/net-snmp",
  15. "--with-defaults",
  16. "--without-rpm",
  17. "--with-mib-modules=host ucd-snmp/diskio",
  18. "--without-kmem-usage"
  19. system "make"
  20. system "make install"
  21. end
  22. def header_created?
  23. cp 'include/net-snmp/system/darwin10.h', 'include/net-snmp/system/darwin11.h'
  24. return TRUE
  25. end
  26. end
  27. __END__
  28. diff --git a/include/net-snmp/system/darwin11.h b/include/net-snmp/system/darwin11.h
  29. new file mode 100644
  30. index 0000000..fd5d9ab
  31. --- /dev/null
  32. +++ b/include/net-snmp/system/darwin11.h
  33. @@ -0,0 +1,148 @@
  34. +/*
  35. + * While Darwin 10 (aka, Mac OS X 10.6 Snow Leopard) is "BSD-like", it differs
  36. + * substantially enough to not warrant pretending it is a BSD flavor.
  37. + * This first section are the vestigal BSD remnants.
  38. + */
  39. +/* Portions of this file are subject to the following copyright(s). See
  40. + * the Net-SNMP's COPYING file for more details and other copyrights
  41. + * that may apply:
  42. + */
  43. +/*
  44. + * Portions of this file are copyrighted by:
  45. + * Copyright (C) 2007 Apple, Inc. All rights reserved.
  46. + * Use is subject to license terms specified in the COPYING file
  47. + * distributed with the Net-SNMP package.
  48. + */
  49. +
  50. +/*
  51. + * BSD systems use a different method of looking up sockaddr_in values
  52. + */
  53. +/* #define NEED_KLGETSA 1 */
  54. +
  55. +/*
  56. + * ARP_Scan_Next needs a 4th ifIndex argument
  57. + */
  58. +#define ARP_SCAN_FOUR_ARGUMENTS 1
  59. +
  60. +#define CHECK_RT_FLAGS 1
  61. +
  62. +/*
  63. + * this is not good enough before freebsd3!
  64. + */
  65. +/* #undef HAVE_NET_IF_MIB_H */
  66. +
  67. +/*
  68. + * This section adds the relevant definitions from generic.h
  69. + * (a file we don't include here)
  70. + */
  71. +
  72. +/*
  73. + * udp_inpcb list symbol, e.g. for mibII/udpTable.c
  74. + */
  75. +#define INP_NEXT_SYMBOL inp_next
  76. +
  77. +/*
  78. + * This section defines Mac OS X 10.5 (and later) specific additions.
  79. + */
  80. +#define darwin 11
  81. +#ifndef darwin11
  82. +# define darwin11 darwin
  83. +#endif
  84. +
  85. +/*
  86. + * Mac OS X should only use the modern API and definitions.
  87. + */
  88. +#ifndef NETSNMP_NO_LEGACY_DEFINITIONS
  89. +#define NETSNMP_NO_LEGACY_DEFINITIONS 1
  90. +#endif
  91. +
  92. +/*
  93. + * looks like the IFTable stuff works better than the mibII versions
  94. + */
  95. +
  96. +#define NETSNMP_INCLUDE_IFTABLE_REWRITES
  97. +
  98. +/*
  99. + * use new host resources files as well
  100. + */
  101. +#define NETSNMP_INCLUDE_HRSWINST_REWRITES
  102. +#define NETSNMP_INCLUDE_HRSWRUN_REWRITES
  103. +#undef NETSNMP_INCLUDE_HRSWRUN_WRITE_SUPPORT
  104. +#define NETSNMP_CAN_GET_DISK_LABEL 1
  105. +
  106. +/*
  107. + * Enabling this restricts the compiler to mostly public APIs.
  108. + */
  109. +#ifndef __APPLE_API_STRICT_CONFORMANCE
  110. +#define __APPLE_API_STRICT_CONFORMANCE 1
  111. +#endif
  112. +#ifndef __APPLE_API_UNSTABLE
  113. +#define __APPLE_API_UNSTABLE 1
  114. +#endif
  115. +
  116. +/*
  117. + * Darwin's tools are capable of building multiple architectures in one pass.
  118. + * As a result, platform definitions should be deferred until compile time.
  119. + */
  120. +#ifdef BYTE_ORDER
  121. +# undef WORDS_BIGENDIAN
  122. +# if BYTE_ORDER == BIG_ENDIAN
  123. +# define WORDS_BIGENDIAN 1
  124. +# endif
  125. +#endif
  126. +
  127. +/*
  128. + * Darwin's tools are capable of building multiple architectures in one pass.
  129. + * As a result, platform definitions should be deferred until compile time.
  130. + */
  131. +#ifdef BYTE_ORDER
  132. +# undef WORDS_BIGENDIAN
  133. +# if BYTE_ORDER == BIG_ENDIAN
  134. +# define WORDS_BIGENDIAN 1
  135. +# endif
  136. +#endif
  137. +
  138. +/*
  139. + * Although Darwin does have an fstab.h file, getfsfile etc. always return null.
  140. + * At least, as of 5.3.
  141. + */
  142. +#undef HAVE_FSTAB_H
  143. +
  144. +#define SWAPFILE_DIR "/private/var/vm"
  145. +#define SWAPFILE_PREFIX "swapfile"
  146. +
  147. +/*
  148. + * These apparently used to be in netinet/tcp_timers.h, but went away in
  149. + * 10.4.2. Define them here til we find out a way to get the real values.
  150. + */
  151. +#define TCPTV_MIN ( 1*PR_SLOWHZ) /* minimum allowable value */
  152. +#define TCPTV_REXMTMAX ( 64*PR_SLOWHZ) /* max allowable REXMT value */
  153. +
  154. +/*
  155. + * Because Mac OS X is built on Mach, it does not provide a BSD-compatible
  156. + * VM statistics API.
  157. + */
  158. +#define USE_MACH_HOST_STATISTICS 1
  159. +
  160. +/*
  161. + * This tells code that manipulates IPv6 that the structures are unified,
  162. + * i.e., IPv4 and IPv6 use the same structs.
  163. + * This should eventually be replaced with a configure directive.
  164. + */
  165. +/* #define USE_UNIFIED_IPV6_STRUCTS 1 */
  166. +#undef STRUCT_in6pcb_HAS_inp_vflag
  167. +
  168. +/*
  169. + * utility macro used in several darwin specific files
  170. + */
  171. +#define SNMP_CFRelease(x) do { if (x) { CFRelease(x); x = NULL; } } while(0)
  172. +
  173. +/*
  174. + * Mac OS X runs on both PPC and Intel hardware,
  175. + * which handle udpTable index values differently
  176. + */
  177. +#include <TargetConditionals.h>
  178. +#ifdef TARGET_RT_LITTLE_ENDIAN
  179. +#define UDP_ADDRESSES_IN_HOST_ORDER 1
  180. +#endif
  181. +