diff options
| author | James G. Kim | 2013-08-05 19:13:24 +0900 |
|---|---|---|
| committer | Adam Vandenberg | 2013-09-15 12:58:35 -0700 |
| commit | f22659129664caa91aa500e0142615a014c2f642 (patch) | |
| tree | 54b31405d4004a9e80a0396f14c05eea2f1537ce /Library/Formula | |
| parent | 1ad3d44053d6dbafb74185178bfdfdfb426d8c46 (diff) | |
| download | homebrew-f22659129664caa91aa500e0142615a014c2f642.tar.bz2 | |
redland: add language bindings
Closes #21494.
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Diffstat (limited to 'Library/Formula')
| -rw-r--r-- | Library/Formula/redland.rb | 105 |
1 files changed, 99 insertions, 6 deletions
diff --git a/Library/Formula/redland.rb b/Library/Formula/redland.rb index 99d5c4f87..f57683149 100644 --- a/Library/Formula/redland.rb +++ b/Library/Formula/redland.rb @@ -1,26 +1,119 @@ require 'formula' +class RedlandBindings < Formula + homepage 'http://librdf.org/bindings/' + url 'http://download.librdf.org/source/redland-bindings-1.0.16.1.tar.gz' + sha1 '98c20b64cf5e99cbf29fcb84490e73e2a828213a' +end + class Redland < Formula homepage 'http://librdf.org/' url 'http://download.librdf.org/source/redland-1.0.16.tar.gz' sha1 '0dc3d65bee6d580cae84ed261720b5b4e6b1f856' + option 'with-php', 'Build with php support' + option 'with-ruby', 'Build with ruby support' + depends_on 'pkg-config' => :build depends_on 'raptor' depends_on 'rasqal' - depends_on 'berkeley-db' => :optional depends_on 'sqlite' => :recommended + depends_on 'berkeley-db' => :optional + depends_on :python => :optional fails_with :llvm do build 2334 end def install - system "./configure", "--disable-debug", "--disable-dependency-tracking", - "--prefix=#{prefix}", - "--with-sqlite=yes", - "--with-mysql=no", - "--with-bdb=#{HOMEBREW_PREFIX}" + args = %W[ + --disable-debug + --disable-dependency-tracking + --prefix=#{prefix} + --with-mysql=no + ] + + if build.with? 'sqlite' + args << "--with-sqlite=yes" + else + args << "--with-sqlite=no" + end + + if build.with? 'berkeley-db' + args << "--with-bdb=#{Formula.factory('berkeley-db').opt_prefix}" + else + args << "--with-bdb=no" + end + + system "./configure", *args system "make install" + + if build.with? 'perl' or build.with? 'php' or build.with? 'ruby' or build.with? 'python' + RedlandBindings.new.brew do + args = %W[ + --disable-debug + --disable-dependency-tracking + --prefix=#{prefix} + ] + + if build.with? 'php' + args << "--with-php" + args << "--with-php-linking=dylib" + end + + if build.with? 'ruby' + `ruby --version` =~ /ruby (\d\.\d).\d \(.*\) \[(.*)\]/ + ruby_install_dir = lib + 'ruby/site_ruby/' + $1 + ruby_arch_install_dir = ruby_install_dir + $2 + ruby_install_dir.mkpath + ruby_arch_install_dir.mkpath + args << "--with-ruby" + args << "--with-ruby-install-dir=#{ruby_install_dir}" + args << "--with-ruby-arch-install-dir=#{ruby_arch_install_dir}" + end + + if build.with? 'python' + ENV['PYTHON_LIB'] = python.site_packages + args << "--with-python" + end + + ENV.append 'PKG_CONFIG_LIBDIR', "#{lib}/pkgconfig", ':' + + system "./configure", *args + + if build.with? 'php' + php_extension_dir = lib + 'php/extensions' + php_extension_dir.mkpath + inreplace 'php/Makefile' do |s| + s.change_make_var! 'PHP_EXTENSION_DIR', php_extension_dir + s.change_make_var! 'phpdir', php_extension_dir + end + end + + system "make install" + end + end + end + + def caveats + s = '' + + if build.with? 'php' + s += <<-EOS.undent + You may need to add the following line to php.ini: + extension="#{HOMEBREW_PREFIX}/lib/php/extensions/redland.dylib" + EOS + end + + if build.with? 'ruby' + s += <<-EOS.undent + You may need to add the Ruby bindings to your RUBYLIB from: + #{HOMEBREW_PREFIX}/lib/ruby/site_ruby + EOS + end + + s += python.standard_caveats if python + + return s.empty? ? nil : s end end |
