homebrew-core/Formula/libbitcoin-explorer.rb
2018-03-11 17:01:44 +01:00

76 lines
2.8 KiB
Ruby

class LibbitcoinExplorer < Formula
desc "Bitcoin command-line tool"
homepage "https://github.com/libbitcoin/libbitcoin-explorer"
url "https://github.com/libbitcoin/libbitcoin-explorer/archive/v3.5.0.tar.gz"
sha256 "630cffd577c0d10345b44ce8160f4604519b0ca69bf201f524f104c207b930aa"
revision 1
bottle do
sha256 "3ddae418ea3aac1c567e041b38275bc49720a8f221ace3c666a0fc6b16895762" => :high_sierra
sha256 "4b57fd07c6ca90d2f029853fca8b1ff8c1e5989860ed2312e0c062578a6fec20" => :sierra
sha256 "dca3ed395418f3f20c1956ece3de05fd384e44ab175c72b009781bf85731f8f1" => :el_capitan
end
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "pkg-config" => :build
depends_on "libbitcoin"
depends_on "libbitcoin-network"
depends_on "zeromq"
resource "libbitcoin-protocol" do
url "https://github.com/libbitcoin/libbitcoin-protocol/archive/v3.5.0.tar.gz"
sha256 "9deac6908489e2d59fb9f89c895c49b00e01902d5fdb661f67d4dbe45b22af76"
end
resource "libbitcoin-client" do
url "https://github.com/libbitcoin/libbitcoin-client/archive/v3.5.0.tar.gz"
sha256 "bafa26647f334ecad04fc4bbef507a1954d7e0682f07bd38b90ab66dba5fe0d2"
end
def install
ENV.prepend_path "PKG_CONFIG_PATH", Formula["libbitcoin"].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
resource("libbitcoin-client").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"
bash_completion.install "data/bx"
end
test do
seed = "7aaa07602b34e49dd9fd13267dcc0f368effe0b4ce15d107"
expected_private_key = "5b4e3cba38709f0d80aff509c1cc87eea9dad95bb34b09eb0ce3e8dbc083f962"
expected_public_key = "023b899a380c81b35647fff5f7e1988c617fe8417a5485217e653cda80bc4670ef"
expected_address = "1AxX5HyQi7diPVXUH2ji7x5k6jZTxbkxfW"
private_key = shell_output("#{bin}/bx ec-new #{seed}").chomp
assert_equal expected_private_key, private_key
public_key = shell_output("#{bin}/bx ec-to-public #{private_key}").chomp
assert_equal expected_public_key, public_key
address = shell_output("#{bin}/bx ec-to-address #{public_key}").chomp
assert_equal expected_address, address
end
end