homebrew-core/Formula/liblwgeom.rb

78 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.2.tar.gz"
sha256 "b6cb286c5016029d984f8c440947bf9178da72e1f6f840ed639270e1c451db5e"
revision 2
head "https://git.osgeo.org/gitea/postgis/postgis"
bottle do
cellar :any
sha256 "2fa994168e7e6080ad8dfa236379ba87a3e5dcebd9f3870224220277d50a90c3" => :catalina
sha256 "2566c5dffdb062c5c44142b1ec0a6e7b076789fde0a8435b059ed7403a6c0c4d" => :mojave
sha256 "a09336c7545767fa94e6733acfe07b4473915d5603d4e6a629bb79f6345489a6" => :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
ENV["SDKROOT"] = MacOS.sdk_path if MacOS.version == :sierra
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