aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/x264.rb
blob: 128bf87dace2a2f114e4d8b14639306ee4395d88 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
require "formula"

class X264 < Formula
  homepage "https://www.videolan.org/developers/x264.html"
  # the latest commit on the stable branch
  url "https://git.videolan.org/git/x264.git", :revision => "021c0dc6c95c1bc239c9db78a80dd85fc856a4dd"
  version "r2455"
  head "https://git.videolan.org/git/x264.git"

  devel do
    # the latest commit on the master branch
    url "https://git.videolan.org/git/x264.git", :revision => "dd79a61e0e354a432907f2d1f7137b27a12dfce7"
    version "r2479"
  end

  bottle do
    cellar :any
    revision 1
    sha1 "dd035a889bb65ba9ae9cc4815a4159e8d28a5ff2" => :yosemite
    sha1 "4dcf404cc4609578b5dffc94e2aff366f0a5d193" => :mavericks
    sha1 "a49c0943b4b420607c410f6736f9edf3d50704c2" => :mountain_lion
  end

  depends_on "yasm" => :build

  option "10-bit", "Build a 10-bit x264 (default: 8-bit)"
  option "with-mp4=", "Select mp4 output: none (default), l-smash or gpac"

  case ARGV.value "with-mp4"
  when "l-smash" then depends_on "l-smash"
  when "gpac" then depends_on "gpac"
  end

  def install
    args = %W[
      --prefix=#{prefix}
      --enable-shared
      --enable-static
      --enable-strip
    ]
    if Formula["l-smash"].installed?
      args << "--disable-gpac"
    elsif Formula["gpac"].installed?
      args << "--disable-lsmash"
    end
    args << "--bit-depth=10" if build.include? "10-bit"

    # For running version.sh correctly
    buildpath.install_symlink cached_download/".git"

    system "./configure", *args
    system "make", "install"
  end
end