From eb97154dd4cc48462a53b46654fdf2f1d37091b7 Mon Sep 17 00:00:00 2001 From: Adam Vandenberg Date: Sun, 18 Mar 2012 11:06:09 -0700 Subject: sqlite: add sqlite unviersal check Also use Requirements for these checks. --- Library/Formula/subversion.rb | 46 ++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 16 deletions(-) (limited to 'Library/Formula') diff --git a/Library/Formula/subversion.rb b/Library/Formula/subversion.rb index 35f2a9683..f0b819389 100644 --- a/Library/Formula/subversion.rb +++ b/Library/Formula/subversion.rb @@ -5,6 +5,30 @@ def build_perl?; ARGV.include? "--perl"; end def build_python?; ARGV.include? "--python"; end def build_ruby?; ARGV.include? "--ruby"; end +class UniversalNeon < Requirement + def message; <<-EOS.undent + A universal build was requested, but neon was already built for a single arch. + You may need to `brew rm neon` first. + EOS + end + def satisfied? + f = Formula.factory('neon') + !f.installed? || archs_for_command(f.lib+'libneon.dylib').universal? + end +end + +class UniversalSqlite < Requirement + def message; <<-EOS.undent + A universal build was requested, but sqlite was already built for a single arch. + You may need to `brew rm sqlite` first. + EOS + end + def satisfied? + f = Formula.factory('sqlite') + !f.installed? || archs_for_command(f.lib+'libsqlite3.dylib').universal? + end +end + class Subversion < Formula homepage 'http://subversion.apache.org/' url 'http://www.apache.org/dyn/closer.cgi?path=subversion/subversion-1.7.3.tar.bz2' @@ -18,6 +42,11 @@ class Subversion < Formula depends_on 'neon' depends_on 'sqlite' + if ARGV.build_universal? + depends_on UniversalNeon.new + depends_on UniversalSqlite.new + end + def options [ ['--java', 'Build Java bindings.'], @@ -28,18 +57,6 @@ class Subversion < Formula ] end - def check_neon_arch - # Check that Neon was built universal if we are building w/ --universal - neon = Formula.factory('neon') - if neon.installed? - neon_arch = archs_for_command(neon.lib+'libneon.dylib') - unless neon_arch.universal? - opoo "A universal build was requested, but neon was already built for a single arch." - puts "You may need to `brew rm neon` first." - end - end - end - def install if build_java? unless ARGV.build_universal? @@ -53,10 +70,7 @@ class Subversion < Formula end end - if ARGV.build_universal? - ENV.universal_binary - check_neon_arch - end + ENV.universal_binary if ARGV.build_universal? # Use existing system zlib # Use dep-provided other libraries -- cgit v1.2.3