blob: 1e2f3797adf4b3b56a9b4101c518c86484ae2b22 (
plain)
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
  | 
require 'formula'
class JpegTurbo < Formula
  homepage 'http://www.libjpeg-turbo.org/'
  url 'http://downloads.sourceforge.net/project/libjpeg-turbo/1.3.0/libjpeg-turbo-1.3.0.tar.gz'
  sha1 '1792c964b35604cebd3a8846f1ca6de5976e9c28'
  depends_on 'nasm' => :build if MacOS.prefer_64_bit?
  keg_only "libjpeg-turbo is not linked to prevent conflicts with the standard libjpeg."
  def install
    args = ["--disable-dependency-tracking", "--prefix=#{prefix}", "--with-jpeg8"]
    if MacOS.prefer_64_bit?
      args << "--host=x86_64-apple-darwin"
      # Auto-detect our 64-bit nasm
      args << "NASM=#{Formula.factory('nasm').bin}/nasm"
    end
    system "./configure", *args
    system 'make'
    ENV.j1 # Stops a race condition error: file exists
    system "make install"
  end
  test do
    system "#{bin}/jpegtran", "-crop", "500x500+200+500",
                              "-transpose", "-perfect",
                              "-outfile", "test.jpg",
                              "/System/Library/CoreServices/DefaultDesktop.jpg"
  end
end
  |