| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
 | require 'formula'
class Netpbm < Formula
  homepage 'http://netpbm.sourceforge.net'
  # Maintainers: Look at http://netpbm.svn.sourceforge.net/viewvc/netpbm/
  # for versions and matching revisions
  url 'http://svn.code.sf.net/p/netpbm/code/advanced', :revision => 2294
  version '10.68'
  head 'http://svn.code.sf.net/p/netpbm/code/trunk'
  bottle do
    cellar :any
    revision 2
    sha1 "1f842e7b6c2632a80401751a5975f3379af6a10e" => :yosemite
    sha1 "b2ee77e9829b27ef530c7ebc50043e4d5bc23b8e" => :mavericks
    sha1 "a036886a7d91d2658ac1dd76ed6bc9cc246e3ec6" => :mountain_lion
  end
  option :universal
  depends_on "libtiff"
  depends_on "jasper"
  depends_on "libpng"
  def install
    ENV.universal_binary if build.universal?
    system "cp", "config.mk.in", "config.mk"
    inreplace "config.mk" do |s|
      s.remove_make_var! "CC"
      s.change_make_var! "CFLAGS_SHLIB", "-fno-common"
      s.change_make_var! "NETPBMLIBTYPE", "dylib"
      s.change_make_var! "NETPBMLIBSUFFIX", "dylib"
      s.change_make_var! "LDSHLIB", "--shared -o $(SONAME)"
      s.change_make_var! "TIFFLIB", "-ltiff"
      s.change_make_var! "JPEGLIB", "-ljpeg"
      s.change_make_var! "PNGLIB", "-lpng"
      s.change_make_var! "ZLIB", "-lz"
      s.change_make_var! "JASPERLIB", "-ljasper"
      s.change_make_var! "JASPERHDR_DIR", "#{Formula["jasper"].opt_include}/jasper"
    end
    ENV.deparallelize
    system "make"
    system "make", "package", "pkgdir=#{buildpath}/stage"
    cd 'stage' do
      inreplace "pkgconfig_template" do |s|
        s.gsub! "@VERSION@", File.read("VERSION").sub("Netpbm ", "").chomp
        s.gsub! "@LINKDIR@", lib
        s.gsub! "@INCLUDEDIR@", include
      end
      prefix.install %w{ bin include lib misc }
      # do man pages explicitly; otherwise a junk file is installed in man/web
      man1.install Dir['man/man1/*.1']
      man5.install Dir['man/man5/*.5']
      lib.install Dir['link/*.a']
      (lib/"pkgconfig").install "pkgconfig_template" => "netpbm.pc"
    end
    (bin/'doc.url').unlink
  end
end
 |