Skip to content

Instantly share code, notes, and snippets.

@lxyu
Created November 13, 2013 09:51
Show Gist options
  • Save lxyu/7446456 to your computer and use it in GitHub Desktop.
Save lxyu/7446456 to your computer and use it in GitHub Desktop.
brew formular for thrift 0.9.1 on os x 10.9 with fastbinary.c unicode patch
require 'formula'
class Thrift < Formula
homepage 'http://thrift.apache.org'
# The thrift.apache.org 0.9.1 archive is missing PHP ext, fixed in THRIFT-2129
# By grapping the source from git instead, it's fixed, but we need to bootstrap
url 'https://git-wip-us.apache.org/repos/asf/thrift.git', :branch => "0.9.1"
version "0.9.1"
head do
url 'https://git-wip-us.apache.org/repos/asf/thrift.git', :branch => "master"
#depends_on :autoconf
#depends_on :automake
#depends_on :libtool
end
env :userpaths # To find brew'ed php (, upstream uses `php-config` some places)
# We need to install from sources, because website tarball is missing php-ext
depends_on :autoconf
depends_on :automake
depends_on :libtool
option "with-haskell", "Install Haskell binding"
option "with-erlang", "Install Erlang binding"
option "with-java", "Install Java binding"
option "with-perl", "Install Perl binding"
depends_on 'boost'
depends_on :python => :optional
# Patches required to compile 0.9.1 with "-std=c++11", maybe remove when thrift 1.0 hits
def patches
[
# Fix issue with C++11 and reserved-user-defined-literal
"https://gist.github.com/duedal/7156317/raw/a7edf1de9d092ef5b0a4f3fc3c048e1985248d36/thrifty.patch",
# Apply THRIFT-2201 fix from master to 0.9.1 branch (required for clang to compile with C++11 support)
"https://git-wip-us.apache.org/repos/asf?p=thrift.git;a=patch;h=836d95f9f00be73c6936d407977796181d1a506c",
# Tutorial includes both boost and std, so shared_ptr is ambigous with C++11 support enabled
"https://gist.github.com/duedal/7156317/raw/9fec9ed82d160f027730ec1790852135dd37ef9f/cpp-tutorial.patch",
"https://gist.github.com/lxyu/5849125/raw/"
]
end
def install
# system "./bootstrap.sh" if build.head?
system "./bootstrap.sh" # always install from source
exclusions = ["--without-ruby"]
exclusions << "--without-python" unless build.with? "python"
exclusions << "--without-haskell" unless build.include? "with-haskell"
exclusions << "--without-java" unless build.include? "with-java"
exclusions << "--without-perl" unless build.include? "with-perl"
exclusions << "--without-php"
exclusions << "--without-erlang" unless build.include? "with-erlang"
ENV["PY_PREFIX"] = prefix # So python bindins don't install to /usr!
ENV["CXXFLAGS"] = "-std=c++11" # Required on OS 10.9, see THRIFT-1458 & THRIFT-2229
system "./configure", "--disable-debug",
"--prefix=#{prefix}",
"--libdir=#{lib}",
*exclusions
ENV.j1
system "make"
system "make install"
end
def caveats
s = <<-EOS.undent
To install Ruby bindings:
gem install thrift
EOS
s += python.standard_caveats if python
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment