2009-10-15 08:07:12 +00:00
|
|
|
require 'formula'
|
2009-10-02 18:02:51 +00:00
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Postgis < Formula
|
2012-04-03 23:35:42 +00:00
|
|
|
homepage 'http://postgis.refractions.net'
|
2012-12-05 21:12:18 +00:00
|
|
|
url 'http://download.osgeo.org/postgis/source/postgis-2.0.2.tar.gz'
|
|
|
|
sha1 'a3fe6c4ea4c50dc3f586e804c863ba5eff23bf06'
|
2009-10-02 18:02:51 +00:00
|
|
|
|
2012-05-10 14:10:12 +00:00
|
|
|
head 'http://svn.osgeo.org/postgis/trunk/'
|
2010-09-21 19:35:53 +00:00
|
|
|
|
2012-12-06 07:58:02 +00:00
|
|
|
option 'with-gui', 'Build shp2pgsql-gui in addition to command line tools'
|
|
|
|
|
2012-12-05 21:12:38 +00:00
|
|
|
depends_on :automake
|
|
|
|
depends_on :libtool
|
2012-07-07 18:08:22 +00:00
|
|
|
|
2012-12-05 21:12:38 +00:00
|
|
|
depends_on 'gpp' => :build
|
2009-10-02 18:02:51 +00:00
|
|
|
depends_on 'postgresql'
|
|
|
|
depends_on 'proj'
|
|
|
|
depends_on 'geos'
|
|
|
|
|
2012-12-06 07:58:02 +00:00
|
|
|
depends_on 'gtk+' if build.include? 'with-gui'
|
2012-02-17 07:43:48 +00:00
|
|
|
|
2012-02-17 07:55:56 +00:00
|
|
|
# For GeoJSON and raster handling
|
2012-04-03 23:35:42 +00:00
|
|
|
depends_on 'json-c'
|
|
|
|
depends_on 'gdal'
|
2011-01-01 23:33:44 +00:00
|
|
|
|
2012-06-25 17:41:28 +00:00
|
|
|
def postgresql
|
|
|
|
# Follow the PostgreSQL linked keg back to the active Postgres installation
|
|
|
|
# as it is common for people to avoid upgrading Postgres.
|
|
|
|
Formula.factory('postgresql').linked_keg.realpath
|
|
|
|
end
|
|
|
|
|
2012-12-05 21:12:38 +00:00
|
|
|
# Force GPP to be used when pre-processing SQL files. See:
|
|
|
|
# http://trac.osgeo.org/postgis/ticket/1694
|
|
|
|
def patches; DATA end
|
|
|
|
|
2009-10-02 18:02:51 +00:00
|
|
|
def install
|
2010-03-22 22:43:58 +00:00
|
|
|
ENV.deparallelize
|
2012-04-03 23:35:42 +00:00
|
|
|
jsonc = Formula.factory 'json-c'
|
2011-01-01 23:33:44 +00:00
|
|
|
|
|
|
|
args = [
|
|
|
|
"--disable-dependency-tracking",
|
2012-02-29 21:59:01 +00:00
|
|
|
# Can't use --prefix, PostGIS disrespects it and flat-out refuses to
|
2012-04-03 23:35:42 +00:00
|
|
|
# accept it with 2.0.
|
2012-02-17 07:55:56 +00:00
|
|
|
"--with-projdir=#{HOMEBREW_PREFIX}",
|
2012-06-25 17:41:28 +00:00
|
|
|
"--with-jsondir=#{jsonc.linked_keg.realpath}",
|
2012-02-17 07:55:56 +00:00
|
|
|
# This is against Homebrew guidelines, but we have to do it as the
|
|
|
|
# PostGIS plugin libraries can only be properly inserted into Homebrew's
|
|
|
|
# Postgresql keg.
|
2012-06-25 17:41:28 +00:00
|
|
|
"--with-pgconfig=#{postgresql}/bin/pg_config",
|
2012-02-17 07:55:56 +00:00
|
|
|
# Unfortunately, NLS support causes all kinds of headaches because
|
|
|
|
# PostGIS gets all of it's compiler flags from the PGXS makefiles. This
|
|
|
|
# makes it nigh impossible to tell the buildsystem where our keg-only
|
|
|
|
# gettext installations are.
|
2012-04-03 23:35:42 +00:00
|
|
|
"--disable-nls"
|
|
|
|
]
|
2012-12-06 07:58:02 +00:00
|
|
|
args << '--with-gui' if build.include? 'with-gui'
|
2012-04-03 23:35:42 +00:00
|
|
|
|
2011-01-01 23:33:44 +00:00
|
|
|
|
2012-12-05 21:12:38 +00:00
|
|
|
system './autogen.sh'
|
2012-02-17 07:55:56 +00:00
|
|
|
system './configure', *args
|
|
|
|
system 'make'
|
|
|
|
|
|
|
|
# PostGIS includes the PGXS makefiles and so will install __everything__
|
|
|
|
# into the Postgres keg instead of the PostGIS keg. Unfortunately, some
|
|
|
|
# things have to be inside the Postgres keg in order to be function. So, we
|
2012-04-19 22:31:21 +00:00
|
|
|
# install everything to a staging directory and manually move the pieces
|
|
|
|
# into the appropriate prefixes.
|
|
|
|
mkdir 'stage'
|
2012-05-08 06:11:58 +00:00
|
|
|
system 'make', 'install', "DESTDIR=#{buildpath}/stage"
|
2009-10-02 22:22:45 +00:00
|
|
|
|
2012-02-17 07:55:56 +00:00
|
|
|
# Install PostGIS plugin libraries into the Postgres keg so that they can
|
|
|
|
# be loaded and so PostGIS databases will continue to function even if
|
|
|
|
# PostGIS is removed.
|
2012-06-25 17:41:28 +00:00
|
|
|
(postgresql/'lib').install Dir['stage/**/*.so']
|
2012-04-03 23:35:42 +00:00
|
|
|
|
|
|
|
# Install extension scripts to the Postgres keg.
|
|
|
|
# `CREATE EXTENSION postgis;` won't work if these are located elsewhere.
|
2012-06-25 17:41:28 +00:00
|
|
|
(postgresql/'share/postgresql/extension').install Dir['stage/**/extension/*']
|
2012-04-03 23:35:42 +00:00
|
|
|
|
2012-04-19 22:31:21 +00:00
|
|
|
bin.install Dir['stage/**/bin/*']
|
|
|
|
lib.install Dir['stage/**/lib/*']
|
|
|
|
include.install Dir['stage/**/include/*']
|
2012-04-03 23:35:42 +00:00
|
|
|
|
2012-04-19 22:31:21 +00:00
|
|
|
# Stand-alone SQL files will be installed the share folder
|
|
|
|
(share + 'postgis').install Dir['stage/**/contrib/postgis-2.0/*']
|
2011-02-11 13:39:35 +00:00
|
|
|
|
2012-04-19 22:31:21 +00:00
|
|
|
# Extension scripts
|
2011-09-11 13:28:53 +00:00
|
|
|
bin.install %w[
|
2012-02-17 07:55:56 +00:00
|
|
|
utils/create_undef.pl
|
|
|
|
utils/postgis_proc_upgrade.pl
|
|
|
|
utils/postgis_restore.pl
|
|
|
|
utils/profile_intersects.pl
|
|
|
|
utils/test_estimation.pl
|
|
|
|
utils/test_geography_estimation.pl
|
|
|
|
utils/test_geography_joinestimation.pl
|
|
|
|
utils/test_joinestimation.pl
|
|
|
|
]
|
|
|
|
|
2012-04-19 22:31:21 +00:00
|
|
|
man1.install Dir['doc/**/*.1']
|
2010-05-07 16:31:01 +00:00
|
|
|
end
|
2009-10-02 22:22:45 +00:00
|
|
|
|
2012-02-17 07:55:56 +00:00
|
|
|
def caveats;
|
2012-04-03 23:35:42 +00:00
|
|
|
<<-EOS.undent
|
2012-02-17 07:55:56 +00:00
|
|
|
To create a spatially-enabled database, see the documentation:
|
2012-06-05 15:34:31 +00:00
|
|
|
http://postgis.refractions.net/documentation/manual-2.0/postgis_installation.html#create_new_db_extensions
|
2012-02-17 07:55:56 +00:00
|
|
|
and to upgrade your existing spatial databases, see here:
|
2012-06-05 15:34:31 +00:00
|
|
|
http://postgis.refractions.net/documentation/manual-2.0/postgis_installation.html#upgrading
|
2012-02-17 07:55:56 +00:00
|
|
|
|
|
|
|
PostGIS SQL scripts installed to:
|
|
|
|
#{HOMEBREW_PREFIX}/share/postgis
|
|
|
|
PostGIS plugin libraries installed to:
|
2012-06-25 17:41:28 +00:00
|
|
|
#{postgresql}/lib
|
2012-04-03 23:35:42 +00:00
|
|
|
PostGIS extension modules installed to:
|
2012-06-25 17:41:28 +00:00
|
|
|
#{postgresql}/share/postgresql/extension
|
|
|
|
EOS
|
2009-10-02 18:02:51 +00:00
|
|
|
end
|
|
|
|
end
|
2012-12-05 21:12:38 +00:00
|
|
|
__END__
|
|
|
|
Force usage of GPP as the SQL pre-processor as Clang chokes.
|
|
|
|
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
|
|
index 136a1d6..c953c69 100644
|
|
|
|
--- a/configure.ac
|
|
|
|
+++ b/configure.ac
|
|
|
|
@@ -31,17 +31,8 @@ AC_SUBST([ANT])
|
|
|
|
dnl
|
|
|
|
dnl SQL Preprocessor
|
|
|
|
dnl
|
|
|
|
-AC_PATH_PROG([CPPBIN], [cpp], [])
|
|
|
|
-if test "x$CPPBIN" != "x"; then
|
|
|
|
- SQLPP="${CPPBIN} -traditional-cpp -P"
|
|
|
|
-else
|
|
|
|
- AC_PATH_PROG([GPP], [gpp_], [])
|
|
|
|
- if test "x$GPP" != "x"; then
|
|
|
|
- SQLPP="${GPP} -C -s \'" dnl Use better string support
|
|
|
|
- else
|
|
|
|
- SQLPP="${CPP} -traditional-cpp"
|
|
|
|
- fi
|
|
|
|
-fi
|
|
|
|
+AC_PATH_PROG([GPP], [gpp], [])
|
|
|
|
+SQLPP="${GPP} -C -s \'" dnl Use better string support
|
|
|
|
AC_SUBST([SQLPP])
|
|
|
|
|
|
|
|
dnl
|