homebrew-core/Formula/libbitcoin-database.rb

49 lines
1.7 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.4.0.tar.gz"
sha256 "34ca5c11800ea8efb1ef986e83f5e4fcdde95e85d2406f0a7ed922725e45f0e0"
revision 1
bottle do
sha256 "db682b54f7ebcb891f14fee15216ba1b5ac7305b7dc1be13b45d0eb77dd259c5" => :high_sierra
sha256 "25ca156caf8f0184080f59479b1e13ef7fadae026b98b6bf1899b3662857cc98" => :sierra
sha256 "e5c72c082c82f8d1256f3291481b3009015d0d7766ed1531e41c54b91e89fb70" => :el_capitan
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",
"-lbitcoin", "-lbitcoin-database", "-lboost_system",
"-o", "test"
system "./test"
end
end