boost: use options dsl

This commit is contained in:
Adam Vandenberg 2012-08-08 22:26:41 -07:00
parent 1a4b900946
commit ee6fade1d6

View file

@ -20,7 +20,7 @@ end
class Boost < Formula class Boost < Formula
homepage 'http://www.boost.org' homepage 'http://www.boost.org'
url 'http://downloads.sourceforge.net/project/boost/boost/1.49.0/boost_1_49_0.tar.bz2' url 'http://downloads.sourceforge.net/project/boost/boost/1.49.0/boost_1_49_0.tar.bz2'
md5 '0d202cb811f934282dea64856a175698' sha1 '26a52840e9d12f829e3008589abf0a925ce88524'
head 'http://svn.boost.org/svn/boost/trunk' head 'http://svn.boost.org/svn/boost/trunk'
@ -29,23 +29,19 @@ class Boost < Formula
sha1 '46945515d520009fbbc101e4ae19f28db1433752' => :snowleopard sha1 '46945515d520009fbbc101e4ae19f28db1433752' => :snowleopard
end end
option :universal
option 'with-mpi', 'Enable MPI support'
option 'without-python', 'Build without Python'
option 'with-icu', 'Build regexp engine with icu support'
depends_on UniversalPython.new if needs_universal_python? depends_on UniversalPython.new if needs_universal_python?
depends_on "icu4c" if ARGV.include? "--with-icu" depends_on "icu4c" if build.include? "--with-icu"
fails_with :llvm do fails_with :llvm do
build 2335 build 2335
cause "Dropped arguments to functions when linking with boost" cause "Dropped arguments to functions when linking with boost"
end end
def options
[
["--with-mpi", "Enable MPI support"],
["--universal", "Build universal binaries"],
["--without-python", "Build without Python"],
["--with-icu", "Build regexp engine with icu support"],
]
end
def install def install
# Adjust the name the libs are installed under to include the path to the # Adjust the name the libs are installed under to include the path to the
# Homebrew lib directory so executables will work when installed to a # Homebrew lib directory so executables will work when installed to a
@ -68,13 +64,13 @@ class Boost < Formula
# Force boost to compile using the appropriate GCC version # Force boost to compile using the appropriate GCC version
open("user-config.jam", "a") do |file| open("user-config.jam", "a") do |file|
file.write "using darwin : : #{ENV.cxx} ;\n" file.write "using darwin : : #{ENV.cxx} ;\n"
file.write "using mpi ;\n" if ARGV.include? '--with-mpi' file.write "using mpi ;\n" if build.include? '--with-mpi'
end end
# we specify libdir too because the script is apparently broken # we specify libdir too because the script is apparently broken
bargs = ["--prefix=#{prefix}", "--libdir=#{lib}"] bargs = ["--prefix=#{prefix}", "--libdir=#{lib}"]
if ARGV.include? "--with-icu" if build.include? "--with-icu"
icu4c_prefix = Formula.factory('icu4c').prefix icu4c_prefix = Formula.factory('icu4c').prefix
bargs << "--with-icu=#{icu4c_prefix}" bargs << "--with-icu=#{icu4c_prefix}"
end end
@ -87,8 +83,8 @@ class Boost < Formula
"threading=multi", "threading=multi",
"install"] "install"]
args << "address-model=32_64" << "architecture=x86" << "pch=off" if ARGV.include? "--universal" args << "address-model=32_64" << "architecture=x86" << "pch=off" if build.universal?
args << "--without-python" if ARGV.include? "--without-python" args << "--without-python" if build.include? "--without-python"
system "./bootstrap.sh", *bargs system "./bootstrap.sh", *bargs
system "./bjam", *args system "./bjam", *args