7c648d9732
When interpolating in strings passed to Formula#system, it should be done in such a way that if any interpolated variables contain spaces, they are either (a) passed as part of a list or (b) protected by quotes if they are part of a long string (which is subject to shell expansion). Otherwise, they will be split on the space when expanded by the shell and passed as multiple arguments to whatever process is being executed. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
44 lines
1.3 KiB
Ruby
44 lines
1.3 KiB
Ruby
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
|
|
system "make", "CC=#{ENV.cc}", "CCFLAGS=#{ENV.cflags}"
|
|
|
|
# It needs j1 to make the tests happen in sequence.
|
|
ENV.deparallelize
|
|
system "make test" if ARGV.include? '--with-check'
|
|
|
|
# Install the files using three common styles of syntax:
|
|
prefix.install %w[contrib examples]
|
|
cd 'pbmtools' do
|
|
bin.install %w(pbmtojbg jbgtopbm pbmtojbg85 jbgtopbm85)
|
|
man1.install %w(pbmtojbg.1 jbgtopbm.1)
|
|
man5.install %w(pbm.5 pgm.5)
|
|
end
|
|
cd 'libjbig' do
|
|
lib.install Dir['lib*.a']
|
|
(prefix+'src').install Dir['j*.c', 'j*.txt']
|
|
include.install Dir['j*.h']
|
|
end
|
|
end
|
|
|
|
def test
|
|
mktemp do
|
|
system "#{bin}/jbgtopbm #{prefix}/examples/ccitt7.jbg | #{bin}/pbmtojbg - testoutput.jbg"
|
|
system "/usr/bin/cmp", "#{prefix}/examples/ccitt7.jbg", "testoutput.jbg"
|
|
end
|
|
end
|
|
end
|