homebrew-core/Formula/libbitcoin-server.rb
2017-10-21 17:50:52 -07:00

63 lines
2.3 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"
revision 1
bottle do
sha256 "91da3aa386c5810c3ad34af991223a579ff7c7f5b77e143ce550b81884347148" => :high_sierra
sha256 "4fd5c27fb1a24f27078bf4fdca964367f6ac13a3d5e5304d4aac8261b227114e" => :sierra
sha256 "ffed49361044749f0a66aaaaa89b7599bfeef1ea3dab10543365eb70e482c804" => :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
#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-node"].opt_libexec}/include",
"-lbitcoin", "-lbitcoin-server", "-lboost_system",
"-o", "test"
system "./test"
end
end