percona-server: use options DSL

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
master
Jack Nagel 2012-08-13 15:40:26 -05:00
parent 331282d156
commit a2614431bf
1 changed files with 11 additions and 15 deletions

View File

@ -10,6 +10,12 @@ class PerconaServer < Formula
depends_on 'readline'
depends_on 'pidof'
option :universal
option 'with-tests', 'Build with unit tests'
option 'with-embedded', 'Build the embedded server'
option 'with-libedit', 'Compile with editline wrapper instead of readline'
option 'enable-local-infile', 'Build with local infile loading support'
conflicts_with 'mysql',
:because => "percona-server and mysql install the same binaries."
conflicts_with 'mariadb',
@ -22,16 +28,6 @@ class PerconaServer < Formula
cause "https://github.com/mxcl/homebrew/issues/issue/144"
end
def options
[
['--with-tests', "Build with unit tests."],
['--with-embedded', "Build the embedded server."],
['--with-libedit', "Compile with EditLine wrapper instead of readline"],
['--universal', "Make mysql a universal binary"],
['--enable-local-infile', "Build with local infile loading support"]
]
end
# The CMAKE patches are so that on Lion we do not detect a private
# pthread_init function as linkable. Patch sourced from the MySQL formula.
def patches
@ -62,23 +58,23 @@ class PerconaServer < Formula
]
# To enable unit testing at build, we need to download the unit testing suite
if ARGV.include? '--with-tests'
if build.include? 'with-tests'
args << "-DENABLE_DOWNLOADS=ON"
else
args << "-DWITH_UNIT_TESTS=OFF"
end
# Build the embedded server
args << "-DWITH_EMBEDDED_SERVER=ON" if ARGV.include? '--with-embedded'
args << "-DWITH_EMBEDDED_SERVER=ON" if build.include? 'with-embedded'
# Compile with readline unless libedit is explicitly chosen
args << "-DWITH_READLINE=yes" unless ARGV.include? '--with-libedit'
args << "-DWITH_READLINE=yes" unless build.include? 'with-libedit'
# Make universal for binding to universal applications
args << "-DCMAKE_OSX_ARCHITECTURES='i386;x86_64'" if ARGV.build_universal?
args << "-DCMAKE_OSX_ARCHITECTURES='i386;x86_64'" if build.universal?
# Build with local infile loading support
args << "-DENABLED_LOCAL_INFILE=1" if ARGV.include? '--enable-local-infile'
args << "-DENABLED_LOCAL_INFILE=1" if build.include? 'enable-local-infile'
system "cmake", *args
system "make"