From 2bfc76683c2443e778b4492b1cb1be0198f36733 Mon Sep 17 00:00:00 2001 From: Dan Loewenherz Date: Mon, 7 Sep 2015 12:00:31 -0500 Subject: [PATCH] libu2f-server 1.0.1 (new formula) --- Formula/libu2f-server.rb | 45 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Formula/libu2f-server.rb diff --git a/Formula/libu2f-server.rb b/Formula/libu2f-server.rb new file mode 100644 index 0000000000..b29a0d3b24 --- /dev/null +++ b/Formula/libu2f-server.rb @@ -0,0 +1,45 @@ +class Libu2fServer < Formula + desc "Server-side of the Universal 2nd Factor (U2F) protocol" + homepage "https://developers.yubico.com/libu2f-server/" + url "https://developers.yubico.com/libu2f-server/Releases/libu2f-server-1.0.1.tar.xz" + sha256 "a618f59051209d6d70c24cf42d64c9b67bd7dd5946b6dbd2c649181d7e8f1f6e" + + depends_on "check" => :build + depends_on "pkg-config" => :build + depends_on "json-c" + depends_on "openssl" + + def install + ENV["LIBSSL_LIBS"] = "-lssl -lcrypto -lz" + ENV["LIBCRYPTO_LIBS"] = "-lcrypto -lz" + ENV["PKG_CONFIG"] = "#{Formula["pkg-config"].opt_bin}/pkg-config" + + system "./configure", "--prefix=#{prefix}" + system "make", "install" + end + + test do + (testpath/"test.c").write <<-EOS.undent + #include + int main() + { + if (u2fs_global_init(U2FS_DEBUG) != U2FS_OK) + { + return 1; + } + + u2fs_ctx_t *ctx; + if (u2fs_init(&ctx) != U2FS_OK) + { + return 1; + } + + u2fs_done(ctx); + u2fs_global_done(); + return 0; + } + EOS + system ENV.cc, "test.c", "-o", "test", "-I#{include}", "-L#{lib}", "-lu2f-server" + system "./test" + end +end