From 9f6bb364b349bfac1afd1db0d2e8b1507c047329 Mon Sep 17 00:00:00 2001 From: Robert Jones Date: Thu, 20 Apr 2017 11:35:24 +1000 Subject: [PATCH] libgeotiff 1.4.2 Closes #12657. Signed-off-by: FX Coudert --- Formula/libgeotiff.rb | 49 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/Formula/libgeotiff.rb b/Formula/libgeotiff.rb index 692fc7087b..083f7fdb68 100644 --- a/Formula/libgeotiff.rb +++ b/Formula/libgeotiff.rb @@ -1,9 +1,9 @@ class Libgeotiff < Formula desc "Library and tools for dealing with GeoTIFF" homepage "https://geotiff.osgeo.org/" - url "http://download.osgeo.org/geotiff/libgeotiff/libgeotiff-1.4.1.tar.gz" - sha256 "acfc76ee19b3d41bb9c7e8b780ca55d413893a96c09f3b27bdb9b2573b41fd23" - revision 2 + url "http://download.osgeo.org/geotiff/libgeotiff/libgeotiff-1.4.2.tar.gz" + sha256 "ad87048adb91167b07f34974a8e53e4ec356494c29f1748de95252e8f81a5e6e" + head "https://svn.osgeo.org/metacrs/geotiff/trunk/libgeotiff" bottle do sha256 "e132dbc428f2ab5fb85099983b1558954f6bcf71e9acf2c65beb02b4c9cda198" => :sierra @@ -16,13 +16,56 @@ class Libgeotiff < Formula depends_on "jpeg" depends_on "proj" + if build.head? + depends_on "automake" => :build + depends_on "autoconf" => :build + depends_on "libtool" => :build + end + def install args = ["--disable-dependency-tracking", "--prefix=#{prefix}", "--with-libtiff=#{HOMEBREW_PREFIX}", "--with-zlib=#{HOMEBREW_PREFIX}", "--with-jpeg=#{HOMEBREW_PREFIX}"] + if build.head? + system "./autogen.sh" + end system "./configure", *args system "make" # Separate steps or install fails system "make", "install" end + + test do + (testpath/"test.c").write <<-EOS.undent + #include "geotiffio.h" + #include "xtiffio.h" + #include + #include + + int main(int argc, char* argv[]) + { + TIFF *tif = XTIFFOpen(argv[1], "w"); + GTIF *gtif = GTIFNew(tif); + TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, (uint32) 10); + GTIFKeySet(gtif, GeogInvFlatteningGeoKey, TYPE_DOUBLE, 1, (double)123.456); + + int i; + char buffer[20L]; + + memset(buffer,0,(size_t)20L); + for (i=0;i<20L;i++){ + TIFFWriteScanline(tif, buffer, i, 0); + } + + GTIFWriteKeys(gtif); + GTIFFree(gtif); + XTIFFClose(tif); + return 0; + } + EOS + + system ENV.cc, "test.c", "-L#{lib}", "-ltiff", "-lgeotiff", "-o", "test" + system "./test", "test.tif" + assert_match(/GeogInvFlatteningGeoKey.*123.456/, shell_output("#{bin}/listgeo test.tif")) + end end