aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorPete Deffendol2011-09-15 23:30:50 -0600
committerCharlie Sharpsteen2011-09-16 17:38:30 -0700
commit0bd820101cd88329476cbebbd602b1b6d415091b (patch)
treedcc5dfb2c7e6f27a4513809b3a12a5505c08ffa2 /Library
parenteab7bcadad04403700a08ea46baaaab4c7463fd5 (diff)
downloadhomebrew-0bd820101cd88329476cbebbd602b1b6d415091b.tar.bz2
MapServer: Add build options
For PHP, GEOS, and PostgreSQL. Closes #7669. Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
Diffstat (limited to 'Library')
-rw-r--r--Library/Formula/mapserver.rb54
1 files changed, 51 insertions, 3 deletions
diff --git a/Library/Formula/mapserver.rb b/Library/Formula/mapserver.rb
index 282c42c6a..51fa25080 100644
--- a/Library/Formula/mapserver.rb
+++ b/Library/Formula/mapserver.rb
@@ -9,10 +9,58 @@ class Mapserver < Formula
depends_on 'proj'
depends_on 'gdal'
+ depends_on 'geos' if ARGV.include? '--with-geos'
+ depends_on 'postgresql' if ARGV.include? '--with-postgresql' and not MacOS.lion?
+
+ def options
+ [
+ ["--with-geos", "Build support for GEOS spatial operations"],
+ ["--with-php", "Build PHP MapScript module"],
+ ["--with-postgresql", "Build support for PostgreSQL as a data source"]
+ ]
+ end
+
+ def configure_args
+ args = [
+ "--prefix=#{prefix}",
+ "--with-proj",
+ "--with-gdal",
+ "--with-ogr",
+ "--with-png=/usr/X11"
+ ]
+
+ args.push "--with-geos" if ARGV.include? '--with-geos'
+ args.push "--with-php=/usr/include/php" if ARGV.include? '--with-php'
+
+ if ARGV.include? '--with-postgresql'
+ if MacOS.lion? # Lion ships with PostgreSQL libs
+ args.push "--with-postgis"
+ else
+ args.push "--with-postgis=#{HOMEBREW_PREFIX}/bin/pg_config"
+ end
+ end
+
+ args
+ end
+
def install
- system "./configure", "--prefix=#{prefix}", "--with-png=/usr/X11",
- "--with-proj", "--with-gdal"
+ system "./configure", *configure_args
system "make"
- bin.install "mapserv"
+ bin.install %w(mapserv)
+
+ if ARGV.include? '--with-php'
+ prefix.install %w(mapscript/php/php_mapscript.so)
+ end
+ end
+
+ def caveats; <<-EOS.undent
+ The Mapserver CGI executable is #{prefix}/mapserv
+
+ 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
end
end