2009-10-15 08:07:12 +00:00
|
|
|
require 'formula'
|
2009-10-02 18:02:51 +00:00
|
|
|
|
2011-01-01 23:33:44 +00:00
|
|
|
def raster?
|
|
|
|
ARGV.include? '--with-raster'
|
|
|
|
end
|
|
|
|
|
|
|
|
def topology?
|
|
|
|
ARGV.include? '--with-topology'
|
|
|
|
end
|
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Postgis < Formula
|
2011-06-26 19:34:55 +00:00
|
|
|
url 'http://postgis.refractions.net/download/postgis-1.5.3.tar.gz'
|
2009-10-02 18:02:51 +00:00
|
|
|
homepage 'http://postgis.refractions.net/'
|
2011-06-26 19:34:55 +00:00
|
|
|
md5 '05a61df5e1b78bf51c9ce98bea5526fc'
|
2009-10-02 18:02:51 +00:00
|
|
|
|
2010-09-21 19:35:53 +00:00
|
|
|
head 'http://svn.osgeo.org/postgis/trunk/', :using => :svn
|
|
|
|
|
2009-10-02 18:02:51 +00:00
|
|
|
depends_on 'postgresql'
|
|
|
|
depends_on 'proj'
|
|
|
|
depends_on 'geos'
|
2011-02-11 13:39:35 +00:00
|
|
|
depends_on 'gdal' if raster?
|
2009-10-02 18:02:51 +00:00
|
|
|
|
2011-01-01 23:33:44 +00:00
|
|
|
# For libintl
|
|
|
|
depends_on 'gettext' if ARGV.build_head?
|
|
|
|
|
|
|
|
def options
|
|
|
|
[
|
|
|
|
['--with-raster', 'Enable PostGIS Raster extension (HEAD builds only).'],
|
|
|
|
['--with-topology', 'Enable PostGIS Topology extension (HEAD builds only).']
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
2009-10-02 18:02:51 +00:00
|
|
|
def install
|
2010-03-22 22:43:58 +00:00
|
|
|
ENV.deparallelize
|
2011-01-01 23:33:44 +00:00
|
|
|
|
|
|
|
args = [
|
|
|
|
"--disable-dependency-tracking",
|
|
|
|
"--prefix=#{prefix}",
|
|
|
|
"--with-projdir=#{HOMEBREW_PREFIX}"
|
|
|
|
]
|
|
|
|
|
2011-07-25 02:22:02 +00:00
|
|
|
# Apple ship a postgres client in Lion, conflicts with installed PostgreSQL server.
|
|
|
|
if MacOS.lion?
|
|
|
|
postgresql = Formula.factory('postgresql')
|
|
|
|
args << "--with-pgconfig=#{postgresql.bin}/pg_config"
|
|
|
|
end
|
|
|
|
|
2011-01-01 23:33:44 +00:00
|
|
|
if ARGV.build_head?
|
|
|
|
system "./autogen.sh"
|
|
|
|
gettext = Formula.factory('gettext')
|
|
|
|
args << "--with-gettext=#{gettext.prefix}"
|
|
|
|
args << "--with-raster" if raster?
|
|
|
|
args << "--with-topology" if topology?
|
|
|
|
end
|
|
|
|
|
|
|
|
system "./configure", *args
|
2009-10-02 18:02:51 +00:00
|
|
|
system "make install"
|
2009-10-02 22:22:45 +00:00
|
|
|
|
|
|
|
# Copy some of the generated files to the share folder
|
2010-09-21 19:35:53 +00:00
|
|
|
(share+'postgis').install %w(
|
|
|
|
spatial_ref_sys.sql postgis/postgis.sql
|
|
|
|
postgis/postgis_upgrade_13_to_15.sql
|
|
|
|
postgis/postgis_upgrade_14_to_15.sql
|
|
|
|
postgis/postgis_upgrade_15_minor.sql postgis/uninstall_postgis.sql
|
|
|
|
)
|
2011-02-11 13:39:35 +00:00
|
|
|
|
|
|
|
if ARGV.build_head?
|
|
|
|
(share+'postgis').install 'raster/rt_pg/rtpostgis.sql' if raster?
|
|
|
|
(share+'postgis').install 'topology/topology.sql' if topology?
|
|
|
|
end
|
|
|
|
|
2009-10-02 22:22:45 +00:00
|
|
|
# Copy loader and utils binaries to bin folder
|
2010-09-21 19:35:53 +00:00
|
|
|
bin.install %w(
|
|
|
|
loader/pgsql2shp loader/shp2pgsql utils/create_undef.pl
|
|
|
|
utils/new_postgis_restore.pl utils/postgis_proc_upgrade.pl
|
|
|
|
utils/postgis_restore.pl utils/profile_intersects.pl
|
|
|
|
)
|
2010-05-07 16:31:01 +00:00
|
|
|
end
|
2009-10-02 22:22:45 +00:00
|
|
|
|
2010-09-21 19:35:53 +00:00
|
|
|
def caveats; <<-EOS.undent
|
|
|
|
To create a spatially-enabled database, see the documentation:
|
2011-06-26 19:34:55 +00:00
|
|
|
http://postgis.refractions.net/documentation/manual-1.5/ch02.html#id2630392
|
|
|
|
and to upgrade your existing spatial databases, see here:
|
|
|
|
http://postgis.refractions.net/documentation/manual-1.5/ch02.html#upgrading
|
2010-05-07 16:31:01 +00:00
|
|
|
EOS
|
2009-10-02 18:02:51 +00:00
|
|
|
end
|
|
|
|
end
|