77 lines
2.7 KiB
Ruby
77 lines
2.7 KiB
Ruby
class Protobuf < Formula
|
|
desc "Protocol buffers (Google's data interchange format)"
|
|
homepage "https://github.com/protocolbuffers/protobuf/"
|
|
url "https://github.com/protocolbuffers/protobuf.git",
|
|
:tag => "v3.12.3",
|
|
:revision => "31ebe2ac71400344a5db91ffc13c4ddfb7589f92"
|
|
head "https://github.com/protocolbuffers/protobuf.git"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "3ced83651f35574357814e547e6d83356464065a40a660be13b69154e6fd98be" => :catalina
|
|
sha256 "b418f7e29dfff62eca17debe37dff8574295e480dc8607ec9c8591690478cd14" => :mojave
|
|
sha256 "ffc0bc6e68a6c48774854de177443ca852c107fe4e6e470486fa9d497334c28f" => :high_sierra
|
|
end
|
|
|
|
depends_on "autoconf" => :build
|
|
depends_on "automake" => :build
|
|
depends_on "libtool" => :build
|
|
depends_on "python@3.8" => [:build, :test]
|
|
|
|
resource "six" do
|
|
url "https://files.pythonhosted.org/packages/6b/34/415834bfdafca3c5f451532e8a8d9ba89a21c9743a0c59fbd0205c7f9426/six-1.15.0.tar.gz"
|
|
sha256 "30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259"
|
|
end
|
|
|
|
def install
|
|
# Don't build in debug mode. See:
|
|
# https://github.com/Homebrew/homebrew/issues/9279
|
|
# https://github.com/protocolbuffers/protobuf/blob/5c24564811c08772d090305be36fae82d8f12bbe/configure.ac#L61
|
|
ENV.prepend "CXXFLAGS", "-DNDEBUG"
|
|
ENV.cxx11
|
|
|
|
system "./autogen.sh"
|
|
system "./configure", "--disable-debug", "--disable-dependency-tracking",
|
|
"--prefix=#{prefix}", "--with-zlib"
|
|
system "make"
|
|
system "make", "check"
|
|
system "make", "install"
|
|
|
|
# Install editor support and examples
|
|
pkgshare.install "editors/proto.vim", "examples"
|
|
elisp.install "editors/protobuf-mode.el"
|
|
|
|
ENV.append_to_cflags "-I#{include}"
|
|
ENV.append_to_cflags "-L#{lib}"
|
|
|
|
resource("six").stage do
|
|
system Formula["python@3.8"].opt_bin/"python3", *Language::Python.setup_install_args(libexec)
|
|
end
|
|
chdir "python" do
|
|
system Formula["python@3.8"].opt_bin/"python3", *Language::Python.setup_install_args(libexec),
|
|
"--cpp_implementation"
|
|
end
|
|
|
|
version = Language::Python.major_minor_version Formula["python@3.8"].opt_bin/"python3"
|
|
site_packages = "lib/python#{version}/site-packages"
|
|
pth_contents = "import site; site.addsitedir('#{libexec/site_packages}')\n"
|
|
(prefix/site_packages/"homebrew-protobuf.pth").write pth_contents
|
|
end
|
|
|
|
test do
|
|
testdata = <<~EOS
|
|
syntax = "proto3";
|
|
package test;
|
|
message TestCase {
|
|
string name = 4;
|
|
}
|
|
message Test {
|
|
repeated TestCase case = 1;
|
|
}
|
|
EOS
|
|
(testpath/"test.proto").write testdata
|
|
system bin/"protoc", "test.proto", "--cpp_out=."
|
|
system Formula["python@3.8"].opt_bin/"python3", "-c", "import google.protobuf"
|
|
end
|
|
end
|