本文参考:
环境
我的brew版本:
➜ ~ brew -v
Homebrew 1.9.2
Homebrew/homebrew-core (git revision 0ff7; last commit 2019-04-29)
安装brew
首先需要安装 brew ,方式很多,可直接看官网
编辑依赖文件
然后编辑并保存一个文件 thrift.rb
,路径随意。
class Thrift < Formula
desc "Framework for scalable cross-language services development"
homepage "https://thrift.apache.org/"
url "https://www.apache.org/dyn/closer.cgi?path=/thrift/0.10.0/thrift-0.10.0.tar.gz"
sha256 "2289d02de6e8db04cbbabb921aeb62bfe3098c4c83f36eec6c31194301efa10b"
bottle do
cellar :any
sha256 "20b9fd54b8aaf036d5c9c85f53ab084819f1b6bbb392bd266e4f7c7e2dbbc48b" => :high_sierra
sha256 "a0d93b6f61524775ec194daa25a3a8da16f5e858823822847074711c718f1618" => :sierra
sha256 "e82b69518d57411e51c78652c2af6bcede1404b3d99fce5087b9e5ceae96598e" => :el_capitan
sha256 "331177b6661cef631e930e14ef2ce2c8884c4fcbc662699498f39fc395b8da5a" => :yosemite
end
head do
url "https://git-wip-us.apache.org/repos/asf/thrift.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "pkg-config" => :build
end
option "with-haskell", "Install Haskell binding"
option "with-erlang", "Install Erlang binding"
option "with-java", "Install Java binding"
option "with-perl", "Install Perl binding"
option "with-php", "Install PHP binding"
option "with-libevent", "Install nonblocking server libraries"
depends_on "bison" => :build
depends_on "boost"
depends_on "openssl"
depends_on "libevent" => :optional
depends_on "python@2" => :optional
def install
system "./bootstrap.sh" unless build.stable?
exclusions = ["--without-ruby", "--disable-tests", "--without-php_extension"]
exclusions << "--without-python" if build.without? "python"
exclusions << "--without-haskell" if build.without? "haskell"
exclusions << "--without-java" if build.without? "java"
exclusions << "--without-perl" if build.without? "perl"
exclusions << "--without-php" if build.without? "php"
exclusions << "--without-erlang" if build.without? "erlang"
ENV.cxx11 if MacOS.version >= :mavericks && ENV.compiler == :clang
# Don't install extensions to /usr:
ENV["PY_PREFIX"] = prefix
ENV["PHP_PREFIX"] = prefix
system "./configure", "--disable-debug",
"--prefix=#{prefix}",
"--libdir=#{lib}",
"--with-openssl=#{Formula["openssl"].opt_prefix}",
*exclusions
ENV.deparallelize
system "make"
system "make", "install"
end
def caveats; <<-EOS
To install Ruby binding:
gem install thrift
To install PHP extension for e.g. PHP 5.5:
brew install homebrew/php/php55-thrift
EOS
end
end
执行安装
brew install ./thrift.rb