class Libbitcoin < Formula desc "Bitcoin Cross-Platform C++ Development Toolkit" homepage "https://libbitcoin.org/" url "https://github.com/libbitcoin/libbitcoin/archive/v3.3.0.tar.gz" sha256 "391913a73615afcb42c6a7c4736f23888cfc999a899fc38395ddcbd560251d94" revision 4 bottle do cellar :any sha256 "c824bd50f96cf55e751f9f0735b35509b0c37167277df22f8d98b246c38124c4" => :high_sierra sha256 "889c3811c26837bd2c90585d93a4a5050926f017641b43710c675899f1ebaa16" => :sierra sha256 "fd225da66b5908773a0f715f3aa35c838e807795ca2bdde5e0e53d9e99c3ab58" => :el_capitan end depends_on "autoconf" => :build depends_on "automake" => :build depends_on "libtool" => :build depends_on "pkg-config" => :build depends_on "boost" depends_on "libpng" depends_on "qrencode" resource "secp256k1" do url "https://github.com/libbitcoin/secp256k1/archive/v0.1.0.13.tar.gz" sha256 "9e48dbc88d0fb5646d40ea12df9375c577f0e77525e49833fb744d3c2a69e727" end def install resource("secp256k1").stage do system "./autogen.sh" system "./configure", "--disable-dependency-tracking", "--disable-silent-rules", "--prefix=#{libexec}", "--enable-module-recovery", "--with-bignum=no" system "make", "install" end ENV.prepend_path "PKG_CONFIG_PATH", "#{libexec}/lib/pkgconfig" system "./autogen.sh" system "./configure", "--disable-dependency-tracking", "--disable-silent-rules", "--prefix=#{prefix}", "--with-png", "--with-qrencode" system "make", "install" end test do (testpath/"test.cpp").write <<-EOS.undent #include int main() { const auto block = bc::chain::block::genesis_mainnet(); const auto& tx = block.transactions().front(); const auto& input = tx.inputs().front(); const auto script = input.script().to_data(false); std::string message(script.begin() + sizeof(uint64_t), script.end()); bc::cout << message << std::endl; return 0; } EOS system ENV.cxx, "-std=c++11", "test.cpp", "-L#{lib}", "-lbitcoin", "-lboost_system", "-o", "test" system "./test" end end