diff options
| author | Daniel Cousineau | 2014-05-20 14:39:41 -0400 |
|---|---|---|
| committer | Jack Nagel | 2014-05-24 18:50:35 -0500 |
| commit | 0add4796902bd29a61266eb4ae7bdb4e734d168b (patch) | |
| tree | 713400c2d83c0d8473ab1a46ef40ebb9a36915fd /Library/Formula | |
| parent | c439ad67e28fb71bf48f68c79973d67893c16c72 (diff) | |
| download | homebrew-0add4796902bd29a61266eb4ae7bdb4e734d168b.tar.bz2 | |
leptonica 1.70
Fixes the pull requests for homebrew/homebrew#26379 by upgrading
leptonica to 1.70, patches the pkg-config file, and provides a patch for
jbig2enc to allow it to build against leptonica 1.70
Closes #29434.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library/Formula')
| -rw-r--r-- | Library/Formula/jbig2enc.rb | 53 | ||||
| -rw-r--r-- | Library/Formula/leptonica.rb | 38 |
2 files changed, 87 insertions, 4 deletions
diff --git a/Library/Formula/jbig2enc.rb b/Library/Formula/jbig2enc.rb index ba85ad9a9..08b554aa1 100644 --- a/Library/Formula/jbig2enc.rb +++ b/Library/Formula/jbig2enc.rb @@ -8,8 +8,61 @@ class Jbig2enc < Formula depends_on 'leptonica' + head do + url 'https://github.com/agl/jbig2enc.git' + + depends_on "autoconf" => :build + depends_on "automake" => :build + depends_on "libtool" => :build + end + + stable do + # Patch data from https://github.com/agl/jbig2enc/commit/53ce5fe7e73d7ed95c9e12b52dd4984723f865fa + patch :DATA + end + def install + system "./autogen.sh" if build.head? system "./configure", "--prefix=#{prefix}" system "make install" end end + +__END__ +diff --git a/configure.ac b/configure.ac +index fe37c22..753a607 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -55,6 +55,7 @@ AC_CHECK_LIB([lept], [findFileFormatStream], [], [ + echo "Error! Leptonica not detected." + exit -1 + ]) ++AC_CHECK_FUNCS(expandBinaryPower2Low,,) + # test for function - it should detect leptonica dependecies + + # Check for possible dependancies of leptonica. +diff --git a/src/jbig2.cc b/src/jbig2.cc +index e10f042..515c1ef 100644 +--- a/src/jbig2.cc ++++ b/src/jbig2.cc +@@ -130,11 +130,16 @@ segment_image(PIX *pixb, PIX *piximg) { + // input color image, so we have to do it this way... + // is there a better way? + // PIX *pixd = pixExpandBinary(pixd4, 4); +- PIX *pixd = pixCreate(piximg->w, piximg->h, 1); +- pixCopyResolution(pixd, piximg); +- if (verbose) pixInfo(pixd, "mask image: "); +- expandBinaryPower2Low(pixd->data, pixd->w, pixd->h, pixd->wpl, ++ PIX *pixd; ++#ifdef HAVE_EXPANDBINARYPOWER2LOW ++ pixd = pixCreate(piximg->w, piximg->h, 1); ++ pixCopyResolution(pixd, piximg); ++ expandBinaryPower2Low(pixd->data, pixd->w, pixd->h, pixd->wpl, + pixd4->data, pixd4->w, pixd4->h, pixd4->wpl, 4); ++#else ++ pixd = pixExpandBinaryPower2(pixd4, 4); ++#endif ++ if (verbose) pixInfo(pixd, "mask image: "); + + pixDestroy(&pixd4); + pixDestroy(&pixsf4); diff --git a/Library/Formula/leptonica.rb b/Library/Formula/leptonica.rb index 2f6f1e7d8..a98996d43 100644 --- a/Library/Formula/leptonica.rb +++ b/Library/Formula/leptonica.rb @@ -2,17 +2,22 @@ require 'formula' class Leptonica < Formula homepage 'http://www.leptonica.org/' - url 'http://www.leptonica.org/source/leptonica-1.69.tar.gz' - sha1 '91199f99d2e78b15b76ffa6fc4e86ee458a330e8' - revision 1 + url 'http://www.leptonica.org/source/leptonica-1.70.tar.gz' + sha1 '476edd5cc3f627f5ad988fcca6b62721188fce13' + + option 'check', 'Run the build checks' depends_on 'libpng' => :recommended depends_on 'jpeg' => :recommended depends_on 'libtiff' => :optional + depends_on 'pkg-config' => :build conflicts_with 'osxutils', :because => "both leptonica and osxutils ship a `fileinfo` executable." + ## Patch to fix pkg-config from https://code.google.com/p/leptonica/issues/detail?id=94 + patch :DATA + def install args = %W[ --disable-dependency-tracking @@ -24,10 +29,35 @@ class Leptonica < Formula end system "./configure", *args + system "make check" if build.include? 'check' system "make install" end test do - system "#{bin}/yuvtest" + (testpath/"test.cpp").write <<-EOS + #include <iostream> + #include <leptonica/allheaders.h> + + int main(int argc, char **argv) { + std::fprintf(stdout, "%d.%d", LIBLEPT_MAJOR_VERSION, LIBLEPT_MINOR_VERSION); + return 0; + } + EOS + system ENV.cxx, "test.cpp", `pkg-config --cflags lept` + assert_equal "1.70", `./a.out` end end + +__END__ +diff --git a/lept.pc.in b/lept.pc.in +index 8044ba8..c1b9492 100644 +--- a/lept.pc.in ++++ b/lept.pc.in +@@ -1,3 +1,5 @@ ++prefix=@prefix@ ++exec_prefix=@exec_prefix@ + libdir=@libdir@ + includedir=@includedir@/leptonica + +-- +1.9.1 |
