diff options
| -rw-r--r-- | Library/Formula/protobuf.rb | 37 | 
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} | 
