Last active
August 29, 2015 14:18
-
-
Save mutaphysis/2880e3866a48a954a310 to your computer and use it in GitHub Desktop.
protobuf-std.rb tap for homebrew
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'formula' | |
class ProtobufStd < Formula | |
homepage 'http://code.google.com/p/protobuf/' | |
url 'http://protobuf.googlecode.com/files/protobuf-2.5.0.tar.bz2' | |
sha1 '62c10dcdac4b69cc8c6bb19f73db40c264cb2726' | |
option :universal | |
option :cxx11 | |
depends_on :python => :optional | |
fails_with :llvm do | |
build 2334 | |
end | |
def install | |
# 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.universal_binary if build.universal? | |
ENV.cxx11 if build.cxx11? | |
#ADD THE FOLLOWING: | |
ENV.append "CXXFLAGS", '-stdlib=libstdc++' | |
ENV.append "CFLAGS", '-stdlib=libstdc++' | |
ENV.append "LDFLAGS", '-stdlib=libstdc++ -lstdc++' | |
#The following is necessary because libtool liks to strip LDFLAGS: | |
ENV['cxx'] = "/usr/bin/clang -stdlib=libstdc++" | |
system "./configure", "--disable-debug", "--disable-dependency-tracking", | |
"--prefix=#{prefix}", | |
"--with-zlib" | |
system "make" | |
system "make install" | |
# Install editor support and examples | |
doc.install %w( editors examples ) | |
if build.with? 'python' | |
chdir 'python' do | |
ENV['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION'] = 'cpp' | |
ENV.append_to_cflags "-I#{include}" | |
ENV.append_to_cflags "-L#{lib}" | |
system 'python', 'setup.py', 'build' | |
system 'python', 'setup.py', 'install', "--prefix=#{prefix}", | |
'--single-version-externally-managed', '--record=installed.txt' | |
end | |
end | |
end | |
def caveats; <<-EOS.undent | |
Editor support and examples have been installed to: | |
#{doc} | |
EOS | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment