Created
February 22, 2013 22:36
-
-
Save robdimarco/5017114 to your computer and use it in GitHub Desktop.
Brew recipe to install postgresql 9.2 and postgis 1.5.8. To run brew install https://gist.github.com/robdimarco/5017114/raw/2e9d55c70ac2ed35d1978eee74780dbb211ecb89/postgis.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'formula' | |
| def raster? | |
| ARGV.include? '--with-raster' | |
| end | |
| def topology? | |
| ARGV.include? '--with-topology' | |
| end | |
| class Postgis < Formula | |
| url 'http://download.osgeo.org/postgis/source/postgis-1.5.8.tar.gz' # http://postgis.refractions.net/download/postgis-1.5.8.tar.gz' | |
| homepage 'http://postgis.refractions.net/' | |
| md5 '932b43487250aa3ab74f74792ccd4b07' | |
| head 'http://svn.osgeo.org/postgis/trunk/', :using => :svn | |
| depends_on 'postgresql' | |
| depends_on 'proj' | |
| depends_on 'geos' | |
| depends_on 'gdal' if raster? | |
| # 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 | |
| def install | |
| ENV.deparallelize | |
| args = [ | |
| "--disable-dependency-tracking", | |
| "--prefix=#{prefix}", | |
| "--with-projdir=#{HOMEBREW_PREFIX}" | |
| ] | |
| 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 | |
| system "make install" | |
| # Copy some of the generated files to the share folder | |
| (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 | |
| ) | |
| if ARGV.build_head? | |
| (share+'postgis').install 'raster/rt_pg/rtpostgis.sql' if raster? | |
| (share+'postgis').install 'topology/topology.sql' if topology? | |
| end | |
| # Copy loader and utils binaries to bin folder | |
| 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 | |
| ) | |
| end | |
| def caveats; <<-EOS.undent | |
| To create a spatially-enabled database, see the documentation: | |
| 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 | |
| EOS | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment