From 415ce0f1d853086052b61b06b8a2efbef9c7bef5 Mon Sep 17 00:00:00 2001 From: Yousef Ourabi Date: Sat, 12 Jan 2013 15:01:57 -0800 Subject: [PATCH] grass: new style options Closes Homebrew/homebrew#17044. Signed-off-by: Adam Vandenberg --- Formula/grass.rb | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/Formula/grass.rb b/Formula/grass.rb index 715ffc4e29..548cc1f4cc 100644 --- a/Formula/grass.rb +++ b/Formula/grass.rb @@ -1,20 +1,12 @@ require 'formula' -def postgres? - ARGV.include? "--with-postgres" -end - -def mysql? - ARGV.include? "--with-mysql" -end - def headless? # The GRASS GUI is based on WxPython. Unfortunately, Lion does not include # this module so we have to drop it. # # This restriction can be lifted once WxMac hits a stable release that is # 64-bit capable. - ARGV.include? '--without-gui' or MacOS.version >= :lion + build.include? 'without-gui' or MacOS.version >= :lion end class Grass < Formula @@ -46,13 +38,9 @@ class Grass < Formula EOS end - def options - [ - ['--with-postgres', 'Specify PostgreSQL as a dependency'], - ['--with-mysql', 'Specify MySQL as a dependency'], - ['--without-gui', 'Build without WxPython interface. Command line tools still available.'] - ] - end + option "with-postgres", "specify PostgreSQL as a dependency." + option "with-mysql", "Specify MySQL as a dependency." + option "without-gui", "Build without WxPython interface. Command line tools still available." def install readline = Formula.factory('readline') @@ -112,8 +100,11 @@ class Grass < Formula args << "--with-cairo" # Database support - args << "--with-postgres" if postgres? - if mysql? + if build.include? "with-postgres" + args << "--with-postgres" + end + + if build.include? "with-mysql" mysql = Formula.factory('mysql') args << "--with-mysql-includes=#{mysql.include + 'mysql'}" args << "--with-mysql-libs=#{mysql.lib + 'mysql'}"