2011-06-27 15:24:13 +00:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
class Mapserver < Formula
|
|
|
|
homepage 'http://mapserver.org/'
|
2013-04-29 20:52:57 +00:00
|
|
|
url 'http://download.osgeo.org/mapserver/mapserver-6.2.1.tar.gz'
|
|
|
|
sha1 'bbe4234a4dcc179812c6598f68fe59a3dae63e44'
|
2011-06-27 15:24:13 +00:00
|
|
|
|
2012-08-27 02:25:29 +00:00
|
|
|
option "with-fastcgi", "Build with fastcgi support"
|
|
|
|
option "with-geos", "Build support for GEOS spatial operations"
|
|
|
|
option "with-php", "Build PHP MapScript module"
|
|
|
|
option "with-postgresql", "Build support for PostgreSQL as a data source"
|
2013-02-19 04:41:38 +00:00
|
|
|
|
|
|
|
env :userpaths
|
2012-08-27 02:25:29 +00:00
|
|
|
|
2012-09-02 08:06:33 +00:00
|
|
|
depends_on :freetype
|
|
|
|
depends_on :libpng
|
2013-01-21 09:33:56 +00:00
|
|
|
depends_on :python => :recommended
|
|
|
|
depends_on 'swig' => :build
|
2012-09-02 08:06:33 +00:00
|
|
|
depends_on 'giflib'
|
2013-02-18 02:37:05 +00:00
|
|
|
depends_on 'gd' => %w{with-freetype}
|
2011-06-27 15:24:13 +00:00
|
|
|
depends_on 'proj'
|
|
|
|
depends_on 'gdal'
|
2013-02-19 04:41:38 +00:00
|
|
|
depends_on 'geos' => :optional
|
2013-07-17 01:38:50 +00:00
|
|
|
depends_on 'postgresql' => :optional unless MacOS.version >= :lion
|
2012-08-27 02:25:29 +00:00
|
|
|
depends_on 'fcgi' if build.include? 'with-fastcgi'
|
2013-01-21 09:33:56 +00:00
|
|
|
depends_on 'cairo' => :optional
|
2011-09-16 05:30:50 +00:00
|
|
|
|
2012-09-02 08:06:33 +00:00
|
|
|
def install
|
2011-09-16 05:30:50 +00:00
|
|
|
args = [
|
|
|
|
"--prefix=#{prefix}",
|
|
|
|
"--with-proj",
|
|
|
|
"--with-gdal",
|
|
|
|
"--with-ogr",
|
2013-03-27 00:46:56 +00:00
|
|
|
"--with-wfs",
|
2011-09-16 05:30:50 +00:00
|
|
|
]
|
|
|
|
|
2013-02-19 04:41:38 +00:00
|
|
|
args << "--with-geos" if build.with? 'geos'
|
|
|
|
args << "--with-php=/usr/bin/php-config" if build.include? 'with-php'
|
2013-06-10 14:06:57 +00:00
|
|
|
args << "--with-cairo" if build.with? 'cairo'
|
2011-09-16 05:30:50 +00:00
|
|
|
|
2013-07-17 01:38:50 +00:00
|
|
|
if build.with? 'postgresql'
|
2012-09-05 04:04:01 +00:00
|
|
|
if MacOS.version >= :lion # Lion ships with PostgreSQL libs
|
2012-08-27 02:25:29 +00:00
|
|
|
args << "--with-postgis"
|
2011-09-16 05:30:50 +00:00
|
|
|
else
|
2012-08-27 02:25:29 +00:00
|
|
|
args << "--with-postgis=#{HOMEBREW_PREFIX}/bin/pg_config"
|
2011-09-16 05:30:50 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-09-02 08:06:33 +00:00
|
|
|
args << "--with-fastcgi=#{HOMEBREW_PREFIX}" if build.include? 'with-fastcgi'
|
2012-03-21 16:09:57 +00:00
|
|
|
|
2013-01-21 09:33:56 +00:00
|
|
|
unless MacOS::CLT.installed?
|
|
|
|
inreplace 'configure', "_JTOPDIR=`echo \"$_ACJNI_FOLLOWED\" | sed -e 's://*:/:g' -e 's:/[^/]*$::'`",
|
|
|
|
"_JTOPDIR='#{MacOS.sdk_path}/System/Library/Frameworks/JavaVM.framework/Headers'"
|
|
|
|
end
|
|
|
|
|
2012-09-02 08:06:33 +00:00
|
|
|
system "./configure", *args
|
2011-06-27 15:24:13 +00:00
|
|
|
system "make"
|
2011-09-16 05:30:50 +00:00
|
|
|
|
2013-02-19 04:41:38 +00:00
|
|
|
install_args = []
|
|
|
|
install_args << "PHP_EXT_DIR=#{prefix}" if build.include? 'with-php'
|
|
|
|
system "make", "install", *install_args
|
|
|
|
|
2013-01-21 09:33:56 +00:00
|
|
|
python do
|
2013-02-19 04:41:38 +00:00
|
|
|
cd 'mapscript/python' do
|
2013-01-21 09:33:56 +00:00
|
|
|
system python, "setup.py", "install", "--prefix=#{prefix}",
|
|
|
|
"--single-version-externally-managed",
|
|
|
|
"--record=installed-files.txt"
|
2013-02-19 04:41:38 +00:00
|
|
|
end
|
2011-09-16 05:30:50 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def caveats; <<-EOS.undent
|
2012-09-02 08:06:33 +00:00
|
|
|
The Mapserver CGI executable is #{bin}/mapserv
|
2011-09-16 05:30:50 +00:00
|
|
|
|
|
|
|
If you built the PHP option:
|
|
|
|
* Add the following line to php.ini:
|
|
|
|
extension="#{prefix}/php_mapscript.so"
|
|
|
|
* Execute "php -m"
|
|
|
|
* You should see MapScript in the module list
|
|
|
|
EOS
|
2011-06-27 15:24:13 +00:00
|
|
|
end
|
2012-09-02 08:06:33 +00:00
|
|
|
|
|
|
|
def test
|
|
|
|
system "#{bin}/mapserver-config", "--version"
|
|
|
|
end
|
2011-06-27 15:24:13 +00:00
|
|
|
end
|