Skip to content

Commit

Permalink
libgeotiff 1.4.2
Browse files Browse the repository at this point in the history
Closes #12657.

Signed-off-by: FX Coudert <fxcoudert@gmail.com>
  • Loading branch information
ArrEssJay authored and fxcoudert committed Apr 23, 2017
1 parent 9134cf0 commit 9f6bb36
Showing 1 changed file with 46 additions and 3 deletions.
49 changes: 46 additions & 3 deletions Formula/libgeotiff.rb
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 <stdlib.h>
#include <string.h>
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

0 comments on commit 9f6bb36

Please sign in to comment.