homebrew-core/Formula/libbitcoin-database.rb
2019-03-21 08:49:49 +01:00

50 lines
1.8 KiB
Ruby

class LibbitcoinDatabase < Formula
desc "Bitcoin High Performance Blockchain Database"
homepage "https://github.com/libbitcoin/libbitcoin-database"
url "https://github.com/libbitcoin/libbitcoin-database/archive/v3.5.0.tar.gz"
sha256 "376ab5abd8d7734a8b678030b9e997c4b1922e422f6e0a185d7daa3eb251db93"
revision 2
bottle do
cellar :any
sha256 "a6f8ebbc4ae4629eb9419276c409de29e56d064eb69c0bed7683cac7c00150c7" => :mojave
sha256 "af669b408252dbc65b12ddffc640d4b5c6aeed8cd809a51d57ef5bf3c02f877b" => :high_sierra
sha256 "82814d872a7574dc08a3a3f9b758be8f535c33b1d0814874a0c86ad07ac6ea21" => :sierra
end
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "pkg-config" => :build
depends_on "libbitcoin"
def install
ENV.prepend_path "PKG_CONFIG_PATH", Formula["libbitcoin"].opt_libexec/"lib/pkgconfig"
system "./autogen.sh"
system "./configure", "--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}"
system "make", "install"
end
test do
(testpath/"test.cpp").write <<~EOS
#include <bitcoin/database.hpp>
using namespace libbitcoin::database;
using namespace libbitcoin::chain;
int main() {
static const transaction tx{ 0, 0, input::list{}, output::list{ output{} } };
unspent_outputs cache(42);
cache.add(tx, 0, 0, false);
assert(cache.size() == 1u);
return 0;
}
EOS
system ENV.cxx, "-std=c++11", "test.cpp", "-o", "test",
"-L#{Formula["libbitcoin"].opt_lib}", "-lbitcoin",
"-L#{lib}", "-lbitcoin-database",
"-L#{Formula["boost"].opt_lib}", "-lboost_system"
system "./test"
end
end