-
-
Notifications
You must be signed in to change notification settings - Fork 12.1k
/
protobuf.rb
83 lines (71 loc) 路 3.05 KB
/
protobuf.rb
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
class Protobuf < Formula
desc "Protocol buffers (Google's data interchange format)"
homepage "https://github.com/protocolbuffers/protobuf/"
url "https://github.com/protocolbuffers/protobuf/releases/download/v3.17.3/protobuf-all-3.17.3.tar.gz"
sha256 "77ad26d3f65222fd96ccc18b055632b0bfedf295cb748b712a98ba1ac0b704b2"
license "BSD-3-Clause"
revision 1
livecheck do
url :stable
strategy :github_latest
end
bottle do
sha256 cellar: :any, arm64_monterey: "a501c2a8db322b604ae4426e784f0d2050fc21e36f69f825ab61ad63d6923668"
sha256 cellar: :any, arm64_big_sur: "ef7a56961e918e7626e099d18ad87d2ad5414ccc2086211d5dd4f6509d7f4de5"
sha256 cellar: :any, monterey: "1e94ea6a18487309aaf24c25c0be5b7d95d1f1e04aa4aaf00e9b55618a063815"
sha256 cellar: :any, big_sur: "d1060a6f73000c9c46a1954397a6375fb41c409d7b3cb7206fc69488313b4855"
sha256 cellar: :any, catalina: "2f25a4051028d54de1b5527826f39815858b89040f39f14866472c8aa6bfb4e1"
sha256 cellar: :any, mojave: "7e6d2eb1baee925d8a0776e9dc9fbcb267e1de5c45d2b648b6a60457f0519667"
sha256 cellar: :any_skip_relocation, x86_64_linux: "1a7178716cb915c19725d6e21bde91b8c7059e0cf6ffd7e3ab2cd1746a1a2d32"
end
head do
url "https://github.com/protocolbuffers/protobuf.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
depends_on "python@3.10" => [:build, :test]
# The Python3.9 bindings can be removed when Python3.9 is made keg-only.
depends_on "python@3.9" => [:build, :test]
depends_on "six"
uses_from_macos "zlib"
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" if build.head?
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}"
cd "python" do
["3.9", "3.10"].each do |xy|
system "python#{xy}", *Language::Python.setup_install_args(prefix), "--cpp_implementation"
end
end
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.9"].opt_bin/"python3", "-c", "import google.protobuf"
system Formula["python@3.10"].opt_bin/"python3", "-c", "import google.protobuf"
end
end