homebrew-core/Formula/libbitcoin-node.rb
2017-09-26 21:49:52 -07:00

62 lines
2.3 KiB
Ruby

class LibbitcoinNode < Formula
desc "Bitcoin Full Node"
homepage "https://github.com/libbitcoin/libbitcoin-node"
url "https://github.com/libbitcoin/libbitcoin-node/archive/v3.3.0.tar.gz"
sha256 "51298e2346d629215171af14b01d61cfabe93ddaa8069595a80b8b9f88224f7b"
bottle do
sha256 "45a2bfe30505ba6f371983e9a8e7b94b12ae9cd24e01c2f2c92b134ddf5f2f52" => :high_sierra
sha256 "67cca1e5930a91ac370a87f96fd5fbfe3416b69d2c376d42630472d5c0a34da7" => :sierra
sha256 "aaab1b82c2945b9da5b9966001c97dfb42670e89ca62f42d839a2e2fe67115e5" => :el_capitan
end
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "pkg-config" => :build
depends_on "libbitcoin-blockchain"
resource "libbitcoin-network" do
url "https://github.com/libbitcoin/libbitcoin-network/archive/v3.3.0.tar.gz"
sha256 "cab9142d2b94019c824365c0b39d7e31dbc9aaeb98c6b4bf22ce32b829395c19"
end
def install
ENV.prepend_path "PKG_CONFIG_PATH", Formula["libbitcoin"].opt_libexec/"lib/pkgconfig"
ENV.prepend_path "PKG_CONFIG_PATH", Formula["libbitcoin-blockchain"].opt_libexec/"lib/pkgconfig"
ENV.prepend_create_path "PKG_CONFIG_PATH", libexec/"lib/pkgconfig"
resource("libbitcoin-network").stage do
system "./autogen.sh"
system "./configure", "--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{libexec}"
system "make", "install"
end
system "./autogen.sh"
system "./configure", "--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}"
system "make", "install"
end
test do
(testpath/"test.cpp").write <<-EOS.undent
#include <bitcoin/node.hpp>
int main() {
libbitcoin::node::settings configuration;
assert(configuration.sync_peers == 0u);
assert(configuration.sync_timeout_seconds == 5u);
assert(configuration.refresh_transactions == true);
return 0;
}
EOS
system ENV.cxx, "-std=c++11", "test.cpp",
"-I#{libexec}/include",
"-I" + Formula["libbitcoin-blockchain"].opt_libexec/"include",
"-lbitcoin", "-lbitcoin-node", "-lboost_system",
"-o", "test"
system "./test"
end
end