GitHub PullRequestReviewCommentEvent at 2014-03-24 16:39:57
Repository: homebrew
Actor: henry0312
Payload: {"comment":{"url":"https://api.github.com/repos/Homebrew/homebrew/pulls/comments/10892735","id":10892735,"diff_hunk":"@@ -1,49 +1,107 @@\n require 'formula'\n \n+class X264DownloadStrategy < CurlDownloadStrategy\n+  def tarball_path\n+    Pathname.new(\"#{HOMEBREW_CACHE}/#{name}-#{resource.version}#{ext}\")\n+  end\n+\n+  def ext\n+    '.tar.gz'\n+  end\n+end\n+\n+class GitVersion\n+  def initialize(git_cached_location)\n+    @git_cache = git_cached_location\n+  end\n+\n+  def get_revision\n+    `cd #{@git_cache} && git rev-list origin/master | sort | wc -l | awk '{print $1}'`.strip\n+  end\n+\n+  def get_head_hash\n+    `cd #{@git_cache} && git rev-list HEAD -n 1 | cut -c 1-7`.strip\n+  end\n+end\n+\n class X264 < Formula\n   homepage 'http://www.videolan.org/developers/x264.html'\n-  url 'http://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20120812-2245-stable.tar.bz2'\n-  sha1 '4be913fb12cd5b3628edc68dedb4b6e664eeda0a'\n-  version 'r2197.4' # brew install -v --HEAD x264 will display the version.\n-  head 'http://git.videolan.org/git/x264.git', :branch => 'stable'\n+  url 'http://git.videolan.org/?p=x264.git;a=snapshot;h=aff928d2a2f601072cebecfd1ac5ff768880cf88;sf=tgz', :using => X264DownloadStrategy\n+  sha1 '51ce24e35d67360e721538541e9e8a1a6961779d'\n+  version 'r2397'\n+  head 'http://git.videolan.org/git/x264.git'\n+\n+  devel do\n+    url 'http://git.videolan.org/?p=x264.git;a=snapshot;h=d6b4e63d2ed8d444b77c11b36c1d646ee5549276;sf=tgz', :using => X264DownloadStrategy\n+    sha1 '733997577215ec233b2ca9382bbd679f9c668d2a'\n+    version 'r2409'\n+  end\n \n-  bottle do\n-    cellar :any\n-    sha1 \"ce6311ee8bb0ce64edd888bd9494b51ba4a91b46\" => :mavericks\n-    sha1 \"15f59b5c6965efd112cc7f6ecc4fcf76d0f1740a\" => :mountain_lion\n-    sha1 \"2667e3a601042682d9a1d4b7a9b69809b47c82e5\" => :lion\n+  patch do\n+    url 'https://github.com/DarkShikari/x264-devel/commit/bc3b27715ce449f4a32fbe6729652feb5682c127.patch'\n+    sha1 '6c3d1bc241c64d8df64273df403d43e3116bd567'\n   end\n \n   depends_on 'yasm' => :build\n \n-  option '10-bit', 'Build a 10-bit x264 (default: 8-bit)'\n+  option \"disable-shared\",      \"doesn't build shared library\"\n+  option \"disable-static\",      \"doesn't static library\"\n+  option \"disable-opencl\",      \"disable OpenCL features\"\n+  option \"disable-gpl\",         \"disable GPL-only features\"\n+  option \"disable-thread\",      \"disable multithreaded encoding\"\n+  option \"disable-interlaced\",  \"disable interlaced encoding support\"\n+  option \"bit-depth=10\",        \"set output bit depth 10\"\n+  option \"enable-debug\",        \"add -g to CFLAGS\"\n+  option \"enable-gprof\",        \"add -pg to CFLAGS and LDFLAGS\"\n+  option \"enable-strip\",        \"add -s to CFLAGS and LDFLAGS\"\n+  option \"enable-pic\",          \"build position-independent code\"\n+  option \"disable-avs\",         \"disable avisynth support\"\n+  option \"disable-swscale\",     \"disable swscale support\"\n+  option \"disable-lavf\",        \"disable libavformat support\"\n+  option \"disable-ffms\",        \"disable ffmpegsource support\"\n+  option \"disable-gpac\",        \"disable gpac support\"\n+  option \"disable-lsmash\",      \"disable lsmash support\"\n \n   def install\n-    # https://github.com/Homebrew/homebrew/pull/19594\n-    ENV.deparallelize\n+    args = [\"--prefix=#{prefix}\"]\n+    args << \"--enable-shared\"   unless build.include? \"disable-shared\"\n+    args << \"--enable-static\"   unless build.include? \"disable-static\"\n+    args << \"--disable-opencl\"  if build.include? \"disable-opencl\"\n+    args << \"--disable-gpl\"     if build.include? \"disable-gpl\"\n+    args << \"--disable-thread\"  if build.include? \"disable-thread\"\n+    args << \"--bit-depth=10\"    if build.include? \"bit-depth=10\"\n+    args << \"--enable-debug\"    if build.include? \"enable-debug\"\n+    args << \"--enable-gprof\"    if build.include? \"enable-gprof\"\n+    args << \"--enable-strip\"    if build.include? \"enable-strip\"\n+    args << \"--enable-pic\"      if build.include? \"enable-pic\"\n+    args << \"--disable-avs\"     if build.include? \"disable-avs\"\n+    args << \"--disable-swscale\" if build.include? \"disable-swscale\"\n+    args << \"--disable-lavf\"    if build.include? \"disable-lavf\"\n+    args << \"--disable-ffms\"    if build.include? \"disable-ffms\"\n+    args << \"--disable-gpac\"    if build.include? \"disable-gpac\"\n+    args << \"--disable-lsmash\"  if build.include? \"disable-lsmash\"\n+\n+    system \"./configure\", *args\n+\n     if build.head?\n-      ENV['GIT_DIR'] = cached_download/'.git'\n-      system './version.sh'\n+      git = GitVersion.new(@active_spec.downloader.cached_location)\n+      _version = \"r\" + git.get_revision\n+      _hash = git.get_head_hash\n+    else\n+      _version = version.to_s\n+      _hash = url.slice(/h=(\\w+);/, 1).slice(0..6)\n     end","path":"Library/Formula/x264.rb","position":107,"original_position":107,"commit_id":"462efbb760e8fc33a2734b5d0ed3eee2f69e775d","original_commit_id":"462efbb760e8fc33a2734b5d0ed3eee2f69e775d","user":{"login":"henry0312","id":433434,"avatar_url":"https://avatars.githubusercontent.com/u/433434?","gravatar_id":"8421c3b79f62b462a2918bf7634ec97e","url":"https://api.github.com/users/henry0312","html_url":"https://github.com/henry0312","followers_url":"https://api.github.com/users/henry0312/followers","following_url":"https://api.github.com/users/henry0312/following{/other_user}","gists_url":"https://api.github.com/users/henry0312/gists{/gist_id}","starred_url":"https://api.github.com/users/henry0312/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henry0312/subscriptions","organizations_url":"https://api.github.com/users/henry0312/orgs","repos_url":"https://api.github.com/users/henry0312/repos","events_url":"https://api.github.com/users/henry0312/events{/privacy}","received_events_url":"https://api.github.com/users/henry0312/received_events","type":"User","site_admin":false},"body":"the current formula can't add x264's versions to built binary.\r\nTherefore, I took the almost same way with `version.sh`.\r\nPlease compare `GitVersion` with `version.sh`.","created_at":"2014-03-24T16:39:57Z","updated_at":"2014-03-24T16:39:57Z","html_url":"https://github.com/Homebrew/homebrew/pull/27828#discussion_r10892735","pull_request_url":"https://api.github.com/repos/Homebrew/homebrew/pulls/27828","_links":{"self":{"href":"https://api.github.com/repos/Homebrew/homebrew/pulls/comments/10892735"},"html":{"href":"https://github.com/Homebrew/homebrew/pull/27828#discussion_r10892735"},"pull_request":{"href":"https://api.github.com/repos/Homebrew/homebrew/pulls/27828"}}}}