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 1 head "https://svn.osgeo.org/postgis/trunk/" bottle do cellar :any sha256 "7a5b41e04d2f3351e8f8ea97c6025ee6e868cb1389055b5bdfe11b4f2b87836e" => :mojave sha256 "1f1d5f8e6148e67fd069d01d00cbbdc5a719cd3e8bbdbcdbd7524261364a844f" => :high_sierra sha256 "ab29ba07d76f6511297ffc3fc57adbe38a9dc44e0aec908c78fa26b7a4880d74" => :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" 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 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