2010-09-26 20:29:29 +00:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
def postgres?
|
|
|
|
ARGV.include? "--with-postgres"
|
|
|
|
end
|
|
|
|
|
|
|
|
def mysql?
|
|
|
|
ARGV.include? "--with-mysql"
|
|
|
|
end
|
|
|
|
|
2012-04-21 19:18:38 +00:00
|
|
|
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.
|
2012-09-05 04:04:01 +00:00
|
|
|
ARGV.include? '--without-gui' or MacOS.version >= :lion
|
2012-04-21 19:18:38 +00:00
|
|
|
end
|
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Grass < Formula
|
2010-09-26 20:29:29 +00:00
|
|
|
homepage 'http://grass.osgeo.org/'
|
2012-03-31 20:48:30 +00:00
|
|
|
url 'http://grass.osgeo.org/grass64/source/grass-6.4.2.tar.gz'
|
2012-09-03 18:33:56 +00:00
|
|
|
sha1 '74481611573677d90ae0cd446c04a3895e232004'
|
2012-05-10 14:10:12 +00:00
|
|
|
|
|
|
|
head 'https://svn.osgeo.org/grass/grass/trunk'
|
2010-09-26 20:29:29 +00:00
|
|
|
|
2011-03-19 16:33:50 +00:00
|
|
|
depends_on "pkg-config" => :build
|
|
|
|
depends_on "gettext"
|
|
|
|
depends_on "readline"
|
2010-09-26 20:29:29 +00:00
|
|
|
depends_on "gdal"
|
|
|
|
depends_on "libtiff"
|
|
|
|
depends_on "unixodbc"
|
|
|
|
depends_on "fftw"
|
2012-09-05 04:04:01 +00:00
|
|
|
depends_on "cairo" if MacOS.version == :leopard
|
2012-06-07 01:35:12 +00:00
|
|
|
depends_on :x11
|
2010-09-26 20:29:29 +00:00
|
|
|
|
2012-04-21 21:26:32 +00:00
|
|
|
# Patches ensure 32 bit system python is used for wxWidgets and that files
|
|
|
|
# are not installed outside of the prefix.
|
2012-03-17 19:08:39 +00:00
|
|
|
def patches; DATA; end
|
2010-09-26 20:29:29 +00:00
|
|
|
|
2012-04-21 19:18:38 +00:00
|
|
|
fails_with :clang do
|
2012-08-19 20:10:21 +00:00
|
|
|
build 421
|
2012-04-21 19:18:38 +00:00
|
|
|
|
|
|
|
cause <<-EOS.undent
|
|
|
|
Multiple build failures while compiling GRASS tools.
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
2010-09-26 20:29:29 +00:00
|
|
|
def options
|
|
|
|
[
|
|
|
|
['--with-postgres', 'Specify PostgreSQL as a dependency'],
|
2012-04-21 19:18:38 +00:00
|
|
|
['--with-mysql', 'Specify MySQL as a dependency'],
|
|
|
|
['--without-gui', 'Build without WxPython interface. Command line tools still available.']
|
2010-09-26 20:29:29 +00:00
|
|
|
]
|
|
|
|
end
|
|
|
|
|
|
|
|
def install
|
2011-05-02 17:22:47 +00:00
|
|
|
readline = Formula.factory('readline')
|
|
|
|
gettext = Formula.factory('gettext')
|
2010-09-26 20:29:29 +00:00
|
|
|
|
2011-04-08 18:16:37 +00:00
|
|
|
args = [
|
|
|
|
"--disable-debug", "--disable-dependency-tracking",
|
2012-08-06 05:33:36 +00:00
|
|
|
"--with-libs=#{MacOS::X11.lib} #{HOMEBREW_PREFIX}/lib",
|
2010-09-26 20:29:29 +00:00
|
|
|
"--with-includes=#{HOMEBREW_PREFIX}/include",
|
|
|
|
"--enable-largefile",
|
|
|
|
"--enable-shared",
|
|
|
|
"--with-cxx",
|
|
|
|
"--with-opengl=aqua",
|
|
|
|
"--with-x",
|
|
|
|
"--without-motif",
|
|
|
|
"--with-python=/usr/bin/python-config",
|
|
|
|
"--with-blas",
|
|
|
|
"--with-lapack",
|
|
|
|
"--with-sqlite",
|
|
|
|
"--with-odbc",
|
2011-05-02 17:22:47 +00:00
|
|
|
"--with-geos=#{HOMEBREW_PREFIX}/bin/geos-config",
|
2012-08-06 05:33:36 +00:00
|
|
|
"--with-png-includes=#{MacOS::X11.include}",
|
2010-09-26 20:29:29 +00:00
|
|
|
"--with-png",
|
|
|
|
"--with-readline-includes=#{readline.include}",
|
|
|
|
"--with-readline-libs=#{readline.lib}",
|
|
|
|
"--with-readline",
|
|
|
|
"--with-nls-includes=#{gettext.include}",
|
|
|
|
"--with-nls-libs=#{gettext.lib}",
|
|
|
|
"--with-nls",
|
2012-08-06 05:33:36 +00:00
|
|
|
"--with-freetype-includes=#{MacOS::X11.include} #{MacOS::X11.include}/freetype2",
|
2010-09-26 20:29:29 +00:00
|
|
|
"--with-freetype",
|
|
|
|
"--without-tcltk" # Disabled due to compatibility issues with OS X Tcl/Tk
|
|
|
|
]
|
|
|
|
|
2012-04-21 19:18:38 +00:00
|
|
|
if headless?
|
|
|
|
args << "--without-wxwidgets"
|
|
|
|
else
|
|
|
|
args << "--with-wxwidgets=/usr/bin/wx-config"
|
|
|
|
end
|
|
|
|
|
2011-03-19 16:33:50 +00:00
|
|
|
if MacOS.prefer_64_bit?
|
2011-04-08 18:16:37 +00:00
|
|
|
args << "--enable-64bit"
|
|
|
|
args << "--with-macosx-archs=x86_64"
|
2010-09-26 20:29:29 +00:00
|
|
|
else
|
2011-04-08 18:16:37 +00:00
|
|
|
args << "--with-macosx-archs=i386"
|
2010-09-26 20:29:29 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
# Deal with Cairo support
|
2012-09-05 04:04:01 +00:00
|
|
|
if MacOS.version == :leopard
|
2011-03-19 16:33:50 +00:00
|
|
|
cairo = Formula.factory('cairo')
|
2011-04-08 18:16:37 +00:00
|
|
|
args << "--with-cairo-includes=#{cairo.include}/cairo"
|
|
|
|
args << "--with-cairo-libs=#{cairo.lib}"
|
|
|
|
else
|
2012-08-06 05:33:36 +00:00
|
|
|
args << "--with-cairo-includes=#{MacOS::X11.include} #{MacOS::X11.include}/cairo"
|
2010-09-26 20:29:29 +00:00
|
|
|
end
|
2011-04-08 18:16:37 +00:00
|
|
|
|
|
|
|
args << "--with-cairo"
|
2010-09-26 20:29:29 +00:00
|
|
|
|
|
|
|
# Database support
|
2011-04-08 18:16:37 +00:00
|
|
|
args << "--with-postgres" if postgres?
|
2010-09-26 20:29:29 +00:00
|
|
|
if mysql?
|
|
|
|
mysql = Formula.factory('mysql')
|
2011-04-08 18:16:37 +00:00
|
|
|
args << "--with-mysql-includes=#{mysql.include + 'mysql'}"
|
|
|
|
args << "--with-mysql-libs=#{mysql.lib + 'mysql'}"
|
|
|
|
args << "--with-mysql"
|
2010-09-26 20:29:29 +00:00
|
|
|
end
|
|
|
|
|
2011-04-08 18:16:37 +00:00
|
|
|
system "./configure", "--prefix=#{prefix}", *args
|
2012-01-04 06:05:05 +00:00
|
|
|
system "make" # make and make install must be separate steps.
|
2010-09-26 20:29:29 +00:00
|
|
|
system "make install"
|
|
|
|
end
|
|
|
|
|
|
|
|
def caveats
|
2012-04-21 19:18:38 +00:00
|
|
|
if headless?
|
|
|
|
<<-EOS.undent
|
|
|
|
This build of GRASS has been compiled without the WxPython GUI. This is
|
|
|
|
done by default on Lion because there is no stable build of WxPython
|
|
|
|
available to compile against.
|
|
|
|
|
|
|
|
The command line tools remain fully functional.
|
|
|
|
EOS
|
|
|
|
else
|
|
|
|
<<-EOS.undent
|
|
|
|
GRASS is currently in a transition period with respect to GUI support.
|
|
|
|
The old Tcl/Tk GUI cannot be built using the version of Tcl/Tk provided
|
|
|
|
by OS X. This has the unfortunate consquence of disabling the NVIZ
|
|
|
|
visualization system. A keg-only Tcl/Tk brew or some deep hackery of
|
|
|
|
the GRASS source may be possible ways to get around this around this.
|
|
|
|
|
|
|
|
Tcl/Tk will eventually be depreciated in GRASS 7 and this version has
|
|
|
|
been built to support the newer wxPython based GUI. However, there is
|
|
|
|
a problem as wxWidgets does not compile as a 64 bit library on OS X
|
|
|
|
which affects Snow Leopard users. In order to remedy this, the GRASS
|
|
|
|
startup script:
|
|
|
|
|
|
|
|
#{prefix}/grass-6.4.0/etc/Init.sh
|
|
|
|
|
|
|
|
has been modified to use the OS X system Python and to start it in 32 bit mode.
|
|
|
|
EOS
|
|
|
|
end
|
2010-09-26 20:29:29 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
__END__
|
2012-04-21 21:26:32 +00:00
|
|
|
Patch 1:
|
|
|
|
Force 32-bit system Python to be used for the WxPython GUI.
|
|
|
|
|
|
|
|
|
2010-09-26 20:29:29 +00:00
|
|
|
diff --git a/lib/init/init.sh b/lib/init/init.sh
|
|
|
|
index 8c87fe1..2d1a2a3 100644
|
|
|
|
--- a/lib/init/init.sh
|
|
|
|
+++ b/lib/init/init.sh
|
|
|
|
@@ -27,6 +27,17 @@ trap "echo 'User break!' ; exit" 2 3 15
|
|
|
|
# Set default GUI
|
|
|
|
DEFAULT_GUI="wxpython"
|
|
|
|
|
|
|
|
+
|
|
|
|
+# Homebrew Additions:
|
|
|
|
+#
|
|
|
|
+# So, problem with wxWidgets is that the developers have not released a stable
|
|
|
|
+# version that builds x86_64 for OS X. So, in order to use the nice GUI for
|
|
|
|
+# GRASS, we have to ensure the system python is used and ensure it starts in 32
|
|
|
|
+# bit mode.
|
|
|
|
+export VERSIONER_PYTHON_PREFER_32_BIT=yes
|
|
|
|
+export GRASS_PYTHON=/usr/bin/pythonw
|
|
|
|
+
|
|
|
|
+
|
|
|
|
# the following is only meant to be an internal variable for debugging this script.
|
|
|
|
# use 'g.gisenv set="DEBUG=[0-5]"' to turn GRASS debug mode on properly.
|
|
|
|
if [ -z "$GRASS_DEBUG" ] ; then
|
2012-04-21 21:26:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
Patch 2:
|
|
|
|
Remove two lines of the Makefile that try to install stuff to
|
|
|
|
/Library/Documentation---which is outside of the prefix and usually fails due
|
|
|
|
to permissions issues.
|
|
|
|
|
|
|
|
diff --git a/Makefile b/Makefile
|
|
|
|
index f1edea6..be404b0 100644
|
|
|
|
--- a/Makefile
|
|
|
|
+++ b/Makefile
|
|
|
|
@@ -304,8 +304,6 @@ ifeq ($(strip $(MINGW)),)
|
|
|
|
-tar cBf - gem/skeleton | (cd ${INST_DIR}/etc ; tar xBf - ) 2>/dev/null
|
|
|
|
-${INSTALL} gem/gem$(GRASS_VERSION_MAJOR)$(GRASS_VERSION_MINOR) ${BINDIR} 2>/dev/null
|
|
|
|
endif
|
|
|
|
- @# enable OSX Help Viewer
|
|
|
|
- @if [ "`cat include/Make/Platform.make | grep -i '^ARCH.*darwin'`" ] ; then /bin/ln -sfh "${INST_DIR}/docs/html" /Library/Documentation/Help/GRASS-${GRASS_VERSION_MAJOR}.${GRASS_VERSION_MINOR} ; fi
|
|
|
|
|
|
|
|
|
|
|
|
install-strip: FORCE
|