homebrew-core/Formula/libbitcoin-server.rb
2017-09-28 03:06:23 -07:00

63 lines
2.4 KiB
Ruby

class LibbitcoinServer < Formula
desc "Bitcoin Full Node and Query Server"
homepage "https://github.com/libbitcoin/libbitcoin-server"
url "https://github.com/libbitcoin/libbitcoin-server/archive/v3.3.0.tar.gz"
sha256 "3066ff98af14574edae3e36b056b847558953e501c9b4f626c0428db9933a0ad"
bottle do
sha256 "3dfbd35e18006ded74f9b991e22c4bf79680866291c0410305da015a04c7ccad" => :high_sierra
sha256 "2f1a282dc888230612e9118446ae9ca4f26e05eb75137e9140e68069402672c9" => :sierra
sha256 "155a13feac83f11515334a9f4662e26bbf27843f86b598d18e2f571414817c14" => :el_capitan
end
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "pkg-config" => :build
depends_on "libbitcoin-node"
depends_on "zeromq"
resource "libbitcoin-protocol" do
url "https://github.com/libbitcoin/libbitcoin-protocol/archive/v3.3.0.tar.gz"
sha256 "7902de78b4c646daf2012e04bb7967784f67a6372a8a8d3c77417dabcc4b617d"
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_path "PKG_CONFIG_PATH", Formula["libbitcoin-node"].opt_libexec/"lib/pkgconfig"
ENV.prepend_create_path "PKG_CONFIG_PATH", libexec/"lib/pkgconfig"
resource("libbitcoin-protocol").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/server.hpp>
int main() {
libbitcoin::server::message message(true);
assert(message.secure() == true);
return 0;
}
EOS
system ENV.cxx, "-std=c++11", "test.cpp",
"-I#{libexec}/include",
"-I#{Formula["libbitcoin-blockchain"].opt_libexec}/include",
"-I#{Formula["libbitcoin-node"].opt_libexec}/include",
"-lbitcoin", "-lbitcoin-server", "-lboost_system",
"-o", "test"
system "./test"
end
end