aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChilledheart2014-11-21 10:20:55 +0800
committerMike McQuaid2014-11-23 11:00:07 +0000
commit2e8ed7ea8befc8874380cff02bcd1dd2b0e6aceb (patch)
treeca391caab39de0d2f4dbf489098a2b5d11e1eb1d
parent4bfd736055d5135a3f0dc601ff313f0a75db3c68 (diff)
downloadhomebrew-2e8ed7ea8befc8874380cff02bcd1dd2b0e6aceb.tar.bz2
protobuf: add an option to do build-time checks.
add an option to do build-time checks and double the build time approximately if enabled, add a simple test protobuf is moved to github, see more https://groups.google.com/d/msg/protobuf/3qvNnYo8-SM/GSMYGGBNXfoJ provide better format Closes #34364. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
-rw-r--r--Library/Formula/protobuf.rb37
1 files changed, 28 insertions, 9 deletions
diff --git a/Library/Formula/protobuf.rb b/Library/Formula/protobuf.rb
index 6c62becc0..49558421e 100644
--- a/Library/Formula/protobuf.rb
+++ b/Library/Formula/protobuf.rb
@@ -1,4 +1,4 @@
-require 'formula'
+require "formula"
class OldOrNoDateutilUnlessGoogleApputils < Requirement
# https://github.com/Homebrew/homebrew/issues/32571
@@ -35,7 +35,7 @@ class OldOrNoDateutilUnlessGoogleApputils < Requirement
end
class Protobuf < Formula
- homepage 'http://code.google.com/p/protobuf/'
+ homepage "https://github.com/google/protobuf/"
url 'https://github.com/google/protobuf/releases/download/2.6.1/protobuf-2.6.1.tar.bz2'
sha1 '6421ee86d8fb4e39f21f56991daa892a3e8d314b'
@@ -46,6 +46,9 @@ class Protobuf < Formula
sha1 "4acb8d1239cd352b4b90691114b4abe8a0ef4d65" => :mountain_lion
end
+ # this will double the build time approximately if enabled
+ option "with-check", "Run build-time check"
+
option :universal
option :cxx11
@@ -60,7 +63,7 @@ class Protobuf < Formula
# Don't build in debug mode. See:
# https://github.com/Homebrew/homebrew/issues/9279
# http://code.google.com/p/protobuf/source/browse/trunk/configure.ac#61
- ENV.prepend 'CXXFLAGS', '-DNDEBUG'
+ ENV.prepend "CXXFLAGS", "-DNDEBUG"
ENV.universal_binary if build.universal?
ENV.cxx11 if build.cxx11?
@@ -68,22 +71,38 @@ class Protobuf < Formula
"--prefix=#{prefix}",
"--with-zlib"
system "make"
- system "make install"
+ system "make", "check" if build.with? "check"
+ system "make", "install"
# Install editor support and examples
doc.install %w( editors examples )
- if build.with? 'python'
- chdir 'python' do
+ if build.with? "python"
+ chdir "python" do
ENV.append_to_cflags "-I#{include}"
ENV.append_to_cflags "-L#{lib}"
- system 'python', 'setup.py', 'build'
- system 'python', 'setup.py', 'install', '--cpp_implementation', "--prefix=#{prefix}",
- '--single-version-externally-managed', '--record=installed.txt'
+ system "python", "setup.py", "build"
+ system "python", "setup.py", "install", "--cpp_implementation", "--prefix=#{prefix}",
+ "--single-version-externally-managed", "--record=installed.txt"
end
end
end
+ test do
+ def testdata; <<-EOS.undent
+ package test;
+ message TestCase {
+ required string name = 4;
+ }
+ message Test {
+ repeated TestCase case = 1;
+ }
+ EOS
+ end
+ (testpath/"test.proto").write(testdata)
+ system "protoc", "test.proto", "--cpp_out=."
+ end
+
def caveats; <<-EOS.undent
Editor support and examples have been installed to:
#{doc}