2011-09-18 03:15:54 +00:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
class Jbigkit < Formula
|
|
|
|
homepage 'http://www.cl.cam.ac.uk/~mgk25/jbigkit/'
|
2012-09-03 21:08:49 +00:00
|
|
|
url 'http://www.cl.cam.ac.uk/~mgk25/download/jbigkit-2.0.tar.gz'
|
2012-09-03 18:33:56 +00:00
|
|
|
sha1 'cfb7d3121f02a74bfb229217858a0d149b6589ef'
|
2011-09-18 03:15:54 +00:00
|
|
|
|
2013-01-26 17:57:12 +00:00
|
|
|
option :universal
|
2012-09-03 21:08:49 +00:00
|
|
|
option 'with-check', "Verify the library during install"
|
2011-09-18 03:15:54 +00:00
|
|
|
|
|
|
|
def install
|
|
|
|
# Set for a universal build and patch the Makefile.
|
|
|
|
# There's no configure. It creates a static lib.
|
2013-01-26 17:57:12 +00:00
|
|
|
ENV.universal_binary if build.universal?
|
2012-05-05 21:53:52 +00:00
|
|
|
system "make", "CC=#{ENV.cc}", "CCFLAGS=#{ENV.cflags}"
|
2011-09-18 03:15:54 +00:00
|
|
|
|
|
|
|
# It needs j1 to make the tests happen in sequence.
|
2011-12-09 19:48:01 +00:00
|
|
|
ENV.deparallelize
|
2012-09-03 21:08:49 +00:00
|
|
|
system "make test" if build.include? 'with-check'
|
2011-09-18 03:15:54 +00:00
|
|
|
|
|
|
|
# Install the files using three common styles of syntax:
|
|
|
|
prefix.install %w[contrib examples]
|
2012-02-21 06:04:21 +00:00
|
|
|
cd 'pbmtools' do
|
2011-09-18 03:15:54 +00:00
|
|
|
bin.install %w(pbmtojbg jbgtopbm pbmtojbg85 jbgtopbm85)
|
|
|
|
man1.install %w(pbmtojbg.1 jbgtopbm.1)
|
|
|
|
man5.install %w(pbm.5 pgm.5)
|
|
|
|
end
|
2012-02-21 06:04:21 +00:00
|
|
|
cd 'libjbig' do
|
2011-09-18 03:15:54 +00:00
|
|
|
lib.install Dir['lib*.a']
|
|
|
|
(prefix+'src').install Dir['j*.c', 'j*.txt']
|
|
|
|
include.install Dir['j*.h']
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def test
|
|
|
|
mktemp do
|
2012-05-05 21:53:39 +00:00
|
|
|
system "#{bin}/jbgtopbm #{prefix}/examples/ccitt7.jbg | #{bin}/pbmtojbg - testoutput.jbg"
|
2012-05-15 18:31:21 +00:00
|
|
|
system "/usr/bin/cmp", "#{prefix}/examples/ccitt7.jbg", "testoutput.jbg"
|
2011-09-18 03:15:54 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|