Created
May 1, 2021 12:15
-
-
Save sjdonado/2527301a9c09e7ac0745bb1ccc058de2 to your computer and use it in GitHub Desktop.
Postgis 2.5.5 homebrew formula
This file contains 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
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.5.tar.gz" | |
sha256 "1217a0212aaa143e44831849d1845b198f248923d7e96634219d3369a6ec8714" | |
license "GPL-2.0-or-later" | |
revision 1 | |
livecheck do | |
url "https://download.osgeo.org/postgis/source/" | |
regex(/href=.*?postgis[._-]v?(\d+(?:\.\d+)+)\.t/i) | |
end | |
bottle do | |
sha256 cellar: :any, arm64_big_sur: "7b2db3f6e3f4582b8d865a9f30d8f865daef0def04d9035c7ff271f36880a49a" | |
sha256 cellar: :any, big_sur: "1684641950af335917bf683c6d01a3134583fb607dacf659f1d178861443601a" | |
sha256 cellar: :any, catalina: "5926acfc50c2c61d577df18965c28f9ad87370760f3888c69bbcf8da4d4c8a00" | |
sha256 cellar: :any, mojave: "5f75dbcb69c3869aec09a51de9eb91ba57aff79e626c27736b494d6f5309f312" | |
end | |
head do | |
url "https://git.osgeo.org/gitea/postgis/postgis/src/tag/2.5.5.git" | |
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 "protobuf-c" # for MVT (map vector tiles) support | |
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", | |
"--with-protobufdir=#{Formula["protobuf-c"].opt_bin}", | |
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to run?
Copy inside
/opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula
Run
brew install --build-from-source postgis