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" bottle do cellar :any sha256 "bd520ddb4ac4b6a55d657b3ad17511f72dafe7b5a1c40b2a92e291db2a1e0c7a" => :high_sierra sha256 "25226b190bc6af0d7e7ec008d9404b29366d15d742b798cac0ab8e395c506106" => :sierra sha256 "89817d12379495c19e917cd35e288c5c46a2bb5dfe8c16855ff5ce5635b60a80" => :el_capitan 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" 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