114 lines
4.4 KiB
Ruby
114 lines
4.4 KiB
Ruby
class Postgis < Formula
|
|
desc "Adds support for geographic objects to PostgreSQL"
|
|
homepage "https://postgis.net/"
|
|
url "https://download.osgeo.org/postgis/source/postgis-2.5.2.tar.gz"
|
|
sha256 "b6cb286c5016029d984f8c440947bf9178da72e1f6f840ed639270e1c451db5e"
|
|
revision 1
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "493b847abc13a5d85e78c2c97351c1a5f51fe1f98ff6cb0af03addeb28a3ca5f" => :mojave
|
|
sha256 "3a4b7d55abec7712716c68fb0fe7a7fe7dfe2fb05428bb92f668a127a12c15ae" => :high_sierra
|
|
sha256 "32062bb7d1f0b5bd5f5fd86166a819d8dafd775db82e13b767e47d9e00c23d04" => :sierra
|
|
end
|
|
|
|
head do
|
|
url "https://svn.osgeo.org/postgis/trunk/"
|
|
|
|
depends_on "autoconf" => :build
|
|
depends_on "automake" => :build
|
|
depends_on "libtool" => :build
|
|
end
|
|
|
|
depends_on "gpp" => :build
|
|
depends_on "pkg-config" => :build
|
|
depends_on "gdal" # for GeoJSON and raster handling
|
|
depends_on "geos"
|
|
depends_on "json-c" # for GeoJSON and raster handling
|
|
depends_on "pcre"
|
|
depends_on "postgresql"
|
|
depends_on "proj"
|
|
depends_on "sfcgal" # for advanced 2D/3D functions
|
|
|
|
def install
|
|
ENV.deparallelize
|
|
|
|
args = [
|
|
"--with-projdir=#{Formula["proj"].opt_prefix}",
|
|
"--with-jsondir=#{Formula["json-c"].opt_prefix}",
|
|
"--with-pgconfig=#{Formula["postgresql"].opt_bin}/pg_config",
|
|
# Unfortunately, NLS support causes all kinds of headaches because
|
|
# PostGIS gets all of its compiler flags from the PGXS makefiles. This
|
|
# makes it nigh impossible to tell the buildsystem where our keg-only
|
|
# gettext installations are.
|
|
"--disable-nls",
|
|
]
|
|
|
|
system "./autogen.sh" if build.head?
|
|
system "./configure", *args
|
|
system "make"
|
|
|
|
mkdir "stage"
|
|
system "make", "install", "DESTDIR=#{buildpath}/stage"
|
|
|
|
bin.install Dir["stage/**/bin/*"]
|
|
lib.install Dir["stage/**/lib/*"]
|
|
include.install Dir["stage/**/include/*"]
|
|
(doc/"postgresql/extension").install Dir["stage/**/share/doc/postgresql/extension/*"]
|
|
(share/"postgresql/extension").install Dir["stage/**/share/postgresql/extension/*"]
|
|
pkgshare.install Dir["stage/**/contrib/postgis-*/*"]
|
|
(share/"postgis_topology").install Dir["stage/**/contrib/postgis_topology-*/*"]
|
|
|
|
# Extension scripts
|
|
bin.install %w[
|
|
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
|
|
]
|
|
|
|
man1.install Dir["doc/**/*.1"]
|
|
end
|
|
|
|
test do
|
|
require "base64"
|
|
(testpath/"brew.shp").write ::Base64.decode64 <<~EOS
|
|
AAAnCgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoOgDAAALAAAAAAAAAAAAAAAA
|
|
AAAAAADwPwAAAAAAABBAAAAAAAAAFEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
AAAAAAAAAAAAAAAAAAEAAAASCwAAAAAAAAAAAPA/AAAAAAAA8D8AAAAAAAAA
|
|
AAAAAAAAAAAAAAAAAgAAABILAAAAAAAAAAAACEAAAAAAAADwPwAAAAAAAAAA
|
|
AAAAAAAAAAAAAAADAAAAEgsAAAAAAAAAAAAQQAAAAAAAAAhAAAAAAAAAAAAA
|
|
AAAAAAAAAAAAAAQAAAASCwAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAA
|
|
AAAAAAAAAAAABQAAABILAAAAAAAAAAAAAAAAAAAAAAAUQAAAAAAAACJAAAAA
|
|
AAAAAEA=
|
|
EOS
|
|
(testpath/"brew.dbf").write ::Base64.decode64 <<~EOS
|
|
A3IJGgUAAABhAFsAAAAAAAAAAAAAAAAAAAAAAAAAAABGSVJTVF9GTEQAAEMA
|
|
AAAAMgAAAAAAAAAAAAAAAAAAAFNFQ09ORF9GTEQAQwAAAAAoAAAAAAAAAAAA
|
|
AAAAAAAADSBGaXJzdCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
|
|
ICAgICAgICAgICAgIFBvaW50ICAgICAgICAgICAgICAgICAgICAgICAgICAg
|
|
ICAgICAgICAgU2Vjb25kICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
|
|
ICAgICAgICAgICAgICBQb2ludCAgICAgICAgICAgICAgICAgICAgICAgICAg
|
|
ICAgICAgICAgIFRoaXJkICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
|
|
ICAgICAgICAgICAgICAgUG9pbnQgICAgICAgICAgICAgICAgICAgICAgICAg
|
|
ICAgICAgICAgICBGb3VydGggICAgICAgICAgICAgICAgICAgICAgICAgICAg
|
|
ICAgICAgICAgICAgICAgIFBvaW50ICAgICAgICAgICAgICAgICAgICAgICAg
|
|
ICAgICAgICAgICAgQXBwZW5kZWQgICAgICAgICAgICAgICAgICAgICAgICAg
|
|
ICAgICAgICAgICAgICAgICBQb2ludCAgICAgICAgICAgICAgICAgICAgICAg
|
|
ICAgICAgICAgICAg
|
|
EOS
|
|
(testpath/"brew.shx").write ::Base64.decode64 <<~EOS
|
|
AAAnCgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARugDAAALAAAAAAAAAAAAAAAA
|
|
AAAAAADwPwAAAAAAABBAAAAAAAAAFEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
AAAAAAAAAAAAAAAAADIAAAASAAAASAAAABIAAABeAAAAEgAAAHQAAAASAAAA
|
|
igAAABI=
|
|
EOS
|
|
result = shell_output("#{bin}/shp2pgsql #{testpath}/brew.shp")
|
|
assert_match(/Point/, result)
|
|
assert_match(/AddGeometryColumn/, result)
|
|
end
|
|
end
|