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.1.0.tar.xz" sha256 "8dcd3caeacebef6e36a42462039fd035e45fa85653dcb2013f45e15aad49a277" license "BSD-2-Clause" revision 3 livecheck do url "https://developers.yubico.com/libu2f-server/Releases/" regex(/href=.*?libu2f-server[._-]v?(\d+(?:\.\d+)+)\.t/i) end bottle do cellar :any sha256 "3a5038a64a9820c04a4ad1067ebcf8076936474cc5c18a0d93f7c986adcf0169" => :catalina sha256 "a1d26284fa87629ecf5bf965433cd6eeba9eb151e064e22a47ca42a115d5e15c" => :mojave sha256 "03e06751297ad4aab253d7b1f742fd5c2ad8d79b35836eb132c3c82c20b485e6" => :high_sierra end depends_on "check" => :build depends_on "gengetopt" => :build depends_on "help2man" => :build depends_on "pkg-config" => :build depends_on "json-c" depends_on "openssl@1.1" # Compatibility with json-c 0.14. Remove with the next release. patch do url "https://github.com/Yubico/libu2f-server/commit/f7c4983b31909299c47bf9b2627c84b6bfe225de.patch?full_index=1" sha256 "012d1d759604ea80f6075b74dc9c7d8a864e4e5889fb82a222db93a6bd72cd1b" end 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 #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