homebrew-core/Formula/liblwgeom.rb

75 lines
2.1 KiB
Ruby

class Liblwgeom < Formula
desc "Allows SpatiaLite to support ST_MakeValid() like PostGIS"
homepage "https://postgis.net/"
url "https://download.osgeo.org/postgis/source/postgis-2.5.4.tar.gz"
sha256 "146d59351cf830e2a2a72fa14e700cd5eab6c18ad3e7c644f57c4cee7ed98bbe"
head "https://git.osgeo.org/gitea/postgis/postgis"
bottle do
cellar :any
sha256 "f3b78efd42b006412552ed9ee5ba052a6ab830d26f4076ea9dfe8213a267e54f" => :catalina
sha256 "a103205f3d0034886edca7d456f56184fb209b2878ff5f31351172d7dae6b77c" => :mojave
sha256 "fb2c01c298317d9705c3a81b223ebef6c391351135c66359fe7a97f6868d7fa5" => :high_sierra
end
keg_only "conflicts with PostGIS, which also installs liblwgeom.dylib"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "gpp" => :build
depends_on "libtool" => :build
depends_on "pkg-config" => :build
depends_on "geos"
depends_on "json-c"
depends_on "proj"
uses_from_macos "libxml2"
def install
# See postgis.rb for comments about these settings
ENV.deparallelize
args = [
"--disable-dependency-tracking",
"--disable-nls",
"--with-projdir=#{Formula["proj"].opt_prefix}",
"--with-jsondir=#{Formula["json-c"].opt_prefix}",
# Disable extraneous support
"--without-pgconfig",
"--without-libiconv-prefix",
"--without-libintl-prefix",
"--without-raster", # this ensures gdal is not required
"--without-topology",
]
system "./autogen.sh"
system "./configure", *args
mkdir "stage"
cd "liblwgeom" do
system "make", "install", "DESTDIR=#{buildpath}/stage"
end
lib.install Dir["stage/**/lib/*"]
include.install Dir["stage/**/include/*"]
end
test do
(testpath/"test.c").write <<~EOS
#include <liblwgeom.h>
int main(int argc, char* argv[])
{
printf("%s\\n", lwgeom_version());
return 0;
}
EOS
system ENV.cc, "test.c", "-I#{include}", "-I#{Formula["proj"].opt_include}",
"-L#{lib}", "-llwgeom", "-o", "test"
system "./test"
end
end