Skip to content

Instantly share code, notes, and snippets.

@rpavlik
Created August 19, 2010 19:51

Revisions

  1. rpavlik revised this gist Aug 19, 2010. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions gistfile1.diff
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,11 @@
    diff --git a/Library/Formula/ganglia.rb b/Library/Formula/ganglia.rb
    index 55dfa78..eab2c66 100644
    index 55dfa78..747b1c7 100644
    --- a/Library/Formula/ganglia.rb
    +++ b/Library/Formula/ganglia.rb
    @@ -5,34 +5,196 @@ class Ganglia <Formula
    @@ -5,34 +5,197 @@ class Ganglia <Formula
    homepage 'http://ganglia.sourceforge.net/'
    md5 '6aa5e2109c2cc8007a6def0799cf1b4c'

    + # TODO: gmetad (requries rrdtool) does not build right now
    +
    + depends_on 'confuse'
    + depends_on 'pcre'
    + depends_on 'rrdtool'
    @@ -39,7 +37,7 @@ index 55dfa78..eab2c66 100644
    + system "/bin/sh ./autogen.sh --download"
    +
    + Dir.chdir "libmetrics" do
    + ENV['PROJECT'] = "ganglia"
    + ENV['PROJECT'] = "libmetrics"
    + system "/bin/sh ../autogen.sh --download"
    + end
    +
    @@ -61,7 +59,6 @@ index 55dfa78..eab2c66 100644
    +
    + # build and install
    system "make install"
    - man1.install Dir['mans/*']
    +
    + Dir.chdir "web" do
    + system "make", "conf.php"
    @@ -77,6 +74,9 @@ index 55dfa78..eab2c66 100644
    +
    + # Install the web files
    + (share + "ganglia").install "web"
    +
    + # Install man pages
    man1.install Dir['mans/*']
    end
    -end

  2. rpavlik created this gist Aug 19, 2010.
    213 changes: 213 additions & 0 deletions gistfile1.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,213 @@
    diff --git a/Library/Formula/ganglia.rb b/Library/Formula/ganglia.rb
    index 55dfa78..eab2c66 100644
    --- a/Library/Formula/ganglia.rb
    +++ b/Library/Formula/ganglia.rb
    @@ -5,34 +5,196 @@ class Ganglia <Formula
    homepage 'http://ganglia.sourceforge.net/'
    md5 '6aa5e2109c2cc8007a6def0799cf1b4c'

    + # TODO: gmetad (requries rrdtool) does not build right now
    +
    + depends_on 'confuse'
    + depends_on 'pcre'
    + depends_on 'rrdtool'
    +
    def patches
    - # "kvm.h" was removed in OS X 10.5
    - # Seems to build without the include, though.
    + # fixes build on Leopard and newer, which lack kvm.h and its corresponding /dev/ node
    + # Patch sent upstream: http://bugzilla.ganglia.info/cgi-bin/bugzilla/show_bug.cgi?id=258
    + # Also, for some reason, having inline or static keywords in gperf generated files
    + # causes missing symbol link errors - manually patch those out for now.
    DATA
    end

    def install
    - system "./configure", "--disable-debug", "--disable-dependency-tracking",
    - "--disable-python",
    - "--prefix=#{prefix}",
    - "--sysconfdir=#{etc}"
    + # ENV var needed to confirm putting the config in the prefix until 3.2
    + ENV['GANGLIA_ACK_SYSCONFDIR'] = '1'
    +
    + # Grab the standard autogen.sh and run it twice,
    + # to update libtool
    + curl "http://buildconf.git.sourceforge.net/git/gitweb.cgi?p=buildconf/buildconf;a=blob_plain;f=autogen.sh;hb=HEAD", "-o", "autogen.sh"
    + ENV['LIBTOOLIZE'] = "/usr/bin/glibtoolize"
    +
    + ENV['PROJECT'] = "ganglia"
    + system "/bin/sh ./autogen.sh --download"
    +
    + Dir.chdir "libmetrics" do
    + ENV['PROJECT'] = "ganglia"
    + system "/bin/sh ../autogen.sh --download"
    + end
    +
    + # Regenerate libtool, etc - now using the autogen.sh script above
    + #system "autoreconf -fiv"
    + #Dir.chdir "libmetrics" do
    + # system "autoreconf -fiv"
    + #end
    +
    + # configure
    + system "./configure",
    + "--disable-debug",
    + "--disable-dependency-tracking",
    + "--prefix=#{prefix}",
    + "--sbindir=#{bin}", # brew doesn't do things with prefix/sbin
    + "--sysconfdir=#{HOMEBREW_PREFIX}/etc",
    + "--with-gexec",
    + "--with-gmetad"
    +
    + # build and install
    system "make install"
    - man1.install Dir['mans/*']
    +
    + Dir.chdir "web" do
    + system "make", "conf.php"
    + system "make", "version.php"
    +
    + inreplace "conf.php", "/usr/bin/rrdtool", "#{HOMEBREW_PREFIX}/bin/rrdtool"
    + end
    +
    + # Generate the default config file
    + Dir.chdir "#{prefix}" do
    + system "bin/gmond -t > #{HOMEBREW_PREFIX}/etc/gmond.conf" unless File.exists? "#{HOMEBREW_PREFIX}/etc/gmond.conf"
    + end
    +
    + # Install the web files
    + (share + "ganglia").install "web"
    end
    -end

    + def caveats; <<-EOS.undent
    + If you did not have the config file
    + #{HOMEBREW_PREFIX}/etc/gmond.conf
    + one was created for you.
    +
    + You might want to copy
    + #{prefix}/share/ganglia/web/* to someplace
    + served by a PHP-capable web server.
    + EOS
    + end
    +end

    __END__
    +diff --git a/libmetrics/config.h.in b/libmetrics/config.h.in
    +index 1ff64b1..13087c6 100644
    +--- a/libmetrics/config.h.in
    ++++ b/libmetrics/config.h.in
    +@@ -152,6 +152,9 @@
    + /* Define to 1 if you have the <sys/fs/s5param.h> header file. */
    + #undef HAVE_SYS_FS_S5PARAM_H
    +
    ++/* Define to 1 if you have the <kvm.h> header file. */
    ++#undef HAVE_KVM_H
    ++
    + /* Define to 1 if you have the <sys/mount.h> header file. */
    + #undef HAVE_SYS_MOUNT_H
    +
    +diff --git a/libmetrics/configure.in b/libmetrics/configure.in
    +index 213d162..b5aa98e 100644
    +--- a/libmetrics/configure.in
    ++++ b/libmetrics/configure.in
    +@@ -31,7 +31,7 @@ AC_HAVE_LIBRARY(nsl)
    + # Checks for header files.
    + AC_HEADER_DIRENT
    + AC_HEADER_STDC
    +-AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h nlist.h paths.h stdlib.h strings.h sys/filsys.h sys/fs/s5param.h sys/mount.h sys/param.h sys/socket.h sys/statfs.h sys/statvfs.h sys/systeminfo.h sys/time.h sys/vfs.h unistd.h utmp.h sys/sockio.h])
    ++AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h nlist.h paths.h stdlib.h strings.h sys/filsys.h sys/fs/s5param.h sys/mount.h sys/param.h sys/socket.h sys/statfs.h sys/statvfs.h sys/systeminfo.h sys/time.h sys/vfs.h unistd.h utmp.h sys/sockio.h kvm.h])
    + AC_CHECK_HEADERS([rpc/rpc.h],,
    + [AC_MSG_ERROR([your system is missing the Sun RPC (ONC/RPC) libraries])])
    +
    diff --git a/libmetrics/darwin/metrics.c b/libmetrics/darwin/metrics.c
    -index 498ed8f..66f9b2b 100644
    +index 498ed8f..bfa09a1 100644
    --- a/libmetrics/darwin/metrics.c
    +++ b/libmetrics/darwin/metrics.c
    -@@ -11,7 +11,7 @@
    +@@ -9,9 +9,17 @@
    + *
    + */

    ++#ifdef HAVE_CONFIG_H
    ++#include "config.h"
    ++#endif
    ++
    #include <stdlib.h>
    #include "interface.h"
    --#include <kvm.h>
    -+// #include <kvm.h>
    ++
    ++#if defined(HAVE_LIBKVM) && defined(HAVE_KVM_H)
    + #include <kvm.h>
    ++#endif
    ++
    #include <sys/sysctl.h>

    #include <mach/mach_init.h>
    +
    +diff --git a/gmetad/type_hash.c b/gmetad/type_hash.c
    +index 519513d..3f65efa 100644
    +--- a/gmetad/type_hash.c
    ++++ b/gmetad/type_hash.c
    +@@ -46,14 +46,7 @@ struct type_tag;
    + #define MAX_HASH_VALUE 21
    + /* maximum key range = 18, duplicates = 0 */
    +
    +-#ifdef __GNUC__
    +-__inline
    +-#else
    +-#ifdef __cplusplus
    +-inline
    +-#endif
    +-#endif
    +-static unsigned int
    ++unsigned int
    + type_hash (str, len)
    + register const char *str;
    + register unsigned int len;
    +@@ -124,12 +117,6 @@ static struct type_tag types[] =
    + {"double", FLOAT}
    + };
    +
    +-#ifdef __GNUC__
    +-__inline
    +-#ifdef __GNUC_STDC_INLINE__
    +-__attribute__ ((__gnu_inline__))
    +-#endif
    +-#endif
    + struct type_tag *
    + in_type_list (str, len)
    + register const char *str;
    +diff --git a/gmetad/xml_hash.c b/gmetad/xml_hash.c
    +index 5c21755..04910b3 100644
    +--- a/gmetad/xml_hash.c
    ++++ b/gmetad/xml_hash.c
    +@@ -42,13 +42,6 @@ struct xml_tag;
    + #define MAX_HASH_VALUE 44
    + /* maximum key range = 42, duplicates = 0 */
    +
    +-#ifdef __GNUC__
    +-__inline
    +-#else
    +-#ifdef __cplusplus
    +-inline
    +-#endif
    +-#endif
    + static unsigned int
    + xml_hash (str, len)
    + register const char *str;
    +@@ -86,12 +79,6 @@ xml_hash (str, len)
    + return len + asso_values[(unsigned char)str[len - 1]] + asso_values[(unsigned char)str[0]];
    + }
    +
    +-#ifdef __GNUC__
    +-__inline
    +-#ifdef __GNUC_STDC_INLINE__
    +-__attribute__ ((__gnu_inline__))
    +-#endif
    +-#endif
    + struct xml_tag *
    + in_xml_list (str, len)
    + register const char *str;