mariadb: use options DSL

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
Jack Nagel 2012-08-13 15:40:11 -05:00
parent 4d99e271aa
commit 331282d156

View file

@ -1,12 +1,17 @@
require 'formula'
class Mariadb < Formula
url 'http://ftp.osuosl.org/pub/mariadb/mariadb-5.3.7/kvm-tarbake-jaunty-x86/mariadb-5.3.7.tar.gz'
homepage 'http://mariadb.org/'
url 'http://ftp.osuosl.org/pub/mariadb/mariadb-5.3.7/kvm-tarbake-jaunty-x86/mariadb-5.3.7.tar.gz'
sha1 '1ee2ef4895aefabd66b4884c382ba2cd1f7bbe2d'
depends_on 'readline'
option :universal
option 'with-tests', 'Keep test when installing'
option 'with-bench', 'Keep benchmark app when installing'
option 'client-only', 'Install only client tools'
conflicts_with 'mysql',
:because => "mariadb and mysql install the same binaries."
conflicts_with 'percona-server',
@ -16,20 +21,11 @@ class Mariadb < Formula
build 421
end
def options
[
['--with-tests', "Keep tests when installing."],
['--with-bench', "Keep benchmark app when installing."],
['--client-only', "Only install client tools, not the server."],
['--universal', "Make mariadb a universal binary"]
]
end
def install
ENV.append 'CXXFLAGS', '-fno-omit-frame-pointer -felide-constructors'
# Make universal for bindings to universal applications
ENV.universal_binary if ARGV.build_universal?
ENV.universal_binary if build.universal?
configure_args = [
"--without-docs",
@ -52,7 +48,7 @@ class Mariadb < Formula
"--with-libevent",
]
configure_args << "--without-server" if ARGV.include? '--client-only'
configure_args << "--without-server" if build.include? 'client-only'
system "./configure", *configure_args
system "make install"
@ -60,8 +56,8 @@ class Mariadb < Formula
bin.install_symlink "#{libexec}/mysqld"
bin.install_symlink "#{share}/mysql/mysql.server"
(prefix+'mysql-test').rmtree unless ARGV.include? '--with-tests' # save 121MB!
(prefix+'sql-bench').rmtree unless ARGV.include? '--with-bench'
(prefix+'mysql-test').rmtree unless build.include? 'with-tests' # save 121MB!
(prefix+'sql-bench').rmtree unless build.include? 'with-bench'
plist_path.write startup_plist
plist_path.chmod 0644