aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorNibbles McGurk2011-09-17 20:15:54 -0700
committerCharlie Sharpsteen2011-09-23 19:09:58 -0700
commite12bcee54160319ee86a41eadb24fef95fcafab4 (patch)
treeb5d053389b958725137b3a8325d6898c4d119e35 /Library
parent380aa8fde32e1fa9f4f0e7e92c19b67813cd6894 (diff)
downloadhomebrew-e12bcee54160319ee86a41eadb24fef95fcafab4.tar.bz2
New Formula: jbigkit
Jbigkit includes libjbig, a C Library for JBIG1 images, and two CLI programs called pbmtojbg and jbgtopbm. Jbigkit builds without a 'configure' using only a Makefile that gets patched by the formula with good CCFLAGS. The makefile comes set with CC = gcc, and it overrides all relevant compiler variables except MAKEFLAGS with very good results. The jbigkit formula builds a universal library, but the makefile is only written to create a static one. There is no make install function to date. The library has no dependencies, but it can be used by libtiff, which will automatically find it during libtiff's configure. Jbigkit was tested on Mac OSX 10.6.8, with a 64bit kernel, and gcc-4.2.1. Closes #7699. Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
Diffstat (limited to 'Library')
-rw-r--r--Library/Formula/jbigkit.rb49
1 files changed, 49 insertions, 0 deletions
diff --git a/Library/Formula/jbigkit.rb b/Library/Formula/jbigkit.rb
new file mode 100644
index 000000000..f990ad3e3
--- /dev/null
+++ b/Library/Formula/jbigkit.rb
@@ -0,0 +1,49 @@
+require 'formula'
+
+class Jbigkit < Formula
+ url 'http://www.cl.cam.ac.uk/~mgk25/download/jbigkit-2.0.tar.gz'
+ homepage 'http://www.cl.cam.ac.uk/~mgk25/jbigkit/'
+ md5 '3dd87f605abb1a97a22dc79d8b3e8f6c'
+
+ def options
+ [
+ ['--with-check', "Verify the library during install. Takes ~10s."]
+ ]
+ end
+
+ def install
+ # Set for a universal build and patch the Makefile.
+ # There's no configure. It creates a static lib.
+ ENV.universal_binary
+ inreplace 'Makefile', "CCFLAGS = -O2 -W", "CCFLAGS = #{ENV.cflags}"
+ system "make"
+
+ # It needs j1 to make the tests happen in sequence.
+ system "make -j1 test" if ARGV.include? '--with-check'
+
+ # Install the files using three common styles of syntax:
+ prefix.install %w[contrib examples]
+ Dir.chdir 'pbmtools' do
+ bin.install %w(pbmtojbg jbgtopbm pbmtojbg85 jbgtopbm85)
+ man1.install %w(pbmtojbg.1 jbgtopbm.1)
+ man5.install %w(pbm.5 pgm.5)
+ end
+ Dir.chdir 'libjbig' do
+ lib.install Dir['lib*.a']
+ (prefix+'src').install Dir['j*.c', 'j*.txt']
+ include.install Dir['j*.h']
+ end
+ end
+
+ def test
+ puts
+ mktemp do
+ system "#{HOMEBREW_PREFIX}/bin/jbgtopbm #{prefix}/examples/ccitt7.jbg | pbmtojbg - testoutput.jbg"
+ system "/usr/bin/cmp #{prefix}/examples/ccitt7.jbg testoutput.jbg"
+ ohai "The test was successful converting between jbig and pbm and back."
+ puts
+ system "/usr/bin/file #{HOMEBREW_PREFIX}/lib/libjbig.a #{HOMEBREW_PREFIX}/lib/libjbig85.a"
+ puts
+ end
+ end
+end