grass: new style options

Closes Homebrew/homebrew#17044.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
This commit is contained in:
Yousef Ourabi 2013-01-12 15:01:57 -08:00 committed by Adam Vandenberg
parent 914668f7bf
commit 415ce0f1d8

View file

@ -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'}"