From 29f2cde8c4a81334a89238371f47eadba9db354e Mon Sep 17 00:00:00 2001 From: Adam Vandenberg Date: Fri, 30 Jul 2010 21:12:08 -0700 Subject: [PATCH] Update rrdtool to 1.4.4 and fix Ruby bindings * Ruby bindings (may) now work against the system Ruby. --- Formula/rrdtool.rb | 69 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 55 insertions(+), 14 deletions(-) diff --git a/Formula/rrdtool.rb b/Formula/rrdtool.rb index b9af06c4058..6da951ecb3f 100644 --- a/Formula/rrdtool.rb +++ b/Formula/rrdtool.rb @@ -1,13 +1,13 @@ require 'formula' class Rrdtool :optional + depends_on 'lua' => :optional if ARGV.include? "--lua" + + def patches + DATA # Ha-ha, but sleeping is annoying when running configure a lot + end def install - system "./configure", "--disable-dependency-tracking", - "--prefix=#{prefix}", - "--enable-perl-site-install", - "--enable-ruby-site-install", - # Installing directly into Homebrew's Python's site-packages - # can break things, so we disable this for now. - # TODO: how to build Python support w/o installing it. - "--disable-python" + which_perl = `/usr/bin/which perl`.chomp + which_ruby = `/usr/bin/which ruby`.chomp + + opoo "Using system Ruby. RRD module will be installed to /Library/Ruby/..." if which_ruby == "/usr/bin/ruby" + opoo "Using system Perl. RRD module will be installed to /Library/Perl/..." if which_perl == "/usr/bin/perl" + + args = ["--disable-dependency-tracking", "--prefix=#{prefix}"] + args << "--enable-perl-site-install" if which_perl == "/usr/bin/perl" + args << "--enable-ruby-site-install" if which_ruby == "/usr/bin/ruby" + + system "./configure", *args + + # Needed to build proper Ruby bundle + if Hardware.is_64_bit? and MACOS_VERSION >= 10.6 + ENV["ARCHFLAGS"] = "-arch x86_64" + else + ENV["ARCHFLAGS"] = "-arch i386" + end system "make install" + prefix.install "bindings/ruby/test.rb" end def test - # Test ruby support; currently fails. - system "ruby", "-e", "require 'RRD'" + system "ruby", prefix+"test.rb" + system "open test.png" + puts "You may want to `rm test.{rrd,png}`" end end + +__END__ +diff --git a/configure b/configure +index 7487ad2..e7b85c1 100755 +--- a/configure ++++ b/configure +@@ -31663,18 +31663,6 @@ $as_echo_n "checking in... " >&6; } + { $as_echo "$as_me:$LINENO: result: and out again" >&5 + $as_echo "and out again" >&6; } + +-echo $ECHO_N "ordering CD from http://tobi.oetiker.ch/wish $ECHO_C" 1>&6 +-sleep 1 +-echo $ECHO_N ".$ECHO_C" 1>&6 +-sleep 1 +-echo $ECHO_N ".$ECHO_C" 1>&6 +-sleep 1 +-echo $ECHO_N ".$ECHO_C" 1>&6 +-sleep 1 +-echo $ECHO_N ".$ECHO_C" 1>&6 +-sleep 1 +-{ $as_echo "$as_me:$LINENO: result: just kidding ;-)" >&5 +-$as_echo " just kidding ;-)" >&6; } + echo + echo "----------------------------------------------------------------" + echo "Config is DONE!"